ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18rg

Dependencies:   mbed Gamepad2 ELEC2645_Project_el18rg

Dependents:   ELEC2645_Project_el18rg

Engine/Engine.h

Committer:
el18rg
Date:
2020-05-29
Revision:
14:9b4a219dd91e
Parent:
13:09bc615e6665
Child:
15:4ed54ff548cf

File content as of revision 14:9b4a219dd91e:

/** Engine Class
* @brief Operates the game
* @author Rosemary Gillman
* @date April, 2020
*/
#ifndef ENGINE_H
#define ENGINE_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Bug.h"
#include "Swatter.h"
#include "Splat.h"

#define GAP 2

class Engine
{
public:

    /** Constructor */
    Engine();
    
    /** Destructor */
    ~Engine();
    
    /** Set initalisation 
    * @param the value of the swatter width, swatter heigh and speed (int)
    */
    void init(int swatter_width,int swatter_height,int speed);
    
    /** 
    * @
    */
    void read_input(Gamepad &pad);
    
    /** Update the engine
    * @
    */
    void update(N5110 & lcd, Gamepad & pad);
    
    /** 
    * @
    */
    void timer();
    
    /** Draw the game
    * @return
    */
    void draw(N5110 &lcd);
    
    /** Check side collisions
    * @
    */
    void check_side_collision(Gamepad &pad);
    
    /** Check swatter/bug collisions
    * @
    */
    void check_swatter_collisions(N5110 & lcd, Gamepad & pad);
    
    /** End the game
    * @
    */
    void ending(N5110 & lcd, Gamepad & pad);

private:

    int height;                 //swatter height
    int width;                  //swatter width
    int x;                      //x-axis point
    int _speed;                 //bug speed
    int random_collision;       //sets the 
    
    float _mag;                 //magnitude

    clock_t start;              //start time
    clock_t end;                //end time
    clock_t clockTicksTaken;    //time value
    
    double timeInSeconds;       //time in seconds of game
    double duration;            //duration of game
    
    Bug _bug;
    Splat _splat;
    Swatter _swatter;
    Direction _d;
    
    bool collisionX;            //X-axis collision
    bool collisionY;            //Y-axis collision
    
};
#endif