Some random attempts at programming the retro console
Fork of RETRO_Pong_Mod by
Diff: Game.h
- Revision:
- 9:5c4a3e89a713
- Parent:
- 8:c63981a45c95
- Child:
- 10:ba2dea5fffd1
--- a/Game.h Sat Feb 28 00:04:52 2015 +0000 +++ b/Game.h Sat Feb 28 14:46:09 2015 +0000 @@ -2,10 +2,8 @@ #include "Color565.h" #include "font_IBM.h" #include "LCD_ST7735.h" -#include "MusicEngine.h" #pragma once -void playSong(); class Game { static const char* LOSE_1; static const char* LOSE_2; @@ -28,13 +26,14 @@ static const int CHAR_HEIGHT = 8; static const int CHAR_SPACING = 0; + static const float MAX_SPEED = 6.0f; // Start with a ball.. let's see what becomes int ballX; int ballY; - int ballSpeedX; - int ballSpeedY; - int ballAccelX; - int ballAccelY; + float ballSpeedX; + float ballSpeedY; + float ballAccelX; + float ballAccelY; int pwmTicksLeft; int lives; int score; @@ -44,7 +43,7 @@ bool lastDown; bool muted; unsigned short colors[3]; - + unsigned short cCol; DigitalIn left; DigitalIn right; DigitalIn down; @@ -57,11 +56,10 @@ AnalogIn ain; I2C i2c; LCD_ST7735 disp; - MusicEngine music; void readRegisters(char address, char* buffer, int len); int writeRegister(char address, char value); - void getXY(double& x, double& y); + void getXY(float& x, float& y); void getXYZ(double& x, double& y, double& z); double convert(char* buffer); @@ -79,6 +77,7 @@ void drawBall(); void updateBall(); void readAccel(); + void bounce(); void checkButtons(); void checkCollision(); void checkPwm();