Chris Dick
/
Gameduino_Invaders_game
Invaders game for the Gameduino
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "GD.h" 00003 #include "shield.h" 00004 GDClass GD(ARD_MOSI, ARD_MISO, ARD_SCK, ARD_D9, USBTX, USBRX) ; 00005 00006 /*--------------------------------------------------------- 00007 A Space Invaders clone for Gameduino 00008 00009 http://www.artlum.com/gameduino/gameduino.html#invaders 00010 00011 Version 0.9 alpha - Still seme things to add 00012 but I'm out of memory! 00013 00014 Edit "joystick.cpp" if you have a custom joystick. 00015 ---------------------------------------------------------*/ 00016 00017 #include "game.h" 00018 #include "arduino.h" 00019 00020 void setup() { 00021 GD.begin(); 00022 makeGraphics(); 00023 Coprocessor::reset(samplePlaybackBuffer); 00024 randomSeed(GD.rd(FRAME)); 00025 resetGameSounds(); 00026 initGame(); 00027 } 00028 00029 void loop() { 00030 GD.waitvblank(); 00031 updateGame(); 00032 updateGameSounds(); 00033 00034 // Debugging/info 00035 if (0) { 00036 joystick.dump(0,33); // Show the joystick state 00037 int yline = Coprocessor::yline(); 00038 showNumber(yline,0,31); 00039 } 00040 // Screenshot when you press the select button 00041 if (0 and joystick.isPressed(Joystick::buttonSelect)) { 00042 sendScreenshot(); 00043 } 00044 } 00045 00046 00047 int main() { 00048 setup(); 00049 while (1) { 00050 loop(); 00051 } 00052 }
Generated on Thu Jul 14 2022 11:20:53 by 1.7.2