not final
Dependencies: mbed
Touch/Touch.h@6:b393cfe4e0a7, 2020-05-28 (annotated)
- Committer:
- ChenZirui
- Date:
- Thu May 28 01:11:47 2020 +0000
- Revision:
- 6:b393cfe4e0a7
- Parent:
- 5:7207c9b70108
- Child:
- 7:f61ac963eb07
not final
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ChenZirui | 5:7207c9b70108 | 1 | #ifndef TOUCH_H |
ChenZirui | 5:7207c9b70108 | 2 | #define TOUCH_H |
ChenZirui | 5:7207c9b70108 | 3 | |
ChenZirui | 5:7207c9b70108 | 4 | #include "mbed.h" |
ChenZirui | 5:7207c9b70108 | 5 | #include "N5110.h" |
ChenZirui | 5:7207c9b70108 | 6 | #include "Gamepad.h" |
ChenZirui | 5:7207c9b70108 | 7 | #include "Bullet.h" |
ChenZirui | 5:7207c9b70108 | 8 | #include "Board.h" |
ChenZirui | 5:7207c9b70108 | 9 | |
ChenZirui | 5:7207c9b70108 | 10 | // gap from edge of screen |
ChenZirui | 5:7207c9b70108 | 11 | #define GAP 2 |
ChenZirui | 5:7207c9b70108 | 12 | |
ChenZirui | 5:7207c9b70108 | 13 | class Touch |
ChenZirui | 5:7207c9b70108 | 14 | { |
ChenZirui | 5:7207c9b70108 | 15 | |
ChenZirui | 5:7207c9b70108 | 16 | public: |
ChenZirui | 5:7207c9b70108 | 17 | Touch(); |
ChenZirui | 5:7207c9b70108 | 18 | ~Touch(); |
ChenZirui | 5:7207c9b70108 | 19 | |
ChenZirui | 6:b393cfe4e0a7 | 20 | void init(int Board_width,int Board_height,int bullet_size,int speed); |
ChenZirui | 5:7207c9b70108 | 21 | void read_input(Gamepad &pad); |
ChenZirui | 6:b393cfe4e0a7 | 22 | void update(Gamepad &pad); |
ChenZirui | 5:7207c9b70108 | 23 | void draw(N5110 &lcd); |
ChenZirui | 5:7207c9b70108 | 24 | |
ChenZirui | 5:7207c9b70108 | 25 | private: |
ChenZirui | 5:7207c9b70108 | 26 | |
ChenZirui | 5:7207c9b70108 | 27 | void check_wall_collision(Gamepad &pad); |
ChenZirui | 6:b393cfe4e0a7 | 28 | void check_Board_collisions(Gamepad &pad); |
ChenZirui | 5:7207c9b70108 | 29 | void check_goal(Gamepad &pad); |
ChenZirui | 5:7207c9b70108 | 30 | void print_scores(N5110 &lcd); |
ChenZirui | 5:7207c9b70108 | 31 | |
ChenZirui | 5:7207c9b70108 | 32 | Board _p1; |
ChenZirui | 5:7207c9b70108 | 33 | Board _p2; |
ChenZirui | 5:7207c9b70108 | 34 | |
ChenZirui | 5:7207c9b70108 | 35 | int _Board_width; |
ChenZirui | 5:7207c9b70108 | 36 | int _Board_height; |
ChenZirui | 5:7207c9b70108 | 37 | int _bullet_size; |
ChenZirui | 5:7207c9b70108 | 38 | int _speed; |
ChenZirui | 5:7207c9b70108 | 39 | |
ChenZirui | 5:7207c9b70108 | 40 | // x positions of the Boards |
ChenZirui | 5:7207c9b70108 | 41 | int _p1x; |
ChenZirui | 5:7207c9b70108 | 42 | int _p2x; |
ChenZirui | 5:7207c9b70108 | 43 | int _p1y; |
ChenZirui | 5:7207c9b70108 | 44 | Bullet _bullet; |
ChenZirui | 5:7207c9b70108 | 45 | |
ChenZirui | 5:7207c9b70108 | 46 | Direction _d; |
ChenZirui | 5:7207c9b70108 | 47 | float _mag; |
ChenZirui | 5:7207c9b70108 | 48 | |
ChenZirui | 5:7207c9b70108 | 49 | }; |
ChenZirui | 5:7207c9b70108 | 50 | |
ChenZirui | 5:7207c9b70108 | 51 | #endif |