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
GameObject/GameObject.h@12:0a5758356381, 2017-05-03 (annotated)
- Committer:
- el15as
- Date:
- Wed May 03 19:57:08 2017 +0000
- Revision:
- 12:0a5758356381
- Parent:
- 8:c3cf8d1057bb
Documentation for GameObject class done
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el15as | 4:1f7f32f3e017 | 1 | #ifndef GAMEOBJECT_H |
| el15as | 4:1f7f32f3e017 | 2 | #define GAMEOBJECT_H |
| el15as | 4:1f7f32f3e017 | 3 | |
| el15as | 4:1f7f32f3e017 | 4 | #include "mbed.h" |
| el15as | 4:1f7f32f3e017 | 5 | #include "N5110.h" |
| el15as | 4:1f7f32f3e017 | 6 | #include "Gamepad.h" |
| el15as | 4:1f7f32f3e017 | 7 | |
| el15as | 12:0a5758356381 | 8 | /** Constants */ |
| el15as | 6:33fd1797beb4 | 9 | #define OBJECTCOUNT 51 |
| el15as | 8:c3cf8d1057bb | 10 | #define MENUOBJECTCOUNT 10 |
| el15as | 4:1f7f32f3e017 | 11 | |
| el15as | 12:0a5758356381 | 12 | /** GameObject class |
| el15as | 12:0a5758356381 | 13 | @brief Stores the parameters of on-screen objects |
| el15as | 12:0a5758356381 | 14 | |
| el15as | 12:0a5758356381 | 15 | @brief Revision 1.0 |
| el15as | 12:0a5758356381 | 16 | |
| el15as | 12:0a5758356381 | 17 | @author Aleksejs Sladzevskis |
| el15as | 12:0a5758356381 | 18 | @date 3rd May 2017 |
| el15as | 12:0a5758356381 | 19 | */ |
| el15as | 12:0a5758356381 | 20 | |
| el15as | 4:1f7f32f3e017 | 21 | class GameObject |
| el15as | 4:1f7f32f3e017 | 22 | { |
| el15as | 4:1f7f32f3e017 | 23 | |
| el15as | 4:1f7f32f3e017 | 24 | public: |
| el15as | 4:1f7f32f3e017 | 25 | |
| el15as | 12:0a5758356381 | 26 | /** Constructor */ |
| el15as | 4:1f7f32f3e017 | 27 | GameObject(); |
| el15as | 12:0a5758356381 | 28 | |
| el15as | 12:0a5758356381 | 29 | /** Destructor */ |
| el15as | 4:1f7f32f3e017 | 30 | ~GameObject(); |
| el15as | 4:1f7f32f3e017 | 31 | |
| el15as | 12:0a5758356381 | 32 | /** Type of the object where: |
| el15as | 12:0a5758356381 | 33 | * 0 - Platform, |
| el15as | 12:0a5758356381 | 34 | * 1 - Horizontal Spikes, |
| el15as | 12:0a5758356381 | 35 | * 2 - Vertical Spikes, |
| el15as | 12:0a5758356381 | 36 | * 3 - Door, |
| el15as | 12:0a5758356381 | 37 | * 4 - Switch, |
| el15as | 12:0a5758356381 | 38 | * 5 - Uncollected Coin, |
| el15as | 12:0a5758356381 | 39 | * 6 - Collected Coin, |
| el15as | 12:0a5758356381 | 40 | * 7 - Menu Box |
| el15as | 12:0a5758356381 | 41 | */ |
| el15as | 12:0a5758356381 | 42 | int type; |
| el15as | 12:0a5758356381 | 43 | |
| el15as | 12:0a5758356381 | 44 | /** Coordinates of object's top-left corner */ |
| el15as | 12:0a5758356381 | 45 | intVector2D position; |
| el15as | 12:0a5758356381 | 46 | |
| el15as | 12:0a5758356381 | 47 | /** Object's width */ |
| el15as | 4:1f7f32f3e017 | 48 | int width; |
| el15as | 12:0a5758356381 | 49 | |
| el15as | 12:0a5758356381 | 50 | /** Object's height */ |
| el15as | 4:1f7f32f3e017 | 51 | int height; |
| el15as | 4:1f7f32f3e017 | 52 | |
| el15as | 12:0a5758356381 | 53 | /** Check whether the object contains given point |
| el15as | 12:0a5758356381 | 54 | *@param x x-coordinate to check |
| el15as | 12:0a5758356381 | 55 | *@param y y-coordinate to check |
| el15as | 12:0a5758356381 | 56 | */ |
| el15as | 4:1f7f32f3e017 | 57 | bool containsPoint(int x, int y); |
| el15as | 4:1f7f32f3e017 | 58 | |
| el15as | 4:1f7f32f3e017 | 59 | private: |
| el15as | 4:1f7f32f3e017 | 60 | |
| el15as | 12:0a5758356381 | 61 | // Check x coordinate |
| el15as | 4:1f7f32f3e017 | 62 | bool containsX(int _x); |
| el15as | 12:0a5758356381 | 63 | |
| el15as | 12:0a5758356381 | 64 | // Check y coordinate |
| el15as | 4:1f7f32f3e017 | 65 | bool containsY(int _y); |
| el15as | 4:1f7f32f3e017 | 66 | |
| el15as | 4:1f7f32f3e017 | 67 | }; |
| el15as | 6:33fd1797beb4 | 68 | #endif |