The preloaded firmware shipped on the RETRO

Dependencies:   mbed

Revision:
1:cd8a3926f263
Child:
2:6ab46f2e851a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Game.h	Mon Nov 17 19:51:24 2014 +0000
@@ -0,0 +1,62 @@
+#include "mbed.h"
+
+#include "DisplayN18.h"
+
+#pragma once
+
+class Game {    
+    static const char* LOSE_1;
+    static const char* LOSE_2;
+    static const char* SPLASH;
+    
+    static const int BALL_RADIUS = 3;
+    static const int MAX_BALL_SPEED = 5;
+    static const int PADDLE_WIDTH = 38;
+    static const int PADDLE_HEIGHT = 4;
+    static const int PADDLE_SPEED = 4;
+    static const int BOUNCE_SOUND_TICKS = 2;
+    
+    int ballX;
+    int ballY;
+    int ballSpeedX;
+    int ballSpeedY;
+    int paddleX;
+    int pwmTicksLeft;
+    int lives;
+    
+    DigitalIn left;
+    DigitalIn right;
+    DigitalIn down;
+    DigitalIn up;
+    DigitalIn square;
+    DigitalIn circle; 
+    DigitalOut led1;
+    DigitalOut led2;
+    PwmOut pwm;
+    AnalogIn ain;
+    I2C i2c;
+    DisplayN18 disp;
+    
+    void initialize();
+    void initializeBall();
+    
+    void drawString(const char* str, int y);
+    
+    void clearPaddle();
+    void drawPaddle();
+    void updatePaddle();
+    
+    void clearBall();
+    void drawBall();
+    void updateBall();
+    
+    void checkCollision();
+    void checkPwm();
+    void checkLives();
+    
+    public:
+        Game();
+        
+        void showSplashScreen();
+        void tick();
+};
\ No newline at end of file