overhauled input symbols to be more gamepad-friendly

This commit is contained in:
Mathew Velasquez 2015-09-03 22:47:43 -04:00
parent 3b64e7871b
commit 5f99c595af
5 changed files with 66 additions and 64 deletions

View File

@ -128,19 +128,16 @@ static buttonCodes[] =
{ "RIGHT", Input::Right }, { "RIGHT", Input::Right },
{ "UP", Input::Up }, { "UP", Input::Up },
{ "A", Input::A }, { "ACTION", Input::Action },
{ "B", Input::B }, { "CANCEL", Input::Cancel },
{ "C", Input::C }, { "MENU", Input::Menu },
{ "X", Input::X }, { "ITEMS", Input::Items },
{ "Y", Input::Y }, { "RUN", Input::Run },
{ "Z", Input::Z }, { "DEACTIVATE", Input::Deactivate },
{ "L", Input::L }, { "L", Input::L },
{ "R", Input::R }, { "R", Input::R },
{ "SHIFT", Input::Shift },
{ "CTRL", Input::Ctrl },
{ "ALT", Input::Alt },
{ "F5", Input::F5 }, { "F5", Input::F5 },
{ "F6", Input::F6 }, { "F6", Input::F6 },
{ "F7", Input::F7 }, { "F7", Input::F7 },

View File

