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
snake_engine/snake_engine.h@20:980b37fde361, 2018-05-08 (annotated)
- Committer:
- weiway
- Date:
- Tue May 08 13:41:08 2018 +0000
- Revision:
- 20:980b37fde361
- Parent:
- 18:e58a1f8e72ad
adding doxygen documentation , comments and references
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| weiway | 13:4026781772cb | 1 | #include "mbed.h" |
| weiway | 13:4026781772cb | 2 | #include "N5110.h" |
| weiway | 13:4026781772cb | 3 | #include "Gamepad.h" |
| weiway | 13:4026781772cb | 4 | #include "snake.h" |
| weiway | 13:4026781772cb | 5 | #include "Fruit.h" |
| weiway | 13:4026781772cb | 6 | |
| weiway | 15:47ea86f1ed70 | 7 | #ifndef SNAKE_ENGINE_H |
| weiway | 15:47ea86f1ed70 | 8 | #define SNAKE_ENGINE_H |
| weiway | 20:980b37fde361 | 9 | /** snake_engine Class |
| weiway | 20:980b37fde361 | 10 | * @author Wei Wei |
| weiway | 20:980b37fde361 | 11 | * @date 3rd May |
| weiway | 20:980b37fde361 | 12 | */ |
| weiway | 13:4026781772cb | 13 | |
| weiway | 13:4026781772cb | 14 | class snake_engine |
| weiway | 13:4026781772cb | 15 | { |
| weiway | 15:47ea86f1ed70 | 16 | public: |
| weiway | 15:47ea86f1ed70 | 17 | snake_engine(); |
| weiway | 15:47ea86f1ed70 | 18 | ~snake_engine(); |
| weiway | 20:980b37fde361 | 19 | void init();//initialise |
| weiway | 20:980b37fde361 | 20 | void draw(N5110 &lcd);//draw snake ,fruit and a squre on lcd screen |
| weiway | 20:980b37fde361 | 21 | void update(Gamepad &pad, N5110 &lcd);//update the new fruit, snake and point |
| weiway | 20:980b37fde361 | 22 | void read_input(Gamepad &pad);//get the command from gamepad |
| weiway | 20:980b37fde361 | 23 | bool getfruit(Gamepad &pad);//a boolean value used for the snake while it eats the fruit return the ture , else false |
| weiway | 20:980b37fde361 | 24 | void collision(Gamepad &pad, N5110 &lcd);//check the snake collision |
| weiway | 18:e58a1f8e72ad | 25 | int clision; |
| weiway | 15:47ea86f1ed70 | 26 | |
| weiway | 15:47ea86f1ed70 | 27 | |
| weiway | 15:47ea86f1ed70 | 28 | |
| weiway | 15:47ea86f1ed70 | 29 | private: |
| weiway | 20:980b37fde361 | 30 | void printpoint(N5110 &lcd);//lcd print the point on the screen |
| weiway | 20:980b37fde361 | 31 | Fruit f;//fruit function |
| weiway | 20:980b37fde361 | 32 | snake s;//snake function |
| weiway | 20:980b37fde361 | 33 | Direction _d;//direction |
| weiway | 15:47ea86f1ed70 | 34 | float _mag; |
| weiway | 13:4026781772cb | 35 | }; |
| weiway | 13:4026781772cb | 36 | #endif |
| weiway | 13:4026781772cb | 37 | |
| weiway | 13:4026781772cb | 38 | |
| weiway | 13:4026781772cb | 39 |