A game for Lab 4 of ECE 4180
Dependencies: 4DGL-uLCD-SE LSM9DS1_Library SDFileSystem mbed-rtos mbed wave_player
Invader.h@5:68f6014f10bd, 2016-03-14 (annotated)
- Committer:
- Dogstopper
- Date:
- Mon Mar 14 18:54:12 2016 +0000
- Revision:
- 5:68f6014f10bd
- Parent:
- 3:27889fffc2f7
Final;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Dogstopper | 0:6a49493943be | 1 | #ifndef _Invader_H_ |
Dogstopper | 0:6a49493943be | 2 | #define _Invader_H_ |
Dogstopper | 0:6a49493943be | 3 | |
Dogstopper | 0:6a49493943be | 4 | #include "rtos.h" |
Dogstopper | 0:6a49493943be | 5 | #include "uLCD_4DGL.h" |
Dogstopper | 0:6a49493943be | 6 | |
Dogstopper | 0:6a49493943be | 7 | class Invader |
Dogstopper | 0:6a49493943be | 8 | { |
Dogstopper | 0:6a49493943be | 9 | public: |
Dogstopper | 0:6a49493943be | 10 | // Constructors |
Dogstopper | 3:27889fffc2f7 | 11 | Invader(uLCD_4DGL* screen, int width, int height); |
Dogstopper | 0:6a49493943be | 12 | |
Dogstopper | 0:6a49493943be | 13 | // Game function |
Dogstopper | 0:6a49493943be | 14 | void update(); |
Dogstopper | 0:6a49493943be | 15 | void draw(); |
Dogstopper | 0:6a49493943be | 16 | |
Dogstopper | 0:6a49493943be | 17 | // Intersection |
Dogstopper | 0:6a49493943be | 18 | bool intersects(int otherX, int otherY, int otherWidth, int otherHeight); |
Dogstopper | 0:6a49493943be | 19 | |
Dogstopper | 0:6a49493943be | 20 | // Getters |
Dogstopper | 0:6a49493943be | 21 | //int getX(); |
Dogstopper | 0:6a49493943be | 22 | // int getY(); |
Dogstopper | 0:6a49493943be | 23 | // int getWidth(); |
Dogstopper | 0:6a49493943be | 24 | // int getHeight(); |
Dogstopper | 0:6a49493943be | 25 | |
Dogstopper | 0:6a49493943be | 26 | private: |
Dogstopper | 0:6a49493943be | 27 | Mutex screen_mutex; |
Dogstopper | 0:6a49493943be | 28 | uLCD_4DGL* screen; |
Dogstopper | 0:6a49493943be | 29 | |
Dogstopper | 3:27889fffc2f7 | 30 | void resetLocationAndSpeed(); |
Dogstopper | 3:27889fffc2f7 | 31 | |
Dogstopper | 3:27889fffc2f7 | 32 | int windowHeight; |
Dogstopper | 3:27889fffc2f7 | 33 | int windowWidth; |
Dogstopper | 3:27889fffc2f7 | 34 | |
Dogstopper | 0:6a49493943be | 35 | int x; |
Dogstopper | 0:6a49493943be | 36 | int y; |
Dogstopper | 0:6a49493943be | 37 | int lastX; |
Dogstopper | 0:6a49493943be | 38 | int lastY; |
Dogstopper | 0:6a49493943be | 39 | int spdX; |
Dogstopper | 0:6a49493943be | 40 | int spdY; |
Dogstopper | 0:6a49493943be | 41 | }; |
Dogstopper | 0:6a49493943be | 42 | |
Dogstopper | 0:6a49493943be | 43 | #endif |