Balint Bogdan SnekGame

Dependencies:   FoodLibrary Gamepad N5110 SnekGame mbed

main.cpp

Committer:
Nefos
Date:
2017-05-05
Revision:
2:94b01aafb32f
Parent:
1:a222ad7a05b9

File content as of revision 2:94b01aafb32f:

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"

#include "Snake.h"

/************************Structs************************/
struct UserInput {
    Direction d;
   
};


/************************Objects************************/
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);//set LCD pins
Gamepad pad;
Snake snake;

//Serial pc(USBTX , USBRX );//tx, rx
//Engine bman;

/************************Prototypes************************/
void start_screen();


/************************Variables************************/

//int heroChar[4]=(1,1,0,1);
//int bomb[4]=(0,1,0,1);
//int boulderLocation[4][8]={}// set the coordinate for boulder, if 00, boulder does not exist

/************************Main code************************/
int main()
{
    lcd.init();//initializing display
    pad.init();
    //pc.printf("initalized");
    snake.init(25,25,5,3);
    start_screen();
    while (true) {

            //printf("updated");
            snake.draw(lcd);
            snake.update(pad);
        
    }
}
/************************Functions************************/

void start_screen(){
        
        lcd.printString("Snek, the game",0,1);
        lcd.printString("Press Start",0,4);
        lcd.refresh();    
        printf("waiting for input");
        while ( pad.check_event(Gamepad::START_PRESSED) == false) {//This switch code was taken from Pong, as it is a very simple code I left it here
        
                pad.leds_on();
                wait(0.1);
                pad.leds_off();
                wait(0.1);
                printf("still...");
                
    }
printf("done");
}