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-08-01 11:01:49 -03:00
|
|
|
}
|
2024-05-21 20:43:37 -03:00
|
|
|
|
2024-07-31 22:31:08 -03:00
|
|
|
void Mouse::Initialize(intptr_t handle) {
|
2024-06-22 11:52:21 -03:00
|
|
|
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
|
|
|
}
|
2024-08-01 11:02:15 -03:00
|
|
|
|
2024-08-01 11:01:49 -03:00
|
|
|
void Mouse::SetPosition(Int x, Int y) {
|
|
|
|
SetCursorPos(x, y);
|
|
|
|
}
|
2024-04-16 19:27:05 -03:00
|
|
|
}
|