10 auto new_mm = make_element_by_type<restricted_main_menu_window>(
state,
"alice_main_menu");
21 auto new_mm = make_element_by_type<main_menu_window>(
state,
"alice_main_menu");
23 state.ui_state.
root->add_child_to_front(std::move(new_mm));
47 disabled = (scale_index == 0);
65 auto scale_index =
uint8_t(
state.user_settings.autosaves);
72 auto scale_index =
uint8_t(
state.user_settings.autosaves);
73 disabled = (scale_index == 0);
76 auto scale_index =
uint8_t(
state.user_settings.autosaves);
83 auto scale_index =
uint8_t(
state.user_settings.autosaves);
84 disabled = (scale_index >= 3);
87 switch(
state.user_settings.autosaves) {
101 set_text(
state,
"???");
108 dcon::locale_id new_locale;
109 if(
state.world.locale_get_native_rtl(
state.font_collection.get_current_locale()) ==
false) {
110 int32_t i =
state.font_collection.get_current_locale().index() - 1;
112 i = int32_t(
state.world.locale_size()) - 1;
114 new_locale = dcon::locale_id{ dcon::locale_id::value_base_t(i) };
116 int32_t i =
state.font_collection.get_current_locale().index() + 1;
117 if(i >= int32_t(
state.world.locale_size())) {
120 new_locale = dcon::locale_id{ dcon::locale_id::value_base_t(i) };
123 if(
state.user_settings.use_classic_fonts
124 &&
state.world.locale_get_hb_script(new_locale) != HB_SCRIPT_LATIN) {
125 state.user_settings.use_classic_fonts =
false;
126 state.font_collection.set_classic_fonts(
state.user_settings.use_classic_fonts);
130 auto length = std::min(
state.world.locale_get_locale_name(new_locale).size(),
uint32_t(15));
131 std::memcpy(
state.user_settings.locale,
state.world.locale_get_locale_name(new_locale).begin(), length);
132 state.user_settings.locale[length] = 0;
133 state.font_collection.change_locale(
state, new_locale);
148 state.province_ownership_changed.store(
true, std::memory_order::release);
149 state.game_state_updated.store(
true, std::memory_order::release);
159 dcon::locale_id new_locale;
160 if(
state.world.locale_get_native_rtl(
state.font_collection.get_current_locale()) ==
false) {
161 int32_t i =
state.font_collection.get_current_locale().index() + 1;
162 if(i >= int32_t(
state.world.locale_size())) {
165 new_locale = dcon::locale_id{ dcon::locale_id::value_base_t(i) };
167 int32_t i =
state.font_collection.get_current_locale().index() - 1;
169 i = int32_t(
state.world.locale_size()) - 1;
171 new_locale = dcon::locale_id{ dcon::locale_id::value_base_t(i) };
174 if(
state.user_settings.use_classic_fonts
175 &&
state.world.locale_get_hb_script(new_locale) != HB_SCRIPT_LATIN) {
176 state.user_settings.use_classic_fonts =
false;
177 state.font_collection.set_classic_fonts(
state.user_settings.use_classic_fonts);
180 auto length = std::min(
state.world.locale_get_locale_name(new_locale).size(),
uint32_t(15));
181 std::memcpy(
state.user_settings.locale,
state.world.locale_get_locale_name(new_locale).begin(), length);
182 state.user_settings.locale[length] = 0;
183 state.font_collection.change_locale(
state, new_locale);
198 state.province_ownership_changed.store(
true, std::memory_order::release);
199 state.game_state_updated.store(
true, std::memory_order::release);
208 auto ln =
state.world.locale_get_display_name(
state.font_collection.get_current_locale());
209 auto ln_sv = std::string_view{ (
char const*)ln.begin(), ln.size() };
210 set_text(state, std::string{ ln_sv });
214 auto scale_index =
uint8_t(
state.user_settings.zoom_mode);
215 if(scale_index > 0) {
221 auto scale_index =
uint8_t(
state.user_settings.zoom_mode);
222 disabled = (scale_index == 0);
225 auto scale_index =
uint8_t(
state.user_settings.zoom_mode);
226 if(scale_index < 4) {
232 auto scale_index =
uint8_t(
state.user_settings.zoom_mode);
233 disabled = (scale_index >= 4);
236 switch(
state.user_settings.zoom_mode) {
253 set_text(
state,
"???");
258 state.user_settings.mouse_edge_scrolling = !
state.user_settings.mouse_edge_scrolling;
262 return state.user_settings.mouse_edge_scrolling;
265 state.user_settings.bind_tooltip_mouse = !
state.user_settings.bind_tooltip_mouse;
269 return state.user_settings.bind_tooltip_mouse;
272 state.user_settings.spoilers = !
state.user_settings.spoilers;
276 return state.user_settings.spoilers;
279 state.user_settings.wasd_for_map_movement = !
state.user_settings.wasd_for_map_movement;
283 return state.user_settings.wasd_for_map_movement;
286 state.user_settings.diplomatic_message_popup = !
state.user_settings.diplomatic_message_popup;
290 return state.user_settings.diplomatic_message_popup;
293 state.user_settings.mute_on_focus_lost = !
state.user_settings.mute_on_focus_lost;
297 return state.user_settings.mute_on_focus_lost;
299void zoom_speed_scrollbar::on_value_change(
sys::state&
state, int32_t v)
noexcept {
300 state.user_settings.zoom_speed = float(v);
303void zoom_speed_scrollbar::on_update(
sys::state& state)
noexcept {
304 update_raw_value(state, int32_t(
state.user_settings.zoom_speed));
312 return state.user_settings.fow_enabled;
315 state.user_settings.fow_enabled = !
state.user_settings.fow_enabled;
316 state.map_state.map_data.update_fog_of_war(
state);
321 return state.user_settings.render_models;
324 state.user_settings.render_models = !
state.user_settings.render_models;
329 return state.user_settings.black_map_font;
332 state.user_settings.black_map_font = !
state.user_settings.black_map_font;
337 return state.user_settings.railroads_enabled;
340 state.user_settings.railroads_enabled = !
state.user_settings.railroads_enabled;
341 state.railroad_built.store(
true, std::memory_order::release);
346 return state.user_settings.rivers_enabled;
349 state.user_settings.rivers_enabled = !
state.user_settings.rivers_enabled;
354 auto scale_index =
uint8_t(
state.user_settings.map_label);
355 if(scale_index > 0) {
357 state.province_ownership_changed.store(
true, std::memory_order::release);
362 auto scale_index =
uint8_t(
state.user_settings.map_label);
363 disabled = (scale_index == 0);
366 auto scale_index =
uint8_t(
state.user_settings.map_label);
367 if(scale_index < 3) {
369 state.province_ownership_changed.store(
true, std::memory_order::release);
374 auto scale_index =
uint8_t(
state.user_settings.map_label);
375 disabled = (scale_index >= 3);
378 switch(
state.user_settings.map_label) {
392 set_text(
state,
"???");
398 if(
state.user_settings.antialias_level > 0) {
399 state.user_settings.antialias_level -= 1;
406 disabled = (
state.user_settings.antialias_level == 0);
409 if(
state.user_settings.antialias_level < 16) {
410 state.user_settings.antialias_level += 1;
417 disabled = (
state.user_settings.antialias_level >= 16);
420 set_text(
state, std::to_string(int32_t(
state.user_settings.antialias_level)));
424 if(
state.user_settings.gaussianblur_level > 1.f) {
425 state.user_settings.gaussianblur_level -= 0.0078125f;
430 disabled = (
state.user_settings.gaussianblur_level == 1.f) || (
state.user_settings.antialias_level == 0);
433 if(
state.user_settings.gaussianblur_level < 1.5f) {
434 state.user_settings.gaussianblur_level += 0.0078125f;
439 disabled = (
state.user_settings.gaussianblur_level >= 1.25f) || (
state.user_settings.antialias_level == 0);
447 if(
state.user_settings.gamma > 0.5f) {
448 state.user_settings.gamma -= 0.1f;
453 disabled = (
state.user_settings.gamma <= 0.5f);
456 if(
state.user_settings.gamma < 2.5f) {
457 state.user_settings.gamma += 0.1f;
462 disabled = (
state.user_settings.gamma >= 2.5f);
477 disabled = (
uint8_t(
state.user_settings.vassal_color) == 0);
488 disabled = (
uint8_t(
state.user_settings.vassal_color) >= 2);
491 switch(
state.user_settings.vassal_color) {
502 set_text(
state,
"???");
508 auto index =
uint8_t(
state.user_settings.color_blind_mode);
519 disabled = (
uint8_t(
state.user_settings.color_blind_mode) == 0);
522 auto index =
uint8_t(
state.user_settings.color_blind_mode);
533 disabled = (
uint8_t(
state.user_settings.color_blind_mode) >= 4);
536 switch(
state.user_settings.color_blind_mode) {
553 set_text(
state,
"???");
578 state.user_settings.prefer_fullscreen = !
state.user_settings.prefer_fullscreen;
583 return state.user_settings.prefer_fullscreen;
600 if(
static_cast<uint8_t>(
state.user_settings.map_is_globe) == 0) {
609 auto it = std::string_view(
"map_projection_globe");
611 it = std::string_view(
"map_projection_flat");
613 it = std::string_view(
"map_projection_globe_perspective");
620 state.user_settings.use_classic_fonts = !
state.user_settings.use_classic_fonts;
621 state.font_collection.set_classic_fonts(
state.user_settings.use_classic_fonts);
636 state.province_ownership_changed.store(
true, std::memory_order::release);
637 state.game_state_updated.store(
true, std::memory_order::release);
644 return state.user_settings.use_classic_fonts;
647 disabled =
state.world.locale_get_hb_script(
state.font_collection.get_current_locale()) != HB_SCRIPT_LATIN;
651 state.user_settings.left_mouse_click_hold_and_release = !
state.user_settings.left_mouse_click_hold_and_release;
655 return state.user_settings.left_mouse_click_hold_and_release;
658void master_volume::on_value_change(
sys::state&
state, int32_t v)
noexcept {
659 auto float_v = float(v) / 128.0f;
661 bool music_was_playing =
state.user_settings.music_volume *
state.user_settings.master_volume > 0;
663 state.user_settings.master_volume = float_v;
668 bool music_is_playing =
state.user_settings.music_volume *
state.user_settings.master_volume > 0;
669 if(music_was_playing != music_is_playing) {
675 send(state, parent, notify_setting_update{});
677void music_volume::on_value_change(
sys::state& state, int32_t v)
noexcept {
678 auto float_v = float(v) / 128.0f;
679 bool music_was_playing =
state.user_settings.music_volume *
state.user_settings.master_volume > 0;
681 state.user_settings.music_volume = float_v;
684 bool music_is_playing =
state.user_settings.music_volume *
state.user_settings.master_volume > 0;
685 if(music_was_playing != music_is_playing) {
691 send(state, parent, notify_setting_update{});
693void effects_volume::on_value_change(
sys::state& state, int32_t v)
noexcept {
694 auto float_v = float(v) / 128.0f;
695 state.user_settings.effects_volume = float_v;
697 send(state, parent, notify_setting_update{});
699void interface_volume::on_value_change(
sys::state& state, int32_t v)
noexcept {
700 auto float_v = float(v) / 128.0f;
701 state.user_settings.interface_volume = float_v;
703 send(state, parent, notify_setting_update{});
706void master_volume::on_update(
sys::state& state)
noexcept {
707 update_raw_value(state, int32_t(
state.user_settings.master_volume * 128.0f));
709void music_volume::on_update(
sys::state& state)
noexcept {
710 update_raw_value(state, int32_t(
state.user_settings.music_volume * 128.0f));
712void effects_volume::on_update(
sys::state& state)
noexcept {
713 update_raw_value(state, int32_t(
state.user_settings.effects_volume * 128.0f));
715void interface_volume::on_update(
sys::state& state)
noexcept {
716 update_raw_value(state, int32_t(
state.user_settings.interface_volume * 128.0f));
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
virtual void on_create(sys::state &state) noexcept
void set_visible(sys::state &state, bool vis)
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void update_map_mode(sys::state &state)
void initialize_msaa(sys::state &state, int32_t size_x, int32_t size_y)
void deinitialize_msaa(sys::state &state)
std::string native_to_utf8(native_string_view data_in)
void play_next_track(sys::state &state)
void change_effect_volume(sys::state &state, float v)
void stop_music(sys::state &state)
void change_interface_volume(sys::state &state, float v)
native_string get_current_track_name(sys::state &state)
void play_previous_track(sys::state &state)
void start_music(sys::state &state, float v)
void change_music_volume(sys::state &state, float v)
constexpr uint32_t ui_scales_count
constexpr float ui_scales[]
std::string format_float(float num, size_t digits)
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
void send(sys::state &state, element_base *parent, T value)
uint32_t get_ui_scale_index(float current_scale)
void show_main_menu_nation_picker(sys::state &state)
void show_main_menu_nation_basic(sys::state &state)
void set_borderless_full_screen(sys::state &game_state, bool fullscreen)
void change_cursor(sys::state &state, cursor_type type)
std::unique_ptr< element_base > end_screen
std::unique_ptr< element_base > nation_picker
element_base * last_tooltip
std::unique_ptr< tool_tip > tooltip
std::unique_ptr< element_base > rgos_root
std::unique_ptr< element_base > select_states_legend
std::unique_ptr< element_base > root
element_base * r_main_menu
std::unique_ptr< element_base > units_root