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@15:47ea86f1ed70, 2018-05-07 (annotated)
- Committer:
- weiway
- Date:
- Mon May 07 11:57:22 2018 +0000
- Revision:
- 15:47ea86f1ed70
- Parent:
- 13:4026781772cb
- Child:
- 16:a790f3f622f8
the game runs well but the fruit reborn outside of the screen. and the snake would not die even if hit the wall
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 | 15:47ea86f1ed70 | 9 | |
| weiway | 13:4026781772cb | 10 | |
| weiway | 13:4026781772cb | 11 | class snake_engine |
| weiway | 13:4026781772cb | 12 | { |
| weiway | 15:47ea86f1ed70 | 13 | public: |
| weiway | 15:47ea86f1ed70 | 14 | snake_engine(); |
| weiway | 15:47ea86f1ed70 | 15 | ~snake_engine(); |
| weiway | 15:47ea86f1ed70 | 16 | void init(); |
| weiway | 15:47ea86f1ed70 | 17 | void draw(N5110 &lcd); |
| weiway | 15:47ea86f1ed70 | 18 | void update(Gamepad &pad, N5110 &lcd); |
| weiway | 15:47ea86f1ed70 | 19 | void read_input(Gamepad &pad); |
| weiway | 15:47ea86f1ed70 | 20 | bool getfruit(Gamepad &pad); |
| weiway | 15:47ea86f1ed70 | 21 | |
| weiway | 15:47ea86f1ed70 | 22 | |
| weiway | 15:47ea86f1ed70 | 23 | |
| weiway | 15:47ea86f1ed70 | 24 | private: |
| weiway | 15:47ea86f1ed70 | 25 | void printpoint(N5110 &lcd); |
| weiway | 15:47ea86f1ed70 | 26 | Fruit f; |
| weiway | 15:47ea86f1ed70 | 27 | snake s; |
| weiway | 15:47ea86f1ed70 | 28 | Direction _d; |
| weiway | 15:47ea86f1ed70 | 29 | float _mag; |
| weiway | 13:4026781772cb | 30 | }; |
| weiway | 13:4026781772cb | 31 | #endif |
| weiway | 13:4026781772cb | 32 | |
| weiway | 13:4026781772cb | 33 | |
| weiway | 13:4026781772cb | 34 |