
Ball drop game with menus and highscore tracking developed for ELEC2645 at the University of Leeds.
Dependencies: N5110 mbed PowerControl
Game developed for ELEC 2645.
Extremely detailed report outlining all aspects of project found below. /media/uploads/AppleJuice/projectreport.pdf
Revision 16:9d676eb9d8d1, committed 2015-05-05
- Comitter:
- AppleJuice
- Date:
- Tue May 05 11:57:46 2015 +0000
- Parent:
- 15:5718d1278f91
- Child:
- 17:7c926de79e02
- Commit message:
- updated docs;
Changed in this revision
GameScreen.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/GameScreen.h Sun May 03 18:46:10 2015 +0000 +++ b/GameScreen.h Tue May 05 11:57:46 2015 +0000 @@ -34,15 +34,17 @@ int y; ///< ball y-location (top pixel) }; -/** -GameScreen Class -inherets N5110 class +/** GameScreen Class +* +*Nokia 5110 screen controller with specific functions for manageing game objects and screens. +* */ class GameScreen: public N5110::N5110 { public: /** Create GameScreen object connected to specific pins + * * constructor inhereted from base class * @param pwr Pin connected to Vcc on the LCD display (pin 1) * @param sce Pin connected to chip enable (pin 3) @@ -60,12 +62,15 @@ * * Calls N5110::init() which powers up display and sets starting brightness * initialises ball position and creates platform list. + * */ void Initialize(); /** Print String + * * Overrides N5110::printString(*) to allow vertical orientation text. - * needs refresh. + * requires a refresh to display. + * *@param str - string to be printed *@param x - x coordinate of the string *@param y - y coordinate of the string @@ -76,14 +81,14 @@ /** Draw Ball * - * Draws ball on screen from playerBall in object + * Draws ball on screen from playerBall struct in object, requires refresh. * */ void drawBall(); /** Erases Ball * - * Erases ball on screen from playerBall in object, requires refresh. + * Erases ball on screen from playerBall struct in object, requires refresh. * */ void eraseBall(); @@ -97,14 +102,14 @@ /** Erases All Platforms * - * Erases all platforms from array allPlatforms in object, requires refresh. + * Erases all platforms on screen from array allPlatforms in object, requires refresh. * */ void eraseAllPlatforms(); /** Shifts Platforms Up * - * Alter array of platforms to shift each platform up, requires refresh. + * Alter array of platforms to shift each platform up n pisxels, requires refresh. *@param n - number of pixels to shift platform. * */ @@ -200,28 +205,49 @@ /** @return ball Y coordinate*/ int getBallY() { return playerBall.y; } -private: - //creates array of platforms, giving each a random gap location + + /** Creates All Platforms + * + * Randomly selects location of gap in each platform and adds all to 'allPlatforms' array. + * + */ void createAllPlatforms(); - // Draw a platform at pos y, gap x. + /** Draws Platform + * + * Draws a platform with thickness _platThickness at height y and gap x. + * + *@param x - location of gap on platform (right hand pixel) + *@param y - y position of platform + * + */ void drawPlatform(int x,int y); - // Erase Platform at pos y + /** Draws Platform + * + * Erases a platform with thickness _platThickness at height y. + * + *@param y - y position of platform + * + */ void erasePlatform(int y); - // Garbage cleanup of allPlatfrom array. + /** Free All Platforms + * + * frees memory of each platform in 'allPlatforms' array and destroys the array. + * + */ void freeAllPlatforms(); - 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 - Ball playerBall; - Platform *allPlatforms[numPlatforms_]; //array used to track each platform, and refresh when needed! + 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 + Ball playerBall; ///< player ball structure + Platform *allPlatforms[numPlatforms_]; ///< array used to track each platform, and refresh when needed! };