mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 03:02:30 +00:00
feat(d3d): add hardware cursor support
This commit is contained in:
parent
c4a516c44d
commit
d80e2b4b4f
2 changed files with 17 additions and 4 deletions
|
|
@ -334,7 +334,7 @@ LRESULT CGxDeviceD3d::WindowProcD3d(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
case WM_SETCURSOR: {
|
case WM_SETCURSOR: {
|
||||||
if (device) {
|
if (device) {
|
||||||
if (device->m_d3dDevice && lParam == 1) {
|
if (device->m_d3dDevice && LOWORD(lParam) == HTCLIENT) {
|
||||||
SetCursor(nullptr);
|
SetCursor(nullptr);
|
||||||
BOOL show = device->m_cursorVisible && device->m_hardwareCursor ? TRUE : FALSE;
|
BOOL show = device->m_cursorVisible && device->m_hardwareCursor ? TRUE : FALSE;
|
||||||
device->m_d3dDevice->ShowCursor(show);
|
device->m_d3dDevice->ShowCursor(show);
|
||||||
|
|
@ -474,7 +474,7 @@ int32_t CGxDeviceD3d::DeviceSetFormat(const CGxFormat& format) {
|
||||||
ShowWindow(this->m_hwnd, 0);
|
ShowWindow(this->m_hwnd, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
this->IDestroyD3dDevice();
|
||||||
|
|
||||||
if (this->m_hwnd) {
|
if (this->m_hwnd) {
|
||||||
DestroyWindow(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)) {
|
if (this->ICreateWindow(createFormat) && this->ICreateD3dDevice(createFormat) && this->CGxDevice::DeviceSetFormat(format)) {
|
||||||
this->intF64 = 1;
|
this->intF64 = 1;
|
||||||
|
this->m_hwCursorNeedsUpdate = 1;
|
||||||
// TODO
|
|
||||||
|
|
||||||
if (this->m_format.window == 0) {
|
if (this->m_format.window == 0) {
|
||||||
RECT windowRect;
|
RECT windowRect;
|
||||||
|
|
@ -498,6 +497,14 @@ int32_t CGxDeviceD3d::DeviceSetFormat(const CGxFormat& format) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
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() {
|
void CGxDeviceD3d::ICursorDraw() {
|
||||||
if (!this->m_hardwareCursor) {
|
if (!this->m_hardwareCursor) {
|
||||||
this->ISceneBegin();
|
this->ISceneBegin();
|
||||||
|
|
|
||||||
|
|
@ -252,6 +252,7 @@ class CGxDeviceD3d : public CGxDevice {
|
||||||
virtual void ICursorDestroy();
|
virtual void ICursorDestroy();
|
||||||
virtual void ICursorDraw();
|
virtual void ICursorDraw();
|
||||||
virtual void CursorSetVisible(int32_t visible);
|
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 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 int32_t DeviceSetFormat(const CGxFormat& format);
|
||||||
virtual void* DeviceWindow();
|
virtual void* DeviceWindow();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue