3 #define DIRECTINPUT_VERSION 0x0800 12 static Mouse& Create(IDirectInput8& directInput,
13 const HWND windowHandle) noexcept;
17 static Mouse& Get() noexcept;
34 __forceinline
const DIMOUSESTATE& GetCurrentState()
const 38 __forceinline
const DIMOUSESTATE& GetLastState()
const 42 __forceinline std::int32_t GetX()
const 46 __forceinline std::int32_t GetY()
const 50 __forceinline std::int32_t GetWheel()
const 54 __forceinline
bool IsButtonUp(
const MouseButton button)
const 56 return (mCurrentState.rgbButtons[button] & 0x80) == 0;
58 __forceinline
bool IsButtonDown(
const MouseButton button)
const 60 return (mCurrentState.rgbButtons[button] & 0x80) != 0;
62 __forceinline
bool WasButtonUp(
const MouseButton button)
const 64 return (mLastState.rgbButtons[button] & 0x80) == 0;
66 __forceinline
bool WasButtonDown(
const MouseButton button)
const 68 return (mLastState.rgbButtons[button] & 0x80) != 0;
70 __forceinline
bool WasButtonPressedThisFrame(
const MouseButton button)
const 72 return IsButtonDown(button) && WasButtonUp(button);
74 __forceinline
bool WasButtonReleasedThisFrame(
const MouseButton button)
const 76 return IsButtonUp(button) && WasButtonDown(button);
78 __forceinline
bool IsButtonHeldDown(
const MouseButton button)
const 80 return IsButtonDown(button) && WasButtonDown(button);
84 explicit Mouse(IDirectInput8& directInput,
const HWND windowHandle);
86 IDirectInput8& mDirectInput;
87 LPDIRECTINPUTDEVICE8 mDevice{
nullptr };
88 DIMOUSESTATE mCurrentState{};
89 DIMOUSESTATE mLastState{};
92 std::int32_t mWheel{ 0 };