ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Committer:
el17m2h
Date:
Mon May 06 11:21:39 2019 +0000
Revision:
22:0d2ac98a8b48
Parent:
17:74de8c17ddac
Child:
23:9be87557b89a
Re-organized the functions for the engine and the doodler so that the velocity and position of the doodler are changed as separate functions.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17m2h 4:8ec314f806ae 1 #ifndef DOODLER_H
el17m2h 4:8ec314f806ae 2 #define DOODLER_H
el17m2h 4:8ec314f806ae 3
el17m2h 4:8ec314f806ae 4 #include "mbed.h"
el17m2h 4:8ec314f806ae 5 #include "N5110.h"
el17m2h 4:8ec314f806ae 6 #include "Gamepad.h"
el17m2h 5:8814d6de77d0 7
el17m2h 4:8ec314f806ae 8 class Doodler{
el17m2h 4:8ec314f806ae 9 public:
el17m2h 4:8ec314f806ae 10 Doodler();
el17m2h 4:8ec314f806ae 11 ~Doodler();
el17m2h 14:529f798adae4 12 void init(int radius, float position_x, float position_y, double velocity_y);
el17m2h 8:90e789413e0b 13 void draw(N5110 &lcd);
el17m2h 17:74de8c17ddac 14 void update(Direction d, float mag);
el17m2h 10:e1d2289705ef 15 float get_velocity_x();
el17m2h 10:e1d2289705ef 16 double get_velocity_y();
el17m2h 10:e1d2289705ef 17 float get_position_x();
el17m2h 10:e1d2289705ef 18 float get_position_y();
el17m2h 14:529f798adae4 19 void set_velocity(float vel_x, double vel_y);
el17m2h 14:529f798adae4 20 void set_position(float pos_x, float pos_y);
el17m2h 22:0d2ac98a8b48 21 void check_rectangle();
el17m2h 22:0d2ac98a8b48 22 void change_pos(Direction d, float mag);
el17m2h 22:0d2ac98a8b48 23 void check_velocity(double velocity_y);
el17m2h 7:0d9cee90ab0d 24
el17m2h 4:8ec314f806ae 25
el17m2h 4:8ec314f806ae 26 private:
el17m2h 4:8ec314f806ae 27 int _radius;
el17m2h 10:e1d2289705ef 28 // since the velocity will be added, it will not be an integer so it cannot be a vector
el17m2h 14:529f798adae4 29 float _position_x;
el17m2h 14:529f798adae4 30 float _position_y;
el17m2h 10:e1d2289705ef 31 // velocity needs to be float in order to decelerate
el17m2h 10:e1d2289705ef 32 float _velocity_x;
el17m2h 10:e1d2289705ef 33 double _velocity_y;
el17m2h 10:e1d2289705ef 34 double _gravity;
el17m2h 10:e1d2289705ef 35 double _up;
el17m2h 4:8ec314f806ae 36 };
el17m2h 4:8ec314f806ae 37 #endif