Skip to content

Commit

Permalink
Reduce scope of function
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher committed Oct 29, 2024
1 parent 7b6db48 commit 34a4788
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions imgui-SFML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ void setClipboardText(void* /*userData*/, const char* text)
}

// mouse cursors
void loadMouseCursor(ImGuiMouseCursor imguiCursorType, sf::Cursor::Type sfmlCursorType);
void updateMouseCursor(sf::Window& window);

// Key mappings
Expand Down Expand Up @@ -327,6 +326,8 @@ bool Init(sf::Window& window, const sf::Vector2f& displaySize, bool loadDefaultF
io.GetClipboardTextFn = getClipboardText;

// load mouse cursors
const auto loadMouseCursor = [](ImGuiMouseCursor imguiCursorType, sf::Cursor::Type sfmlCursorType)
{ s_currWindowCtx->mouseCursors[imguiCursorType] = sf::Cursor::createFromSystem(sfmlCursorType); };
loadMouseCursor(ImGuiMouseCursor_Arrow, sf::Cursor::Type::Arrow);
loadMouseCursor(ImGuiMouseCursor_TextInput, sf::Cursor::Type::Text);
loadMouseCursor(ImGuiMouseCursor_ResizeAll, sf::Cursor::Type::SizeAll);
Expand Down Expand Up @@ -1239,11 +1240,6 @@ void updateJoystickAxisState(ImGuiIO& io)
false);
}

void loadMouseCursor(ImGuiMouseCursor imguiCursorType, sf::Cursor::Type sfmlCursorType)
{
s_currWindowCtx->mouseCursors[imguiCursorType] = sf::Cursor::createFromSystem(sfmlCursorType);
}

void updateMouseCursor(sf::Window& window)
{
const ImGuiIO& io = ImGui::GetIO();
Expand Down

0 comments on commit 34a4788

Please sign in to comment.