![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Diff: GameEngine/LengthManager/LengthManager.h
- Revision:
- 93:7f9c31ed5cab
- Parent:
- 83:329da564799a
diff -r 693a6ae0ff8e -r 7f9c31ed5cab GameEngine/LengthManager/LengthManager.h --- a/GameEngine/LengthManager/LengthManager.h Wed May 08 22:27:45 2019 +0000 +++ b/GameEngine/LengthManager/LengthManager.h Wed May 08 23:08:49 2019 +0000 @@ -5,46 +5,71 @@ #include "N5110.h" #include "Gamepad.h" +/** LengthManager Class +@brief This class calculates the length of the snake at every point during the game and can be used to set length values in other classes using _getLength(). +@author Ahmed N.Adamjee +@date 8th May 2019 +*/ class LengthManager { public: - + /** Constructor */ LengthManager(); + /** Destructor */ ~LengthManager(); - /** Initialise LengthManager - * - * This function sets the initial length parameters. + /** + * @brief This function sets the initial length parameters and gets pointers of lcd and pad from int main() to be used privately in the entire class. + * @param N5110 *lcd @details pointer to the N5110 object in main, address of this pointer is saved to make availability to the entire class, without passing address to each function. + * @param Gamepad *pad @details pointer to the gamepad object in main, address of this pointer is saved to make availability to the entire class, without passing address to each function. + @code + _lcd = lcd; + _length = 4; + @endcode */ void init(N5110 *lcd); - /** Minus Length - * - * This function decrements the length value by 1;. + /** + * @brief This function decrements the length value by 1; + @code + _length -= 1; + @endcode */ void MinusLength(); - /** Plus Length - * - * This function increments the length by one. + /** + * @brief This function increments the length by one. + @code + _length += 1; + @endcode */ void PlusLength(); - /** Draw - * - * This function draws the length on the screen. + /** + * @brief This function prints the length on top edge of screen. + @code + char bufferscore[14]; + sprintf(bufferscore,"%d",_length); + _lcd->printString(bufferscore,1,0); + @endcode */ void print_length_on_screen(); - /** get the length - * - * This sends the current length value when called. + /** + * @brief This sends the current length value when called. + * @returns _length @details This is the length of the snake, which is passed back after any manipulation such as MinusLength() or PlusLength(). + @code + return _length; + @endcode */ int _getLength(); - /** Set the Length - * - * This function obtains the length value to be altered. + /** + * @brief This function obtains the length value to be altered for a specific operation. + * @param length @details This is the length of the snake, which is recieved from the calling function to either initialise this or update this. + @code + _length = length; + @endcode */ void _setLength(int length);