37 action_remapped(false)
51 back_text = std::make_unique<scene::text>();
69 auto select_back_callback = [&
ctx]()
139 std::string mapping_string;
141 if (
auto key_mappings = action_map.
get_key_mappings(control); !key_mappings.empty())
143 const auto& key_mapping = key_mappings.front();
146 std::string scancode_string_name =
std::format(
"scancode_{:02x}", std::to_underlying(key_mapping.scancode));
149 mapping_string =
get_string(
ctx, hash::fnv1a32<char>(scancode_string_name));
153 const auto& mouse_button_mapping = mouse_button_mappings.front();
154 switch (mouse_button_mapping.button)
170 std::string format_string =
get_string(
ctx,
"mouse_button_n_format");
171 mapping_string = std::vformat(format_string, std::make_format_args(std::to_underlying(mouse_button_mapping.button)));
178 const auto& mouse_scroll_mapping = mouse_scroll_mappings.front();
182 if (!mouse_scroll_mapping.direction)
193 if (!mouse_scroll_mapping.direction)
208 return mapping_string;
214 auto name_text = std::make_unique<scene::text>();
215 auto value_text = std::make_unique<scene::text>();
222 value_text->set_content(get_mapping_string(action_map, control));
225 auto input_mapped_callback = [
this, &
ctx = this->
ctx, action_map = &action_map, control = &control, value_text = value_text.get()](
const auto&
event)
227 this->action_remapped =
true;
237 action_map->add_mapping(*control,
event.mapping);
241 value_text->set_content(this->get_mapping_string(*action_map, *control));
256 auto select_callback = [
this, &
ctx = this->
ctx, action_map = &action_map, control = &control, value_text = value_text.get(), input_mapped_callback]()
265 input_mapped_callback
269 input_mapped_callback
273 input_mapped_callback
287 control_item_texts.emplace_back(std::move(name_text));
288 control_item_texts.emplace_back(std::move(value_text));
Abstract base class for game states.
std::vector< std::function< void()> > menu_left_callbacks
input::action move_up_action
input::action move_down_action
std::vector< std::function< void()> > menu_right_callbacks
hsm::state_machine< game_state > state_machine
input::action move_right_action
input::action pause_action
std::vector< std::function< void()> > menu_select_callbacks
std::filesystem::path controls_path
std::string control_profile_filename
input::action move_left_action
input::action move_forward_action
std::vector< std::tuple< scene::text *, scene::text * > > menu_item_texts
std::unique_ptr< resource_manager > resource_manager
std::queue< std::function< void()> > function_queue
input::action move_back_action
std::function< void()> menu_back_callback
input::action_map movement_action_map
input::mapper input_mapper
std::unique_ptr< app::input_manager > input_manager
std::shared_ptr<::control_profile > control_profile
void update_control_profile(::game &ctx, ::control_profile &profile)
Updates a control profile after actions have been remapped.
log_message< log_message_severity::trace, Args... > log_trace
Formats and logs a trace message.
Publish-subscribe messaging.
format
Image and vertex formats.
User-defined literals for compile-time string hashing.
std::string get_string(const ::game &ctx, hash::fnv1a32_t key)
Returns a localized string.
32-bit FNV-1a hash value.