Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
main.h@87:871d9fecb593, 2019-05-08 (annotated)
- Committer:
- AhmedPlaymaker
- Date:
- Wed May 08 16:39:24 2019 +0000
- Revision:
- 87:871d9fecb593
- Parent:
- 84:9950d561fdf8
- Child:
- 99:4841f326200f
I have changed some variable names so that they have more meaning, and also added some more comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AhmedPlaymaker | 87:871d9fecb593 | 1 | #ifndef MAIN_H |
AhmedPlaymaker | 87:871d9fecb593 | 2 | #define MAIN_H |
AhmedPlaymaker | 87:871d9fecb593 | 3 | |
AhmedPlaymaker | 73:80556a279962 | 4 | /** @file main.h |
AhmedPlaymaker | 73:80556a279962 | 5 | * @brief Main.cpp's header file that defines all the directives and objects to use along with the definition of it's own function prototypes. |
AhmedPlaymaker | 73:80556a279962 | 6 | */ |
AhmedPlaymaker | 73:80556a279962 | 7 | |
AhmedPlaymaker | 87:871d9fecb593 | 8 | ///////////// MAIN.H //////////////// |
AhmedPlaymaker | 73:80556a279962 | 9 | |
AhmedPlaymaker | 73:80556a279962 | 10 | ///////// pre-processor directives //////// |
AhmedPlaymaker | 73:80556a279962 | 11 | #include "mbed.h" |
AhmedPlaymaker | 73:80556a279962 | 12 | #include "Gamepad.h" |
AhmedPlaymaker | 73:80556a279962 | 13 | #include "N5110.h" |
AhmedPlaymaker | 73:80556a279962 | 14 | #include "FXOS8700CQ.h" |
AhmedPlaymaker | 73:80556a279962 | 15 | #include "StartScreen.h" |
AhmedPlaymaker | 73:80556a279962 | 16 | #include "SnakevsBlock.h" |
AhmedPlaymaker | 73:80556a279962 | 17 | #include "SDFileSystem.h" |
AhmedPlaymaker | 73:80556a279962 | 18 | |
AhmedPlaymaker | 73:80556a279962 | 19 | #ifdef TEST_SNAKE |
AhmedPlaymaker | 73:80556a279962 | 20 | # include "tests.h" |
AhmedPlaymaker | 73:80556a279962 | 21 | #endif |
AhmedPlaymaker | 73:80556a279962 | 22 | |
AhmedPlaymaker | 73:80556a279962 | 23 | /////////////// objects /////////////// |
AhmedPlaymaker | 73:80556a279962 | 24 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
AhmedPlaymaker | 73:80556a279962 | 25 | Gamepad pad; |
AhmedPlaymaker | 73:80556a279962 | 26 | FXOS8700CQ device(I2C_SDA,I2C_SCL); |
AhmedPlaymaker | 73:80556a279962 | 27 | StartScreen _start; |
AhmedPlaymaker | 73:80556a279962 | 28 | Stats _stats; |
AhmedPlaymaker | 73:80556a279962 | 29 | SnakevsBlock _game; |
AhmedPlaymaker | 73:80556a279962 | 30 | AnalogIn noisy(PTB0); //This creates a random noise which I can use to seed the random numbers. |
AhmedPlaymaker | 73:80556a279962 | 31 | // Connections to SD card holder on K64F (SPI interface) |
AhmedPlaymaker | 73:80556a279962 | 32 | SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); // MOSI, MISO, SCK, CS |
AhmedPlaymaker | 73:80556a279962 | 33 | //Serial serial(USBTX, USBRX); // for PC debug |
AhmedPlaymaker | 73:80556a279962 | 34 | |
AhmedPlaymaker | 73:80556a279962 | 35 | |
AhmedPlaymaker | 73:80556a279962 | 36 | //Constants// |
AhmedPlaymaker | 73:80556a279962 | 37 | int fps = 40; // frames per second, this will be changed in menu. |
AhmedPlaymaker | 73:80556a279962 | 38 | int g_mode = 1; //selects between joystick and motion control. |
AhmedPlaymaker | 73:80556a279962 | 39 | int back; //this allows us to use the back key to exit the game loop; |
AhmedPlaymaker | 73:80556a279962 | 40 | |
AhmedPlaymaker | 73:80556a279962 | 41 | |
AhmedPlaymaker | 73:80556a279962 | 42 | ///////////// prototypes ////////////// |
AhmedPlaymaker | 73:80556a279962 | 43 | void init(); |
AhmedPlaymaker | 73:80556a279962 | 44 | void menu(); |
AhmedPlaymaker | 73:80556a279962 | 45 | void read_write_stats(); |
AhmedPlaymaker | 73:80556a279962 | 46 | void _set_mode_speed(); |
AhmedPlaymaker | 73:80556a279962 | 47 | void gameLoop(); |
AhmedPlaymaker | 84:9950d561fdf8 | 48 | void refresh_game(); |
AhmedPlaymaker | 87:871d9fecb593 | 49 | //void deinit(); |
AhmedPlaymaker | 87:871d9fecb593 | 50 | |
AhmedPlaymaker | 87:871d9fecb593 | 51 | #endif |