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 Class Reference
GameEngine Class. More...
#include <GameEngine.h>
Public Member Functions | |
| void | init (int CrossHairsSpeed, int fps) |
| Initisalise the game with cross hair speed and frames per second. | |
| void | read_input (Gamepad &pad) |
| read input from gamepad | |
| void | update (Gamepad &pad) |
| updates the gamepad based on inputs | |
| void | draw (N5110 &lcd) |
| draws sprites on the display | |
| bool | get_game_over () |
| returns if the game is over or not | |
| void | set_game_over (bool is_game_over) |
| sets if game is over or not | |
Detailed Description
GameEngine Class.
- Date:
- April 2019 Revision 1.0
#include "mbed.h" #include "Gamepad.h" #include "N5110.h" #include "GameEngine.h" int main() { //initialise game object GameEngine game; int crossHairsSpeed = 5; int fps = 16 game.init(crossHairsSpeed, fps); //read input from gamepad Gamepad pad; game.read_input(pad); //update game state game.update(pad); /draw game state game.draw(lcd); //returns if game is over or not bool isOver = game.get_game_over(); //sets if game is over or not game.set_game_over(false); //false = not over, true = over }
Definition at line 62 of file GameEngine.h.
Member Function Documentation
| void draw | ( | N5110 & | lcd ) |
draws sprites on the display
- Parameters:
-
lcd the N5110 object
Definition at line 50 of file GameEngine.cpp.
| bool get_game_over | ( | ) |
returns if the game is over or not
- Returns:
- game over
a boolean value
Definition at line 147 of file GameEngine.cpp.
| void init | ( | int | CrossHairsSpeed, |
| int | fps | ||
| ) |
Initisalise the game with cross hair speed and frames per second.
- Parameters:
-
cross hairs speed
max speed of the cross hairs in pixels per frame
- Parameters:
-
fps the fps of the game
Definition at line 15 of file GameEngine.cpp.
| void read_input | ( | Gamepad & | pad ) |
read input from gamepad
- Parameters:
-
gamepad the gamepad object
Definition at line 44 of file GameEngine.cpp.
| void set_game_over | ( | bool | is_game_over ) |
sets if game is over or not
- Parameters:
-
game over
a boolean value
Definition at line 151 of file GameEngine.cpp.
| void update | ( | Gamepad & | pad ) |
updates the gamepad based on inputs
- Parameters:
-
gamepad the gamepad object
Definition at line 69 of file GameEngine.cpp.
Generated on Mon Nov 11 2024 22:48:00 by
1.7.2