Project Alice
Loading...
Searching...
No Matches
gui_main_menu.cpp
Go to the documentation of this file.
1#include "gui_main_menu.hpp"
2#include "sound.hpp"
3
4#include <cstdio>
5
6namespace ui {
7
9 if(!state.ui_state.r_main_menu) {
10 auto new_mm = make_element_by_type<restricted_main_menu_window>(state, "alice_main_menu");
11 state.ui_state.r_main_menu = new_mm.get();
12 state.ui_state.nation_picker->add_child_to_front(std::move(new_mm));
13 } else {
14 state.ui_state.r_main_menu->set_visible(state, true);
15 state.ui_state.nation_picker->move_child_to_front(state.ui_state.r_main_menu);
16 }
17}
18
20 if(!state.ui_state.main_menu) {
21 auto new_mm = make_element_by_type<main_menu_window>(state, "alice_main_menu");
22 state.ui_state.main_menu = new_mm.get();
23 state.ui_state.root->add_child_to_front(std::move(new_mm));
24 } else {
25 state.ui_state.main_menu->set_visible(state, true);
26 state.ui_state.root->move_child_to_front(state.ui_state.main_menu);
27 }
28}
29
30uint32_t get_ui_scale_index(float current_scale) {
31 for(uint32_t i = 0; i < sys::ui_scales_count; ++i) {
32 if(current_scale <= sys::ui_scales[i])
33 return i;
34 }
36}
37
39 auto scale_index = get_ui_scale_index(state.user_settings.ui_scale);
40 if(scale_index > 0) {
41 state.update_ui_scale(sys::ui_scales[scale_index - 1]);
43 }
44}
46 auto scale_index = get_ui_scale_index(state.user_settings.ui_scale);
47 disabled = (scale_index == 0);
48}
50 auto scale_index = get_ui_scale_index(state.user_settings.ui_scale);
51 if(scale_index < uint32_t(sys::ui_scales_count - 1)) {
52 state.update_ui_scale(sys::ui_scales[scale_index + 1]);
54 }
55}
57 auto scale_index = get_ui_scale_index(state.user_settings.ui_scale);
58 disabled = (scale_index >= uint32_t(sys::ui_scales_count - 1));
59}
60void ui_scale_display::on_update(sys::state& state) noexcept {
61 set_text(state, text::format_float(state.user_settings.ui_scale, 2));
62}
63
65 auto scale_index = uint8_t(state.user_settings.autosaves);
66 if(scale_index > 0) {
67 state.user_settings.autosaves = sys::autosave_frequency(scale_index - 1);
69 }
70}
72 auto scale_index = uint8_t(state.user_settings.autosaves);
73 disabled = (scale_index == 0);
74}
76 auto scale_index = uint8_t(state.user_settings.autosaves);
77 if(scale_index < 3) {
78 state.user_settings.autosaves = sys::autosave_frequency(scale_index + 1);
80 }
81}
83 auto scale_index = uint8_t(state.user_settings.autosaves);
84 disabled = (scale_index >= 3);
85}
86void autosave_display::on_update(sys::state& state) noexcept {
87 switch(state.user_settings.autosaves) {
89 set_text(state, text::produce_simple_string(state, "auto_save_0"));
90 break;
92 set_text(state, text::produce_simple_string(state, "auto_save_1"));
93 break;
95 set_text(state, text::produce_simple_string(state, "auto_save_2"));
96 break;
98 set_text(state, text::produce_simple_string(state, "auto_save_3"));
99 break;
100 default:
101 set_text(state, "???");
102 break;
103 }
104}
105
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;
111 if(i < 0) {
112 i = int32_t(state.world.locale_size()) - 1;
113 }
114 new_locale = dcon::locale_id{ dcon::locale_id::value_base_t(i) };
115 } else {
116 int32_t i = state.font_collection.get_current_locale().index() + 1;
117 if(i >= int32_t(state.world.locale_size())) {
118 i = 0;
119 }
120 new_locale = dcon::locale_id{ dcon::locale_id::value_base_t(i) };
121 }
122
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);
127 }
128 //
129
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);
134
135 //
136 if(state.ui_state.units_root)
137 state.ui_state.units_root->impl_on_reset_text(state);
138 if(state.ui_state.rgos_root)
139 state.ui_state.rgos_root->impl_on_reset_text(state);
140 if(state.ui_state.root)
141 state.ui_state.root->impl_on_reset_text(state);
142 if(state.ui_state.nation_picker)
143 state.ui_state.nation_picker->impl_on_reset_text(state);
144 if(state.ui_state.select_states_legend)
145 state.ui_state.select_states_legend->impl_on_reset_text(state);
146 if(state.ui_state.end_screen)
147 state.ui_state.end_screen->impl_on_reset_text(state);
148 state.province_ownership_changed.store(true, std::memory_order::release); //update map
149 state.game_state_updated.store(true, std::memory_order::release); //update ui
150 //
151 send(state, parent, notify_setting_update{});
153}
155
156}
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())) {
163 i = 0;
164 }
165 new_locale = dcon::locale_id{ dcon::locale_id::value_base_t(i) };
166 } else {
167 int32_t i = state.font_collection.get_current_locale().index() - 1;
168 if(i < 0) {
169 i = int32_t(state.world.locale_size()) - 1;
170 }
171 new_locale = dcon::locale_id{ dcon::locale_id::value_base_t(i) };
172 }
173
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);
178 }
179
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);
184
185 //
186 if(state.ui_state.units_root)
187 state.ui_state.units_root->impl_on_reset_text(state);
188 if(state.ui_state.rgos_root)
189 state.ui_state.rgos_root->impl_on_reset_text(state);
190 if(state.ui_state.root)
191 state.ui_state.root->impl_on_reset_text(state);
192 if(state.ui_state.nation_picker)
193 state.ui_state.nation_picker->impl_on_reset_text(state);
194 if(state.ui_state.select_states_legend)
195 state.ui_state.select_states_legend->impl_on_reset_text(state);
196 if(state.ui_state.end_screen)
197 state.ui_state.end_screen->impl_on_reset_text(state);
198 state.province_ownership_changed.store(true, std::memory_order::release); //update map
199 state.game_state_updated.store(true, std::memory_order::release); //update ui
200 //
201 send(state, parent, notify_setting_update{});
203}
205
206}
207void language_display::on_update(sys::state& state) noexcept {
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 });
211}
212
214 auto scale_index = uint8_t(state.user_settings.zoom_mode);
215 if(scale_index > 0) {
216 state.user_settings.zoom_mode = sys::map_zoom_mode(scale_index - 1);
217 send(state, parent, notify_setting_update{});
218 }
219}
221 auto scale_index = uint8_t(state.user_settings.zoom_mode);
222 disabled = (scale_index == 0);
223}
225 auto scale_index = uint8_t(state.user_settings.zoom_mode);
226 if(scale_index < 4) {
227 state.user_settings.zoom_mode = sys::map_zoom_mode(scale_index + 1);
228 send(state, parent, notify_setting_update{});
229 }
230}
232 auto scale_index = uint8_t(state.user_settings.zoom_mode);
233 disabled = (scale_index >= 4);
234}
235void map_zoom_mode_display::on_update(sys::state& state) noexcept {
236 switch(state.user_settings.zoom_mode) {
238 set_text(state, text::produce_simple_string(state, "zoom_mode_panning"));
239 break;
241 set_text(state, text::produce_simple_string(state, "zoom_mode_inverted"));
242 break;
244 set_text(state, text::produce_simple_string(state, "zoom_mode_centered"));
245 break;
247 set_text(state, text::produce_simple_string(state, "zoom_mode_to_cursor"));
248 break;
250 set_text(state, text::produce_simple_string(state, "zoom_mode_away_from_cursor"));
251 break;
252 default:
253 set_text(state, "???");
254 break;
255 }
256}
258 state.user_settings.mouse_edge_scrolling = !state.user_settings.mouse_edge_scrolling;
259 send(state, parent, notify_setting_update{});
260}
262 return state.user_settings.mouse_edge_scrolling;
263}
265 state.user_settings.bind_tooltip_mouse = !state.user_settings.bind_tooltip_mouse;
266 send(state, parent, notify_setting_update{});
267}
269 return state.user_settings.bind_tooltip_mouse;
270}
272 state.user_settings.spoilers = !state.user_settings.spoilers;
273 send(state, parent, notify_setting_update{});
274}
276 return state.user_settings.spoilers;
277}
279 state.user_settings.wasd_for_map_movement = !state.user_settings.wasd_for_map_movement;
280 send(state, parent, notify_setting_update{});
281}
283 return state.user_settings.wasd_for_map_movement;
284}
286 state.user_settings.diplomatic_message_popup = !state.user_settings.diplomatic_message_popup;
287 send(state, parent, notify_setting_update{});
288}
290 return state.user_settings.diplomatic_message_popup;
291}
293 state.user_settings.mute_on_focus_lost = !state.user_settings.mute_on_focus_lost;
294 send(state, parent, notify_setting_update{});
295}
297 return state.user_settings.mute_on_focus_lost;
298}
299void zoom_speed_scrollbar::on_value_change(sys::state& state, int32_t v) noexcept {
300 state.user_settings.zoom_speed = float(v);
301 send(state, parent, notify_setting_update{});
302}
303void zoom_speed_scrollbar::on_update(sys::state& state) noexcept {
304 update_raw_value(state, int32_t(state.user_settings.zoom_speed));
305}
306
309 disabled = (state.network_mode != sys::network_mode_type::single_player);
310}
312 return state.user_settings.fow_enabled;
313}
315 state.user_settings.fow_enabled = !state.user_settings.fow_enabled;
316 state.map_state.map_data.update_fog_of_war(state);
317 send(state, parent, notify_setting_update{});
318}
319
321 return state.user_settings.render_models;
322}
324 state.user_settings.render_models = !state.user_settings.render_models;
325 send(state, parent, notify_setting_update{});
326}
327
329 return state.user_settings.black_map_font;
330}
332 state.user_settings.black_map_font = !state.user_settings.black_map_font;
333 send(state, parent, notify_setting_update{});
334}
335
337 return state.user_settings.railroads_enabled;
338}
340 state.user_settings.railroads_enabled = !state.user_settings.railroads_enabled;
341 state.railroad_built.store(true, std::memory_order::release);
342 send(state, parent, notify_setting_update{});
343}
344
346 return state.user_settings.rivers_enabled;
347}
349 state.user_settings.rivers_enabled = !state.user_settings.rivers_enabled;
350 send(state, parent, notify_setting_update{});
351}
352
354 auto scale_index = uint8_t(state.user_settings.map_label);
355 if(scale_index > 0) {
356 state.user_settings.map_label = sys::map_label_mode(scale_index - 1);
357 state.province_ownership_changed.store(true, std::memory_order::release);
358 send(state, parent, notify_setting_update{});
359 }
360}
362 auto scale_index = uint8_t(state.user_settings.map_label);
363 disabled = (scale_index == 0);
364}
366 auto scale_index = uint8_t(state.user_settings.map_label);
367 if(scale_index < 3) {
368 state.user_settings.map_label = sys::map_label_mode(scale_index + 1);
369 state.province_ownership_changed.store(true, std::memory_order::release);
370 send(state, parent, notify_setting_update{});
371 }
372}
374 auto scale_index = uint8_t(state.user_settings.map_label);
375 disabled = (scale_index >= 3);
376}
377void map_label_display::on_update(sys::state& state) noexcept {
378 switch(state.user_settings.map_label) {
380 set_text(state, text::produce_simple_string(state, "map_label_0"));
381 break;
383 set_text(state, text::produce_simple_string(state, "map_label_1"));
384 break;
386 set_text(state, text::produce_simple_string(state, "map_label_2"));
387 break;
389 set_text(state, text::produce_simple_string(state, "map_label_3"));
390 break;
391 default:
392 set_text(state, "???");
393 break;
394 }
395}
396
398 if(state.user_settings.antialias_level > 0) {
399 state.user_settings.antialias_level -= 1;
401 ogl::initialize_msaa(state, state.x_size, state.y_size);
402 send(state, parent, notify_setting_update{});
403 }
404}
406 disabled = (state.user_settings.antialias_level == 0);
407}
409 if(state.user_settings.antialias_level < 16) {
410 state.user_settings.antialias_level += 1;
412 ogl::initialize_msaa(state, state.x_size, state.y_size);
413 send(state, parent, notify_setting_update{});
414 }
415}
417 disabled = (state.user_settings.antialias_level >= 16);
418}
419void antialiasing_display::on_update(sys::state& state) noexcept {
420 set_text(state, std::to_string(int32_t(state.user_settings.antialias_level)));
421}
422
424 if(state.user_settings.gaussianblur_level > 1.f) {
425 state.user_settings.gaussianblur_level -= 0.0078125f;
426 send(state, parent, notify_setting_update{});
427 }
428}
430 disabled = (state.user_settings.gaussianblur_level == 1.f) || (state.user_settings.antialias_level == 0);
431}
433 if(state.user_settings.gaussianblur_level < 1.5f) {
434 state.user_settings.gaussianblur_level += 0.0078125f;
435 send(state, parent, notify_setting_update{});
436 }
437}
439 disabled = (state.user_settings.gaussianblur_level >= 1.25f) || (state.user_settings.antialias_level == 0);
440}
441void gaussianblur_display::on_update(sys::state& state) noexcept {
442 /* More user friendly displaying of gaussian blur */
443 set_text(state, text::format_float((state.user_settings.gaussianblur_level - 1.f) * 64.f));
444}
445
447 if(state.user_settings.gamma > 0.5f) {
448 state.user_settings.gamma -= 0.1f;
449 send(state, parent, notify_setting_update{});
450 }
451}
453 disabled = (state.user_settings.gamma <= 0.5f);
454}
456 if(state.user_settings.gamma < 2.5f) {
457 state.user_settings.gamma += 0.1f;
458 send(state, parent, notify_setting_update{});
459 }
460}
462 disabled = (state.user_settings.gamma >= 2.5f);
463}
464void gamma_display::on_update(sys::state& state) noexcept {
465 set_text(state, text::format_float(state.user_settings.gamma));
466}
467
469 auto index = uint8_t(state.user_settings.vassal_color);
470 if(index > 0) {
471 state.user_settings.vassal_color = sys::map_vassal_color_mode(index - 1);
473 send(state, parent, notify_setting_update{});
474 }
475}
477 disabled = (uint8_t(state.user_settings.vassal_color) == 0);
478}
480 auto index = uint8_t(state.user_settings.vassal_color);
481 if(index < 2) {
482 state.user_settings.vassal_color = sys::map_vassal_color_mode(index + 1);
484 send(state, parent, notify_setting_update{});
485 }
486}
488 disabled = (uint8_t(state.user_settings.vassal_color) >= 2);
489}
490void vassal_color_display::on_update(sys::state& state) noexcept {
491 switch(state.user_settings.vassal_color) {
493 set_text(state, text::produce_simple_string(state, "vassal_color_inherit"));
494 break;
496 set_text(state, text::produce_simple_string(state, "vassal_color_same"));
497 break;
499 set_text(state, text::produce_simple_string(state, "vassal_color_none"));
500 break;
501 default:
502 set_text(state, "???");
503 break;
504 }
505}
506
508 auto index = uint8_t(state.user_settings.color_blind_mode);
509 if(index > 0) {
510 state.user_settings.color_blind_mode = sys::color_blind_mode(index - 1);
512 state.ui_state.units_root->impl_on_update(state);
513 state.ui_state.rgos_root->impl_on_update(state);
514 state.ui_state.root->impl_on_update(state);
515 send(state, parent, notify_setting_update{});
516 }
517}
519 disabled = (uint8_t(state.user_settings.color_blind_mode) == 0);
520}
522 auto index = uint8_t(state.user_settings.color_blind_mode);
523 if(index < 4) {
524 state.user_settings.color_blind_mode = sys::color_blind_mode(index + 1);
526 state.ui_state.units_root->impl_on_update(state);
527 state.ui_state.rgos_root->impl_on_update(state);
528 state.ui_state.root->impl_on_update(state);
529 send(state, parent, notify_setting_update{});
530 }
531}
533 disabled = (uint8_t(state.user_settings.color_blind_mode) >= 4);
534}
535void color_blind_display::on_update(sys::state& state) noexcept {
536 switch(state.user_settings.color_blind_mode) {
538 set_text(state, text::produce_simple_string(state, "color_blind_mode_none"));
539 break;
541 set_text(state, text::produce_simple_string(state, "color_blind_mode_deutan"));
542 break;
544 set_text(state, text::produce_simple_string(state, "color_blind_mode_protan"));
545 break;
547 set_text(state, text::produce_simple_string(state, "color_blind_mode_tritan"));
548 break;
550 set_text(state, text::produce_simple_string(state, "color_blind_mode_achroma"));
551 break;
552 default:
553 set_text(state, "???");
554 break;
555 }
556}
557
558/*
559class autosave_left : public button_element_base {
560public:
561 void button_action(sys::state& state) noexcept override;
562 void on_update(sys::state& state) noexcept override;
563};
564class autosave_right : public button_element_base {
565public:
566 void button_action(sys::state& state) noexcept override;
567 void on_update(sys::state& state) noexcept override;
568};
569class autosave_display : public simple_text_element_base {
570 void on_update(sys::state& state) noexcept override;
571};
572*/
573
575
576}
578 state.user_settings.prefer_fullscreen = !state.user_settings.prefer_fullscreen;
579 window::set_borderless_full_screen(state, state.user_settings.prefer_fullscreen);
580 send(state, parent, notify_setting_update{});
581}
583 return state.user_settings.prefer_fullscreen;
584}
585
587 state.user_settings.map_is_globe = static_cast<sys::projection_mode> (static_cast<uint8_t>(state.user_settings.map_is_globe) + 1);
588 if(state.user_settings.map_is_globe >= sys::projection_mode::num_of_modes) {
589 state.user_settings.map_is_globe = static_cast<sys::projection_mode>(0);
590 }
591 send(state, parent, notify_setting_update{});
592}
595 //validation
596 if(state.user_settings.map_is_globe >= sys::projection_mode::num_of_modes) {
597 state.user_settings.map_is_globe = static_cast<sys::projection_mode>(0);
598 }
599
600 if(static_cast<uint8_t>(state.user_settings.map_is_globe) == 0) {
601 state.user_settings.map_is_globe = static_cast<sys::projection_mode>(static_cast<uint8_t>(sys::projection_mode::num_of_modes) - 1);
602 } else {
603 state.user_settings.map_is_globe = static_cast<sys::projection_mode> (static_cast<uint8_t>(state.user_settings.map_is_globe) - 1);
604 }
605 send(state, parent, notify_setting_update{});
606}
608void projection_mode_display::on_update(sys::state& state) noexcept {
609 auto it = std::string_view("map_projection_globe");
610 if(state.user_settings.map_is_globe == sys::projection_mode::flat) {
611 it = std::string_view("map_projection_flat");
612 } else if (state.user_settings.map_is_globe == sys::projection_mode::globe_perpect) {
613 it = std::string_view("map_projection_globe_perspective");
614 }
615
616 set_text(state, text::produce_simple_string(state, it));
617}
618
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);
622 //
624 if(state.ui_state.units_root)
625 state.ui_state.units_root->impl_on_reset_text(state);
626 if(state.ui_state.rgos_root)
627 state.ui_state.rgos_root->impl_on_reset_text(state);
628 if(state.ui_state.root)
629 state.ui_state.root->impl_on_reset_text(state);
630 if(state.ui_state.nation_picker)
631 state.ui_state.nation_picker->impl_on_reset_text(state);
632 if(state.ui_state.select_states_legend)
633 state.ui_state.select_states_legend->impl_on_reset_text(state);
634 if(state.ui_state.end_screen)
635 state.ui_state.end_screen->impl_on_reset_text(state);
636 state.province_ownership_changed.store(true, std::memory_order::release); //update map
637 state.game_state_updated.store(true, std::memory_order::release); //update ui
638 state.ui_state.tooltip->set_visible(state, false);
639 state.ui_state.last_tooltip = nullptr;
640 send(state, parent, notify_setting_update{});
642}
644 return state.user_settings.use_classic_fonts;
645}
647 disabled = state.world.locale_get_hb_script(state.font_collection.get_current_locale()) != HB_SCRIPT_LATIN;
648}
649
651 state.user_settings.left_mouse_click_hold_and_release = !state.user_settings.left_mouse_click_hold_and_release;
652 send(state, parent, notify_setting_update{});
653}
655 return state.user_settings.left_mouse_click_hold_and_release;
656}
657
658void master_volume::on_value_change(sys::state& state, int32_t v) noexcept {
659 auto float_v = float(v) / 128.0f;
660
661 bool music_was_playing = state.user_settings.music_volume * state.user_settings.master_volume > 0;
662
663 state.user_settings.master_volume = float_v;
664 sound::change_music_volume(state, state.user_settings.music_volume * state.user_settings.master_volume);
665 sound::change_effect_volume(state, state.user_settings.effects_volume * state.user_settings.master_volume);
666 sound::change_interface_volume(state, state.user_settings.interface_volume * state.user_settings.master_volume);
667
668 bool music_is_playing = state.user_settings.music_volume * state.user_settings.master_volume > 0;
669 if(music_was_playing != music_is_playing) {
670 if(music_is_playing)
671 sound::start_music(state, state.user_settings.music_volume * state.user_settings.master_volume);
672 else
674 }
675 send(state, parent, notify_setting_update{});
676}
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;
680
681 state.user_settings.music_volume = float_v;
682 sound::change_music_volume(state, state.user_settings.music_volume * state.user_settings.master_volume);
683
684 bool music_is_playing = state.user_settings.music_volume * state.user_settings.master_volume > 0;
685 if(music_was_playing != music_is_playing) {
686 if(music_is_playing)
687 sound::start_music(state, state.user_settings.music_volume * state.user_settings.master_volume);
688 else
689 sound::stop_music(state);
690 }
691 send(state, parent, notify_setting_update{});
692}
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;
696 sound::change_effect_volume(state, state.user_settings.effects_volume * state.user_settings.master_volume);
697 send(state, parent, notify_setting_update{});
698}
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;
702 sound::change_interface_volume(state, state.user_settings.interface_volume * state.user_settings.master_volume);
703 send(state, parent, notify_setting_update{});
704}
705
706void master_volume::on_update(sys::state& state) noexcept {
707 update_raw_value(state, int32_t(state.user_settings.master_volume * 128.0f));
708}
709void music_volume::on_update(sys::state& state) noexcept {
710 update_raw_value(state, int32_t(state.user_settings.music_volume * 128.0f));
711}
712void effects_volume::on_update(sys::state& state) noexcept {
713 update_raw_value(state, int32_t(state.user_settings.effects_volume * 128.0f));
714}
715void interface_volume::on_update(sys::state& state) noexcept {
716 update_raw_value(state, int32_t(state.user_settings.interface_volume * 128.0f));
717}
718
719 //TODO: Perhaps add a tooltip of which next song is going to be played, or the queue of songs
722 send(state, parent, notify_setting_update{});
723}
726 send(state, parent, notify_setting_update{});
727}
728void music_player_display::on_update(sys::state& state) noexcept {
730}
731
732} // namespace ui
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
void button_action(sys::state &state) noexcept override
bool is_active(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
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 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
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)
Definition: map_modes.cpp:1021
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)
Definition: sound_nix.cpp:410
void change_effect_volume(sys::state &state, float v)
Definition: sound_nix.cpp:188
void stop_music(sys::state &state)
Definition: sound_nix.cpp:209
void change_interface_volume(sys::state &state, float v)
Definition: sound_nix.cpp:191
native_string get_current_track_name(sys::state &state)
Definition: sound_nix.cpp:417
void play_previous_track(sys::state &state)
Definition: sound_nix.cpp:413
void start_music(sys::state &state, float v)
Definition: sound_nix.cpp:214
void change_music_volume(sys::state &state, float v)
Definition: sound_nix.cpp:194
constexpr uint32_t ui_scales_count
Definition: constants.hpp:167
map_zoom_mode
Definition: constants.hpp:185
autosave_frequency
Definition: constants.hpp:169
constexpr float ui_scales[]
Definition: constants.hpp:166
projection_mode
color_blind_mode
Definition: constants.hpp:554
map_label_mode
Definition: constants.hpp:178
map_vassal_color_mode
Definition: constants.hpp:193
std::string format_float(float num, size_t digits)
Definition: text.cpp:981
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
Definition: text.cpp:617
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)
Definition: window_nix.cpp:76
void change_cursor(sys::state &state, cursor_type type)
Definition: window_nix.cpp:351
uint uint32_t
uchar uint8_t
element_base * main_menu
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