41 fullscreen_name_text = std::make_unique<scene::text>();
42 fullscreen_value_text = std::make_unique<scene::text>();
43 resolution_name_text = std::make_unique<scene::text>();
44 resolution_value_text = std::make_unique<scene::text>();
45 v_sync_name_text = std::make_unique<scene::text>();
46 v_sync_value_text = std::make_unique<scene::text>();
47 aa_method_name_text = std::make_unique<scene::text>();
48 aa_method_value_text = std::make_unique<scene::text>();
49 font_scale_name_text = std::make_unique<scene::text>();
50 font_scale_value_text = std::make_unique<scene::text>();
51 dyslexia_font_name_text = std::make_unique<scene::text>();
52 dyslexia_font_value_text = std::make_unique<scene::text>();
53 back_text = std::make_unique<scene::text>();
56 ctx.
menu_item_texts.push_back({fullscreen_name_text.get(), fullscreen_value_text.get()});
57 ctx.
menu_item_texts.push_back({resolution_name_text.get(), resolution_value_text.get()});
59 ctx.
menu_item_texts.push_back({aa_method_name_text.get(), aa_method_value_text.get()});
60 ctx.
menu_item_texts.push_back({font_scale_name_text.get(), font_scale_value_text.get()});
61 ctx.
menu_item_texts.push_back({dyslexia_font_name_text.get(), dyslexia_font_value_text.get()});
65 fullscreen_name_text->set_content(
get_string(
ctx,
"graphics_menu_fullscreen"));
66 resolution_name_text->set_content(
get_string(
ctx,
"graphics_menu_resolution"));
67 v_sync_name_text->set_content(
get_string(
ctx,
"graphics_menu_v_sync"));
68 aa_method_name_text->set_content(
get_string(
ctx,
"graphics_menu_aa_method"));
69 font_scale_name_text->set_content(
get_string(
ctx,
"graphics_menu_font_scale"));
70 dyslexia_font_name_text->set_content(
get_string(
ctx,
"graphics_menu_dyslexia_font"));
72 update_value_text_content();
84 auto toggle_fullscreen_callback = [
this, &
ctx]()
86 bool fullscreen = !
ctx.
window->is_fullscreen();
90 this->update_value_text_content();
97 auto increase_resolution_callback = [
this, &
ctx]()
116 this->update_value_text_content();
120 auto decrease_resolution_callback = [
this, &
ctx]()
139 this->update_value_text_content();
143 auto toggle_v_sync_callback = [
this, &
ctx]()
152 this->update_value_text_content();
156 auto next_aa_method_callback = [
this, &
ctx]()
175 this->update_value_text_content();
182 auto previous_aa_method_callback = [
this, &
ctx]()
201 this->update_value_text_content();
208 auto increase_font_scale_callback = [
this, &
ctx]()
224 this->update_value_text_content();
236 auto decrease_font_scale_callback = [
this, &
ctx]()
252 this->update_value_text_content();
264 auto toggle_dyslexia_font_callback = [
this, &
ctx]()
269 this->update_value_text_content();
283 auto select_back_callback = [&
ctx]()
359 void graphics_menu_state::update_value_text_content()
361 const bool fullscreen =
ctx.
window->is_fullscreen();
363 const bool v_sync =
ctx.
window->get_v_sync();
381 const std::string string_aa_methods[2] =
387 std::get<1>(
ctx.
menu_item_texts[0])->set_content((fullscreen) ? string_on : string_off);
392 std::get<1>(
ctx.
menu_item_texts[5])->set_content((dyslexia_font) ? string_on : string_off);
Abstract base class for game states.
std::vector< std::function< void()> > menu_left_callbacks
input::action menu_modifier_action
std::vector< std::function< void()> > menu_right_callbacks
hsm::state_machine< game_state > state_machine
std::vector< std::function< void()> > menu_select_callbacks
render::anti_aliasing_method anti_aliasing_method
std::shared_ptr< dict< hash::fnv1a32_t > > settings
std::vector< std::tuple< scene::text *, scene::text * > > menu_item_texts
std::shared_ptr< app::window > window
std::queue< std::function< void()> > function_queue
std::function< void()> menu_back_callback
void load_fonts(::game &ctx)
log_message< log_message_severity::trace, Args... > log_trace
Formats and logs a trace message.
void select_anti_aliasing_method(::game &ctx, render::anti_aliasing_method method)
void change_render_resolution(::game &ctx, float scale)
User-defined literals for compile-time string hashing.
constexpr vector< T, N > round(const vector< T, N > &x)
Performs a element-wise round operation.
@ fxaa
Fast approximate anti-aliasing (FXAA).
std::string get_string(const ::game &ctx, hash::fnv1a32_t key)
Returns a localized string.
Self-formatting message that logs itself to the default logger on construction.