vcpkg/ports/imgui-sfml/0002-clean-deprecated-api.patch

59 lines
2.7 KiB
Diff
Raw Permalink Normal View History

2024-11-22 17:21:15 -06:00
diff --git a/imgui-SFML.cpp b/imgui-SFML.cpp
index d9c4f52..6ae99c1 100644
--- a/imgui-SFML.cpp
+++ b/imgui-SFML.cpp
@@ -867,36 +867,9 @@ void SetJoystickRTriggerThreshold(float threshold) {
void SetJoystickMapping(int key, unsigned int joystickButton) {
assert(s_currWindowCtx);
- // This function now expects ImGuiKey_* values.
- // For partial backwards compatibility, also expect some ImGuiNavInput_* values.
- ImGuiKey finalKey;
- switch (key) {
- case ImGuiNavInput_Activate:
- finalKey = ImGuiKey_GamepadFaceDown;
- break;
- case ImGuiNavInput_Cancel:
- finalKey = ImGuiKey_GamepadFaceRight;
- break;
- case ImGuiNavInput_Input:
- finalKey = ImGuiKey_GamepadFaceUp;
- break;
- case ImGuiNavInput_Menu:
- finalKey = ImGuiKey_GamepadFaceLeft;
- break;
- case ImGuiNavInput_FocusPrev:
- case ImGuiNavInput_TweakSlow:
- finalKey = ImGuiKey_GamepadL1;
- break;
- case ImGuiNavInput_FocusNext:
- case ImGuiNavInput_TweakFast:
- finalKey = ImGuiKey_GamepadR1;
- break;
- default:
- assert(key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END);
- finalKey = static_cast<ImGuiKey>(key);
- }
+ assert(key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END);
assert(joystickButton < sf::Joystick::ButtonCount);
- s_currWindowCtx->joystickMapping[joystickButton] = finalKey;
+ s_currWindowCtx->joystickMapping[joystickButton] = static_cast<ImGuiKey>(key);
}
void SetDPadXAxis(sf::Joystick::Axis dPadXAxis, bool inverted) {
@@ -1228,11 +1201,11 @@ void RenderDrawLists(ImDrawData* draw_data) {
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert),
- (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, pos)));
+ (const GLvoid*)((const char*)vtx_buffer + offsetof(ImDrawVert, pos)));
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert),
- (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, uv)));
+ (const GLvoid*)((const char*)vtx_buffer + offsetof(ImDrawVert, uv)));
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert),
- (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, col)));
+ (const GLvoid*)((const char*)vtx_buffer + offsetof(ImDrawVert, col)));
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) {
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];