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

Remove implementações em Mouse::PlatformImplementation e add SetPosition

This commit is contained in:
Danilo 2024-08-01 11:01:49 -03:00
parent 73eb32b44f
commit 1805fbca97
3 changed files with 12 additions and 26 deletions

View File

@ -14,23 +14,7 @@ namespace xna {
mstate.ScroolWheelValue = state.scrollWheelValue; mstate.ScroolWheelValue = state.scrollWheelValue;
return mstate; return mstate;
} }
bool Mouse::PlatformImplementation::IsConnected() const {
return _dxMouse->IsConnected();
}
bool Mouse::PlatformImplementation::IsVisible() const {
return _dxMouse->IsVisible();
}
void Mouse::PlatformImplementation::IsVisible(bool value) const {
_dxMouse->SetVisible(value);
}
void Mouse::PlatformImplementation::ResetScrollWheel() const {
_dxMouse->ResetScrollWheelValue();
}
void Mouse::Initialize(intptr_t handle) { void Mouse::Initialize(intptr_t handle) {
impl = unew<PlatformImplementation>(); impl = unew<PlatformImplementation>();
@ -44,4 +28,9 @@ namespace xna {
impl->_dxMouse->SetWindow(hwnd); impl->_dxMouse->SetWindow(hwnd);
} }
//Sets the position of the mouse cursor relative to the upper - left corner of the window.
void Mouse::SetPosition(Int x, Int y) {
SetCursorPos(x, y);
}
} }

View File

@ -38,7 +38,9 @@ namespace xna {
//Gets or sets the window used for mouse processing. //Gets or sets the window used for mouse processing.
//Mouse coordinates returned by GetState are relative to the upper-left corner of this window. //Mouse coordinates returned by GetState are relative to the upper-left corner of this window.
static void WindowHandle(intptr_t value); static void WindowHandle(intptr_t value);
static void SetPosition(Int x, Int y);
private: private:
friend class Game; friend class Game;

View File

@ -645,18 +645,13 @@ namespace xna {
struct Mouse::PlatformImplementation { struct Mouse::PlatformImplementation {
PlatformImplementation() { PlatformImplementation() {
_dxMouse = unew<DirectX::Mouse>(); _dxMouse = unew<DirectX::Mouse>();
} }
void ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam) const { inline void ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam) const {
if (_dxMouse) if (_dxMouse)
_dxMouse->ProcessMessage(message, wParam, lParam); _dxMouse->ProcessMessage(message, wParam, lParam);
} }
bool IsConnected() const;
bool IsVisible() const;
void IsVisible(bool value) const;
void ResetScrollWheel() const;
uptr<DirectX::Mouse> _dxMouse = nullptr; uptr<DirectX::Mouse> _dxMouse = nullptr;
}; };