Project Alice
Loading...
Searching...
No Matches
map::map_state Class Reference

#include <map_state.hpp>

Collaboration diagram for map::map_state:

Public Member Functions

 map_state ()
 
void load_map_data (parsers::scenario_building_context &context)
 
void load_map (sys::state &state)
 
map_view current_view (sys::state &state)
 
void render (sys::state &state, uint32_t screen_x, uint32_t screen_y)
 
void set_province_color (std::vector< uint32_t > const &prov_color, map_mode::mode map_mode)
 
void set_terrain_map_mode ()
 
void update_borders (sys::state &state)
 
glm::vec2 normalize_map_coord (glm::vec2 pos)
 
bool map_to_screen (sys::state &state, glm::vec2 map_pos, glm::vec2 screen_size, glm::vec2 &screen_pos)
 
void set_pos (glm::vec2 pos)
 
void center_map_on_province (sys::state &state, dcon::province_id)
 
void on_key_down (sys::virtual_key keycode, sys::key_modifiers mod)
 
void on_key_up (sys::virtual_key keycode, sys::key_modifiers mod)
 
void on_mouse_wheel (int32_t x, int32_t y, int32_t screen_size_x, int32_t screen_size_y, sys::key_modifiers mod, float amount)
 
void on_mouse_move (int32_t x, int32_t y, int32_t screen_size_x, int32_t screen_size_y, sys::key_modifiers mod)
 
void on_mbuttom_down (int32_t x, int32_t y, int32_t screen_size_x, int32_t screen_size_y, sys::key_modifiers mod)
 
void on_mbuttom_up (int32_t x, int32_t y, sys::key_modifiers mod)
 
void on_lbutton_down (sys::state &state, int32_t x, int32_t y, int32_t screen_size_x, int32_t screen_size_y, sys::key_modifiers mod)
 
void on_lbutton_up (sys::state &state, int32_t x, int32_t y, int32_t screen_size_x, int32_t screen_size_y, sys::key_modifiers mod)
 
void on_rbutton_down (sys::state &state, int32_t x, int32_t y, int32_t screen_size_x, int32_t screen_size_y, sys::key_modifiers mod)
 
dcon::province_id get_province_under_mouse (sys::state &state, int32_t x, int32_t y, int32_t screen_size_x, int32_t screen_size_y)
 
dcon::province_id get_selected_province ()
 
void set_selected_province (dcon::province_id prov_id)
 
void update (sys::state &state)
 
bool screen_to_map (glm::vec2 screen_pos, glm::vec2 screen_size, map_view view_mode, glm::vec2 &map_pos)
 
float get_zoom ()
 

Public Attributes

map_mode::mode active_map_mode = map_mode::mode::terrain
 
dcon::province_id selected_province = dcon::province_id{}
 
display_data map_data
 
bool is_dragging = false
 
std::chrono::time_point< std::chrono::steady_clock > last_update_time {}
 
float time_counter = 0
 
bool unhandled_province_selection = false
 
glm::vec2 pos = glm::vec2(0.5f, 0.5f)
 
glm::vec2 pos_velocity = glm::vec2(0.f)
 
glm::vec2 last_camera_drag_pos = glm::vec2(0.5f, 0.5f)
 
glm::mat4 globe_rotation = glm::mat4(1.0f)
 
glm::vec2 last_unit_box_drag_pos = glm::vec2(0, 0)
 
float zoom = 1.f
 
float zoom_change = 1.f
 
bool has_zoom_changed = false
 
bool pgup_key_down = false
 
bool pgdn_key_down = false
 
bool left_arrow_key_down = false
 
bool right_arrow_key_down = false
 
bool up_arrow_key_down = false
 
bool down_arrow_key_down = false
 
bool shift_key_down = false
 
bool left_mouse_down = false
 
glm::vec2 scroll_pos_velocity = glm::vec2(0.f)
 
std::vector< bool > visible_provinces
 

Detailed Description

Definition at line 18 of file map_state.hpp.

Constructor & Destructor Documentation

◆ map_state()

map::map_state::map_state ( )
inline

Definition at line 20 of file map_state.hpp.

Member Function Documentation

◆ center_map_on_province()

void map::map_state::center_map_on_province ( sys::state state,
dcon::province_id  p 
)

Definition at line 1189 of file map_state.cpp.

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

◆ current_view()

