ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Committer:
shahidsajid
Date:
Tue Apr 16 09:48:37 2019 +0000
Revision:
4:55a0509c4874
Parent:
3:bd3465a70a5a
Child:
6:3e50f2cf4366
Initialised the Bat class;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shahidsajid 3:bd3465a70a5a 1 #ifndef BALL_H
shahidsajid 3:bd3465a70a5a 2 #define BALL_H
shahidsajid 3:bd3465a70a5a 3
shahidsajid 3:bd3465a70a5a 4 #include "mbed.h"
shahidsajid 3:bd3465a70a5a 5 #include "N5110.h"
shahidsajid 3:bd3465a70a5a 6 #include "Gamepad.h"
shahidsajid 3:bd3465a70a5a 7
shahidsajid 3:bd3465a70a5a 8 /** Ball Class
shahidsajid 3:bd3465a70a5a 9 @author Dr Craig A. Evans, University of Leeds
shahidsajid 3:bd3465a70a5a 10 @brief Controls the ball in the Pong game
shahidsajid 3:bd3465a70a5a 11 @date Febraury 2017
shahidsajid 3:bd3465a70a5a 12 */
shahidsajid 3:bd3465a70a5a 13 class Ball
shahidsajid 3:bd3465a70a5a 14 {
shahidsajid 3:bd3465a70a5a 15
shahidsajid 3:bd3465a70a5a 16 public:
shahidsajid 3:bd3465a70a5a 17 Ball();
shahidsajid 3:bd3465a70a5a 18 ~Ball();
shahidsajid 3:bd3465a70a5a 19 void init(int size,int speed);
shahidsajid 3:bd3465a70a5a 20 void draw(N5110 &lcd);
shahidsajid 3:bd3465a70a5a 21 void update();
shahidsajid 3:bd3465a70a5a 22 /// accessors and mutators
shahidsajid 3:bd3465a70a5a 23 void set_velocity(Vector2D v);
shahidsajid 3:bd3465a70a5a 24 Vector2D get_velocity();
shahidsajid 3:bd3465a70a5a 25 Vector2D get_pos();
shahidsajid 3:bd3465a70a5a 26 void set_pos(Vector2D p);
shahidsajid 3:bd3465a70a5a 27 void start(N5110 &lcd);
shahidsajid 3:bd3465a70a5a 28 void get_direction(Gamepad &pad);
shahidsajid 3:bd3465a70a5a 29 void set_field(N5110 &lcd);
shahidsajid 3:bd3465a70a5a 30
shahidsajid 3:bd3465a70a5a 31 private:
shahidsajid 4:55a0509c4874 32 Gamepad pad;
shahidsajid 4:55a0509c4874 33 struct Fielder{
shahidsajid 4:55a0509c4874 34 int x;
shahidsajid 4:55a0509c4874 35 int y;
shahidsajid 4:55a0509c4874 36 int position;
shahidsajid 4:55a0509c4874 37 };
shahidsajid 3:bd3465a70a5a 38
shahidsajid 3:bd3465a70a5a 39 Vector2D _velocity;
shahidsajid 4:55a0509c4874 40 Fielder field[5];
shahidsajid 3:bd3465a70a5a 41 Direction _d;
shahidsajid 4:55a0509c4874 42 int d;
shahidsajid 3:bd3465a70a5a 43 int _size;
shahidsajid 3:bd3465a70a5a 44 int _x;
shahidsajid 3:bd3465a70a5a 45 int _y;
shahidsajid 3:bd3465a70a5a 46 };
shahidsajid 3:bd3465a70a5a 47 #endif