Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: N5110 mbed PowerControl
Diff: GameScreen.h
- Revision:
- 2:d4402bc3dd45
- Parent:
- 1:3305d7e44880
- Child:
- 4:f8d04c073730
diff -r 3305d7e44880 -r d4402bc3dd45 GameScreen.h
--- a/GameScreen.h Sat Mar 07 09:58:29 2015 +0000
+++ b/GameScreen.h Sat Mar 07 13:49:53 2015 +0000
@@ -7,6 +7,22 @@
//GameScreen class is an extension of the base Nokia Library Created by Craig Evans
// This extension adds functionality relevant to 'Fall Down Game'.
// drawPlatform, drawBall, drawScore etc....
+// # of platforms defined and can be altered/
+// updates platforms at speed proportional to speedOfPlatforms_
+// manages location and state of all platforms + player ball
+
+//ISSUES:
+// text is written in wrong plane. Easy fix if I had access to private members of N5110...could just edit lib...
+// could also override current fontarray... look into this later.
+//
+//
+
+
+struct Platform {
+ int id; //for identifying.
+ int x; //col of gap
+ int y; //row
+};
class GameScreen: public N5110::N5110
{
@@ -18,18 +34,33 @@
//draw horizontal platform where y top pixel layer location. x hole location
void drawPlatform(int x,int y);
+ void erasePlatform(int y);
+ void drawBall(int x, int y);
+ void eraseBall(int x, int y);
+ void createAllPlatforms();
+ void freeAllPlatforms(); //garbage cleanup
+ void drawAllPlatforms();
+ void eraseAllPlatforms();
+ void shiftAllPlatformsUp(); //move all platforms up 1 pixel
- //Accessors
+ //Read Only
int maxY(){ return maxY_; }
int maxX(){ return maxX_; }
+ int platThickness() {return platThickness_;}
+ int ballRadius() {return ballRadius_;}
+ Platform *allPlatforms[6]; //public for testing...
private:
- int platGapSize;
- int platThickness;
- int maxX_;
- int maxY_;
-
+ static const int platGapSize_ = 8; //standard platform gap width in pixels
+ static const int platThickness_ = 2; //platform thickness in pixels
+ static const int platSpacing_ = 14; // subsequent platform spacing in pixels
+ static const int maxX_ = 48; // maximun horizontal pixel
+ static const int maxY_ = 84; // maximum vertical pixel
+ static const int ballRadius_ = 4; // size of player ball
+ static const int numPlatforms_ = 6; // total number of platforms
+ //Platform *allPlatforms[numPlatforms_]; //array used to track each platform, and refresh when needed!
};
+
#endif
\ No newline at end of file