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
Diff: snake_engine/snake_engine.h
- Revision:
- 20:980b37fde361
- Parent:
- 18:e58a1f8e72ad
--- a/snake_engine/snake_engine.h Tue May 08 12:51:40 2018 +0000
+++ b/snake_engine/snake_engine.h Tue May 08 13:41:08 2018 +0000
@@ -6,28 +6,31 @@
#ifndef SNAKE_ENGINE_H
#define SNAKE_ENGINE_H
-
+/** snake_engine Class
+* @author Wei Wei
+* @date 3rd May
+*/
class snake_engine
{
public:
snake_engine();
~snake_engine();
- void init();
- void draw(N5110 &lcd);
- void update(Gamepad &pad, N5110 &lcd);
- void read_input(Gamepad &pad);
- bool getfruit(Gamepad &pad);
- void collision(Gamepad &pad, N5110 &lcd);
+ void init();//initialise
+ void draw(N5110 &lcd);//draw snake ,fruit and a squre on lcd screen
+ void update(Gamepad &pad, N5110 &lcd);//update the new fruit, snake and point
+ void read_input(Gamepad &pad);//get the command from gamepad
+ bool getfruit(Gamepad &pad);//a boolean value used for the snake while it eats the fruit return the ture , else false
+ void collision(Gamepad &pad, N5110 &lcd);//check the snake collision
int clision;
private:
- void printpoint(N5110 &lcd);
- Fruit f;
- snake s;
- Direction _d;
+ void printpoint(N5110 &lcd);//lcd print the point on the screen
+ Fruit f;//fruit function
+ snake s;//snake function
+ Direction _d;//direction
float _mag;
};
#endif