Symphony Of Empires
Eng3D::State Class Reference

#include <state.hpp>

Inheritance diagram for Eng3D::State:
Collaboration diagram for Eng3D::State:

Public Member Functions

 State (const std::vector< std::string > &pkg_paths)
 
 ~State ()
 
void init_window (void)
 
void clear () const
 
void reload_shaders ()
 
void swap ()
 
void do_event ()
 
void set_multisamples (int samples) const
 
void do_run (std::function< bool(void)> cond, std::function< void(void)> event, std::function< void(void)> render)
 Perform the main game loop. More...
 
virtual void handle_resize ()
 
virtual void handle_mouse_btn (const Eng3D::Event::MouseButton &e)
 
virtual void handle_mouse_motion (const Eng3D::Event::MouseMotion &e)
 
virtual void handle_mouse_wheel (const Eng3D::Event::MouseWheel &e)
 
virtual void handle_key (const Eng3D::Event::Key &e)
 

Static Public Member Functions

static Stateget_instance ()
 

Public Attributes

int map_movement_axis_num = 0
 Number of the axis assigned to map movement. More...
 
int cursor_movement_axis_num = 1
 Number of the axis assigned to cursor movement. More...
 
int zoomin_button_num = 10
 Button for zooming in. More...
 
int zoomout_button_num = 11
 
int left_button_num = 12
 
int up_button_num = 13
 
int right_button_num = 14
 
int down_button_num = 15
 
int select_button_num = 0
 
int back_button_num = 1
 
int map_select_button_num = 2
 
int map_back_button_num = 3
 
std::atomic< bool > run
 Variable telling if the game should quit, honored by most event loops but should be used explicitly if possible. More...
 
bool show_ui = true
 
std::chrono::system_clock::time_point current_frame_time
 
float delta_time
 
SDL_Window * window
 
Eng3D::StringManager string_man
 
Eng3D::Installer installer
 
Eng3D::IO::PackageManager package_man
 
Eng3D::AudioManager audio_man
 
Eng3D::TextureManager tex_man
 
Eng3D::MaterialManager material_man
 
Eng3D::ModelManager model_man
 
Eng3D::TrueType::Manager ttf_man
 
UI::Context ui_ctx
 

Static Public Attributes

constexpr static auto JOYSTICK_DEAD_ZONE = 3000
 Value to ignore x/y axis motion taps (useful ignoring stray joystick input) More...
 

Detailed Description

Definition at line 60 of file state.hpp.

Constructor & Destructor Documentation

◆ State()

Eng3D::State::State ( const std::vector< std::string > &  pkg_paths)

Definition at line 318 of file state.cpp.

Here is the call graph for this function:

◆ ~State()

Eng3D::State::~State ( )

Definition at line 361 of file state.cpp.

Member Function Documentation

◆ clear()

void Eng3D::State::clear ( ) const
Todo:
RGX clear function

Definition at line 401 of file state.cpp.

Here is the caller graph for this function:

◆ do_event()

void Eng3D::State::do_event ( )

Definition at line 427 of file state.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_run()

void Eng3D::State::do_run ( std::function< bool(void)>  cond,
std::function< void(void)>  event,
std::function< void(void)>  render 
)

Perform the main game loop.

Parameters
CondFnCondition that is evaluated and checked, if it is not true then stop execution
EventFnFunction to handle events
RenderFnFunction to handle the rendering of the game

Definition at line 522 of file state.cpp.

Here is the caller graph for this function:

◆ get_instance()

Eng3D::State & Eng3D::State::get_instance ( )
static

Definition at line 514 of file state.cpp.

Here is the caller graph for this function:

◆ handle_key()

void Eng3D::State::handle_key ( const Eng3D::Event::Key e)
virtual

Reimplemented in GameState, GameState, and GameState.

Definition at line 575 of file state.cpp.

◆ handle_mouse_btn()

void Eng3D::State::handle_mouse_btn ( const Eng3D::Event::MouseButton e)
virtual

Reimplemented in GameState.

Definition at line 541 of file state.cpp.

◆ handle_mouse_motion()

void Eng3D::State::handle_mouse_motion ( const Eng3D::Event::MouseMotion e)
virtual

Reimplemented in GameState.

Definition at line 560 of file state.cpp.

◆ handle_mouse_wheel()

