mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
Co-authored-by: Philip Rebohle <philip.rebohle@tu-dortmund.de> Co-authored-by: Robin Kertels <robin.kertels@gmail.com> Co-authored-by: pchome <pchome@users.noreply.github.com> Co-authored-by: Christopher Egert <cme3000@gmail.com> Co-authored-by: Derek Lesho <dereklesho52@Gmail.com> Co-authored-by: Luis Cáceres <lacaceres97@gmail.com> Co-authored-by: Nelson Chen <crazysim@gmail.com> Co-authored-by: Edmondo Tommasina <edmondo.tommasina@gmail.com> Co-authored-by: Riesi <riesi@opentrash.com> Co-authored-by: gbMichelle <gbmichelle.dev@gmail.com>
42 lines
977 B
C++
42 lines
977 B
C++
#include "d3d9_cursor.h"
|
|
|
|
#include <utility>
|
|
|
|
namespace dxvk {
|
|
|
|
void D3D9Cursor::UpdateCursor(int X, int Y) {
|
|
::SetCursorPos(X, Y);
|
|
}
|
|
|
|
|
|
BOOL D3D9Cursor::ShowCursor(BOOL bShow) {
|
|
::SetCursor(bShow ? m_hCursor : nullptr);
|
|
return std::exchange(m_visible, bShow);
|
|
}
|
|
|
|
|
|
HRESULT D3D9Cursor::SetHardwareCursor(UINT XHotSpot, UINT YHotSpot, const CursorBitmap& bitmap) {
|
|
DWORD mask[32];
|
|
std::memset(mask, ~0, sizeof(mask));
|
|
|
|
ICONINFO info;
|
|
info.fIcon = FALSE;
|
|
info.xHotspot = XHotSpot;
|
|
info.yHotspot = YHotSpot;
|
|
info.hbmMask = ::CreateBitmap(HardwareCursorWidth, HardwareCursorHeight, 1, 1, mask);
|
|
info.hbmColor = ::CreateBitmap(HardwareCursorWidth, HardwareCursorHeight, 1, 32, &bitmap[0]);
|
|
|
|
if (m_hCursor != nullptr)
|
|
::DestroyCursor(m_hCursor);
|
|
|
|
m_hCursor = ::CreateIconIndirect(&info);
|
|
|
|
::DeleteObject(info.hbmMask);
|
|
::DeleteObject(info.hbmColor);
|
|
|
|
ShowCursor(m_visible);
|
|
|
|
return D3D_OK;
|
|
}
|
|
|
|
} |