Brick Breaker

Dependencies:   4DGL-uLCD-SE mbed-rtos mbed

Committer:
hotwheelharry
Date:
Tue Oct 21 16:14:11 2014 +0000
Revision:
0:099e4258aba4
Brick Breaker! It's okay

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hotwheelharry 0:099e4258aba4 1 #include "mbed.h"
hotwheelharry 0:099e4258aba4 2 #include "rtos.h"
hotwheelharry 0:099e4258aba4 3 #include "uLCD_4DGL.h"
hotwheelharry 0:099e4258aba4 4
hotwheelharry 0:099e4258aba4 5 #include "Game.h"
hotwheelharry 0:099e4258aba4 6
hotwheelharry 0:099e4258aba4 7
hotwheelharry 0:099e4258aba4 8 //already defined
hotwheelharry 0:099e4258aba4 9 //#define SIZE_X 128
hotwheelharry 0:099e4258aba4 10 //#define SIZE_Y 128
hotwheelharry 0:099e4258aba4 11
hotwheelharry 0:099e4258aba4 12 //display
hotwheelharry 0:099e4258aba4 13 uLCD_4DGL lcd(p28,p27,p29); // serial tx, serial rx, reset pin;
hotwheelharry 0:099e4258aba4 14
hotwheelharry 0:099e4258aba4 15 //inputs
hotwheelharry 0:099e4258aba4 16 AnalogIn sliderh(p17);
hotwheelharry 0:099e4258aba4 17 AnalogIn sliderv(p19);
hotwheelharry 0:099e4258aba4 18 DigitalIn button(p20);
hotwheelharry 0:099e4258aba4 19
hotwheelharry 0:099e4258aba4 20 //outputs
hotwheelharry 0:099e4258aba4 21 AnalogOut aout(p18);
hotwheelharry 0:099e4258aba4 22
hotwheelharry 0:099e4258aba4 23 //game objects
hotwheelharry 0:099e4258aba4 24 Controller controller(sliderh, sliderv, button);
hotwheelharry 0:099e4258aba4 25 vec2 screen = {SIZE_X, SIZE_Y};
hotwheelharry 0:099e4258aba4 26 Renderer gfx(lcd, screen);
hotwheelharry 0:099e4258aba4 27 Audio audio(aout);
hotwheelharry 0:099e4258aba4 28 Game game(gfx, audio, controller);
hotwheelharry 0:099e4258aba4 29
hotwheelharry 0:099e4258aba4 30
hotwheelharry 0:099e4258aba4 31 void thread_audio( void const *args ){
hotwheelharry 0:099e4258aba4 32 audio.run();
hotwheelharry 0:099e4258aba4 33 }
hotwheelharry 0:099e4258aba4 34 int main() {
hotwheelharry 0:099e4258aba4 35 lcd.baudrate(3000000);
hotwheelharry 0:099e4258aba4 36 gfx.background = Color(0x444444);
hotwheelharry 0:099e4258aba4 37 lcd.background_color(gfx.background);
hotwheelharry 0:099e4258aba4 38 lcd.cls();
hotwheelharry 0:099e4258aba4 39
hotwheelharry 0:099e4258aba4 40 Thread t_audio(thread_audio); //start the audio
hotwheelharry 0:099e4258aba4 41
hotwheelharry 0:099e4258aba4 42 while(true){
hotwheelharry 0:099e4258aba4 43 game.loop();
hotwheelharry 0:099e4258aba4 44 //Thread::wait(10);
hotwheelharry 0:099e4258aba4 45 }
hotwheelharry 0:099e4258aba4 46 }