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
SnakeEngine.h
00001 #ifndef SNAKEENGINE_H 00002 #define SNAKEENGINE_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 #include "Head.h" 00008 #include "Body.h" 00009 #include "Food.h" 00010 00011 // gap from edge of screen 00012 #define GAP 2 00013 00014 class SnakeEngine 00015 { 00016 00017 public: 00018 SnakeEngine(); 00019 ~SnakeEngine(); 00020 00021 void init(int head_length,int head_speed, int _food_size, int score); 00022 void read_input(Gamepad &pad); 00023 00024 void update(Gamepad &pad, N5110 &lcd); 00025 void draw(N5110 &lcd); 00026 void gameover(N5110 &lcd, Gamepad &pad); 00027 00028 private: 00029 int hx; 00030 int hy; 00031 int fx; 00032 int fy; 00033 int _head_length; 00034 int _head_speed; 00035 int _score; 00036 int _nbody; 00037 int _food_size; 00038 bool _gameover; 00039 void collison(Gamepad &pad, N5110 &lcd); 00040 void eat_food(Gamepad &pad, N5110 &lcd); 00041 00042 Head _h; 00043 Body _b; 00044 Food _f; 00045 Direction _d; 00046 float _mag; 00047 00048 00049 }; 00050 00051 #endif
Generated on Mon Jul 18 2022 08:02:22 by
1.7.2