Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

GameObject/GameObject.h

Committer:
kocemax
Date:
2019-05-08
Revision:
8:9b77eea95088
Parent:
7:cd3cafda3dd4
Child:
9:f720f5d87420

File content as of revision 8:9b77eea95088:

#ifndef GAMEOBJECT_H
#define GAMEOBJECT_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"

/** GameObject Class
@author Kostadin Chakarov, University of Leeds
@brief Draws and controls the objects in the Breakout game, which can either be static or non-static
@date April 2019
*/ 

class StaticGameObject
{
public:
    /** Constructor */
    StaticGameObject();
    /** Destructor */
    ~StaticGameObject();
    /** Controls the movement physics of static game objects */
    virtual void move();
    /** Draws the game objects */
    virtual void draw(N5110 &lcd);
    /** Gets the x and y coordinates of game objects */
    const Vector2D& getPos() const;
    /** Gets the width of the game objects 
    * @return the width of the game objects
    */
    int getW() { return w; };
    /** Gets the height of the game objects 
    * @return the height of the game objects
    */
    int getH() { return h; };
    /** Sets the width of any game object
    * @param value - sets the width of the game objects equal to it
    * @details Used for the power-up features
    */
    void setW(int value) { w = value;}
protected:
    int w, h; /** width and height of any game object */
    Vector2D pos; /** x and y position of any game objects */
};


class GameObject : public StaticGameObject
{
public:
    /** Constructor */
    GameObject() : StaticGameObject() {}
    /** Controls the movement physics of non-static game objects */
    virtual void move();
    /** Gets the velocity of the game objects 
    * @return the velocity of the game objects
    */
    Vector2D& getVelocity() { return velocity; }
    
protected:
    Vector2D velocity; /** velocity of non-static game objects */
    
};
#endif