Arturs Kozlovskis 201253737

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Objects.h Source File

Objects.h

00001 #ifndef OBJECTS_H
00002 #define OBJECTS_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include <vector>
00008 /** Objects class
00009 * @brief draws game objects on the lcd screen
00010 * @author Arturs Kozlovskis
00011 * @date April,2020
00012 */
00013 
00014 class Objects
00015 {
00016 public:
00017 
00018     /**Constructor */
00019     Objects();//initialises variables
00020     
00021     /** Draw the base of the game 
00022     * @param N5110 class object
00023     */
00024     void draw_base(N5110 &lcd);// draws the base
00025     
00026     /** Update the cannon position
00027     * @param Gamepad class object
00028     */
00029     void cannon_position(Gamepad &pad);// changes the cannon position depending of the joystick
00030     
00031     /** Draw a cannon
00032     * @param N5110 class object
00033     */
00034     void draw_cannon(N5110 &lcd);//draws the cannon
00035     
00036     /** Draw shots
00037     * @param N5110 class object
00038     * @param Gamepad class object
00039     * @param c if an update of position is needed value(bool)
00040     */
00041     void draw_shots(N5110 &lcd,Gamepad &pad,bool c);// makes the shoting on the screen
00042     
00043    /** Draw ball
00044     * @param N5110 calss object
00045     * @param ball_x ball x position(int)
00046     * @param ball_y ball y position(int)
00047     * @param delta_r ball's radiuss(int)
00048    */
00049     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
00050     
00051     /** Get size value of _shot_y_pos vector
00052     * @return size of vector
00053     */
00054     int get_size();//gets the size of _shot_y_pos vector
00055     /** Get x value
00056     * @param i which shot value to return(int)
00057     * @return shot x value
00058     */ 
00059     int get_x_value(int i);//gets _shot_x_pos(i)
00060     
00061     /** Get y value
00062     * @param i which shot value to return(int)
00063     * @return shot y value
00064     */ 
00065     int get_y_value(int i);//gets _shot_y_pos(i)
00066     
00067     /** Erase a shot
00068     * @param i which shot value to erase(int)
00069     */ 
00070     void erase_shot(int i);//erases _shot_x_pos(i) and _shot_y_pos(i)
00071     
00072     /** Get cannon x position
00073     * @return cannon x position
00074     */
00075     int get_x_cannon();
00076 
00077 private:
00078     //variables
00079     int _cannon_pos; //stores the positon of the cannon
00080     int _initial_shot_pos;//stroes the initial vertical position of the shot
00081     int _shot_incrementer;//increments the shot on the lcd by 2
00082     int _radiuss;// the initiak radiuss of the ball
00083     vector <int> _shot_y_pos; //holds the shots y positions
00084     vector <int> _shot_x_pos;//holds the shots x positons
00085 
00086 };
00087 #endif