Owen Cavender 201159294

Dependencies:   mbed Gamepad2

Committer:
el17oc
Date:
Fri May 29 16:00:56 2020 +0000
Revision:
12:60c856354406
Parent:
10:ee781d18e0f6
Child:
14:7fb3c93343b6
HH

Who changed what in which revision?

UserRevisionLine numberNew 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 12:60c856354406 29 void check_gameover(N5110 &lcd);
el17oc 12:60c856354406 30 void apple_collected(N5110 &lcd, Gamepad &pad);
el17oc 9:a69a6a06dddf 31 void render_clear_tail(N5110 &lcd);
el17oc 8:997f90c88246 32 void get_direction(Gamepad &pad);
el17oc 8:997f90c88246 33 void move_snake();
el17oc 8:997f90c88246 34 void get_time(Timer &timer);
el17oc 8:997f90c88246 35 void render(N5110 &lcd);
el17oc 12:60c856354406 36 // void print_display_time(N5110 &lcd);
el17oc 8:997f90c88246 37
el17oc 8:997f90c88246 38
el17oc 6:bf90044188d0 39 bool get_gameover();
el17oc 10:ee781d18e0f6 40 int get_oldscore();
el17oc 6:bf90044188d0 41 int get_score();
el17oc 8:997f90c88246 42 Vector2D get_Snakehead();
el17oc 12:60c856354406 43 int set_reset_value();
el17oc 12:60c856354406 44 int get_reset_value();
el17oc 12:60c856354406 45 bool get_timer_reset();
el17oc 12:60c856354406 46 bool get_RST();
el17oc 12:60c856354406 47 int get_countdown();
el17oc 12:60c856354406 48 void snake_isr();
el17oc 12:60c856354406 49 void gameover_true(N5110 &lcd);
el17oc 12:60c856354406 50 void get_Apple_position(N5110 &lcd);
el17oc 1:897160a1a3ae 51
el17oc 1:897160a1a3ae 52
el17oc 1:897160a1a3ae 53 private:
el17oc 12:60c856354406 54
el17oc 12:60c856354406 55
el17oc 12:60c856354406 56 int _countdown;
el17oc 1:897160a1a3ae 57 bool _gameover;
el17oc 1:897160a1a3ae 58 Directions _direction;
el17oc 10:ee781d18e0f6 59 int _oldscore;
el17oc 1:897160a1a3ae 60 int _score;
el17oc 12:60c856354406 61 // float _display_time;
el17oc 12:60c856354406 62 int _reset_apple;
el17oc 12:60c856354406 63 int _reset_value;
el17oc 12:60c856354406 64
el17oc 6:bf90044188d0 65
el17oc 6:bf90044188d0 66
el17oc 6:bf90044188d0 67 int _x0;
el17oc 6:bf90044188d0 68 int _x1;
el17oc 6:bf90044188d0 69 int _x2;
el17oc 6:bf90044188d0 70 int _x3;
el17oc 12:60c856354406 71 int _x4;
el17oc 12:60c856354406 72 int _x5;
el17oc 6:bf90044188d0 73
el17oc 6:bf90044188d0 74 int _y0;
el17oc 6:bf90044188d0 75 int _y1;
el17oc 6:bf90044188d0 76 int _y2;
el17oc 6:bf90044188d0 77 int _y3;
el17oc 12:60c856354406 78 int _y4;
el17oc 12:60c856354406 79 int _y5;
el17oc 9:a69a6a06dddf 80
el17oc 9:a69a6a06dddf 81 int _apx;
el17oc 9:a69a6a06dddf 82 int _apy;
el17oc 12:60c856354406 83
el17oc 12:60c856354406 84
el17oc 6:bf90044188d0 85
el17oc 6:bf90044188d0 86 //Vector2D SK0;
el17oc 6:bf90044188d0 87 //Vector2D SK1;
el17oc 6:bf90044188d0 88 //Vector2D SK2;
el17oc 6:bf90044188d0 89 //Vector2D SK3;
el17oc 1:897160a1a3ae 90
el17oc 1:897160a1a3ae 91 };
el17oc 1:897160a1a3ae 92
el17oc 1:897160a1a3ae 93
el17oc 1:897160a1a3ae 94 #endif