testing documentation

Dependencies:   mbed ll16j23s_test_docs

main.cpp

Committer:
JoeShotton
Date:
2020-05-25
Revision:
8:bcc3403d7e79
Parent:
7:dd84e0fab346
Child:
9:0571880085cc

File content as of revision 8:bcc3403d7e79:

/* 
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
2019/20

Name: Joe Shotton
Username: ll16j23s
Student ID Number: 201127267
Date: 4/4/20
*/

// includes
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "FXOS8700CQ.h"
#include "Bitmap.h"
#include "SnakeEngine.h"
#include "Map.h"
#include <vector>
#include <cstdlib>

#define X_MAX       84
#define Y_MAX       48

// objects
Gamepad pad;
N5110 lcd;
SnakeEngine snake;
FXOS8700CQ mag(I2C_SDA,I2C_SCL);

int main() {
    
    lcd.init();
    pad.init();
    snake.game_init(pad, lcd, mag);
    
    snake._game_state = 2;
    snake.menu2_init(lcd);
    
    //snake.transition_black(lcd);
    //snake.transition_white(lcd);
    float speed = 0.5;
    
    int fps = 25;
    int frame_t = 1000/fps;

    while(snake._game_state == 1){ 
        snake.menu1_select(lcd, pad);
        snake.contrast(pad, lcd);
    }
    
    while(snake._game_state == 2){ 
        snake.menu2_select(lcd, pad);
        snake.contrast(pad, lcd);
    }
    
    while(snake._game_state == 3){
        lcd.clear();
        snake.game_run(pad, lcd);
        lcd.refresh();
        wait_ms(500/(5+snake.score));
    }
    
    while(snake._game_state == 4){
        //snake.death;
        snake.contrast(pad, lcd);
    }
    


}