ST_engine
0.3-ALPHA
|
This class is responsible for managing all levels and the lua backend, it is the heart of the engine. More...
#include <game_manager.hpp>
Public Member Functions | |
game_manager (message_bus &msg_bus) | |
~game_manager () | |
std::string | get_active_level () const |
bool | key_pressed (uint16_t arg) const |
bool | key_held (uint16_t arg) const |
bool | key_released (uint16_t arg) const |
int32_t | get_mouse_x () const |
int32_t | get_mouse_y () const |
int16_t | get_left_trigger () const |
int16_t | get_right_trigger () const |
int16_t | get_left_stick_horizontal () const |
int16_t | get_left_stick_vertical () const |
int16_t | get_right_stick_vertical () const |
int16_t | get_right_stick_horizontal () const |
void | update () |
bool | game_is_running () const |
ST::level * | get_level () const |
void | center_camera_on_entity (uint64_t id) |
uint16_t | get_window_width () const |
uint16_t | get_window_height () const |
uint16_t | get_internal_width () const |
uint16_t | get_internal_height () const |
void | save_state (const std::string &filepath) |
game_manager (message_bus *msg_bus, task_manager *tsk_mngr) | |
std::string | get_active_level () const |
ST::level * | get_level () |
bool | key_pressed (size_t arg) const |
bool | key_held (size_t arg) const |
bool | key_released (size_t arg) const |
int32_t | get_mouse_x () const |
int32_t | get_mouse_y () const |
void | update () |
bool | game_is_running () const |
void | center_camera_on_entity (uint64_t id) |
int16_t | get_left_trigger () const |
int16_t | get_right_trigger () const |
int16_t | get_left_stick_horizontal () const |
int16_t | get_left_stick_vertical () const |
int16_t | get_right_stick_vertical () const |
int16_t | get_right_stick_horizontal () const |
void | save_state (const std::string &filepath) |
uint16_t | get_internal_width () const |
uint16_t | get_internal_height () const |
uint16_t | get_window_width () const |
uint16_t | get_window_height () const |
This class is responsible for managing all levels and the lua backend, it is the heart of the engine.
MOCK: contained in game_manager_mock.hpp This is a mock class of the game_manager. It contains the exact same function definitions as the real game_manager, but not the implementations. This is need to properly test the lua_backend. GMock is not used as it requires to use virtual methods (interfaces) to create mocks. We assume that this mock contains the same definitions as the real thing, but this is not checked anywhere and is done per hand. (A compile time error will occur if a method/attribute is not found, but things like wrong data types in the method arguments may not be noticed easily).
Definition at line 20 of file game_manager.hpp.
|
explicit |
initializes the game_manager and loads the level specified as first ("main" is default)
msg_bus | A pointer to the global message bus. |
tsk_mngr | A pointer to the global task_mngr. |
Definition at line 23 of file game_manager.cpp.
game_manager::~game_manager | ( | ) |
Closes the game manager and the lua backend.
Definition at line 308 of file game_manager.cpp.
void game_manager::center_camera_on_entity | ( | uint64_t | id | ) |
Center the camera on an entity.
id | The ID of the entity to center on. |
Definition at line 360 of file game_manager.cpp.
bool game_manager::game_is_running | ( | ) | const |
Tells is if the game is still running or not. This is the main condition for running the main loop (the entire engine).
Definition at line 438 of file game_manager.cpp.
std::string game_manager::get_active_level | ( | ) | const |
Get the name of the active level.
Definition at line 415 of file game_manager.cpp.
uint16_t game_manager::get_internal_height | ( | ) | const |
Definition at line 590 of file game_manager.cpp.
uint16_t game_manager::get_internal_width | ( | ) | const |
Definition at line 583 of file game_manager.cpp.
int16_t game_manager::get_left_stick_horizontal | ( | ) | const |
Definition at line 331 of file game_manager.cpp.
int16_t game_manager::get_left_stick_vertical | ( | ) | const |
Definition at line 338 of file game_manager.cpp.
int16_t game_manager::get_left_trigger | ( | ) | const |
Definition at line 317 of file game_manager.cpp.
ST::level * game_manager::get_level | ( | ) | const |
Definition at line 429 of file game_manager.cpp.
int32_t game_manager::get_mouse_x | ( | ) | const |
Get the current mouse X position.
Definition at line 446 of file game_manager.cpp.
int32_t game_manager::get_mouse_y | ( | ) | const |
Get the current mouse Y position.
Definition at line 454 of file game_manager.cpp.
int16_t game_manager::get_right_stick_horizontal | ( | ) | const |
Definition at line 352 of file game_manager.cpp.
int16_t game_manager::get_right_stick_vertical | ( | ) | const |
Definition at line 345 of file game_manager.cpp.
int16_t game_manager::get_right_trigger | ( | ) | const |
Definition at line 324 of file game_manager.cpp.
uint16_t game_manager::get_window_height | ( | ) | const |
Definition at line 576 of file game_manager.cpp.
uint16_t game_manager::get_window_width | ( | ) | const |
Definition at line 569 of file game_manager.cpp.
bool game_manager::key_held | ( | uint16_t | arg | ) | const |
Tells if a key corresponding to a certain action has been held.
arg | A hash of the name of the action. |
Definition at line 477 of file game_manager.cpp.
bool game_manager::key_pressed | ( | uint16_t | arg | ) | const |
Tells if a key corresponding to a certain action has been pressed.
arg | A hash of the name of the action. |
Definition at line 463 of file game_manager.cpp.
bool game_manager::key_released | ( | uint16_t | arg | ) | const |
Tells if a key corresponding to a certain action has been released.
arg | A hash of the name of the action. |
Definition at line 491 of file game_manager.cpp.
void game_manager::update | ( | ) |
Listens to messages and runs one iteration of loop.lua for the specific level.
Definition at line 406 of file game_manager.cpp.