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.
My_game_clases/Objects.h
- Committer:
- thestudent
- Date:
- 2020-05-19
- Revision:
- 25:b0c1d7955678
- Parent:
- 21:32429d8e90ff
File content as of revision 25:b0c1d7955678:
#ifndef OBJECTS_H
#define OBJECTS_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include <vector>
/** Objects class
* @brief draws game objects on the lcd screen
* @author Arturs Kozlovskis
* @date April,2020
*/
class Objects
{
public:
    /**Constructor */
    Objects();//initialises variables
    
    /** Draw the base of the game 
    * @param N5110 class object
    */
    void draw_base(N5110 &lcd);// draws the base
    
    /** Update the cannon position
    * @param Gamepad class object
    */
    void cannon_position(Gamepad &pad);// changes the cannon position depending of the joystick
    
    /** Draw a cannon
    * @param N5110 class object
    */
    void draw_cannon(N5110 &lcd);//draws the cannon
    
    /** Draw shots
    * @param N5110 class object
    * @param Gamepad class object
    * @param c if an update of position is needed value(bool)
    */
    void draw_shots(N5110 &lcd,Gamepad &pad,bool c);// makes the shoting on the screen
    
   /** Draw ball
    * @param N5110 calss object
    * @param ball_x ball x position(int)
    * @param ball_y ball y position(int)
    * @param delta_r ball's radiuss(int)
   */
    void draw_ball(N5110 &lcd, int ball_x, int ball_y, int delta_r); //ball_x: balls x position; ball_y: balls y position; delta_r: added to the inital radiuss to make the ball bigger
    
    /** Get size value of _shot_y_pos vector
    * @return size of vector
    */
    int get_size();//gets the size of _shot_y_pos vector
    /** Get x value
    * @param i which shot value to return(int)
    * @return shot x value
    */ 
    int get_x_value(int i);//gets _shot_x_pos(i)
    
    /** Get y value
    * @param i which shot value to return(int)
    * @return shot y value
    */ 
    int get_y_value(int i);//gets _shot_y_pos(i)
    
    /** Erase a shot
    * @param i which shot value to erase(int)
    */ 
    void erase_shot(int i);//erases _shot_x_pos(i) and _shot_y_pos(i)
    
    /** Get cannon x position
    * @return cannon x position
    */
    int get_x_cannon();
private:
    //variables
    int _cannon_pos; //stores the positon of the cannon
    int _initial_shot_pos;//stroes the initial vertical position of the shot
    int _shot_incrementer;//increments the shot on the lcd by 2
    int _radiuss;// the initiak radiuss of the ball
    vector <int> _shot_y_pos; //holds the shots y positions
    vector <int> _shot_x_pos;//holds the shots x positons
};
#endif