map_view map::map_state::current_view ( sys::state state)

Definition at line 27 of file map_state.cpp.

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

◆ get_province_under_mouse()

dcon::province_id map::map_state::get_province_under_mouse ( sys::state state,
int32_t  x,
int32_t  y,
int32_t  screen_size_x,
int32_t  screen_size_y 
)

Definition at line 1380 of file map_state.cpp.

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

◆ get_selected_province()

dcon::province_id map::map_state::get_selected_province ( )

Definition at line 18 of file map_state.cpp.

◆ get_zoom()

float map::map_state::get_zoom ( )
inline

Definition at line 97 of file map_state.hpp.

Here is the caller graph for this function:

◆ load_map()

void map::map_state::load_map ( sys::state state)

Definition at line 23 of file map_state.cpp.

Here is the call graph for this function:

◆ load_map_data()

void map::map_state::load_map_data ( parsers::scenario_building_context context)

Definition at line 520 of file map_data_loading.cpp.

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

◆ map_to_screen()

bool map::map_state::map_to_screen ( sys::state state,
glm::vec2  map_pos,
glm::vec2  screen_size,
glm::vec2 &  screen_pos 
)

Definition at line 1401 of file map_state.cpp.

Here is the caller graph for this function:

◆ normalize_map_coord()

glm::vec2 map::map_state::normalize_map_coord ( glm::vec2  pos)

Definition at line 1560 of file map_state.cpp.

Here is the caller graph for this function:

◆ on_key_down()

void map::map_state::on_key_down ( sys::virtual_key  keycode,
sys::key_modifiers  mod 
)

Definition at line 1128 of file map_state.cpp.

Here is the caller graph for this function:

◆ on_key_up()

void map::map_state::on_key_up ( sys::virtual_key  keycode,
sys::key_modifiers  mod 
)

Definition at line 1156 of file map_state.cpp.

Here is the caller graph for this function:

◆ on_lbutton_down()

void map::map_state::on_lbutton_down ( sys::state state,
int32_t  x,
int32_t  y,
int32_t  screen_size_x,
int32_t  screen_size_y,
sys::key_modifiers  mod 
)

Definition at line 1326 of file map_state.cpp.

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

◆ on_lbutton_up()

void map::map_state::on_lbutton_up ( sys::state state,
int32_t  x,
int32_t  y,
int32_t  screen_size_x,
int32_t  screen_size_y,
sys::key_modifiers  mod 
)

Definition at line 1333 of file map_state.cpp.

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

◆ on_mbuttom_down()

void map::map_state::on_mbuttom_down ( int32_t  x,
int32_t  y,
int32_t  screen_size_x,
int32_t  screen_size_y,
sys::key_modifiers  mod 
)

Definition at line 1310 of file map_state.cpp.

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

◆ on_mbuttom_up()

void map::map_state::on_mbuttom_up ( int32_t  x,
int32_t  y,
sys::key_modifiers  mod 
)

Definition at line 1322 of file map_state.cpp.

Here is the caller graph for this function:

◆ on_mouse_move()

void map::map_state::on_mouse_move ( int32_t  x,
int32_t  y,
int32_t  screen_size_x,
int32_t  screen_size_y,
sys::key_modifiers  mod 
)

Definition at line 1207 of file map_state.cpp.

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

◆ on_mouse_wheel()

void map::map_state::on_mouse_wheel ( int32_t  x,
int32_t  y,
int32_t  screen_size_x,
int32_t  screen_size_y,
sys::key_modifiers  mod,
float  amount 
)

Definition at line 1200 of file map_state.cpp.

Here is the caller graph for this function:

◆ on_rbutton_down()

void map::map_state::on_rbutton_down ( sys::state state,
int32_t  x,
int32_t  y,
int32_t  screen_size_x,
int32_t  screen_size_y,
sys::key_modifiers  mod 
)

Definition at line 1363 of file map_state.cpp.

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

◆ render()

void map::map_state::render ( sys::state state,
uint32_t  screen_x,
uint32_t  screen_y 
)

Definition at line 42 of file map_state.cpp.

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

◆ screen_to_map()

bool map::map_state::screen_to_map ( glm::vec2  screen_pos,
glm::vec2  screen_size,
map_view  view_mode,
glm::vec2 &  map_pos 
)

Definition at line 1229 of file map_state.cpp.

