diff --git a/src/gx/d3d/CGxDeviceD3d.cpp b/src/gx/d3d/CGxDeviceD3d.cpp index b60fc97..d28eb4e 100644 --- a/src/gx/d3d/CGxDeviceD3d.cpp +++ b/src/gx/d3d/CGxDeviceD3d.cpp @@ -334,7 +334,7 @@ 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); @@ -474,7 +474,7 @@ int32_t CGxDeviceD3d::DeviceSetFormat(const CGxFormat& format) { ShowWindow(this->m_hwnd, 0); } - // TODO + this->IDestroyD3dDevice(); if (this->m_hwnd) { DestroyWindow(this->m_hwnd); @@ -488,8 +488,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; @@ -498,6 +497,14 @@ int32_t CGxDeviceD3d::DeviceSetFormat(const CGxFormat& format) { } return 1; + } else { + CGxDevice::Log("CGxDeviceD3d::DeviceSetFormat(): unable to set format!"); + this->IDestroyD3dDevice(); + if (this->m_hwnd) { + DestroyWindow(this->m_hwnd); + } + this->m_hwnd = nullptr; + return 0; } } @@ -1249,6 +1256,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(); diff --git a/src/gx/d3d/CGxDeviceD3d.hpp b/src/gx/d3d/CGxDeviceD3d.hpp index 16c9f3e..ceeee09 100644 --- a/src/gx/d3d/CGxDeviceD3d.hpp +++ b/src/gx/d3d/CGxDeviceD3d.hpp @@ -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();