Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ll16j23s_test_docs
Food.h
00001 #ifndef FOOD_H 00002 #define FOOD_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 #include "FXOS8700CQ.h" 00008 00009 /** SnakeEngine: 00010 @brief - Functions that exclusively control the food 00011 @author Joseph Shotton 00012 @date May 2020 00013 @version V1.0 00014 */ 00015 00016 class Food 00017 { 00018 00019 public: 00020 00021 Food(); 00022 ~Food(); 00023 00024 00025 /** Initialises magnetometer and seeds random function 00026 *@param Gamepad 00027 *@param LCD 00028 *@param Magnetometer 00029 */ 00030 void init(Gamepad &pad, N5110 &lcd, FXOS8700CQ &mag); 00031 00032 00033 /** Chooses random coordinates for food 00034 *@param Gamepad 00035 *@param LCD 00036 *@returns returns true if selected position is already on (ie the snake or walls are at this coordinate) 00037 */ 00038 bool rand_pos(Gamepad &pad, N5110 &lcd); 00039 00040 00041 /** Animates food 00042 *@param LCD 00043 */ 00044 void draw(N5110 &lcd); 00045 00046 00047 /** Runs food functions that need looping 00048 *@param LCD 00049 */ 00050 void run(N5110 &lcd); 00051 00052 int x; 00053 int y; 00054 00055 private: 00056 int _frame; 00057 float _values; 00058 float _seed; 00059 }; 00060 #endif
Generated on Fri Jul 15 2022 20:20:44 by
1.7.2