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 N5110 ShiftReg PinDetect
Diff: Game.h
- Revision:
- 12:8178fad5e660
- Parent:
- 11:adb68da98262
- Child:
- 13:7ab71c7c311b
--- a/Game.h Fri May 08 22:10:54 2015 +0000
+++ b/Game.h Fri May 08 23:51:26 2015 +0000
@@ -1,12 +1,17 @@
#ifndef GAME_H
#define GAME_H
+/** @file Game.h
+* @author Andreas Garmannslund
+*/
+
#include "State.h"
#include "Resources.h" // TODO: Move to State.h ?
#include "Entity.h"
#include "map.h"
#include <vector>
+/// Simple objects with a position (x,y) and velocity (vx, vy)
struct Point
{
int x;
@@ -14,24 +19,30 @@
int vx, vy;
};
+/// State: Game
class Game : public State
{
public:
+ /// Creates the Game state
Game(StateManager* fsm, N5110 *lcd, InputManager* input)
: State(fsm, lcd, input) {init();}
-
+
+ /// Handle input and update logic
virtual void update(float dt);
+
+ /// Draw state to lcd
virtual void render();
- void init();
private:
- Entity player;
- bool onGround; // true if player is on ground
+
- bool releasedBtnB;
+ void init(); /// Sets some initial values
+ Entity player; /// Player object
- std::vector<Point*> bullets;
+ bool releasedBtnB; /// True if button B has been released after being pressed down
+
+ std::vector<Point*> bullets; /// Container for bullets
};
#endif