fix(d3d): fix hardware cursor

This commit is contained in:
VDm 2024-12-11 00:20:01 +04:00
parent 6f108b3067
commit 5fb8536fce
4 changed files with 16 additions and 4 deletions

@ -1 +1 @@
Subproject commit 9722c1e8c35e14e57f9a4f1e45806d8237df957b
Subproject commit 22e9686d64db308a9b480ecf6e1fba43c2563315

View File

@ -274,6 +274,7 @@ void ConsoleDeviceInitialize(const char* title) {
s_requestedFormat.hwTnL = true;
// TODO
s_requestedFormat.hwCursor = true;
CGxFormat format;
memcpy(&format, &s_requestedFormat, sizeof(s_requestedFormat));

View File

@ -334,11 +334,17 @@ LRESULT CGxDeviceD3d::WindowProcD3d(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
case WM_SETCURSOR: {
if (device) {
if (device->m_d3dDevice && lParam == 1) {
if (device->m_d3dDevice && LOWORD(lParam) == HTCLIENT) {
SetCursor(nullptr);
BOOL show = device->m_cursorVisible && device->m_hardwareCursor ? TRUE : FALSE;
device->m_d3dDevice->ShowCursor(show);
} else {
// Uncomment when the "glove" cursor will be fixed
//break;
}
} else {
// Uncomment when the "glove" cursor will be fixed
//break;
}
return 1;
@ -488,8 +494,7 @@ int32_t CGxDeviceD3d::DeviceSetFormat(const CGxFormat& format) {
if (this->ICreateWindow(createFormat) && this->ICreateD3dDevice(createFormat) && this->CGxDevice::DeviceSetFormat(format)) {
this->intF64 = 1;
// TODO
this->m_hwCursorNeedsUpdate = 1;
if (this->m_format.window == 0) {
RECT windowRect;
@ -1249,6 +1254,11 @@ void CGxDeviceD3d::CursorSetVisible(int32_t visible) {
}
}
void CGxDeviceD3d::CursorUnlock(uint32_t x, uint32_t y) {
CGxDevice::CursorUnlock(x, y);
this->m_hwCursorNeedsUpdate = 1;
}
void CGxDeviceD3d::ICursorDraw() {
if (!this->m_hardwareCursor) {
this->ISceneBegin();

View File

@ -252,6 +252,7 @@ class CGxDeviceD3d : public CGxDevice {
virtual void ICursorDestroy();
virtual void ICursorDraw();
virtual void CursorSetVisible(int32_t visible);
virtual void CursorUnlock(uint32_t x, uint32_t y);
virtual int32_t DeviceCreate(int32_t (*windowProc)(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam), const CGxFormat& format);
virtual int32_t DeviceSetFormat(const CGxFormat& format);
virtual void* DeviceWindow();