Li Ruofan 201199450
Dependencies: mbed Gamepad Joystick
shot/shot.h@8:b4a2954dd74f, 2020-05-16 (annotated)
- Committer:
- DannyLee
- Date:
- Sat May 16 17:26:10 2020 +0000
- Revision:
- 8:b4a2954dd74f
- Parent:
- 6:cbd9e1f26a10
Debugging
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DannyLee | 8:b4a2954dd74f | 1 | #ifndef Shot_H |
DannyLee | 8:b4a2954dd74f | 2 | #define Shot_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 | 8:b4a2954dd74f | 8 | /** Shot Class |
DannyLee | 8:b4a2954dd74f | 9 | @brief Library for one of the objects Shot of spaceship, University of Leeds |
DannyLee | 8:b4a2954dd74f | 10 | @author Li Ruofan |
DannyLee | 8:b4a2954dd74f | 11 | @date May 2020 |
DannyLee | 3:cf9fead9c3f4 | 12 | */ |
DannyLee | 3:cf9fead9c3f4 | 13 | |
DannyLee | 8:b4a2954dd74f | 14 | class Shot{ |
DannyLee | 3:cf9fead9c3f4 | 15 | |
DannyLee | 3:cf9fead9c3f4 | 16 | public: |
DannyLee | 3:cf9fead9c3f4 | 17 | /** Constructor */ |
DannyLee | 8:b4a2954dd74f | 18 | Shot(); |
DannyLee | 3:cf9fead9c3f4 | 19 | |
DannyLee | 3:cf9fead9c3f4 | 20 | /** Destructor */ |
DannyLee | 8:b4a2954dd74f | 21 | ~Shot(); |
DannyLee | 3:cf9fead9c3f4 | 22 | |
DannyLee | 8:b4a2954dd74f | 23 | /** Initialize the position and the size of the Shot |
DannyLee | 3:cf9fead9c3f4 | 24 | * @param the value of horizontal position x (int) |
DannyLee | 3:cf9fead9c3f4 | 25 | * @param the value of vertical position x (int) |
DannyLee | 8:b4a2954dd74f | 26 | * @param the number of columns of Shot image (int) |
DannyLee | 8:b4a2954dd74f | 27 | * @param the number of rows of Shot image (int) |
DannyLee | 3:cf9fead9c3f4 | 28 | */ |
DannyLee | 3:cf9fead9c3f4 | 29 | void init(int x,int y,int sizeX,int sizeY); |
DannyLee | 3:cf9fead9c3f4 | 30 | |
DannyLee | 8:b4a2954dd74f | 31 | /** draw the image of the Shot |
DannyLee | 3:cf9fead9c3f4 | 32 | * @param lcd (N5110) |
DannyLee | 3:cf9fead9c3f4 | 33 | */ |
DannyLee | 8:b4a2954dd74f | 34 | void draw(N5110 &lcd); //draw the Shot |
DannyLee | 3:cf9fead9c3f4 | 35 | |
DannyLee | 8:b4a2954dd74f | 36 | /** Update the position of the Shot */ |
DannyLee | 3:cf9fead9c3f4 | 37 | void update(); |
DannyLee | 3:cf9fead9c3f4 | 38 | |
DannyLee | 8:b4a2954dd74f | 39 | /** get the position of Shot in the lcd |
DannyLee | 8:b4a2954dd74f | 40 | * @return the current postion of Shot |
DannyLee | 3:cf9fead9c3f4 | 41 | */ |
DannyLee | 3:cf9fead9c3f4 | 42 | Vector2D getPos(); |
DannyLee | 3:cf9fead9c3f4 | 43 | private: |
DannyLee | 3:cf9fead9c3f4 | 44 | int _x; |
DannyLee | 3:cf9fead9c3f4 | 45 | int _y; |
DannyLee | 3:cf9fead9c3f4 | 46 | int _width; |
DannyLee | 3:cf9fead9c3f4 | 47 | int _height; |
DannyLee | 3:cf9fead9c3f4 | 48 | }; |
DannyLee | 3:cf9fead9c3f4 | 49 | #endif |