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.
Fork of fy15raf by
GameEngine Class Reference
GameEngine Class. More...
#include <GameEngine.h>
Public Member Functions | |
GameEngine () | |
Constructor. | |
~GameEngine () | |
Destructor. | |
void | init () |
Initialise the game elements: Spaceship, asteroids, time, and game over value. | |
void | read_input (Gamepad &g_pad) |
Read the direction and magnitude data from the joystick. | |
void | draw (N5110 &lcd) |
Draw the game elements: Spaceship, asteroids, hearts and show the time. | |
void | update (Gamepad &pad) |
Update the game elements: Spaceship, asteroids, the hearts and the time. | |
void | draw_hearts (N5110 &lcd) |
Draw the hearts. | |
int | check_gameOver () |
Check if it is the end of the game. | |
void | print_time (N5110 &lcd) |
Print the current time in sec. | |
void | time_increment () |
Increase the time every 1 sec. | |
void | time_stop () |
Stop the time counter at the end of the game. | |
void | print_travel_time (N5110 &lcd) |
Print the total time in sec at the end of the game. | |
void | reset_gameOver () |
Reset the time and game over value to play again. |
Detailed Description
GameEngine Class.
class to control the game functions
- Date:
- May, 2018
Definition at line 15 of file GameEngine.h.
Constructor & Destructor Documentation
GameEngine | ( | ) |
Constructor.
Definition at line 3 of file GameEngine.cpp.
~GameEngine | ( | ) |
Destructor.
Definition at line 8 of file GameEngine.cpp.
Member Function Documentation
int check_gameOver | ( | ) |
Check if it is the end of the game.
- Returns:
- the gameover value (int)
Definition at line 161 of file GameEngine.cpp.
void draw | ( | N5110 & | lcd ) |
Draw the game elements: Spaceship, asteroids, hearts and show the time.
- Parameters:
-
LCD object (N5110)
Definition at line 33 of file GameEngine.cpp.
void draw_hearts | ( | N5110 & | lcd ) |
void init | ( | ) |
Initialise the game elements: Spaceship, asteroids, time, and game over value.
Definition at line 14 of file GameEngine.cpp.
void print_time | ( | N5110 & | lcd ) |
Print the current time in sec.
- Parameters:
-
LCD object (N5110)
Definition at line 192 of file GameEngine.cpp.
void print_travel_time | ( | N5110 & | lcd ) |
Print the total time in sec at the end of the game.
- Parameters:
-
LCD object (N5110)
Definition at line 201 of file GameEngine.cpp.
void read_input | ( | Gamepad & | g_pad ) |
Read the direction and magnitude data from the joystick.
- Parameters:
-
gamepad object (Gamepad)
Definition at line 26 of file GameEngine.cpp.
void reset_gameOver | ( | ) |
Reset the time and game over value to play again.
Definition at line 169 of file GameEngine.cpp.
void time_increment | ( | ) |
Increase the time every 1 sec.
Definition at line 177 of file GameEngine.cpp.
void time_stop | ( | ) |
Stop the time counter at the end of the game.
Definition at line 185 of file GameEngine.cpp.
void update | ( | Gamepad & | pad ) |
Update the game elements: Spaceship, asteroids, the hearts and the time.
- Parameters:
-
gamepad object (Gamepad)
Definition at line 49 of file GameEngine.cpp.
Generated on Thu Jul 14 2022 18:15:41 by
