Skip to content

Commit

Permalink
Merge branch '2.6.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher committed Dec 7, 2024
2 parents 98ab51b + bf46eaa commit 4fec0d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 43 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defaults:

jobs:
build:
name: ${{matrix.platform.name}} ${{matrix.config.name}} ${{matrix.type.name}}
name: ${{matrix.platform.name}} ${{matrix.config.name}} ${{matrix.type.name}} ImGui ${{matrix.imgui.version}}
runs-on: ${{matrix.platform.os}}

strategy:
Expand All @@ -36,6 +36,9 @@ jobs:
type:
- { name: Release }
- { name: Debug }
imgui:
- { version: 1.89, flags: -DIMGUI_SFML_DISABLE_OBSOLETE_FUNCTIONS=ON }
- { version: 1.91.5 }

steps:
- name: Get CMake and Ninja
Expand All @@ -55,7 +58,7 @@ jobs:
with:
repository: ocornut/imgui
path: imgui
ref: v1.89
ref: v${{matrix.imgui.version}}

- name: Checkout SFML
uses: actions/checkout@v4
Expand Down Expand Up @@ -95,9 +98,9 @@ jobs:
-DIMGUI_SFML_BUILD_EXAMPLES=ON \
-DIMGUI_SFML_BUILD_TESTING=ON \
-DIMGUI_SFML_ENABLE_WARNINGS=ON \
-DIMGUI_SFML_DISABLE_OBSOLETE_FUNCTIONS=ON \
${{matrix.platform.flags}} \
${{matrix.config.flags}}
${{matrix.config.flags}} \
${{matrix.imgui.flags}}
- name: Build ImGui-SFML
run: cmake --build imgui-sfml/build --config ${{matrix.type.name}} --target install
Expand Down
45 changes: 6 additions & 39 deletions imgui-SFML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,37 +702,10 @@ 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);
assert(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)
Expand Down Expand Up @@ -1027,18 +1000,12 @@ void RenderDrawLists(ImDrawData* draw_data)
const ImDrawList* cmd_list = draw_data->CmdLists[n];
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)));
glTexCoordPointer(2,
GL_FLOAT,
sizeof(ImDrawVert),
(const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, uv)));
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + offsetof(ImDrawVert, pos)));
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (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++)
{
Expand Down

0 comments on commit 4fec0d0

Please sign in to comment.