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: mbed
main.cpp
- Committer:
- S_Tingle
- Date:
- 2019-04-29
- Revision:
- 8:bf4f93602b8b
- Parent:
- 5:e6cb6fda5b37
File content as of revision 8:bf4f93602b8b:
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "Game.h"
struct joystick_val {
Direction dir;
float mag;
};
Game game;
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
void init();
void inputs(joystick_val input);
void render();
void start_screen();
int main(){
// DELETE LATER
// lcd.setBrightness(1.0);
// lcd.setContrast(0.4);
// ^^^^^^^^
int fps = 6;
init();
start_screen();
render();
wait(1.0f/fps);
while (1) {
render();
game.dirmag(pad);
game.movement(pad);
game.allCollisions(lcd,pad);
wait(1.0f/fps);
}
}
void init(){
lcd.init();
pad.init();
game.init();
}
void render(){
lcd.clear();
game.drawSprite(lcd);
lcd.refresh();
}
void start_screen(){
lcd.printString(" | Life | ",0,0);
lcd.printString(" Press Start to be Born ",0,0);
}