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.
Ball/Ball.h@10:40c77d69e83c, 2019-04-11 (annotated)
- Committer:
- JamesCummins
- Date:
- Thu Apr 11 08:08:52 2019 +0000
- Revision:
- 10:40c77d69e83c
- Parent:
- 9:ce0a12fb205b
- Child:
- 11:2cf0d4ce8677
Continuing work on the game engine
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JamesCummins | 9:ce0a12fb205b | 1 | #ifndef BALL_H |
| JamesCummins | 9:ce0a12fb205b | 2 | #define BALL_H |
| JamesCummins | 9:ce0a12fb205b | 3 | |
| JamesCummins | 9:ce0a12fb205b | 4 | #include "mbed.h" |
| JamesCummins | 9:ce0a12fb205b | 5 | #include "N5110.h" |
| JamesCummins | 9:ce0a12fb205b | 6 | #include "Gamepad.h" |
| JamesCummins | 9:ce0a12fb205b | 7 | #include "FXOS8700CQ.h" |
| JamesCummins | 9:ce0a12fb205b | 8 | |
| JamesCummins | 9:ce0a12fb205b | 9 | |
| JamesCummins | 9:ce0a12fb205b | 10 | class Ball { |
| JamesCummins | 9:ce0a12fb205b | 11 | |
| JamesCummins | 9:ce0a12fb205b | 12 | public: |
| JamesCummins | 9:ce0a12fb205b | 13 | //constructor method |
| JamesCummins | 9:ce0a12fb205b | 14 | Ball(); |
| JamesCummins | 9:ce0a12fb205b | 15 | //destructor method |
| JamesCummins | 9:ce0a12fb205b | 16 | ~Ball(); |
| JamesCummins | 9:ce0a12fb205b | 17 | //methods for engine |
| JamesCummins | 9:ce0a12fb205b | 18 | void init(int radius); |
| JamesCummins | 9:ce0a12fb205b | 19 | void draw(N5110 &lcd); |
| JamesCummins | 9:ce0a12fb205b | 20 | void update(FXOS8700CQ &accelerometer); |
| JamesCummins | 9:ce0a12fb205b | 21 | //accessor methods |
| JamesCummins | 9:ce0a12fb205b | 22 | Vector2D get_accel(); |
| JamesCummins | 9:ce0a12fb205b | 23 | Vector2D get_velocity(); |
| JamesCummins | 9:ce0a12fb205b | 24 | Vector2D get_position(); |
| JamesCummins | 10:40c77d69e83c | 25 | int get_radius(); |
| JamesCummins | 9:ce0a12fb205b | 26 | //mutator methods |
| JamesCummins | 9:ce0a12fb205b | 27 | void set_velocity(Vector2D vel); |
| JamesCummins | 9:ce0a12fb205b | 28 | void set_position(Vector2D pos); |
| JamesCummins | 10:40c77d69e83c | 29 | void set_radius(int radius); |
| JamesCummins | 9:ce0a12fb205b | 30 | |
| JamesCummins | 9:ce0a12fb205b | 31 | private: |
| JamesCummins | 9:ce0a12fb205b | 32 | _radius; |
| JamesCummins | 9:ce0a12fb205b | 33 | _x; |
| JamesCummins | 9:ce0a12fb205b | 34 | _y; |
| JamesCummins | 9:ce0a12fb205b | 35 | Vector2D _velocity; |
| JamesCummins | 9:ce0a12fb205b | 36 | Vector2D _accel; |
| JamesCummins | 9:ce0a12fb205b | 37 | }; |
| JamesCummins | 9:ce0a12fb205b | 38 | #endif |