Symphony Of Empires
GameState Struct Reference

#include <game_state.hpp>

Inheritance diagram for GameState:
Collaboration diagram for GameState:

Public Member Functions

 GameState (const std::vector< std::string > &pkg_paths)
 
 ~GameState ()=default
 
void play_nation ()
 
void update_on_tick ()
 
void world_thread ()
 
void music_enqueue ()
 
void load_world_thread ()
 
void handle_resize () override
 
void handle_mouse_btn (const Eng3D::Event::MouseButton &) override
 
void handle_mouse_motion (const Eng3D::Event::MouseMotion &) override
 
void handle_mouse_wheel (const Eng3D::Event::MouseWheel &) override
 
void handle_key (const Eng3D::Event::Key &) override
 
std::shared_ptr< Eng3D::Textureget_nation_flag (const Nation &nation)
 
 GameState (const std::vector< std::string > &pkg_paths)
 
 ~GameState ()=default
 
 GameState (const std::vector< std::string > &pkg_paths)
 
 ~GameState ()=default
 
void handle_key (const Eng3D::Event::Key &e) override
 
 GameState (const std::vector< std::string > &pkg_paths)
 
 ~GameState ()=default
 
void handle_key (const Eng3D::Event::Key &e) override
 
- Public Member Functions inherited from Eng3D::State
 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...
 

Public Attributes

std::unique_ptr< Clientclient
 
std::unique_ptr< Serverserver
 
std::atomic< bool > loaded_world
 
std::atomic< bool > loaded_map
 
float load_progress = 0.f
 
std::atomic< bool > update_tick
 
std::atomic< bool > paused
 
std::atomic< int > ms_delay_speed
 
std::atomic< bool > quit
 
Worldworld = nullptr
 
Nationcurr_nation = nullptr
 
std::unique_ptr< Mapmap
 
Input input
 
ClientState client_state
 
MapMode current_mode = MapMode::NO_MAP
 
Interface::LobbySelectViewselect_nation = nullptr
 
UI::Widgettop_win = nullptr
 
UI::Widgettime_win = nullptr
 
UI::Widgetminimap = nullptr
 
UI::Widgetprofiler_view = nullptr
 
UI::Widgetevent_tray_grp = nullptr
 
UI::Widgetunit_menu = nullptr
 
std::vector< std::shared_ptr< Eng3D::Texture > > nation_flags
 
std::mutex render_lock
 
std::vector< UnitTypeIdproduction_queue
 
UI::Widgetright_side_panel = nullptr
 
UI::Widgetlower_left_panel = nullptr
 
std::string ip_address = "127.0.0.1"
 
bool in_game = false
 
bool motion_blur = true
 
bool host_mode = false
 
bool editor = false
 
bool sea_paint = false
 
bool singleplayer = true
 
std::vector< Eng3D::StringRefdecision_autodo
 
Eng3D::Interface::ProfilerViewprofiler_view = nullptr
 
Eng3D::Profiler profiler
 
- Public Attributes inherited from Eng3D::State
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
 

Additional Inherited Members

- Static Public Member Functions inherited from Eng3D::State
static Stateget_instance ()
 
- Static Public Attributes inherited from Eng3D::State
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 127 of file game_state.hpp.

Constructor & Destructor Documentation

◆ GameState() [1/4]

GameState::GameState ( const std::vector< std::string > &  pkg_paths)
inline

Definition at line 129 of file game_state.hpp.

◆ ~GameState() [1/4]

GameState::~GameState ( )
default

◆ GameState() [2/4]

GameState::GameState ( const std::vector< std::string > &  pkg_paths)
inline

Definition at line 36 of file archive.cpp.

◆ ~GameState() [2/4]

GameState::~GameState ( )
default

◆ GameState() [3/4]

GameState::GameState ( const std::vector< std::string > &  pkg_paths)
inline

Definition at line 37 of file pyscript.cpp.

◆ ~GameState() [3/4]

GameState::~GameState ( )
default

◆ GameState() [4/4]

GameState::GameState ( const std::vector< std::string > &  pkg_paths)
inline

Definition at line 36 of file triangle.cpp.

◆ ~GameState() [4/4]

GameState::~GameState ( )
default

Member Function Documentation

◆ get_nation_flag()

std::shared_ptr< Eng3D::Texture > GameState::get_nation_flag ( const Nation nation)

Definition at line 84 of file game_state.cpp.

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

◆ handle_key() [1/3]

void GameState::handle_key ( const Eng3D::Event::Key e)
overridevirtual

Reimplemented from Eng3D::State.

Definition at line 244 of file game_state.cpp.

Here is the call graph for this function:

◆ handle_key() [2/3]

void GameState::handle_key ( const Eng3D::Event::Key e)
inlineoverridevirtual

Reimplemented from Eng3D::State.

Definition at line 47 of file pyscript.cpp.

Here is the call graph for this function:

◆ handle_key() [3/3]

void GameState::handle_key ( const Eng3D::Event::Key e)
inlineoverridevirtual

Reimplemented from Eng3D::State.

Definition at line 46 of file triangle.cpp.

Here is the call graph for this function:

◆ handle_mouse_btn()

void GameState::handle_mouse_btn ( const Eng3D::Event::MouseButton e)
overridevirtual

Reimplemented from Eng3D::State.

Definition at line 184 of file game_state.cpp.

Here is the call graph for this function:

◆ handle_mouse_motion()

void GameState::handle_mouse_motion ( const Eng3D::Event::MouseMotion e)
overridevirtual

Reimplemented from Eng3D::State.

