ELEC2645 (2018/19) / Mbed 2 deprecated el17ebs

Dependencies:   mbed FATFileSystem

Ball/Ball.h

Committer:
ellisbhastroud
Date:
2019-03-29
Revision:
3:a8960004d261
Child:
4:035448357749

File content as of revision 3:a8960004d261:

#ifndef BALL_H
#define BALL_H

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


/** Ball Class
* @brief Class for controlling the golf ball
* @author Ellis Blackford Stroud
* @date May, 2018
*/

/** Joystick struct */
struct Joystick {
    float x; /**< float for x value */
    float y; /**< float for y value */
    float mag; /**< float for magnitude */
};


class Ball {

public:

    /** Constructor */
    Ball();

    /** Destructor */
    ~Ball();
    
    void init(float x_pos, float y_pos);
    
    void draw_ball(N5110 &lcd);
    
    void draw_aim(N5110 &lcd);
    
    void draw_screen(N5110 &lcd);
    
    void move_ball();
    
    void shoot_ball(Gamepad &pad);
    
    void set_vel(float x_vel, float y_vel);
    
    void check_hit_wall();

    void read_joy(Gamepad &pad);
    
private:


    Vector2D _coords;
    Joystick _joy;
    float _x_pos; 
    float _y_pos;
    float _x_vel;
    float _y_vel;
};  

#endif