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: mbed
Diff: ModeA/ModeA.h
- Revision:
- 10:1c3bdbf2fe9f
- Parent:
- 9:571f92b0211b
- Child:
- 11:e29b173ccb27
--- a/ModeA/ModeA.h Wed May 08 20:27:31 2019 +0000 +++ b/ModeA/ModeA.h Wed May 08 23:29:53 2019 +0000 @@ -6,34 +6,109 @@ #include "N5110.h" #include "Gamepad.h" -// function prototypes -void mode_A(); + +/** ModeA Class +@brief Controls the bar and the square in the game +@author Maria Ungureanu, University of Leeds +@date May 2019 +*/ + + + class ModeA { public: +/** Constructor */ ModeA(); + /** Destructor */ ~ModeA(); + + /** + * @brief Sets the screen + * @param lcd @details Clears the lcd + @code + void ModeA::screen(N5110 &lcd) +{ + lcd.clear(); + lcd.printString("GAME",0,0); + lcd.printString("Back:Rules",0,2); + + }; + @endcode + */ void screen(N5110 &lcd); + + + /** + * @brief Sets the screen + * @param x_position @details Sets the x coordinate of the square + * @param y_position @details Sets they coordinate of the square + * @param speed @details Sets the speed of the square + * @param gravity @details Sets the value of the gravitational force + * @param screen_width @details Sets the value of the gravitational force + * @param bar_width @details Sets the width of the bar + * @param bar_speed @details Sets the speed of the bar + * @param size_top @details Sets the size of the top bar + * @param size_bottom @details Sets the size of the bottom bar + @code + void ModeA::initialise(N5110 &lcd) + { + //variables for the square + x_position = 12; + y_position = 18; + speed = 0; + gravity = 1; + //variables for the bar + screen_width = 80; + bar_width = 10; + bar_speed = 2; + + //score = 1; + + //generating random sizes of the bar + srand(time(NULL)); + size_top = rand() % 15; + srand(time(NULL)); + size_bottom = rand() % 15; + + + } + @endcode + */ + + /** Constructor */ void initialise(N5110 &lcd); + + /** Constructor */ void Bird(N5110 &lcd); private: -int x_position; + + int x_position; + int y_position; int gravity; + int screen_width; + int bar_width; + int bar_speed; + + int speed; + + int score; int size_bottom; + int size_top;