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
PeopleEngine/PeopleEngine.h@13:eb60628db8bf, 2020-05-14 (annotated)
- Committer:
- el19zf
- Date:
- Thu May 14 16:45:20 2020 +0000
- Revision:
- 13:eb60628db8bf
- Parent:
- 8:8287d2ef965d
- Child:
- 16:cf2bfada3adf
using Doxygen style to comment the code and debug some function;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el19zf | 2:67b51ee7fc34 | 1 | #ifndef PEOPLEENGINE_H |
| el19zf | 2:67b51ee7fc34 | 2 | #define PEOPLEENGINE_H |
| el19zf | 2:67b51ee7fc34 | 3 | |
| el19zf | 2:67b51ee7fc34 | 4 | #include "mbed.h" |
| el19zf | 2:67b51ee7fc34 | 5 | #include "Gamepad.h" |
| el19zf | 2:67b51ee7fc34 | 6 | #include "N5110.h" |
| el19zf | 2:67b51ee7fc34 | 7 | #include "People.h" |
| el19zf | 2:67b51ee7fc34 | 8 | |
| el19zf | 4:b12a49f0b730 | 9 | /** PeopleEngine class |
| el19zf | 13:eb60628db8bf | 10 | @set a Engine of 'People' and do some basic check |
| el19zf | 13:eb60628db8bf | 11 | @author Zeyu Feng |
| el19zf | 13:eb60628db8bf | 12 | @12 April 2020 |
| el19zf | 13:eb60628db8bf | 13 | */ |
| el19zf | 2:67b51ee7fc34 | 14 | |
| el19zf | 3:b8fbaefc496c | 15 | class PeopleEngine |
| el19zf | 3:b8fbaefc496c | 16 | { |
| el19zf | 3:b8fbaefc496c | 17 | |
| el19zf | 13:eb60628db8bf | 18 | public: |
| el19zf | 13:eb60628db8bf | 19 | /**constructor*/ |
| el19zf | 13:eb60628db8bf | 20 | PeopleEngine(); |
| el19zf | 3:b8fbaefc496c | 21 | |
| el19zf | 13:eb60628db8bf | 22 | /**destructor*/ |
| el19zf | 13:eb60628db8bf | 23 | ~PeopleEngine(); |
| el19zf | 13:eb60628db8bf | 24 | |
| el19zf | 13:eb60628db8bf | 25 | /**initialize the position of people*/ |
| el19zf | 3:b8fbaefc496c | 26 | void init(); |
| el19zf | 13:eb60628db8bf | 27 | |
| el19zf | 13:eb60628db8bf | 28 | /**read the polar input from Joystick*/ |
| el19zf | 3:b8fbaefc496c | 29 | void read_input(Gamepad &pad); |
| el19zf | 13:eb60628db8bf | 30 | |
| el19zf | 13:eb60628db8bf | 31 | /**update the position of people according to pad input(Joystick)*/ |
| el19zf | 3:b8fbaefc496c | 32 | void update(); |
| el19zf | 4:b12a49f0b730 | 33 | |
| el19zf | 13:eb60628db8bf | 34 | /**draw the basic element of game: box,start circle and destination circle and main object(people) |
| el19zf | 13:eb60628db8bf | 35 | *@param lcd |
| el19zf | 13:eb60628db8bf | 36 | *@param flag(int) |
| el19zf | 13:eb60628db8bf | 37 | */ |
| el19zf | 13:eb60628db8bf | 38 | void draw(N5110 &lcd,int flag); |
| el19zf | 13:eb60628db8bf | 39 | /**mutators check whether the collision happens*/ |
| el19zf | 8:8287d2ef965d | 40 | Vector2D get_pos(); |
| el19zf | 3:b8fbaefc496c | 41 | |
| el19zf | 3:b8fbaefc496c | 42 | private: |
| el19zf | 3:b8fbaefc496c | 43 | |
| el19zf | 13:eb60628db8bf | 44 | People _people;//People class |
| el19zf | 3:b8fbaefc496c | 45 | Direction _d; |
| el19zf | 13:eb60628db8bf | 46 | float _mag; |
| el19zf | 3:b8fbaefc496c | 47 | Vector2D _p; |
| el19zf | 3:b8fbaefc496c | 48 | }; |
| el19zf | 3:b8fbaefc496c | 49 | #endif |
| el19zf | 3:b8fbaefc496c | 50 | |
| el19zf | 3:b8fbaefc496c | 51 | |
| el19zf | 3:b8fbaefc496c | 52 |