Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

main.h

Committer:
AhmedPlaymaker
Date:
2019-05-08
Revision:
87:871d9fecb593
Parent:
84:9950d561fdf8
Child:
99:4841f326200f

File content as of revision 87:871d9fecb593:

#ifndef MAIN_H
#define MAIN_H

/** @file main.h
 *  @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.
 */
 
///////////// MAIN.H ////////////////

///////// pre-processor directives ////////
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "FXOS8700CQ.h"
#include "StartScreen.h"
#include "SnakevsBlock.h"
#include "SDFileSystem.h"

#ifdef TEST_SNAKE
# include "tests.h"
#endif

/////////////// objects ///////////////
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
FXOS8700CQ device(I2C_SDA,I2C_SCL);
StartScreen _start;
Stats _stats;
SnakevsBlock _game;
AnalogIn noisy(PTB0); //This creates a random noise which I can use to seed the random numbers.
// Connections to SD card holder on K64F (SPI interface)
SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); // MOSI, MISO, SCK, CS
//Serial serial(USBTX, USBRX);  // for PC debug


//Constants//
int fps = 40;  // frames per second, this will be changed in menu.
int g_mode = 1; //selects between joystick and motion control.
int back; //this allows us to use the back key to exit the game loop;
 
 
///////////// prototypes //////////////
void init();
void menu();
void read_write_stats();
void _set_mode_speed();
void gameLoop();
void refresh_game();
//void deinit();

#endif