NXP Rapid IoT prototyping kit port of Silabs "hungry gecko" smake-like game. https://os.mbed.com/teams/SiliconLabs/code/Hungry_gecko/

Dependencies:   lib_sx9500 GraphicsDisplay ColorMemLCD Large_fonts

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers food.h Source File

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 "mbed.h"
00033 #include "settings.h"
00034 // #include "LS013B7DH03.h"
00035 
00036 class Gecko; // Forward declaration
00037 #ifndef FOOD_H_
00038 #define FOOD_H_
00039 /* Pixel map for the food
00040  * 4 most significant bits y-crd, 4 least significant bits x-crd
00041  * The upper left corner of the part is asigned coordinates (x,y)=(0,0)
00042  */
00043 class Food{
00044 public:
00045     Food();
00046     bool isEaten(Gecko &gck);
00047     void reset(ColorMemLCD &display, const Gecko &gck);
00048     void draw(ColorMemLCD &display);
00049 
00050 private:
00051     uint8_t x;
00052     uint8_t y;
00053     void remove(ColorMemLCD &display);
00054 };
00055 
00056 
00057 #endif /* FOOD_H_ */
00058