Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE LSM9DS1_Library SDFileSystem mbed-rtos mbed wave_player
main.cpp
- Committer:
- Dogstopper
- Date:
- 2016-03-10
- Revision:
- 2:623f29bad35c
- Parent:
- 0:6a49493943be
- Child:
- 3:27889fffc2f7
File content as of revision 2:623f29bad35c:
#include "mbed.h" #include "InputHandler.h" #include "Invader.h" #include "Player.h" #define WIDTH 128 #define HEIGHT 128 //DigitalOut led(LED1); InputHandler input(p9, p10, 0xD6, 0x3C, p15); uLCD_4DGL uLCD(p28,p27,p30); // serial tx, serial rx, reset pin; //Player player(&uLCD, &input, WIDTH/2, HEIGHT/2); Invader invader(&uLCD, WIDTH/2, HEIGHT/2, 0, 2); void gameLoop(void const *p) { // bool alive = true; // while(alive) { //// player.update(); // invader.update(); // // invader.draw(); //// player.draw(); // // // If there is a collision, we are done //// if (invader.intersects(player.getX(), player.getY(), player.getWidth(), player.getHeight())) { //// led = 1; //// alive = false; //// } // // Thread::wait(32); // 30 FPS // } } int main() { Thread* gameThread = new Thread(gameLoop); Thread* inputThread = input.start(); uLCD.background_color(BLACK); invader.draw(); while(1) { printf("xAccel: %.6f\n\ryAccel: %.6f\n\rbutton: %s\n\r", input.getXAccel(), input.getYAccel(), input.getPushed() ? "true" : "false"); wait(0.5); } }