Play snake using mbed! A snake-like game that runs on the memoryLCD display on Happy Gecko.
Embed:
(wiki syntax)
Show/hide line numbers
food.h
Go to the documentation of this file.
00001 /***************************************************************************//** 00002 * @file food.h 00003 * @brief class for creating a food-like object and keeps track of its momvement 00004 ******************************************************************************* 00005 * @section License 00006 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b> 00007 ******************************************************************************* 00008 * 00009 * Permission is granted to anyone to use this software for any purpose, 00010 * including commercial applications, and to alter it and redistribute it 00011 * freely, subject to the following restrictions: 00012 * 00013 * 1. The origin of this software must not be misrepresented; you must not 00014 * claim that you wrote the original software. 00015 * 2. Altered source versions must be plainly marked as such, and must not be 00016 * misrepresented as being the original software. 00017 * 3. This notice may not be removed or altered from any source distribution. 00018 * 00019 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no 00020 * obligation to support this Software. Silicon Labs is providing the 00021 * Software "AS IS", with no express or implied warranties of any kind, 00022 * including, but not limited to, any implied warranties of merchantability 00023 * or fitness for any particular purpose or warranties against infringement 00024 * of any proprietary rights of a third party. 00025 * 00026 * Silicon Labs will not be liable for any consequential, incidental, or 00027 * special damages, or any other relief, or for any claim by any third party, 00028 * arising from your use of this Software. 00029 * 00030 ******************************************************************************/ 00031 00032 #include "settings.h" 00033 #include "LS013B7DH03.h" 00034 00035 class Gecko; // Forward declaration 00036 #ifndef FOOD_H_ 00037 #define FOOD_H_ 00038 /* Pixel map for the food 00039 * 4 most significant bits y-crd, 4 least significant bits x-crd 00040 * The upper left corner of the part is asigned coordinates (x,y)=(0,0) 00041 */ 00042 class Food{ 00043 public: 00044 Food(); 00045 bool isEaten(Gecko &gck); 00046 void reset(silabs::LS013B7DH03 &display, const Gecko &gck); 00047 void draw(silabs::LS013B7DH03 &display); 00048 00049 private: 00050 uint8_t x; 00051 uint8_t y; 00052 void remove(silabs::LS013B7DH03 &display); 00053 }; 00054 00055 00056 #endif /* FOOD_H_ */ 00057
Generated on Thu Jul 14 2022 05:54:03 by 1.7.2