MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_mouse.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_MOUSE_H_1609404927
12#define INCGUARD_MGL_MOUSE_H_1609404927
13
15#include <mgl/mgl_environment.h>
16
17namespace MGL::Input
18{
20class Mouse
21{
22public:
23 /* ------------------------------------------------------------------------- */
27 /* ------------------------------------------------------------------------- */
28 Mouse() noexcept
29 : _server(MouseServer::GetInstance())
30 {
31 }
32
33 /* ------------------------------------------------------------------------- */
38 /* ------------------------------------------------------------------------- */
39 constexpr MouseServer &GetServer() noexcept
40 {
41 return _server;
42 }
43
44 /* ------------------------------------------------------------------------- */
50 /* ------------------------------------------------------------------------- */
51 [[nodiscard]] bool IsAvailable() const noexcept
52 {
53 return _server.IsAvailable();
54 }
55
56 /* ------------------------------------------------------------------------- */
63 /* ------------------------------------------------------------------------- */
64 [[nodiscard]] bool IsPressing(MouseButton button) const noexcept
65 {
66 return _server.IsPressing(button);
67 }
68
69 /* ------------------------------------------------------------------------- */
76 /* ------------------------------------------------------------------------- */
77 [[nodiscard]] bool IsPressing(MouseButtonFlags buttonFlags) const noexcept
78 {
79 return _server.IsPressing(buttonFlags);
80 }
81
82 /* ------------------------------------------------------------------------- */
89 /* ------------------------------------------------------------------------- */
90 [[nodiscard]] bool IsPressingAny(MouseButtonFlags buttonFlags = kMouseButtonAll) const noexcept
91 {
92 return _server.IsPressingAny(buttonFlags);
93 }
94
95 /* ------------------------------------------------------------------------- */
102 /* ------------------------------------------------------------------------- */
103 [[nodiscard]] bool IsTriggered(MouseButton button) const noexcept
104 {
105 return _server.IsTriggered(button);
106 }
107
108 /* ------------------------------------------------------------------------- */
115 /* ------------------------------------------------------------------------- */
116 [[nodiscard]] bool IsReleased(MouseButton button) const noexcept
117 {
118 return _server.IsReleased(button);
119 }
120
121 /* ------------------------------------------------------------------------- */
126 /* ------------------------------------------------------------------------- */
127 [[nodiscard]] const Vector2 &GetPosition() const noexcept
128 {
129 return _server.GetPosition();
130 }
131
132 /* ------------------------------------------------------------------------- */
137 /* ------------------------------------------------------------------------- */
138 [[nodiscard]] const Vector2 &GetUVPosition() const noexcept
139 {
140 return _server.GetUVPosition();
141 }
142
143 /* ------------------------------------------------------------------------- */
148 /* ------------------------------------------------------------------------- */
149 [[nodiscard]] const Vector2 &GetDeltaMove() const noexcept
150 {
151 return _server.GetDeltaMove();
152 }
153
154 /* ------------------------------------------------------------------------- */
159 /* ------------------------------------------------------------------------- */
160 [[nodiscard]] const Vector2 &GetUVDeltaMove() const noexcept
161 {
162 return _server.GetUVDeltaMove();
163 }
164
165 /* ------------------------------------------------------------------------- */
170 /* ------------------------------------------------------------------------- */
171 void SetBounds(const Rectangle &bounds) noexcept
172 {
173 _server.SetBounds(bounds);
174 }
175
176 /* ------------------------------------------------------------------------- */
182 /* ------------------------------------------------------------------------- */
183 void SetBounds(const Rectangle &bounds, const Vector2 &logicalSize) noexcept
184 {
185 _server.SetBounds(bounds, logicalSize);
186 }
187
188 /* ------------------------------------------------------------------------- */
195 /* ------------------------------------------------------------------------- */
196 bool SetCursorMode(CursorMode cursorMode) noexcept
197 {
198 return _server.SetCursorMode(cursorMode);
199 }
200
201 /* ------------------------------------------------------------------------- */
206 /* ------------------------------------------------------------------------- */
207 [[nodiscard]] CursorMode GetCursorMode() const noexcept
208 {
209 return _server.GetCursorMode();
210 }
211
212 /* ------------------------------------------------------------------------- */
217 /* ------------------------------------------------------------------------- */
218 void SetCursorVisibleMode(CursorVisibleMode visibleMode) noexcept
219 {
220 _server.SetCursorVisibleMode(visibleMode);
221 }
222
223 /* ------------------------------------------------------------------------- */
228 /* ------------------------------------------------------------------------- */
229 [[nodiscard]] CursorVisibleMode GetCursorVisibleMode() const noexcept
230 {
231 return _server.GetCursorVisibleMode();
232 }
233
234 /* ------------------------------------------------------------------------- */
240 /* ------------------------------------------------------------------------- */
241 [[nodiscard]] constexpr bool IsConnecting() const noexcept
242 {
243 return _server.IsConnecting();
244 }
245
246private:
247 MouseServer &_server;
248};
249} // namespace MGL::Input
250
251#endif // INCGUARD_MGL_MOUSE_H_1609404927
252
253// vim: et ts=4 sw=4 sts=4
MGL マウス入力取得クラス
Definition mgl_mouse.h:21
const Vector2 & GetUVDeltaMove() const noexcept
マウスポインタの移動量をUV座標で取得
Definition mgl_mouse.h:160
bool IsReleased(MouseButton button) const noexcept
ボタンが離された瞬間を取得
Definition mgl_mouse.h:116
Mouse() noexcept
コンストラクタ
Definition mgl_mouse.h:28
constexpr MouseServer & GetServer() noexcept
マウスサーバを取得
Definition mgl_mouse.h:39
const Vector2 & GetDeltaMove() const noexcept
マウスポインタの移動量を取得
Definition mgl_mouse.h:149
void SetCursorVisibleMode(CursorVisibleMode visibleMode) noexcept
カーソルの表示モードを設定
Definition mgl_mouse.h:218
const Vector2 & GetPosition() const noexcept
マウスポインタの位置を取得
Definition mgl_mouse.h:127
bool IsTriggered(MouseButton button) const noexcept
ボタンが押された瞬間を取得
Definition mgl_mouse.h:103
bool IsPressing(MouseButtonFlags buttonFlags) const noexcept
指定したボタンが全て押されているかを取得
Definition mgl_mouse.h:77
const Vector2 & GetUVPosition() const noexcept
マウスポインタの位置をUV座標で取得
Definition mgl_mouse.h:138
constexpr bool IsConnecting() const noexcept
マウスの接続状態を取得
Definition mgl_mouse.h:241
bool IsAvailable() const noexcept
マウスサーバが有効かどうかを返す
Definition mgl_mouse.h:51
bool IsPressingAny(MouseButtonFlags buttonFlags=kMouseButtonAll) const noexcept
指定したボタンのいずれかが押されているかを取得
Definition mgl_mouse.h:90
void SetBounds(const Rectangle &bounds) noexcept
マウスの入力範囲を設定
Definition mgl_mouse.h:171
bool SetCursorMode(CursorMode cursorMode) noexcept
カーソルモードを設定
Definition mgl_mouse.h:196
CursorMode GetCursorMode() const noexcept
カーソルモードを取得
Definition mgl_mouse.h:207
void SetBounds(const Rectangle &bounds, const Vector2 &logicalSize) noexcept
マウスの入力範囲を疑似サイズで設定
Definition mgl_mouse.h:183
CursorVisibleMode GetCursorVisibleMode() const noexcept
カーソルの表示モードを取得
Definition mgl_mouse.h:229
bool IsPressing(MouseButton button) const noexcept
ボタンが押されているかを取得
Definition mgl_mouse.h:64
マウスサーバクラス
Definition mgl_mouse_server.h:30
constexpr bool IsConnecting() const noexcept
マウスの接続状態を取得
Definition mgl_mouse_server.h:77
const Vector2 & GetDeltaMove() const noexcept
マウスポインタの移動量を取得
Definition mgl_mouse_server.cc:230
bool IsPressing(MouseButton button) const noexcept
ボタンが押されているかを取得
Definition mgl_mouse_server.cc:138
bool IsPressingAny(MouseButtonFlags buttonFlags=kMouseButtonAll) const noexcept
指定したボタンが全て押されているかを取得
Definition mgl_mouse_server.cc:166
bool IsTriggered(MouseButton button) const noexcept
ボタンが押された瞬間を取得
Definition mgl_mouse_server.cc:180
const Vector2 & GetUVPosition() const noexcept
マウスポインタの位置をUV座標で取得
Definition mgl_mouse_server.cc:218
bool SetCursorMode(CursorMode cursorMode) noexcept
カーソルモードを設定
Definition mgl_mouse_server.cc:283
bool IsAvailable() const noexcept
マウスサーバが有効かどうかを返す
Definition mgl_mouse_server.h:45
CursorMode GetCursorMode() const noexcept
カーソルモードを取得
Definition mgl_mouse_server.cc:300
CursorVisibleMode GetCursorVisibleMode() const noexcept
カーソルの表示モードを取得
Definition mgl_mouse_server.cc:332
void SetCursorVisibleMode(CursorVisibleMode visibleMode) noexcept
カーソルの表示モードを設定
Definition mgl_mouse_server.cc:317
const Vector2 & GetPosition() const noexcept
マウスポインタの位置を取得
Definition mgl_mouse_server.cc:206
void SetBounds(const Rectangle &bounds) noexcept
マウスの入力範囲を設定
Definition mgl_mouse_server.cc:254
const Vector2 & GetUVDeltaMove() const noexcept
マウスポインタの移動量をUV座標で取得
Definition mgl_mouse_server.cc:242
bool IsReleased(MouseButton button) const noexcept
ボタンが離された瞬間を取得
Definition mgl_mouse_server.cc:194
MGL 環境定義
MGL マウスサーバ
CursorVisibleMode
表示設定
Definition mgl_mouse_state.h:75
MouseButton
マウスボタン
Definition mgl_mouse_state.h:23
CursorMode
カーソルモード
Definition mgl_mouse_state.h:67
矩形
Definition mgl_rectangle.h:20
2Dベクトル
Definition mgl_vector2.h:23