Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Committer:
AhmedPlaymaker
Date:
Sun May 05 10:58:33 2019 +0000
Revision:
73:80556a279962
Child:
84:9950d561fdf8
Added a header file for main.cpp , called main.h, this is used to define all the function prototypes and reference pre-processor directives.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AhmedPlaymaker 73:80556a279962 1 /** @file main.h
AhmedPlaymaker 73:80556a279962 2 * @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 3 */
AhmedPlaymaker 73:80556a279962 4
AhmedPlaymaker 73:80556a279962 5 ///////////// MAIN.CPP ////////////////
AhmedPlaymaker 73:80556a279962 6
AhmedPlaymaker 73:80556a279962 7 ///////// pre-processor directives ////////
AhmedPlaymaker 73:80556a279962 8 #include "mbed.h"
AhmedPlaymaker 73:80556a279962 9 #include "Gamepad.h"
AhmedPlaymaker 73:80556a279962 10 #include "N5110.h"
AhmedPlaymaker 73:80556a279962 11 #include "FXOS8700CQ.h"
AhmedPlaymaker 73:80556a279962 12 #include "StartScreen.h"
AhmedPlaymaker 73:80556a279962 13 #include "SnakevsBlock.h"
AhmedPlaymaker 73:80556a279962 14 #include "SDFileSystem.h"
AhmedPlaymaker 73:80556a279962 15
AhmedPlaymaker 73:80556a279962 16 #ifdef TEST_SNAKE
AhmedPlaymaker 73:80556a279962 17 # include "tests.h"
AhmedPlaymaker 73:80556a279962 18 #endif
AhmedPlaymaker 73:80556a279962 19
AhmedPlaymaker 73:80556a279962 20
AhmedPlaymaker 73:80556a279962 21 /////////////// objects ///////////////
AhmedPlaymaker 73:80556a279962 22 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
AhmedPlaymaker 73:80556a279962 23 Gamepad pad;
AhmedPlaymaker 73:80556a279962 24 FXOS8700CQ device(I2C_SDA,I2C_SCL);
AhmedPlaymaker 73:80556a279962 25 StartScreen _start;
AhmedPlaymaker 73:80556a279962 26 Stats _stats;
AhmedPlaymaker 73:80556a279962 27 SnakevsBlock _game;
AhmedPlaymaker 73:80556a279962 28 AnalogIn noisy(PTB0); //This creates a random noise which I can use to seed the random numbers.
AhmedPlaymaker 73:80556a279962 29 // Connections to SD card holder on K64F (SPI interface)
AhmedPlaymaker 73:80556a279962 30 SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); // MOSI, MISO, SCK, CS
AhmedPlaymaker 73:80556a279962 31 //Serial serial(USBTX, USBRX); // for PC debug
AhmedPlaymaker 73:80556a279962 32
AhmedPlaymaker 73:80556a279962 33
AhmedPlaymaker 73:80556a279962 34 //Constants//
AhmedPlaymaker 73:80556a279962 35 int fps = 40; // frames per second, this will be changed in menu.
AhmedPlaymaker 73:80556a279962 36 int g_mode = 1; //selects between joystick and motion control.
AhmedPlaymaker 73:80556a279962 37 int back; //this allows us to use the back key to exit the game loop;
AhmedPlaymaker 73:80556a279962 38
AhmedPlaymaker 73:80556a279962 39
AhmedPlaymaker 73:80556a279962 40 ///////////// prototypes //////////////
AhmedPlaymaker 73:80556a279962 41 void init();
AhmedPlaymaker 73:80556a279962 42 void refresh_game();
AhmedPlaymaker 73:80556a279962 43 void menu();
AhmedPlaymaker 73:80556a279962 44 void read_write_stats();
AhmedPlaymaker 73:80556a279962 45 void _set_mode_speed();
AhmedPlaymaker 73:80556a279962 46 void gameLoop();
AhmedPlaymaker 73:80556a279962 47 //void deinit();