void Eng3D::State::handle_mouse_wheel ( const Eng3D::Event::MouseWheel e)
virtual

Reimplemented in GameState.

Definition at line 568 of file state.cpp.

◆ handle_resize()

void Eng3D::State::handle_resize ( )
virtual

Reimplemented in GameState.

Definition at line 537 of file state.cpp.

◆ init_window()

void Eng3D::State::init_window ( void  )

◆ reload_shaders()

void Eng3D::State::reload_shaders ( )

Definition at line 365 of file state.cpp.

Here is the caller graph for this function:

◆ set_multisamples()

void Eng3D::State::set_multisamples ( int  samples) const

Definition at line 507 of file state.cpp.

◆ swap()

void Eng3D::State::swap ( )

Definition at line 413 of file state.cpp.

Member Data Documentation

◆ audio_man

Eng3D::AudioManager Eng3D::State::audio_man

Definition at line 123 of file state.hpp.

◆ back_button_num

int Eng3D::State::back_button_num = 1

Definition at line 95 of file state.hpp.

◆ current_frame_time

std::chrono::system_clock::time_point Eng3D::State::current_frame_time

Definition at line 103 of file state.hpp.

◆ cursor_movement_axis_num

int Eng3D::State::cursor_movement_axis_num = 1

Number of the axis assigned to cursor movement.

Definition at line 86 of file state.hpp.

◆ delta_time

float Eng3D::State::delta_time

Definition at line 104 of file state.hpp.

◆ down_button_num

int Eng3D::State::down_button_num = 15

Definition at line 93 of file state.hpp.

◆ installer

Eng3D::Installer Eng3D::State::installer

Definition at line 121 of file state.hpp.

◆ JOYSTICK_DEAD_ZONE

constexpr static auto Eng3D::State::JOYSTICK_DEAD_ZONE = 3000
staticconstexpr

Value to ignore x/y axis motion taps (useful ignoring stray joystick input)

Definition at line 75 of file state.hpp.

◆ left_button_num

int Eng3D::State::left_button_num = 12

Definition at line 90 of file state.hpp.

◆ map_back_button_num

int Eng3D::State::map_back_button_num = 3

Definition at line 97 of file state.hpp.

◆ map_movement_axis_num

int Eng3D::State::map_movement_axis_num = 0

Number of the axis assigned to map movement.

Definition at line 84 of file state.hpp.

◆ map_select_button_num

int Eng3D::State::map_select_button_num = 2

Definition at line 96 of file state.hpp.

◆ material_man

Eng3D::MaterialManager Eng3D::State::material_man

Definition at line 125 of file state.hpp.

◆ model_man

Eng3D::ModelManager Eng3D::State::model_man

Definition at line 126 of file state.hpp.

◆ package_man

Eng3D::IO::PackageManager Eng3D::State::package_man

Definition at line 122 of file state.hpp.

◆ right_button_num

int Eng3D::State::right_button_num = 14

Definition at line 92 of file state.hpp.

◆ run

std::atomic<bool> Eng3D::State::run

Variable telling if the game should quit, honored by most event loops but should be used explicitly if possible.

Definition at line 101 of file state.hpp.

◆ select_button_num

int Eng3D::State::select_button_num = 0

Definition at line 94 of file state.hpp.

◆ show_ui

bool Eng3D::State::show_ui = true

Definition at line 102 of file state.hpp.

◆ string_man

Eng3D::StringManager Eng3D::State::string_man

Definition at line 120 of file state.hpp.

◆ tex_man

Eng3D::TextureManager Eng3D::State::tex_man

Definition at line 124 of file state.hpp.

◆ ttf_man

Eng3D::TrueType::Manager Eng3D::State::ttf_man

Definition at line 127 of file state.hpp.

◆ ui_ctx

UI::Context Eng3D::State::ui_ctx

Definition at line 128 of file state.hpp.

◆ up_button_num

int Eng3D::State::up_button_num = 13

Definition at line 91 of file state.hpp.

◆ window

SDL_Window* Eng3D::State::window

Definition at line 107 of file state.hpp.

◆ zoomin_button_num

int Eng3D::State::zoomin_button_num = 10

Button for zooming in.

Definition at line 88 of file state.hpp.

◆ zoomout_button_num

int Eng3D::State::zoomout_button_num = 11

Definition at line 89 of file state.hpp.


The documentation for this class was generated from the following files: