From 4c6f78eda4052e98a20341e5b1e1391ca295e35a Mon Sep 17 00:00:00 2001 From: superp00t Date: Fri, 6 Sep 2024 12:27:55 -0400 Subject: [PATCH] feat(ui): CSimpleTop::SetCursor --- src/ui/CSimpleTop.cpp | 10 ++++++++++ src/ui/CSimpleTop.hpp | 1 + 2 files changed, 11 insertions(+) diff --git a/src/ui/CSimpleTop.cpp b/src/ui/CSimpleTop.cpp index 78d0596..88060a8 100644 --- a/src/ui/CSimpleTop.cpp +++ b/src/ui/CSimpleTop.cpp @@ -8,6 +8,7 @@ #include "ui/CSimpleRender.hpp" #include "ui/CSimpleTexture.hpp" #include "ui/CSimpleTitleRegion.hpp" +#include "cursor/Cursor.hpp" #include #include @@ -515,6 +516,15 @@ void CSimpleTop::RegisterFrame(CSimpleFrame* frame) { this->m_frames.LinkToTail(frame); } +void CSimpleTop::SetCursor(MipBits* image) { + if (image) { + auto cursor = g_theGxDevicePtr->CursorLock(); + memcpy(cursor, image->mip[0], CURSOR_IMAGE_BYTES); + g_theGxDevicePtr->CursorUnlock(0, 0); + g_theGxDevicePtr->CursorSetVisible(1); + } +} + void CSimpleTop::ShowFrame(CSimpleFrame* frame, int32_t a3) { this->m_strata[frame->m_strata]->AddFrame(frame); frame->RegisterForEvents(a3); diff --git a/src/ui/CSimpleTop.hpp b/src/ui/CSimpleTop.hpp index 3cdab38..c7dc43c 100644 --- a/src/ui/CSimpleTop.hpp +++ b/src/ui/CSimpleTop.hpp @@ -74,6 +74,7 @@ class CSimpleTop : public CLayoutFrame { int32_t RaiseFrame(CSimpleFrame* frame, int32_t checkOcclusion); void RegisterForEvent(CSimpleFrame* frame, CSimpleEventType event, int32_t a4, uint32_t priority); void RegisterFrame(CSimpleFrame* frame); + void SetCursor(MipBits* cursorImage); void ShowFrame(CSimpleFrame* frame, int32_t a3); int32_t StartMoveOrResizeFrame(const CMouseEvent& start, MOVERESIZE_REASON reason, int32_t resize); int32_t StartMoveOrResizeFrame(CSimpleFrame* frame, MOVERESIZE_REASON reason, float startx, float starty, int32_t a6);