new mods upon mods by devhammer: - Added paddle control using tilting of the console - Finished mute function - Reduced flickering See game.cpp for full info.

Dependencies:   mbed

Fork of RETRO_Pong_Mod by G. Andrew Duthie

This is a mod of the official Pong game released with the RETRO game console.

Revision:
2:6ab46f2e851a
Parent:
1:cd8a3926f263
Child:
3:2f09c90a732d
--- a/Game.h	Mon Nov 17 19:51:24 2014 +0000
+++ b/Game.h	Fri Nov 21 20:13:10 2014 +0000
@@ -7,14 +7,17 @@
 class Game {    
     static const char* LOSE_1;
     static const char* LOSE_2;
-    static const char* SPLASH;
+    static const char* SPLASH_1;
+    static const char* SPLASH_2;
     
     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;
+    static const int GRAPH_HEIGHT = 40;
+    static const int GRAPH_SPACING = 2;
+    static const char I2C_ADDR = 0x1C << 1;
     
     int ballX;
     int ballY;
@@ -23,7 +26,12 @@
     int paddleX;
     int pwmTicksLeft;
     int lives;
-    
+    int graphX;    
+    bool mode;
+    bool lastUp;
+    bool lastDown;
+    unsigned short colors[3];
+
     DigitalIn left;
     DigitalIn right;
     DigitalIn down;
@@ -37,6 +45,16 @@
     I2C i2c;
     DisplayN18 disp;
     
+    void readRegisters(char address, char* buffer, int len);
+    int writeRegister(char address, char value);
+    void getXYZ(double& x, double& y, double& z);
+    double convert(char* buffer);
+    void printDouble(double value, int x, int y);
+    
+    void drawAxes();
+    void drawPoint(int axis, double value);
+    void checkGraphReset();
+    
     void initialize();
     void initializeBall();
     
@@ -50,6 +68,7 @@
     void drawBall();
     void updateBall();
     
+    void checkButtons();
     void checkCollision();
     void checkPwm();
     void checkLives();