Skip to content

Commit ee754ac

Browse files
committed
Upgrade to new SFML 3 sf::Cursor API
1 parent 7758bfd commit ee754ac

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

imgui-SFML.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ struct WindowContext {
191191
TriggerInfo lTriggerInfo;
192192
TriggerInfo rTriggerInfo;
193193

194-
sf::Cursor mouseCursors[ImGuiMouseCursor_COUNT];
195-
bool mouseCursorLoaded[ImGuiMouseCursor_COUNT] = {ImGuiKey_None};
194+
std::optional<sf::Cursor> mouseCursors[ImGuiMouseCursor_COUNT];
196195

197196
#ifdef ANDROID
198197
#ifdef USE_JNI
@@ -1065,8 +1064,7 @@ const char* getClipboardText(void* /*userData*/) {
10651064
}
10661065

10671066
void loadMouseCursor(ImGuiMouseCursor imguiCursorType, sf::Cursor::Type sfmlCursorType) {
1068-
s_currWindowCtx->mouseCursorLoaded[imguiCursorType] =
1069-
s_currWindowCtx->mouseCursors[imguiCursorType].loadFromSystem(sfmlCursorType);
1067+
s_currWindowCtx->mouseCursors[imguiCursorType] = sf::Cursor::loadFromSystem(sfmlCursorType);
10701068
}
10711069

10721070
void updateMouseCursor(sf::Window& window) {
@@ -1078,9 +1076,9 @@ void updateMouseCursor(sf::Window& window) {
10781076
} else {
10791077
window.setMouseCursorVisible(true);
10801078

1081-
const sf::Cursor& c = s_currWindowCtx->mouseCursorLoaded[cursor] ?
1082-
s_currWindowCtx->mouseCursors[cursor] :
1083-
s_currWindowCtx->mouseCursors[ImGuiMouseCursor_Arrow];
1079+
const sf::Cursor& c = s_currWindowCtx->mouseCursors[cursor] ?
1080+
*s_currWindowCtx->mouseCursors[cursor] :
1081+
*s_currWindowCtx->mouseCursors[ImGuiMouseCursor_Arrow];
10841082
window.setMouseCursor(c);
10851083
}
10861084
}

0 commit comments

Comments
 (0)