Skip to content

Commit c77f8ba

Browse files
authored
Fix ImGuiKey enum usage (#219)
ImGui changed how keyboard is handled. there's no ImGuiKey_ enum anymore
1 parent e0bf635 commit c77f8ba

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

imgui-SFML.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ struct WindowContext {
192192
sf::Vector2i touchPos;
193193

194194
unsigned int joystickId;
195-
ImGuiKey_ joystickMapping[sf::Joystick::ButtonCount];
195+
ImGuiKey joystickMapping[sf::Joystick::ButtonCount];
196196
StickInfo dPadInfo;
197197
StickInfo lStickInfo;
198198
StickInfo rStickInfo;
@@ -848,7 +848,7 @@ void SetJoystickMapping(int key, unsigned int joystickButton) {
848848
assert(s_currWindowCtx);
849849
// This function now expects ImGuiKey_* values.
850850
// For partial backwards compatibility, also expect some ImGuiNavInput_* values.
851-
ImGuiKey_ finalKey;
851+
ImGuiKey finalKey;
852852
switch (key) {
853853
case ImGuiNavInput_Activate:
854854
finalKey = ImGuiKey_GamepadFaceDown;
@@ -872,7 +872,7 @@ void SetJoystickMapping(int key, unsigned int joystickButton) {
872872
break;
873873
default:
874874
assert(key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END);
875-
finalKey = static_cast<ImGuiKey_>(key);
875+
finalKey = static_cast<ImGuiKey>(key);
876876
}
877877
assert(joystickButton < sf::Joystick::ButtonCount);
878878
s_currWindowCtx->joystickMapping[joystickButton] = finalKey;
@@ -1312,7 +1312,7 @@ void initDefaultJoystickMapping() {
13121312

13131313
void updateJoystickButtonState(ImGuiIO& io) {
13141314
for (int i = 0; i < sf::Joystick::ButtonCount; ++i) {
1315-
ImGuiKey_ key = s_currWindowCtx->joystickMapping[i];
1315+
ImGuiKey key = s_currWindowCtx->joystickMapping[i];
13161316
if (key != ImGuiKey_None) {
13171317
bool isPressed = sf::Joystick::isButtonPressed(s_currWindowCtx->joystickId, i);
13181318
if (s_currWindowCtx->windowHasFocus || !isPressed) {
@@ -1322,7 +1322,7 @@ void updateJoystickButtonState(ImGuiIO& io) {
13221322
}
13231323
}
13241324

1325-
void updateJoystickAxis(ImGuiIO& io, ImGuiKey_ key, sf::Joystick::Axis axis, float threshold,
1325+
void updateJoystickAxis(ImGuiIO& io, ImGuiKey key, sf::Joystick::Axis axis, float threshold,
13261326
float maxThreshold, bool inverted) {
13271327
float pos = sf::Joystick::getAxisPosition(s_currWindowCtx->joystickId, axis);
13281328
if (inverted) {
@@ -1336,7 +1336,7 @@ void updateJoystickAxis(ImGuiIO& io, ImGuiKey_ key, sf::Joystick::Axis axis, flo
13361336
}
13371337
}
13381338

1339-
void updateJoystickAxisPair(ImGuiIO& io, ImGuiKey_ key1, ImGuiKey_ key2, sf::Joystick::Axis axis,
1339+
void updateJoystickAxisPair(ImGuiIO& io, ImGuiKey key1, ImGuiKey key2, sf::Joystick::Axis axis,
13401340
float threshold, bool inverted) {
13411341
updateJoystickAxis(io, key1, axis, -threshold, -100, inverted);
13421342
updateJoystickAxis(io, key2, axis, threshold, 100, inverted);

0 commit comments

Comments
 (0)