Definition at line 222 of file game_state.cpp.

Here is the call graph for this function:

◆ handle_mouse_wheel()

void GameState::handle_mouse_wheel ( const Eng3D::Event::MouseWheel e)
overridevirtual

Reimplemented from Eng3D::State.

Definition at line 234 of file game_state.cpp.

Here is the call graph for this function:

◆ handle_resize()

void GameState::handle_resize ( )
overridevirtual

Reimplemented from Eng3D::State.

Definition at line 180 of file game_state.cpp.

◆ load_world_thread()

void GameState::load_world_thread ( )
Todo:
Events can't be properly reloaded right now :/

Definition at line 168 of file game_state.cpp.

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

◆ music_enqueue()

void GameState::music_enqueue ( )

Definition at line 152 of file game_state.cpp.

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

◆ play_nation()

void GameState::play_nation ( )

Definition at line 65 of file game_state.cpp.

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

◆ update_on_tick()

void GameState::update_on_tick ( )
Todo:
This is inefficient and we should only update when needed

Definition at line 114 of file game_state.cpp.

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

◆ world_thread()

void GameState::world_thread ( )
Todo:
Don't run this thread if not needed (i.e non-host-mode)

Definition at line 125 of file game_state.cpp.

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

Member Data Documentation

◆ client

std::unique_ptr<Client> GameState::client

Definition at line 143 of file game_state.hpp.

◆ client_state

ClientState GameState::client_state

Definition at line 161 of file game_state.hpp.

◆ curr_nation

Nation* GameState::curr_nation = nullptr

Definition at line 158 of file game_state.hpp.

◆ current_mode

MapMode GameState::current_mode = MapMode::NO_MAP

Definition at line 162 of file game_state.hpp.

◆ decision_autodo

std::vector<Eng3D::StringRef> GameState::decision_autodo

Definition at line 190 of file game_state.hpp.

◆ editor

bool GameState::editor = false

Definition at line 186 of file game_state.hpp.

◆ event_tray_grp

UI::Widget* GameState::event_tray_grp = nullptr

Definition at line 169 of file game_state.hpp.

◆ host_mode

bool GameState::host_mode = false

Definition at line 185 of file game_state.hpp.

◆ in_game

bool GameState::in_game = false

Definition at line 183 of file game_state.hpp.

◆ input

Input GameState::input

Definition at line 160 of file game_state.hpp.

◆ ip_address

std::string GameState::ip_address = "127.0.0.1"

Definition at line 182 of file game_state.hpp.

◆ load_progress

float GameState::load_progress = 0.f

Definition at line 148 of file game_state.hpp.

◆ loaded_map

std::atomic<bool> GameState::loaded_map

Definition at line 147 of file game_state.hpp.

◆ loaded_world

std::atomic<bool> GameState::loaded_world

Definition at line 146 of file game_state.hpp.

◆ lower_left_panel

UI::Widget* GameState::lower_left_panel = nullptr

Definition at line 180 of file game_state.hpp.

◆ map

std::unique_ptr<Map> GameState::map

Definition at line 159 of file game_state.hpp.

◆ minimap

UI::Widget* GameState::minimap = nullptr

Definition at line 167 of file game_state.hpp.

◆ motion_blur

bool GameState::motion_blur = true

Definition at line 184 of file game_state.hpp.

◆ ms_delay_speed

std::atomic<int> GameState::ms_delay_speed

Definition at line 152 of file game_state.hpp.

◆ nation_flags

std::vector<std::shared_ptr<Eng3D::Texture> > GameState::nation_flags

Definition at line 172 of file game_state.hpp.

◆ paused

std::atomic<bool> GameState::paused

Definition at line 151 of file game_state.hpp.

◆ production_queue

std::vector<UnitTypeId> GameState::production_queue

Definition at line 177 of file game_state.hpp.

◆ profiler

Eng3D::Profiler GameState::profiler

Definition at line 45 of file pyscript.cpp.

◆ profiler_view [1/2]

Eng3D::Interface::ProfilerView* GameState::profiler_view = nullptr

Definition at line 44 of file pyscript.cpp.

◆ profiler_view [2/2]

Eng3D::Interface::ProfilerView * GameState::profiler_view = nullptr

Definition at line 168 of file game_state.hpp.

◆ quit

std::atomic<bool> GameState::quit

Definition at line 153 of file game_state.hpp.

◆ render_lock

std::mutex GameState::render_lock

Definition at line 176 of file game_state.hpp.

◆ right_side_panel

UI::Widget* GameState::right_side_panel = nullptr

Definition at line 179 of file game_state.hpp.

◆ sea_paint

bool GameState::sea_paint = false

Definition at line 187 of file game_state.hpp.

◆ select_nation

Interface::LobbySelectView* GameState::select_nation = nullptr

Definition at line 164 of file game_state.hpp.

◆ server

std::unique_ptr<Server> GameState::server

Definition at line 144 of file game_state.hpp.

◆ singleplayer

bool GameState::singleplayer = true

Definition at line 188 of file game_state.hpp.

◆ time_win

UI::Widget* GameState::time_win = nullptr

Definition at line 166 of file game_state.hpp.

◆ top_win

UI::Widget* GameState::top_win = nullptr

Definition at line 165 of file game_state.hpp.

◆ unit_menu

UI::Widget* GameState::unit_menu = nullptr

Definition at line 170 of file game_state.hpp.

◆ update_tick

std::atomic<bool> GameState::update_tick

Definition at line 150 of file game_state.hpp.

◆ world

World* GameState::world = nullptr

Definition at line 156 of file game_state.hpp.


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