diff --git a/client/src/app.c b/client/src/app.c index b335f18c..a3cae879 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -661,6 +661,35 @@ static inline void mergeRect(struct Rect * dest, const struct Rect * a, const st dest->h = y2 - dest->y; } +static inline LG_DSPointer mapImGuiCursor(ImGuiMouseCursor cursor) +{ + switch (cursor) + { + case ImGuiMouseCursor_None: + return LG_POINTER_NONE; + case ImGuiMouseCursor_Arrow: + return LG_POINTER_ARROW; + case ImGuiMouseCursor_TextInput: + return LG_POINTER_INPUT; + case ImGuiMouseCursor_ResizeAll: + return LG_POINTER_MOVE; + case ImGuiMouseCursor_ResizeNS: + return LG_POINTER_RESIZE_NS; + case ImGuiMouseCursor_ResizeEW: + return LG_POINTER_RESIZE_EW; + case ImGuiMouseCursor_ResizeNESW: + return LG_POINTER_RESIZE_NESW; + case ImGuiMouseCursor_ResizeNWSE: + return LG_POINTER_RESIZE_NWSE; + case ImGuiMouseCursor_Hand: + return LG_POINTER_HAND; + case ImGuiMouseCursor_NotAllowed: + return LG_POINTER_NOT_ALLOWED; + default: + return LG_POINTER_ARROW; + } +} + int app_renderOverlay(struct Rect * rects, int maxRects) { int totalRects = 0; @@ -675,6 +704,16 @@ int app_renderOverlay(struct Rect * rects, int maxRects) totalDamage = true; ImDrawList_AddRectFilled(igGetBackgroundDrawListNil(), (ImVec2) { 0.0f , 0.0f }, g_state.io->DisplaySize, 0xCC000000, 0, 0); + + bool test; + igShowDemoWindow(&test); + + ImGuiMouseCursor cursor = igGetMouseCursor(); + if (cursor != g_state.cursorLast) + { + g_state.ds->setPointer(mapImGuiCursor(cursor)); + g_state.cursorLast = cursor; + } } // render the overlays diff --git a/client/src/keybind.c b/client/src/keybind.c index cc02f084..94831b31 100644 --- a/client/src/keybind.c +++ b/client/src/keybind.c @@ -136,6 +136,7 @@ static void bind_passthrough(int sc, void * opaque) static void bind_toggleOverlay(int sc, void * opaque) { g_state.overlayInput ^= true; + g_state.cursorLast = -2; if (g_state.overlayInput) { g_state.io->ConfigFlags &= ~ImGuiConfigFlags_NoMouse; diff --git a/client/src/main.c b/client/src/main.c index aab59369..c30c7abe 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -780,6 +780,8 @@ static int lg_run(void) g_state.io = igGetIO(); g_state.style = igGetStyle(); + g_state.io->BackendFlags |= ImGuiBackendFlags_HasMouseCursors; + g_state.windowScale = 1.0; g_state.fontName = util_getUIFont(g_params.uiFont); DEBUG_INFO("Using font: %s", g_state.fontName); diff --git a/client/src/main.h b/client/src/main.h index 01e73cee..18ea70fd 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -48,12 +48,13 @@ struct AppState { enum RunState state; - ImGuiIO * io; - ImGuiStyle * style; - struct ll * overlays; - char * fontName; - ImFont * fontLarge; - bool overlayInput; + ImGuiIO * io; + ImGuiStyle * style; + struct ll * overlays; + char * fontName; + ImFont * fontLarge; + bool overlayInput; + ImGuiMouseCursor cursorLast; bool alertShow; char * alertMessage;