Modified version of official firmware for Outrageous Circuits' RETRO. See Game.cpp for change history.
Fork of Official_RETRO by
Game.h
00001 #include "mbed.h" 00002 00003 #include "DisplayN18.h" 00004 00005 #pragma once 00006 00007 class Game { 00008 static const char* LOSE_1; 00009 static const char* LOSE_2; 00010 static const char* SPLASH_1; 00011 static const char* SPLASH_2; 00012 static const char* LIVES; 00013 static const char* SCORE; 00014 00015 static const int BALL_RADIUS = 3; 00016 static const int BALL_STARTING_SPEED = 3; 00017 static const int PADDLE_WIDTH = 38; 00018 static const int PADDLE_HEIGHT = 4; 00019 static const int PADDLE_SPEED = 5; 00020 static const int BOUNCE_SOUND_TICKS = 2; 00021 static const int GRAPH_HEIGHT = 40; 00022 static const int GRAPH_SPACING = 2; 00023 static const char I2C_ADDR = 0x1C << 1; 00024 00025 int ballX; 00026 int ballY; 00027 int ballSpeedX; 00028 int ballSpeedY; 00029 int paddleX; 00030 int pwmTicksLeft; 00031 int lives; 00032 int score; 00033 int graphX; 00034 bool mode; 00035 bool lastUp; 00036 bool lastDown; 00037 bool muted; 00038 unsigned short colors[3]; 00039 00040 DigitalIn left; 00041 DigitalIn right; 00042 DigitalIn down; 00043 DigitalIn up; 00044 DigitalIn square; 00045 DigitalIn circle; 00046 DigitalOut led1; 00047 DigitalOut led2; 00048 PwmOut pwm; 00049 AnalogIn ain; 00050 I2C i2c; 00051 DisplayN18 disp; 00052 00053 void readRegisters(char address, char* buffer, int len); 00054 int writeRegister(char address, char value); 00055 void getXYZ(double& x, double& y, double& z); 00056 double convert(char* buffer); 00057 void printDouble(double value, int x, int y); 00058 00059 void drawAxes(); 00060 void drawPoint(int axis, double value); 00061 void checkGraphReset(); 00062 00063 void initialize(); 00064 void initializeBall(); 00065 00066 void drawString(const char* str, int y); 00067 00068 void clearPaddle(); 00069 void drawPaddle(); 00070 void updatePaddle(); 00071 00072 void clearBall(); 00073 void drawBall(); 00074 void updateBall(); 00075 00076 void checkButtons(); 00077 void checkCollision(); 00078 void checkPwm(); 00079 void checkLives(); 00080 00081 public: 00082 Game(); 00083 00084 void showSplashScreen(); 00085 void tick(); 00086 };
Generated on Sat Jul 16 2022 11:28:40 by 1.7.2