ELEC2645 (2019/20)
/
ELEC2645_Project_el17oc1
Owen Cavender 201159294
snake.h@11:e7c56013acd9, 2020-05-28 (annotated)
- Committer:
- el17oc
- Date:
- Thu May 28 21:59:12 2020 +0000
- Revision:
- 11:e7c56013acd9
- Parent:
- 10:ee781d18e0f6
messy test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17oc | 1:897160a1a3ae | 1 | |
el17oc | 1:897160a1a3ae | 2 | #ifndef SNAKE_H |
el17oc | 1:897160a1a3ae | 3 | #define SNAKE_H |
el17oc | 1:897160a1a3ae | 4 | |
el17oc | 1:897160a1a3ae | 5 | #include "mbed.h" |
el17oc | 1:897160a1a3ae | 6 | #include "N5110.h" |
el17oc | 1:897160a1a3ae | 7 | #include "Gamepad.h" |
el17oc | 1:897160a1a3ae | 8 | |
el17oc | 1:897160a1a3ae | 9 | |
el17oc | 1:897160a1a3ae | 10 | class Snake |
el17oc | 1:897160a1a3ae | 11 | { |
el17oc | 1:897160a1a3ae | 12 | |
el17oc | 1:897160a1a3ae | 13 | |
el17oc | 1:897160a1a3ae | 14 | public: |
el17oc | 1:897160a1a3ae | 15 | Snake(); |
el17oc | 1:897160a1a3ae | 16 | ~Snake(); |
el17oc | 1:897160a1a3ae | 17 | |
el17oc | 1:897160a1a3ae | 18 | enum Directions { |
el17oc | 1:897160a1a3ae | 19 | up, |
el17oc | 1:897160a1a3ae | 20 | down, |
el17oc | 1:897160a1a3ae | 21 | left, |
el17oc | 1:897160a1a3ae | 22 | right, |
el17oc | 1:897160a1a3ae | 23 | null |
el17oc | 1:897160a1a3ae | 24 | }; |
el17oc | 1:897160a1a3ae | 25 | |
el17oc | 6:bf90044188d0 | 26 | void init(); |
el17oc | 6:bf90044188d0 | 27 | |
el17oc | 6:bf90044188d0 | 28 | |
el17oc | 6:bf90044188d0 | 29 | void check_collisions(); |
el17oc | 8:997f90c88246 | 30 | void apple_collected(N5110 &lcd, Gamepad &pad, Timer &timer); |
el17oc | 6:bf90044188d0 | 31 | |
el17oc | 6:bf90044188d0 | 32 | |
el17oc | 6:bf90044188d0 | 33 | |
el17oc | 9:a69a6a06dddf | 34 | void render_clear_tail(N5110 &lcd); |
el17oc | 8:997f90c88246 | 35 | void get_direction(Gamepad &pad); |
el17oc | 11:e7c56013acd9 | 36 | |
el17oc | 8:997f90c88246 | 37 | void get_time(Timer &timer); |
el17oc | 8:997f90c88246 | 38 | void render(N5110 &lcd); |
el17oc | 10:ee781d18e0f6 | 39 | void print_display_time(N5110 &lcd); |
el17oc | 8:997f90c88246 | 40 | |
el17oc | 8:997f90c88246 | 41 | |
el17oc | 6:bf90044188d0 | 42 | bool get_gameover(); |
el17oc | 10:ee781d18e0f6 | 43 | int get_oldscore(); |
el17oc | 6:bf90044188d0 | 44 | int get_score(); |
el17oc | 8:997f90c88246 | 45 | Vector2D get_Snakehead(); |
el17oc | 1:897160a1a3ae | 46 | |
el17oc | 1:897160a1a3ae | 47 | |
el17oc | 1:897160a1a3ae | 48 | |
el17oc | 1:897160a1a3ae | 49 | private: |
el17oc | 8:997f90c88246 | 50 | void get_Apple_position(N5110 &lcd); |
el17oc | 1:897160a1a3ae | 51 | |
el17oc | 1:897160a1a3ae | 52 | bool _gameover; |
el17oc | 1:897160a1a3ae | 53 | Directions _direction; |
el17oc | 10:ee781d18e0f6 | 54 | int _oldscore; |
el17oc | 1:897160a1a3ae | 55 | int _score; |
el17oc | 6:bf90044188d0 | 56 | float _realtime; |
el17oc | 8:997f90c88246 | 57 | float _display_time; |
el17oc | 6:bf90044188d0 | 58 | int Reset_value; |
el17oc | 6:bf90044188d0 | 59 | |
el17oc | 6:bf90044188d0 | 60 | |
el17oc | 6:bf90044188d0 | 61 | int _x0; |
el17oc | 6:bf90044188d0 | 62 | int _x1; |
el17oc | 6:bf90044188d0 | 63 | int _x2; |
el17oc | 6:bf90044188d0 | 64 | int _x3; |
el17oc | 6:bf90044188d0 | 65 | |
el17oc | 6:bf90044188d0 | 66 | int _y0; |
el17oc | 6:bf90044188d0 | 67 | int _y1; |
el17oc | 6:bf90044188d0 | 68 | int _y2; |
el17oc | 6:bf90044188d0 | 69 | int _y3; |
el17oc | 9:a69a6a06dddf | 70 | |
el17oc | 9:a69a6a06dddf | 71 | int _apx; |
el17oc | 9:a69a6a06dddf | 72 | int _apy; |
el17oc | 6:bf90044188d0 | 73 | |
el17oc | 6:bf90044188d0 | 74 | //Vector2D SK0; |
el17oc | 6:bf90044188d0 | 75 | //Vector2D SK1; |
el17oc | 6:bf90044188d0 | 76 | //Vector2D SK2; |
el17oc | 6:bf90044188d0 | 77 | //Vector2D SK3; |
el17oc | 1:897160a1a3ae | 78 | |
el17oc | 1:897160a1a3ae | 79 | }; |
el17oc | 1:897160a1a3ae | 80 | |
el17oc | 1:897160a1a3ae | 81 | |
el17oc | 1:897160a1a3ae | 82 | #endif |