zenilib
0.5.3.0
|
#include <Game.h>
Inherits Zeni::Singleton< Game >.
Classes | |
struct | Controller_Mouse |
Public Member Functions | |
Console_State & | get_console () |
Get a reference to the Console_State. More... | |
Sint16 | get_controller_axis_state (const int &which, const SDL_GameControllerAxis &axis) const |
Get the state of a joystick axis. More... | |
bool | get_controller_button_state (const int &which, const SDL_GameControllerButton &button) const |
Get the state of a joystick button. More... | |
size_t | get_fps () const |
Get the current approximation of the frames displayed per second. More... | |
bool | get_key_state (const int &key) const |
Get the state of a key. More... | |
bool | get_mouse_button_state (const int &button) const |
Get the state of a mouse button. More... | |
Gamestate | get_top () |
Get a reference to the current Gamestate. More... | |
bool | is_console_active () const |
void | on_event (const SDL_Event &event) |
Called in main, calls the function by the same name in the current Gamestate. More... | |
void | perform_logic () |
Called in main, calls the function by the same name in the current Gamestate. More... | |
Gamestate | pop_state () |
Pop a Gamestate off the stack. Pop the current Gamestate with caution. All members will instantly become invalid. More... | |
void | prerender () |
Called in main, calls the function by the same name in the current Gamestate. More... | |
void | push_Popup_Menu_State () |
void | push_Popup_Pause_State () |
void | push_state (const Gamestate &state) |
Push a new Gamestate onto the stack. More... | |
void | render () |
Called in main, calls the function by the same name in the current Gamestate. More... | |
void | replace_Popup_Menu_State_Factory (Popup_Menu_State_Factory *const popup_menu_state_factory) |
void | replace_Popup_Pause_State_Factory (Popup_Pause_State_Factory *const popup_pause_state_factory) |
void | run () |
size_t | size () const |
Get the current size of the Gamestate stack. More... | |
void | write_to_console (const String &text) |
Write text to the console when in Debug mode. More... | |
Public Member Functions inherited from Zeni::Singleton< Game > | |
void | fax_post_reinit (Event::Handler *const &handler) |
void | fax_pre_uninit (Event::Handler *const &handler) |
void | give_post_reinit (Event::Handler *const &handler) |
void | give_pre_uninit (Event::Handler *const &handler) |
void | lend_post_reinit (Event::Handler *const &handler) |
void | lend_pre_uninit (Event::Handler *const &handler) |
Public Attributes | |
struct Zeni::Game::Controller_Mouse | controller_mouse |
Friends | |
class | Singleton< Game > |
Additional Inherited Members | |
Static Public Member Functions inherited from Zeni::Singleton< Game > | |
static void | completely_destroy () |
static void | destroy () |
static Game & | get () |
static bool | is_initialized () |
static void | remove_post_reinit (Event::Handler *const &handler) |
static void | remove_pre_uninit (Event::Handler *const &handler) |
Protected Member Functions inherited from Zeni::Singleton< Game > | |
Singleton () | |
virtual | ~Singleton () |
The Gamestate Stack.
This singleton is a stack of Gamestates. The main function continually refers to the Game singleton to get the current Gamestate.
Contact: bazal d@ze nipex .com
Console_State & Zeni::Game::get_console | ( | ) |
Get a reference to the Console_State.
Sint16 Zeni::Game::get_controller_axis_state | ( | const int & | which, |
const SDL_GameControllerAxis & | axis | ||
) | const |
bool Zeni::Game::get_controller_button_state | ( | const int & | which, |
const SDL_GameControllerButton & | button | ||
) | const |
Get the state of a joystick button.
Definition at line 313 of file Game.cpp.
Referenced by Zeni::Gamestate_II::fire_missed_events().
|
inline |
Get the state of a key.
Definition at line 287 of file Game.cpp.
Referenced by Zeni::Gamestate_II::fire_missed_events(), Zeni::Text_Box::on_key(), and Zeni::Gamestate_Base::to_char().
Get the state of a mouse button.
Definition at line 294 of file Game.cpp.
Referenced by Zeni::Gamestate_II::fire_missed_events().
|
inline |
Called in main, calls the function by the same name in the current Gamestate.
Definition at line 123 of file Game.cpp.
References SDL_ControllerAxisEvent::axis, SDL_MouseButtonEvent::button, SDL_ControllerButtonEvent::button, SDL_Event::button, SDL_Event::caxis, SDL_Event::cbutton, SDL_Event::cdevice, Zeni::Controllers::device_added(), Zeni::Controllers::get_controller_index(), Zeni::get_Controllers(), SDL_Event::key, SDL_KeyboardEvent::keysym, memcpy, Zeni::Gamestate::on_event(), SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERBUTTONDOWN, SDL_CONTROLLERBUTTONUP, SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, SDL_KEYDOWN, SDL_KEYUP, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, SDL_Keysym::sym, SDL_Event::type, SDL_ControllerAxisEvent::value, SDL_ControllerAxisEvent::which, SDL_ControllerButtonEvent::which, and SDL_ControllerDeviceEvent::which.
void Zeni::Game::perform_logic | ( | ) |
Called in main, calls the function by the same name in the current Gamestate.
Definition at line 210 of file Game.cpp.
References Zeni::Gamestate::perform_logic().
Gamestate Zeni::Game::pop_state | ( | ) |
Pop a Gamestate off the stack. Pop the current Gamestate with caution. All members will instantly become invalid.
Definition at line 90 of file Game.cpp.
References Zeni::Gamestate::on_pop().
Referenced by Zeni::Popup_Pause_State::on_active(), and Zeni::Popup_State::on_key().
void Zeni::Game::prerender | ( | ) |
Called in main, calls the function by the same name in the current Gamestate.
Definition at line 235 of file Game.cpp.
References Zeni::Gamestate::prerender().
Referenced by engine_draw_frame().
void Zeni::Game::push_Popup_Menu_State | ( | ) |
Definition at line 547 of file Game.cpp.
Referenced by Zeni::Gamestate_II::on_event(), and Zeni::Gamestate_Base::on_key().
void Zeni::Game::push_Popup_Pause_State | ( | ) |
Definition at line 551 of file Game.cpp.
Referenced by Zeni::Gamestate_Base::on_active().
Push a new Gamestate onto the stack.
Definition at line 76 of file Game.cpp.
Referenced by main2(), Zeni::Title_State< PLAY_STATE, INSTRUCTIONS_STATE >::Play_Button::on_accept(), Zeni::Title_State< PLAY_STATE, INSTRUCTIONS_STATE >::Instructions_Button::on_accept(), and Zeni::Popup_Menu_State::Configure_Video_Button::on_accept().
void Zeni::Game::render | ( | ) |
Called in main, calls the function by the same name in the current Gamestate.
Definition at line 260 of file Game.cpp.
References Zeni::Gamestate::render().
Referenced by engine_draw_frame().
void Zeni::Game::replace_Popup_Menu_State_Factory | ( | Popup_Menu_State_Factory *const | popup_menu_state_factory | ) |
void Zeni::Game::replace_Popup_Pause_State_Factory | ( | Popup_Pause_State_Factory *const | popup_pause_state_factory | ) |
void Zeni::Game::run | ( | ) |
Definition at line 325 of file Game.cpp.
References Zeni::Video::begin_prerender(), Zeni::Video::begin_render(), SDL_MouseButtonEvent::button, SDL_Event::button, SDL_Event::common, destroy(), Zeni::Controllers::detect_removed(), e, Zeni::Video::end_render(), Zeni::Random::frand_lte(), Zeni::get_Controllers(), Zeni::Window::get_height(), Zeni::Time::get_seconds_since(), Zeni::get_Sound(), Zeni::get_Sound_Source_Pool(), Zeni::get_Video(), Zeni::Window::get_width(), Zeni::get_Window(), gui, int, SDL_Event::key, SDL_KeyboardEvent::keysym, max, min, SDL_Keysym::mod, NASTY_MAX_RATE, NASTY_MIN_RATE, NASTY_RATE_CUTOFF, NASTY_ZERO_STEP_FREQUENCY, Zeni::Random::rand_lt(), Zeni::render(), SDL_Keysym::scancode, SDL_BUTTON_LEFT, SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERBUTTONDOWN, SDL_CONTROLLERBUTTONUP, SDL_GetModState(), SDL_GetMouseState(), SDL_GetWindowID(), SDL_KEYDOWN, SDL_KEYUP, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, SDL_MOUSEWHEEL, SDL_PollEvent(), SDL_QUIT, SDL_SCANCODE_ESCAPE, SDL_WarpMouseInWindow(), SDL_WINDOWEVENT, SDL_WINDOWEVENT_CLOSE, SDLK_BACKQUOTE, SDLK_ESCAPE, SDLK_F4, SDLK_LALT, SDLK_LCTRL, SDLK_LGUI, SDLK_LSHIFT, SDLK_q, SDLK_RALT, SDLK_RCTRL, SDLK_RGUI, SDLK_RSHIFT, SDL_KeyboardEvent::state, SDL_MouseButtonEvent::state, SDL_Keysym::sym, SDL_CommonEvent::timestamp, SDL_CommonEvent::type, u, Zeni::Sound::update(), Zeni::Sound_Source_Pool::update(), SDL_Event::wheel, SDL_MouseButtonEvent::which, SDL_MouseWheelEvent::which, SDL_MouseWheelEvent::windowID, Zeni::Point2f::x, SDL_MouseButtonEvent::x, SDL_MouseWheelEvent::x, Zeni::Point2f::y, SDL_MouseButtonEvent::y, and SDL_MouseWheelEvent::y.
Referenced by main2().
|
inline |
Write text to the console when in Debug mode.
Definition at line 69 of file Game.cpp.
References Zeni::Console_State::write_to_log().
struct Zeni::Game::Controller_Mouse Zeni::Game::controller_mouse |