MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_mouse_delegate_macos.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_MOUSE_DELEGATE_MACOS_H_1613927027
12#define INCGUARD_MGL_MOUSE_DELEGATE_MACOS_H_1613927027
13
14#include <mgl/mgl_environment.h>
15#if defined(MGL_MOUSE_DELEGATE_ENABLE_MACOS)
16
17#if defined(__OBJC__)
18#include <AppKit/NSWindow.h>
19#endif
20
23#include <mgl/event/mgl_event.h>
24
25namespace MGL::Input
26{
27#if !defined(__OBJC__)
28class NSWindow;
29#endif
30
32class MacOSMouseDelegate : public MouseDelegate
33{
34public:
35 MacOSMouseDelegate() noexcept;
36
37 void UpdateState(MouseState &state) noexcept override;
38 void PostUpdatePosition(const MouseState &state) noexcept override;
39
40 bool SetCursorMode(CursorMode cursorMode) noexcept override;
41 [[nodiscard]] CursorMode GetCursorMode() const noexcept override;
42
43 void SetCursorVisibleMode(CursorVisibleMode visibleMode) noexcept override;
44 [[nodiscard]] CursorVisibleMode GetCursorVisibleMode() const noexcept override;
45
46 /* ------------------------------------------------------------------------- */
52 /* ------------------------------------------------------------------------- */
53 [[nodiscard]] bool IsConnecting() const noexcept override
54 {
55 return true;
56 }
57
58private:
59 static void OnEventInputMouse(void *callbackArg, void *notifyArg) noexcept;
60 static void OnEventShouldClearInput(void *callbackArg, void *notifyArg) noexcept;
61
62 void UpdateButtonState(MouseButton button, bool isPressed) noexcept;
63 void UpdatePosition(const Vector2 &position) noexcept;
64 void UpdateDeltaMove(const Vector2 &deltaMove) noexcept;
65 void UpdateDeltaWheel(const Vector2 &deltaWheel) noexcept;
66
67 void UpdateCursorAutoErase(const MouseState &state, float elapsedTime) noexcept;
68 void SetVisibleCursor(bool isVisible) noexcept;
69
70 void MoveCursorToCenter(const NSWindow *window) noexcept;
71
72 bool ShouldFixCursor(const NSWindow *window) const noexcept;
73
74 Event::Handle _eventInputMouse;
75 Event::Handle _eventShouldClearInput;
76
77 MouseButtonFlags _buttonFlags;
78 MouseButtonFlags _firstFrameButtonFlags;
79 MouseButtonFlags _nextFrameReleaseFlags;
80
81 Vector2 _position;
82 Vector2 _deltaMove;
83 Vector2 _deltaWheel;
84
85 CursorMode _cursorMode;
86
87 CursorVisibleMode _cursorVisibleMode;
88 float _cursorDisplayTime;
89 bool _isVisibleCursor;
90};
91} // namespace MGL::Input
92
93#endif // MGL_MOUSE_DELEGATE_ENABLE_MACOS
94#endif // INCGUARD_MGL_MOUSE_DELEGATE_MACOS_H_1613927027
95
96// vim: et ts=4 sw=4 sts=4
MGL 環境定義
MGL イベント
MGL マウス入力デリゲート基底クラス
MGL マウスイベント定義
CursorVisibleMode
表示設定
Definition mgl_mouse_state.h:75
CursorMode
カーソルモード
Definition mgl_mouse_state.h:67
MGL::EnumBitFlags< MouseButton > MouseButtonFlags
マウスボタンの入力状態のビットフラグ型
Definition mgl_mouse_state.h:39