Li Ruofan 201199450

Dependencies:   mbed Gamepad Joystick

Committer:
DannyLee
Date:
Thu May 14 13:12:28 2020 +0000
Revision:
3:cf9fead9c3f4
Child:
5:e3a9f0548922
aaa

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DannyLee 3:cf9fead9c3f4 1 #ifndef spaceship_H
DannyLee 3:cf9fead9c3f4 2 #define spaceship_H
DannyLee 3:cf9fead9c3f4 3
DannyLee 3:cf9fead9c3f4 4 #include "mbed.h"
DannyLee 3:cf9fead9c3f4 5 #include "N5110.h"
DannyLee 3:cf9fead9c3f4 6 #include "Joystick.h"
DannyLee 3:cf9fead9c3f4 7 #include "Bitmap.h"
DannyLee 3:cf9fead9c3f4 8 /* spaceship Class
DannyLee 3:cf9fead9c3f4 9 @Library for Spaceship object in the spaceship project
DannyLee 3:cf9fead9c3f4 10 @coded by Li Ruofan
DannyLee 3:cf9fead9c3f4 11 @May 2020
DannyLee 3:cf9fead9c3f4 12 */
DannyLee 3:cf9fead9c3f4 13 class spaceship{
DannyLee 3:cf9fead9c3f4 14
DannyLee 3:cf9fead9c3f4 15 public:
DannyLee 3:cf9fead9c3f4 16 /* Construct function of our ship*/
DannyLee 3:cf9fead9c3f4 17 Spaceship();
DannyLee 3:cf9fead9c3f4 18
DannyLee 3:cf9fead9c3f4 19 /* Destruct function of our ship*/
DannyLee 3:cf9fead9c3f4 20 ~Spaceship();
DannyLee 3:cf9fead9c3f4 21
DannyLee 3:cf9fead9c3f4 22 /* draw the image of the ship
DannyLee 3:cf9fead9c3f4 23 @param lcd (N5110)
DannyLee 3:cf9fead9c3f4 24 */
DannyLee 3:cf9fead9c3f4 25 void draw(N5110 &lcd, int mode);
DannyLee 3:cf9fead9c3f4 26
DannyLee 3:cf9fead9c3f4 27 /* Initiate the position and the size of the ship
DannyLee 3:cf9fead9c3f4 28 @param the value of horizontal position x (int)
DannyLee 3:cf9fead9c3f4 29 @param the value of vertical position y (int)
DannyLee 3:cf9fead9c3f4 30 @param the columns of spaceship image (int)
DannyLee 3:cf9fead9c3f4 31 @param the rows of spaceship image (int)
DannyLee 3:cf9fead9c3f4 32 */
DannyLee 3:cf9fead9c3f4 33 void init(int x,int y,int width,int height);
DannyLee 3:cf9fead9c3f4 34 void update();
DannyLee 3:cf9fead9c3f4 35 /// access and mutate
DannyLee 3:cf9fead9c3f4 36
DannyLee 3:cf9fead9c3f4 37 /* get position and speed of spaceship in the lcd
DannyLee 3:cf9fead9c3f4 38 @return the current postion of spaceship
DannyLee 3:cf9fead9c3f4 39 */
DannyLee 3:cf9fead9c3f4 40 void set_speed(Vector2D v);
DannyLee 3:cf9fead9c3f4 41 Vector2D get_speed();
DannyLee 3:cf9fead9c3f4 42 Vector2D get_pos();
DannyLee 3:cf9fead9c3f4 43 void set_pos(Vector2D p);
DannyLee 3:cf9fead9c3f4 44
DannyLee 3:cf9fead9c3f4 45 private:
DannyLee 3:cf9fead9c3f4 46 Vector2D _velocity;
DannyLee 3:cf9fead9c3f4 47 int _x;
DannyLee 3:cf9fead9c3f4 48 int _y;
DannyLee 3:cf9fead9c3f4 49 int _width;
DannyLee 3:cf9fead9c3f4 50 int _height;
DannyLee 3:cf9fead9c3f4 51 int _speed;
DannyLee 3:cf9fead9c3f4 52 };
DannyLee 3:cf9fead9c3f4 53 #endif