Chris Dick
/
Gameduino_Invaders_game
Invaders game for the Gameduino
Diff: main.cpp
- Revision:
- 0:8a7c58553b44
- Child:
- 1:f44175dd69fd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jun 21 19:13:34 2012 +0000 @@ -0,0 +1,53 @@ +#include "mbed.h" +#include "GD.h" + + +/*--------------------------------------------------------- + A Space Invaders clone for Gameduino + + http://www.artlum.com/gameduino/gameduino.html#invaders + + Version 0.9 alpha - Still seme things to add + but I'm out of memory! + + Edit "joystick.cpp" if you have a custom joystick. +---------------------------------------------------------*/ + +#include <SPI.h> +#include <GD.h> +#include "game.h" +#include "arduino.h" + +void setup() { + GD.begin(); + makeGraphics(); + Coprocessor::reset(samplePlaybackBuffer); + //randomSeed(GD.rd(FRAME)); + resetGameSounds(); + initGame(); +} + +void loop() { + GD.waitvblank(); + updateGame(); + updateGameSounds(); + + // Debugging/info + if (0) { + joystick.dump(0,33); // Show the joystick state + int yline = Coprocessor::yline(); + showNumber(yline,0,31); + } + // Screenshot when you press the select button + if (0 and joystick.isPressed(Joystick::buttonSelect)) { + sendScreenshot(); + } +} + + +int main() { + setup(); + while (1) { + loop(); + } +} \ No newline at end of file