diff --git a/src/Platform.Win32/MouseWin32.cpp b/src/Platform.Win32/MouseWin32.cpp index 6aa4b2c72..44962106a 100644 --- a/src/Platform.Win32/MouseWin32.cpp +++ b/src/Platform.Win32/MouseWin32.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2013-2016 mogemimi. Distributed under the MIT license. #include "MouseWin32.hpp" +#include "Pomdog/Input/MouseButtons.hpp" #include "Pomdog/Utility/Assert.hpp" namespace Pomdog { @@ -28,6 +29,7 @@ void MouseWin32::HandleMessage(const RAWMOUSE& mouse) GetCursorPos(&cursorPos); ScreenToClient(windowHandle, &cursorPos); state.Position = Point2D{ cursorPos.x, cursorPos.y }; + Mouse::Moved(state.Position); } else if (mouse.usFlags & MOUSE_MOVE_ABSOLUTE) { previousState.Position = state.Position; @@ -37,11 +39,13 @@ void MouseWin32::HandleMessage(const RAWMOUSE& mouse) GetCursorPos(&cursorPos); ScreenToClient(windowHandle, &cursorPos); state.Position = Point2D{ cursorPos.x, cursorPos.y }; + Mouse::Moved(state.Position); } if (mouse.usButtonFlags & RI_MOUSE_WHEEL) { previousState.ScrollWheel = state.ScrollWheel; state.ScrollWheel += *(SHORT*)(&mouse.usButtonData); + Mouse::ScrollWheel(state.ScrollWheel - previousState.ScrollWheel); } // Not implemented @@ -52,46 +56,56 @@ void MouseWin32::HandleMessage(const RAWMOUSE& mouse) if (mouse.usButtonFlags & RI_MOUSE_BUTTON_1_DOWN) { previousState.LeftButton = state.LeftButton; state.LeftButton = ButtonState::Pressed; + Mouse::ButtonDown(MouseButtons::LeftButton); } else if (mouse.usButtonFlags & RI_MOUSE_BUTTON_1_UP) { previousState.LeftButton = state.LeftButton; state.LeftButton = ButtonState::Released; + Mouse::ButtonUp(MouseButtons::LeftButton); } if (mouse.usButtonFlags & RI_MOUSE_BUTTON_2_DOWN) { previousState.RightButton = state.RightButton; state.RightButton = ButtonState::Pressed; + Mouse::ButtonDown(MouseButtons::RightButton); } else if (mouse.usButtonFlags & RI_MOUSE_BUTTON_2_UP) { previousState.RightButton = state.RightButton; state.RightButton = ButtonState::Released; + Mouse::ButtonUp(MouseButtons::RightButton); } if (mouse.usButtonFlags & RI_MOUSE_BUTTON_3_DOWN) { previousState.MiddleButton = state.MiddleButton; state.MiddleButton = ButtonState::Pressed; + Mouse::ButtonDown(MouseButtons::MiddleButton); } else if (mouse.usButtonFlags & RI_MOUSE_BUTTON_3_UP) { previousState.MiddleButton = state.MiddleButton; state.MiddleButton = ButtonState::Released; + Mouse::ButtonUp(MouseButtons::MiddleButton); } if (mouse.usButtonFlags & RI_MOUSE_BUTTON_4_DOWN) { previousState.XButton1 = state.XButton1; state.XButton1 = ButtonState::Pressed; + Mouse::ButtonDown(MouseButtons::XButton1); } else if (mouse.usButtonFlags & RI_MOUSE_BUTTON_4_UP) { previousState.XButton1 = state.XButton1; state.XButton1 = ButtonState::Released; + Mouse::ButtonUp(MouseButtons::XButton1); } if (mouse.usButtonFlags & RI_MOUSE_BUTTON_5_DOWN) { previousState.XButton2 = state.XButton2; state.XButton2 = ButtonState::Pressed; + Mouse::ButtonDown(MouseButtons::XButton2); } else if (mouse.usButtonFlags & RI_MOUSE_BUTTON_5_UP) { previousState.XButton2 = state.XButton2; state.XButton2 = ButtonState::Released; + Mouse::ButtonUp(MouseButtons::XButton2); } }