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
GameEngine/engine.h@9:dc13042b09f5, 2019-05-05 (annotated)
- Committer:
- batJoro
- Date:
- Sun May 05 23:31:07 2019 +0000
- Revision:
- 9:dc13042b09f5
- Parent:
- 8:b3738229ba85
- Child:
- 10:b939edd9b87c
engine4;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| batJoro | 6:4c55dd4b6d42 | 1 | |
| batJoro | 6:4c55dd4b6d42 | 2 | #ifndef ENGINE_H |
| batJoro | 6:4c55dd4b6d42 | 3 | #define ENGINE_H |
| batJoro | 6:4c55dd4b6d42 | 4 | |
| batJoro | 8:b3738229ba85 | 5 | #include "mbed.h" |
| batJoro | 8:b3738229ba85 | 6 | #include "N5110.h" |
| batJoro | 8:b3738229ba85 | 7 | #include "Gamepad.h" |
| batJoro | 8:b3738229ba85 | 8 | #include "functions.h" |
| batJoro | 9:dc13042b09f5 | 9 | #include <vector> |
| batJoro | 8:b3738229ba85 | 10 | |
| batJoro | 9:dc13042b09f5 | 11 | struct MapSegment { |
| batJoro | 9:dc13042b09f5 | 12 | |
| batJoro | 9:dc13042b09f5 | 13 | float curvature; |
| batJoro | 9:dc13042b09f5 | 14 | float meters; |
| batJoro | 9:dc13042b09f5 | 15 | }; |
| batJoro | 8:b3738229ba85 | 16 | class Engine{ |
| batJoro | 6:4c55dd4b6d42 | 17 | |
| batJoro | 8:b3738229ba85 | 18 | public: |
| batJoro | 8:b3738229ba85 | 19 | Engine(); |
| batJoro | 8:b3738229ba85 | 20 | ~Engine(); |
| batJoro | 8:b3738229ba85 | 21 | |
| batJoro | 8:b3738229ba85 | 22 | void init(int screenHeight, int screenWidth, int speed); |
| batJoro | 8:b3738229ba85 | 23 | void read_input(Gamepad &pad); |
| batJoro | 9:dc13042b09f5 | 24 | void update(Gamepad &pad, N5110 &lcd, float elapsedTime); |
| batJoro | 8:b3738229ba85 | 25 | void draw(N5110 &lcd); |
| batJoro | 8:b3738229ba85 | 26 | |
| batJoro | 8:b3738229ba85 | 27 | void setSpeed(int speed); |
| batJoro | 8:b3738229ba85 | 28 | |
| batJoro | 8:b3738229ba85 | 29 | private: |
| batJoro | 9:dc13042b09f5 | 30 | |
| batJoro | 9:dc13042b09f5 | 31 | float _curvature; |
| batJoro | 9:dc13042b09f5 | 32 | |
| batJoro | 9:dc13042b09f5 | 33 | vector<MapSegment> track; // curvature and distance |
| batJoro | 9:dc13042b09f5 | 34 | |
| batJoro | 9:dc13042b09f5 | 35 | float _car_positon; |
| batJoro | 9:dc13042b09f5 | 36 | float _distance; |
| batJoro | 9:dc13042b09f5 | 37 | float _speed; |
| batJoro | 8:b3738229ba85 | 38 | int _screen_height; |
| batJoro | 8:b3738229ba85 | 39 | int _screen_width; |
| batJoro | 8:b3738229ba85 | 40 | |
| batJoro | 8:b3738229ba85 | 41 | static int car1[]; |
| batJoro | 8:b3738229ba85 | 42 | static int car2[]; |
| batJoro | 8:b3738229ba85 | 43 | static int car3[]; |
| batJoro | 6:4c55dd4b6d42 | 44 | }; |
| batJoro | 6:4c55dd4b6d42 | 45 | |
| batJoro | 6:4c55dd4b6d42 | 46 | #endif |