MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_keyboard.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_KEYBOARD_H_1609136230
12#define INCGUARD_MGL_KEYBOARD_H_1609136230
13
15#include <mgl/mgl_environment.h>
16
17namespace MGL::Input
18{
21{
22public:
23 /* ------------------------------------------------------------------------- */
27 /* ------------------------------------------------------------------------- */
28 Keyboard() noexcept
29 : _server(KeyboardServer::GetInstance())
30 {}
31
32 /* ------------------------------------------------------------------------- */
37 /* ------------------------------------------------------------------------- */
38 constexpr KeyboardServer &GetServer() noexcept
39 {
40 return _server;
41 }
42
43 /* ------------------------------------------------------------------------- */
49 /* ------------------------------------------------------------------------- */
50 [[nodiscard]] bool IsAvailable() const noexcept
51 {
52 return _server.IsAvailable();
53 }
54
55 /* ------------------------------------------------------------------------- */
62 /* ------------------------------------------------------------------------- */
63 [[nodiscard]] bool IsPressing(Keycode keycode) const noexcept
64 {
65 return _server.IsPressing(keycode);
66 }
67
68 /* ------------------------------------------------------------------------- */
75 /* ------------------------------------------------------------------------- */
76 [[nodiscard]] bool IsTriggered(Keycode keycode) const noexcept
77 {
78 return _server.IsTriggered(keycode);
79 }
80
81 /* ------------------------------------------------------------------------- */
88 /* ------------------------------------------------------------------------- */
89 [[nodiscard]] bool IsReleased(Keycode keycode) const noexcept
90 {
91 return _server.IsReleased(keycode);
92 }
93
94 /* ------------------------------------------------------------------------- */
101 /* ------------------------------------------------------------------------- */
102 [[nodiscard]] bool IsARepeat(Keycode keycode) const noexcept
103 {
104 return _server.IsARepeat(keycode);
105 }
106
107 /* ------------------------------------------------------------------------- */
112 /* ------------------------------------------------------------------------- */
113 constexpr void SetRepeatSetting(const RepeatSetting &repeatSetting) noexcept
114 {
115 _server.SetRepeatSetting(repeatSetting);
116 }
117
118 /* ------------------------------------------------------------------------- */
123 /* ------------------------------------------------------------------------- */
124 [[nodiscard]] constexpr const RepeatSetting &GetRepeatSetting() const noexcept
125 {
126 return _server.GetRepeatSetting();
127 }
128
129 /* ------------------------------------------------------------------------- */
135 /* ------------------------------------------------------------------------- */
136 [[nodiscard]] constexpr bool IsConnecting() const noexcept
137 {
138 return _server.IsConnecting();
139 }
140
141private:
142 KeyboardServer &_server;
143};
144} // namespace MGL::Input
145
146#endif // INCGUARD_MGL_KEYBOARD_H_1609136230
147
148// vim: et ts=4 sw=4 sts=4
キーボード入力取得クラス
Definition mgl_keyboard.h:21
constexpr KeyboardServer & GetServer() noexcept
キーボードサーバの取得
Definition mgl_keyboard.h:38
constexpr const RepeatSetting & GetRepeatSetting() const noexcept
リピート入力の設定状態を取得
Definition mgl_keyboard.h:124
Keyboard() noexcept
コンストラクタ
Definition mgl_keyboard.h:28
bool IsTriggered(Keycode keycode) const noexcept
指定したキーが押された瞬間を取得
Definition mgl_keyboard.h:76
constexpr void SetRepeatSetting(const RepeatSetting &repeatSetting) noexcept
リピート入力を設定
Definition mgl_keyboard.h:113
bool IsPressing(Keycode keycode) const noexcept
指定したキーが押されているかを取得
Definition mgl_keyboard.h:63
bool IsReleased(Keycode keycode) const noexcept
指定したキーが離された瞬間を取得
Definition mgl_keyboard.h:89
bool IsARepeat(Keycode keycode) const noexcept
指定したキーのリピート入力状態を取得
Definition mgl_keyboard.h:102
constexpr bool IsConnecting() const noexcept
キーボードが接続されているかを取得
Definition mgl_keyboard.h:136
bool IsAvailable() const noexcept
キーボードサーバが有効かどうかを返す
Definition mgl_keyboard.h:50
キーボードサーバ
Definition mgl_keyboard_server.h:28
bool IsTriggered(Keycode keycode) const noexcept
指定したキーが押された瞬間を取得
Definition mgl_keyboard_server.cc:87
bool IsAvailable() const noexcept
キーボードサーバが有効かどうかを返す
Definition mgl_keyboard_server.h:43
constexpr bool IsConnecting() const noexcept
キーボードが接続されているかを取得
Definition mgl_keyboard_server.h:82
bool IsReleased(Keycode keycode) const noexcept
指定したキーが離された瞬間を取得
Definition mgl_keyboard_server.cc:103
bool IsARepeat(Keycode keycode) const noexcept
指定したキーのリピート入力状態を取得
Definition mgl_keyboard_server.cc:119
constexpr const RepeatSetting & GetRepeatSetting() const noexcept
リピート入力の設定状態を取得
Definition mgl_keyboard_server.h:70
bool IsPressing(Keycode keycode) const noexcept
指定したキーが押されているかを取得
Definition mgl_keyboard_server.cc:73
constexpr void SetRepeatSetting(const RepeatSetting &repeatSetting) noexcept
リピート入力を設定
Definition mgl_keyboard_server.h:59
MGL 環境定義
Keycode
キーボード用コード
Definition mgl_keyboard_keycode.h:23
MGL キーボードサーバ
リピート設定
Definition mgl_input_repeat.h:25