@ -205,12 +205,6 @@ struct MsBinding : public Binding
/* Not rebindable */ /* Not rebindable */
static const KbBindingData staticKbBindings[] = static const KbBindingData staticKbBindings[] =
{ {
{ SDL_SCANCODE_LSHIFT, Input::Shift },
{ SDL_SCANCODE_RSHIFT, Input::Shift },
{ SDL_SCANCODE_LCTRL, Input::Ctrl },
{ SDL_SCANCODE_RCTRL, Input::Ctrl },
{ SDL_SCANCODE_LALT, Input::Alt },
{ SDL_SCANCODE_RALT, Input::Alt },
{ SDL_SCANCODE_F5, Input::F5 }, { SDL_SCANCODE_F5, Input::F5 },
{ SDL_SCANCODE_F6, Input::F6 }, { SDL_SCANCODE_F6, Input::F6 },
{ SDL_SCANCODE_F7, Input::F7 }, { SDL_SCANCODE_F7, Input::F7 },

View File

@ -34,11 +34,14 @@ public:
Down = 2, Left = 4, Right = 6, Up = 8, Down = 2, Left = 4, Right = 6, Up = 8,
A = 11, B = 12, C = 13, Action = 11,
X = 14, Y = 15, Z = 16, Cancel = 12,
L = 17, R = 18, Menu = 13,
Items = 14,
Run = 15,
Deactivate = 16,
Shift = 21, Ctrl = 22, Alt = 23, L = 17, R = 18,
F5 = 25, F6 = 26, F7 = 27, F8 = 28, F9 = 29, F5 = 25, F6 = 26, F7 = 27, F8 = 28, F9 = 29,

View File

@ -75,24 +75,25 @@ static const KbBindingData defaultKbBindings[] =
{ SDL_SCANCODE_L, Input::Right }, { SDL_SCANCODE_L, Input::Right },
{ SDL_SCANCODE_K, Input::Up }, { SDL_SCANCODE_K, Input::Up },
{ SDL_SCANCODE_J, Input::Down }, { SDL_SCANCODE_J, Input::Down },
{ SDL_SCANCODE_Z, Input::C }, { SDL_SCANCODE_Z, Input::Action },
{ SDL_SCANCODE_SPACE, Input::C }, { SDL_SCANCODE_SPACE, Input::Action },
{ SDL_SCANCODE_RETURN, Input::C }, { SDL_SCANCODE_RETURN, Input::Action },
{ SDL_SCANCODE_X, Input::B }, { SDL_SCANCODE_X, Input::Cancel },
{ SDL_SCANCODE_ESCAPE, Input::B }, { SDL_SCANCODE_A, Input::Menu },
{ SDL_SCANCODE_KP_0, Input::B }, { SDL_SCANCODE_ESCAPE, Input::Menu },
{ SDL_SCANCODE_LSHIFT, Input::A }, { SDL_SCANCODE_KP_0, Input::Menu },
{ SDL_SCANCODE_LCTRL, Input::X }, { SDL_SCANCODE_S, Input::Items },
{ SDL_SCANCODE_LSHIFT, Input::Run },
{ SDL_SCANCODE_LCTRL, Input::Deactivate },
{ SDL_SCANCODE_Q, Input::L },
{ SDL_SCANCODE_W, Input::R },
}; };
static elementsN(defaultKbBindings); static elementsN(defaultKbBindings);
static const JsBindingData defaultJsBindings[] = static const JsBindingData defaultJsBindings[] =
{ {
{ 0, Input::C }, { 0, Input::Action },
{ 1, Input::B },
{ 2, Input::A },
{ 3, Input::X },
}; };
static elementsN(defaultJsBindings); static elementsN(defaultJsBindings);
@ -148,7 +149,7 @@ BDescVec genDefaultBindings()
return d; return d;
} }
#define FORMAT_VER 2 #define FORMAT_VER 3
struct Header struct Header
{ {
@ -210,10 +211,13 @@ static bool verifyDesc(const BindingDesc &desc)
{ {
Input::None, Input::None,
Input::Down, Input::Left, Input::Right, Input::Up, Input::Down, Input::Left, Input::Right, Input::Up,
Input::A, Input::B, Input::C, Input::Action,
Input::X, Input::Y, Input::Z, Input::Cancel,
Input::Menu,
Input::Items,
Input::Run,
Input::Deactivate,
Input::L, Input::R, Input::L, Input::R,
Input::Shift, Input::Ctrl, Input::Alt,
Input::F5, Input::F6, Input::F7, Input::F8, Input::F9 Input::F5, Input::F6, Input::F7, Input::F8, Input::F9
}; };

View File

@ -37,7 +37,7 @@
#include <algorithm> #include <algorithm>
#include <assert.h> #include <assert.h>
const Vec2i winSize(700, 316); const Vec2i winSize(700, 500);
const uint8_t cBgNorm = 50; const uint8_t cBgNorm = 50;
const uint8_t cBgDark = 20; const uint8_t cBgDark = 20;
@ -62,13 +62,18 @@ struct VButton
} static const vButtons[] = } static const vButtons[] =
{ {
BTN_STRING(Up), BTN_STRING(Up),
BTN_STRING(Down),
BTN_STRING(Left), BTN_STRING(Left),
BTN_STRING(Action),
BTN_STRING(Cancel),
BTN_STRING(Menu),
BTN_STRING(L),
BTN_STRING(Down),
BTN_STRING(Right), BTN_STRING(Right),
{ Input::C, "Action" }, BTN_STRING(Run),
{ Input::B, "Menu" }, BTN_STRING(Deactivate),
{ Input::A, "Run/Misc" }, BTN_STRING(Items),
{ Input::X, "Deactivate" }, BTN_STRING(R),
}; };
static elementsN(vButtons); static elementsN(vButtons);
@ -516,7 +521,6 @@ struct SettingsMenuPrivate
} }
dupWarnLabel.setVisible(haveDup); dupWarnLabel.setVisible(haveDup);
infoLabel.setVisible(!haveDup);
} }
void redraw() void redraw()
@ -962,7 +966,7 @@ SettingsMenu::SettingsMenu(RGSSThreadData &rtData)
p->rgb = p->winSurf->format; p->rgb = p->winSurf->format;
const size_t layoutW = 2; const size_t layoutW = 2;
const size_t layoutH = 4; const size_t layoutH = 6;
assert(layoutW*layoutH == vButtonsN); assert(layoutW*layoutH == vButtonsN);
const int bWidgetW = winSize.x / layoutW; const int bWidgetW = winSize.x / layoutW;
@ -1005,10 +1009,10 @@ SettingsMenu::SettingsMenu(RGSSThreadData &rtData)
/* Labels */ /* Labels */
const char *info = "Use left click to bind a slot, right click to clear its binding"; const char *info = "Use left click to bind a slot, right click to clear its binding";
p->infoLabel = Label(p, IntRect(112 + 32, buttonY + 8, winSize.x, 16), info, cText, cText, cText); p->infoLabel = Label(p, IntRect(16, 16, winSize.x, 16), info, cText, cText, cText);
const char *warn = "Warning: Same physical key bound to multiple slots"; const char *warn = "Warning: Same physical key bound to multiple slots";
p->dupWarnLabel = Label(p, IntRect(112 + 32, buttonY + 8, winSize.x, 16), warn, 255, 0, 0); p->dupWarnLabel = Label(p, IntRect(16, 40, winSize.x, 16), warn, 255, 0, 0);
p->widgets.push_back(&p->infoLabel); p->widgets.push_back(&p->infoLabel);
p->widgets.push_back(&p->dupWarnLabel); p->widgets.push_back(&p->dupWarnLabel);