ELEC2645 (2018/19) / Mbed 2 deprecated el17dtt

Dependencies:   mbed

Car/car.h

Committer:
batJoro
Date:
2019-05-10
Revision:
12:bc9a43f56261
Parent:
11:0e6a221ad8a9

File content as of revision 12:bc9a43f56261:


#ifndef CAR_H
#define CAR_H

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

/** Car Class
@author Dobri Tsvetkov, University of Leeds
@brief C++ class that covers the characteristics of a car 
@date May 2019
*/ 
class Car {
  
  public:
    /**
    @brief init method
    @param None 
    @details initialises some of the variables
    */
    void init(); // to niit a car object
    /**
    @brief draw method
    @param the lcd ref and screen width 
    @details draw the car on the buffer
    */
    void draw(N5110 &lcd, int screenWidth); // draw the car based on given position
    /**
    @brief Decrement _gear
    @param None 
    @details _gear --
    */
    void downShift(); // decrement _gear --
    /**
    @brief Increment _gear
    @param None
    @details _gear ++
    */
    void upShift(); // increment _gear ++
    
    // mutators
    
    /** 
    @brief Fuel mutator
    @param int _fuel
    @details Sets _fuel to given int parameter
    */
    void set_fuel(int _fuel);
    /**
    @brief Health mutator
    @param int _health
    @details Sets _health to given int parameter
    */
    void set_health(int _health);
    /**
    @brief Direction mutator
    @param int _direction
    @details Sets _direction to given int parameter
    */
    void set_direction(int _direction);
    /**
    @brief Gear mutator
    @param int _gear
    @details Sets _gear to given int parameter
    */
    void set_gear();
    
    /**
    @brief Rev mutator
    @param float _rev
    @details Sets _rev to given float parameter
    */
    void set_rev(float r);  
     /**
    @brief Speed mutator
    @param float _speed
    @details Sets _speed to given float parameter
    */
    void set_speed(float sp);
     /**
    @brief Position mutator
    @param float _car_position
    @details Sets _car_position to given float parameter
    */
    void set_car_position(float pos);
     /**
    @brief Car distance mutator
    @param float _car_distance
    @details Sets _car_distance to given float parameter
    */
    void set_car_distance(float _distance);
    
    // accessors
    
    /**
    @brief Fuel accessor
    @param None
    @details returns int _fuel
    */
    int get_fuel();
    /**
    @brief Health accessor
    @param None
    @details returns int _health
    */
    int get_health();
     /**
    @brief Direction accessor
    @param None
    @details returns int _direction
    */
    int get_direction();
    
     /**
    @brief Speed accessor
    @param None
    @details returns float _speed
    */
    float get_speed();
     /**
    @brief Position accessor
    @param None
    @details returns float _car_position
    */
    float get_car_position();
     /**
    @brief Distance accessor
    @param None
    @details returns float _car_distance
    */
    float get_car_distance();
    /**
    @brief Rev accessor
    @param None
    @details returns float _rev
    */
    float get_rev();
    
  private:
  
    int _fuel; /**<int for future development */
    int _health;    /**<int for future development */
    int _direction; /**<int choice to display the turning car */
    int _gear;  /**<int the gear between 1 and 3 */
  
    float _rev; /**<float revs based on the gear */
    float _car_distance; /**<float the distance of the car */
    float _speed; /**<float car speed */
    float _car_position;    /**<float car position before parsing */
  
    // pictures to draw car in different direction
    static int car1[]; /**<static int car goes straight  */
    static int car2[]; /**<static int car goes to the right  */
    static int car3[]; /**<static int car goes to the left */
    
};


#endif