1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00

35 lines
926 B
C++
Raw Permalink Normal View History

2024-07-13 22:55:36 -03:00
#include "xna/xna-dx.hpp"
2024-04-16 19:27:05 -03:00
namespace xna {
2024-05-21 20:43:37 -03:00
MouseState Mouse::GetState() {
const auto state = impl->_dxMouse->GetState();
MouseState mstate;
mstate.LeftButton = static_cast<ButtonState>(state.leftButton);
mstate.RightButton = static_cast<ButtonState>(state.rightButton);
mstate.MiddleButton = static_cast<ButtonState>(state.middleButton);
mstate.XButton1 = static_cast<ButtonState>(state.xButton1);
mstate.XButton2 = static_cast<ButtonState>(state.xButton2);
mstate.X = state.x;
mstate.Y = state.y;
mstate.ScroolWheelValue = state.scrollWheelValue;
return mstate;
}
2024-05-21 20:43:37 -03:00
2024-07-31 22:31:08 -03:00
void Mouse::Initialize(intptr_t handle) {
impl = unew<PlatformImplementation>();
2024-07-31 22:31:08 -03:00
windowHandle = handle;
}
void Mouse::WindowHandle(intptr_t value) {
auto hwnd = reinterpret_cast<HWND>(value);
if (!hwnd) return;
impl->_dxMouse->SetWindow(hwnd);
2024-05-21 20:43:37 -03:00
}
void Mouse::SetPosition(Int x, Int y) {
SetCursorPos(x, y);
}
2024-04-16 19:27:05 -03:00
}