mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2023-12-30 21:52:56 +00:00
Options refactor part 2.1: fixed control option labels.
This commit is contained in:
parent
d99fbb092e
commit
8df996f452
@ -23,36 +23,42 @@ optionsStruct options::Options
|
||||
{
|
||||
{
|
||||
"Left Flipper key",
|
||||
Msg::KEYMAPPER_FlipperL,
|
||||
{InputTypes::Keyboard, SDLK_z},
|
||||
{InputTypes::Mouse, SDL_BUTTON_LEFT},
|
||||
{InputTypes::GameController, SDL_CONTROLLER_BUTTON_LEFTSHOULDER}
|
||||
},
|
||||
{
|
||||
"Right Flipper key",
|
||||
Msg::KEYMAPPER_FlipperR,
|
||||
{InputTypes::Keyboard, SDLK_SLASH},
|
||||
{InputTypes::Mouse,SDL_BUTTON_RIGHT},
|
||||
{InputTypes::GameController, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER}
|
||||
},
|
||||
{
|
||||
"Plunger key",
|
||||
Msg::KEYMAPPER_Plunger,
|
||||
{InputTypes::Keyboard, SDLK_SPACE},
|
||||
{InputTypes::Mouse,SDL_BUTTON_MIDDLE},
|
||||
{InputTypes::GameController, SDL_CONTROLLER_BUTTON_A}
|
||||
},
|
||||
{
|
||||
"Left Table Bump key",
|
||||
Msg::KEYMAPPER_BumpLeft,
|
||||
{InputTypes::Keyboard, SDLK_x},
|
||||
{InputTypes::Mouse,SDL_BUTTON_X1},
|
||||
{InputTypes::GameController, SDL_CONTROLLER_BUTTON_DPAD_LEFT}
|
||||
},
|
||||
{
|
||||
"Right Table Bump key",
|
||||
Msg::KEYMAPPER_BumpRight,
|
||||
{InputTypes::Keyboard, SDLK_PERIOD},
|
||||
{InputTypes::Mouse,SDL_BUTTON_X2},
|
||||
{InputTypes::GameController, SDL_CONTROLLER_BUTTON_DPAD_RIGHT}
|
||||
},
|
||||
{
|
||||
"Bottom Table Bump key",
|
||||
Msg::KEYMAPPER_BumpBottom,
|
||||
{InputTypes::Keyboard, SDLK_UP},
|
||||
{InputTypes::Mouse,SDL_BUTTON_X2 + 1},
|
||||
{InputTypes::GameController, SDL_CONTROLLER_BUTTON_DPAD_UP}
|
||||
@ -299,16 +305,6 @@ void options::ShowControlDialog()
|
||||
|
||||
void options::RenderControlDialog()
|
||||
{
|
||||
static const Msg controlDescriptions[6]
|
||||
{
|
||||
Msg::KEYMAPPER_FlipperL,
|
||||
Msg::KEYMAPPER_FlipperR,
|
||||
Msg::KEYMAPPER_BumpLeft,
|
||||
Msg::KEYMAPPER_BumpRight,
|
||||
Msg::KEYMAPPER_BumpBottom,
|
||||
Msg::KEYMAPPER_Plunger,
|
||||
};
|
||||
|
||||
if (!ShowDialog)
|
||||
return;
|
||||
|
||||
@ -325,7 +321,9 @@ void options::RenderControlDialog()
|
||||
ImGui::TextUnformatted(pb::get_rc_string(Msg::KEYMAPPER_Groupbox1));
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2{5, 10});
|
||||
if (ImGui::BeginTable("Controls", 4, ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders| ImGuiTableFlags_SizingStretchSame))
|
||||
if (ImGui::BeginTable("Controls", 4,
|
||||
ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders |
|
||||
ImGuiTableFlags_SizingStretchSame))
|
||||
{
|
||||
ImGui::TableSetupColumn("Control");
|
||||
ImGui::TableSetupColumn("Binding 1");
|
||||
@ -334,13 +332,11 @@ void options::RenderControlDialog()
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
int rowHash = 0;
|
||||
for (auto inputId = GameBindings::Min; inputId < GameBindings::Max; inputId++)
|
||||
for (auto& option : Options.Key)
|
||||
{
|
||||
auto& option = Options.Key[~inputId];
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{0.5, 0, 0, 1});
|
||||
if (ImGui::Button(pb::get_rc_string(controlDescriptions[~inputId])))
|
||||
if (ImGui::Button(pb::get_rc_string(option.Description), ImVec2(-1, 0)))
|
||||
{
|
||||
for (auto& input : option.Inputs)
|
||||
input = {};
|
||||
|
@ -191,11 +191,14 @@ struct BoolOption : OptionBaseT<bool>
|
||||
|
||||
struct ControlOption : OptionBase
|
||||
{
|
||||
const Msg Description;
|
||||
GameInput Defaults[3];
|
||||
GameInput Inputs[3];
|
||||
|
||||
ControlOption(LPCSTR name, GameInput defaultKeyboard, GameInput defaultMouse, GameInput defaultController) :
|
||||
ControlOption(LPCSTR name, Msg description, GameInput defaultKeyboard, GameInput defaultMouse,
|
||||
GameInput defaultController) :
|
||||
OptionBase(name),
|
||||
Description(description),
|
||||
Defaults{defaultKeyboard, defaultMouse, defaultController},
|
||||
Inputs{
|
||||
{InputTypes::Keyboard, -1},
|
||||
|
Loading…
Reference in New Issue
Block a user