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.
Swarm/Swarm.h@6:b59bc5e15cf3, 2020-05-14 (annotated)
- Committer:
- haoyan
- Date:
- Thu May 14 06:30:39 2020 +0000
- Revision:
- 6:b59bc5e15cf3
- Parent:
- 1:8c48fb8ca5e0
test
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| haoyan | 1:8c48fb8ca5e0 | 1 | #ifndef SWARM_H |
| haoyan | 1:8c48fb8ca5e0 | 2 | #define SWARM_H |
| haoyan | 1:8c48fb8ca5e0 | 3 | |
| haoyan | 1:8c48fb8ca5e0 | 4 | #include "mbed.h" |
| haoyan | 1:8c48fb8ca5e0 | 5 | #include "N5110.h" |
| haoyan | 1:8c48fb8ca5e0 | 6 | #include "Gamepad.h" |
| haoyan | 1:8c48fb8ca5e0 | 7 | #include "Battleship.h" |
| haoyan | 1:8c48fb8ca5e0 | 8 | |
| haoyan | 1:8c48fb8ca5e0 | 9 | /** Swarm Class |
| haoyan | 1:8c48fb8ca5e0 | 10 | * @brief Swarm |
| haoyan | 1:8c48fb8ca5e0 | 11 | * @author Haoyan Zhang |
| haoyan | 1:8c48fb8ca5e0 | 12 | * @date April, 2020 |
| haoyan | 1:8c48fb8ca5e0 | 13 | */ |
| haoyan | 1:8c48fb8ca5e0 | 14 | |
| haoyan | 1:8c48fb8ca5e0 | 15 | class Swarm |
| haoyan | 1:8c48fb8ca5e0 | 16 | { |
| haoyan | 1:8c48fb8ca5e0 | 17 | public: |
| haoyan | 1:8c48fb8ca5e0 | 18 | |
| haoyan | 1:8c48fb8ca5e0 | 19 | Swarm(); |
| haoyan | 1:8c48fb8ca5e0 | 20 | ~Swarm(); |
| haoyan | 1:8c48fb8ca5e0 | 21 | void init(int height, int width, int speed); |
| haoyan | 1:8c48fb8ca5e0 | 22 | void draw(N5110 &lcd); |
| haoyan | 1:8c48fb8ca5e0 | 23 | void update(); |
| haoyan | 1:8c48fb8ca5e0 | 24 | void set_velocity(Vector2D v); |
| haoyan | 1:8c48fb8ca5e0 | 25 | Vector2D get_velocity(); |
| haoyan | 1:8c48fb8ca5e0 | 26 | Vector2D get_pos(); |
| haoyan | 1:8c48fb8ca5e0 | 27 | void set_pos(Vector2D p); |
| haoyan | 1:8c48fb8ca5e0 | 28 | |
| haoyan | 1:8c48fb8ca5e0 | 29 | private: |
| haoyan | 1:8c48fb8ca5e0 | 30 | |
| haoyan | 1:8c48fb8ca5e0 | 31 | Vector2D _velocity; |
| haoyan | 1:8c48fb8ca5e0 | 32 | int _height; |
| haoyan | 1:8c48fb8ca5e0 | 33 | int _width; |
| haoyan | 1:8c48fb8ca5e0 | 34 | int _x; |
| haoyan | 1:8c48fb8ca5e0 | 35 | int _y; |
| haoyan | 1:8c48fb8ca5e0 | 36 | }; |
| haoyan | 1:8c48fb8ca5e0 | 37 | #endif |
| haoyan | 1:8c48fb8ca5e0 | 38 | |
| haoyan | 1:8c48fb8ca5e0 | 39 |