Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
shot/shot.h@7:c49f3d3b672f, 2020-04-29 (annotated)
- Committer:
- el19zf
- Date:
- Wed Apr 29 05:10:57 2020 +0000
- Revision:
- 7:c49f3d3b672f
- Parent:
- 6:dce38fe4e092
- Child:
- 8:8287d2ef965d
change the initial position of shots, and add some comment
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el19zf | 4:b12a49f0b730 | 1 | #ifndef SHOT_H |
el19zf | 4:b12a49f0b730 | 2 | #define SHOT_H |
el19zf | 4:b12a49f0b730 | 3 | |
el19zf | 4:b12a49f0b730 | 4 | #include "mbed.h" |
el19zf | 4:b12a49f0b730 | 5 | #include "Gamepad.h" |
el19zf | 4:b12a49f0b730 | 6 | #include "N5110.h" |
el19zf | 4:b12a49f0b730 | 7 | #include <vector> |
el19zf | 6:dce38fe4e092 | 8 | #include <time.h> |
el19zf | 6:dce38fe4e092 | 9 | #include <stdlib.h> |
el19zf | 4:b12a49f0b730 | 10 | |
el19zf | 4:b12a49f0b730 | 11 | /** shot class |
el19zf | 4:b12a49f0b730 | 12 | @set several kinds of shot and come from all around |
el19zf | 4:b12a49f0b730 | 13 | @author Zeyu Feng |
el19zf | 4:b12a49f0b730 | 14 | @13 April 2020 |
el19zf | 4:b12a49f0b730 | 15 | */ |
el19zf | 7:c49f3d3b672f | 16 | |
el19zf | 7:c49f3d3b672f | 17 | |
el19zf | 6:dce38fe4e092 | 18 | |
el19zf | 6:dce38fe4e092 | 19 | |
el19zf | 7:c49f3d3b672f | 20 | struct shot_posandtype { |
el19zf | 5:6774b7272e85 | 21 | int x; |
el19zf | 5:6774b7272e85 | 22 | int y; |
el19zf | 5:6774b7272e85 | 23 | int type; |
el19zf | 5:6774b7272e85 | 24 | int dir; |
el19zf | 5:6774b7272e85 | 25 | }; |
el19zf | 4:b12a49f0b730 | 26 | |
el19zf | 7:c49f3d3b672f | 27 | class shot |
el19zf | 7:c49f3d3b672f | 28 | { |
el19zf | 7:c49f3d3b672f | 29 | |
el19zf | 7:c49f3d3b672f | 30 | public: |
el19zf | 4:b12a49f0b730 | 31 | //constructor |
el19zf | 4:b12a49f0b730 | 32 | shot(); |
el19zf | 4:b12a49f0b730 | 33 | //destructor |
el19zf | 4:b12a49f0b730 | 34 | ~shot(); |
el19zf | 7:c49f3d3b672f | 35 | |
el19zf | 6:dce38fe4e092 | 36 | void init(); |
el19zf | 7:c49f3d3b672f | 37 | |
el19zf | 6:dce38fe4e092 | 38 | void init_pos(shot_posandtype* i); |
el19zf | 7:c49f3d3b672f | 39 | |
el19zf | 7:c49f3d3b672f | 40 | void gen_shot(); |
el19zf | 7:c49f3d3b672f | 41 | |
el19zf | 6:dce38fe4e092 | 42 | void update(); |
el19zf | 7:c49f3d3b672f | 43 | |
el19zf | 4:b12a49f0b730 | 44 | void draw(N5110 &lcd); |
el19zf | 7:c49f3d3b672f | 45 | |
el19zf | 6:dce38fe4e092 | 46 | void delete_shot(); |
el19zf | 7:c49f3d3b672f | 47 | |
el19zf | 7:c49f3d3b672f | 48 | int _size;//use for resize number of vector |
el19zf | 7:c49f3d3b672f | 49 | |
el19zf | 4:b12a49f0b730 | 50 | private: |
el19zf | 7:c49f3d3b672f | 51 | |
el19zf | 5:6774b7272e85 | 52 | std::vector<shot_posandtype> _p; |
el19zf | 4:b12a49f0b730 | 53 | |
el19zf | 4:b12a49f0b730 | 54 | }; |
el19zf | 4:b12a49f0b730 | 55 | #endif |
el19zf | 7:c49f3d3b672f | 56 | |
el19zf | 4:b12a49f0b730 | 57 | |
el19zf | 7:c49f3d3b672f | 58 | |
el19zf | 7:c49f3d3b672f | 59 |