Here is the caller graph for this function:

◆ set_pos()

void map::map_state::set_pos ( glm::vec2  pos)

Definition at line 1184 of file map_state.cpp.

Here is the caller graph for this function:

◆ set_province_color()

void map::map_state::set_province_color ( std::vector< uint32_t > const &  prov_color,
map_mode::mode  map_mode 
)

Definition at line 1119 of file map_state.cpp.

Here is the call graph for this function:

◆ set_selected_province()

void map::map_state::set_selected_province ( dcon::province_id  prov_id)

Definition at line 37 of file map_state.cpp.

Here is the caller graph for this function:

◆ set_terrain_map_mode()

void map::map_state::set_terrain_map_mode ( )

Definition at line 1124 of file map_state.cpp.

◆ update()

void map::map_state::update ( sys::state state)

Definition at line 965 of file map_state.cpp.

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

◆ update_borders()

void map::map_state::update_borders ( sys::state state)

Member Data Documentation

◆ active_map_mode

map_mode::mode map::map_state::active_map_mode = map_mode::mode::terrain

Definition at line 57 of file map_state.hpp.

◆ down_arrow_key_down

bool map::map_state::down_arrow_key_down = false

Definition at line 87 of file map_state.hpp.

◆ globe_rotation

glm::mat4 map::map_state::globe_rotation = glm::mat4(1.0f)

Definition at line 76 of file map_state.hpp.

◆ has_zoom_changed

bool map::map_state::has_zoom_changed = false

Definition at line 81 of file map_state.hpp.

◆ is_dragging

bool map::map_state::is_dragging = false

Definition at line 61 of file map_state.hpp.

◆ last_camera_drag_pos

glm::vec2 map::map_state::last_camera_drag_pos = glm::vec2(0.5f, 0.5f)

Definition at line 75 of file map_state.hpp.

◆ last_unit_box_drag_pos

glm::vec2 map::map_state::last_unit_box_drag_pos = glm::vec2(0, 0)

Definition at line 77 of file map_state.hpp.

◆ last_update_time

std::chrono::time_point<std::chrono::steady_clock> map::map_state::last_update_time {}

Definition at line 64 of file map_state.hpp.

◆ left_arrow_key_down

bool map::map_state::left_arrow_key_down = false

Definition at line 84 of file map_state.hpp.

◆ left_mouse_down

bool map::map_state::left_mouse_down = false

Definition at line 89 of file map_state.hpp.

◆ map_data

display_data map::map_state::map_data

Definition at line 60 of file map_state.hpp.

◆ pgdn_key_down

bool map::map_state::pgdn_key_down = false

Definition at line 83 of file map_state.hpp.

◆ pgup_key_down

bool map::map_state::pgup_key_down = false

Definition at line 82 of file map_state.hpp.

◆ pos

glm::vec2 map::map_state::pos = glm::vec2(0.5f, 0.5f)

Definition at line 73 of file map_state.hpp.

◆ pos_velocity

glm::vec2 map::map_state::pos_velocity = glm::vec2(0.f)

Definition at line 74 of file map_state.hpp.

◆ right_arrow_key_down

bool map::map_state::right_arrow_key_down = false

Definition at line 85 of file map_state.hpp.

◆ scroll_pos_velocity

glm::vec2 map::map_state::scroll_pos_velocity = glm::vec2(0.f)

Definition at line 90 of file map_state.hpp.

◆ selected_province

dcon::province_id map::map_state::selected_province = dcon::province_id{}

Definition at line 58 of file map_state.hpp.

◆ shift_key_down

bool map::map_state::shift_key_down = false

Definition at line 88 of file map_state.hpp.

◆ time_counter

float map::map_state::time_counter = 0

Definition at line 67 of file map_state.hpp.

◆ unhandled_province_selection

bool map::map_state::unhandled_province_selection = false

Definition at line 70 of file map_state.hpp.

◆ up_arrow_key_down

bool map::map_state::up_arrow_key_down = false

Definition at line 86 of file map_state.hpp.

◆ visible_provinces

std::vector<bool> map::map_state::visible_provinces

Definition at line 91 of file map_state.hpp.

◆ zoom

float map::map_state::zoom = 1.f

Definition at line 79 of file map_state.hpp.

◆ zoom_change

float map::map_state::zoom_change = 1.f

Definition at line 80 of file map_state.hpp.


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