feat(ui): CSimpleTop::SetCursor

This commit is contained in:
superp00t 2024-09-06 12:27:55 -04:00
parent 671fd73fd3
commit 4c6f78eda4
2 changed files with 11 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#include "ui/CSimpleRender.hpp"
#include "ui/CSimpleTexture.hpp"
#include "ui/CSimpleTitleRegion.hpp"
#include "cursor/Cursor.hpp"
#include <cstring>
#include <tempest/Math.hpp>
@ -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);

View File

@ -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);