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: Ball/Ball.h
- Revision:
- 7:cf469c3505a2
- Parent:
- 6:85314a3d69cd
--- a/Ball/Ball.h Mon May 06 09:37:34 2019 +0000 +++ b/Ball/Ball.h Thu May 09 06:22:13 2019 +0000 @@ -5,25 +5,81 @@ #include "N5110.h" #include "Gamepad.h" +/** Ball class + +@brief Class for creating the ball object and determining how it will move and be controlled + +@version 1.0 + +@author Connor Rainey + +@date May 2019 + +*/ + class Ball { - + public: - Ball(); - ~Ball(); + // constructor + /** + * @brief Constructs the ball object + * @details simple construtor that creates a trivial calibration + */ + Ball(); + // destructor + /** + * @brief Destructs the ball object + * @details deallocates memory location for the ball object + */ + ~Ball(); + /** + * @brief initialises ball object + * @param y @details the initial y coordinate of the ball + * @param size @details the size of the ball + */ void init(int y,int size); + /** + * @brief draws the ball object + * @param N5110 &lcd @details The screen in which the ball is drawn on + */ void draw(N5110 &lcd); + /** + * @brief updates the ball object + * @details updates the balls position to enable it to move on the screen + */ void update(); //acessor and mutator methods + /** + * @brief sets the velocity + * @param v @details the velocity vector of the ball moving on the screen + */ void set_velocity(Vector2D v); + /** + * @brief gets the velocity + * @returns the velocity vector of the ball moving on the screen + */ Vector2D get_velocity(); + /** + * @brief gets the postion vector of the ball on the screen + * @returns the position vector of the ball on the screen + */ Vector2D get_pos(); + /** + * @brief sets the postion vector of the ball on the screen + * @param p @details the position vector of the ball on the screen + */ void set_pos(Vector2D p); + /** + * @brief updates the x postion of the ball on the screen in accordance with the joystick + * @param d @details direction in which ball is moving along x axis + * @param mag @details magnitude at which the ball moves + */ void updateX(Direction d,float mag); - - - + + + private: Vector2D _velocity; @@ -31,9 +87,8 @@ double _x; double _y; double _speed; - + }; #endif - - - \ No newline at end of file + +