YSTest: Input.h 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

Input.h
浏览该文件的文档.
1 /*
2 © 2009-2016 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YCL_INC_Inupt_h_
29 #define YCL_INC_Inupt_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YCLib_Keys
33 #include YFM_YCLib_Video // for SPos;
34 #include YFM_YCLib_Container
35
36 namespace platform
37 {
38
44 #if !YCL_DS
45 # define YCL_KEY(X) size_t(#X [0])
46 # define YCL_KEY_Start size_t('P')
47 #else
48 # define YCL_KEY(X) size_t(KeyCodes::X)
49 # define YCL_KEY_Start size_t(KeyCodes::Start)
50 #endif
51
52
56 YF_API void
57 WaitForInput();
58
59 } // namespace platform;
60
61 #if YCL_Android
62 struct AInputEvent;
64 #endif
65
66 namespace platform_ex
67 {
68
75 #if YF_Multithread // || ...
76 # define YCL_KEYSTATE_DIRECT 0
77 #elif defined(YCL_DS)
78 # define YCL_KEYSTATE_DIRECT 1
79 #endif
80
81
86 YF_API const platform::KeyInput&
87 FetchKeyState();
88
93 YF_API const platform::KeyInput&
94 FetchOldKeyState();
95
100 YF_API platform::KeyInput
101 FetchKeyDownState();
102
107 YF_API platform::KeyInput
108 FetchKeyUpState();
109
114 YF_API void
115 ClearKeyStates();
116
121 YF_API void
122 UpdateKeyStates();
123
124 #if YCL_KEYSTATE_DIRECT
125
129 extern YF_API platform::KeyInput KeyState, OldKeyState;
130
131 inline PDefH(const platform::KeyInput&, FetchKeyState, )
132 ImplRet(KeyState)
133
134 inline PDefH(const platform::KeyInput&, FetchOldKeyState, )
135 ImplRet(OldKeyState)
136
137 inline PDefH(void, ClearKeyStates, )
138 ImplUnseq(KeyState.reset(), OldKeyState.reset())
139
140 inline PDefH(platform::KeyInput, FetchKeyDownState, )
141 ImplRet(FetchKeyState() &~ FetchOldKeyState())
142
143 inline PDefH(platform::KeyInput, FetchKeyUpState, )
144 ImplRet((FetchKeyState() ^ FetchOldKeyState()) & ~FetchKeyState())
145
146 #endif
147
148
149 #if YCL_DS
150
154 YF_API pair<std::int16_t, std::int16_t>
155 FetchCursor();
156
157
162 YF_API void
163 WaitForKey(platform::KeyInput);
164
168 YF_API void
169 WaitForKeypad();
170
174 YF_API void
175 WaitForFrontKey();
176
180 YF_API void
181 WaitForFrontKeypad();
182
186 YF_API void
187 WaitForArrowKey();
188
192 YF_API void
193 WaitForABXY();
194 #elif YCL_Android
195
199 YF_API pair<float, float>
200 FetchCursor();
201
207 void
208 SaveInput(const ::AInputEvent&);
209 #endif
210
211 } // namespace platform_ex;
212
213 #endif
214
ystdex::reset
bool reset(std::unique_ptr< _type, _tDeleter > &p)
Definition: memory.hpp:708
platform
默认平台命名空间。
Definition: Container.h:47
ImplUnseq
#define ImplUnseq(...)
Definition: YBaseMacro.h:110
platform::WaitForInput
YF_API void WaitForInput()
等待任意按键。
Definition: Input.cpp:46
platform_ex::ImplRet
const char16_t *s ImplRet(platform::Nonnull(s)) inline PDefH(const u16string &
platform_ex::FetchKeyDownState
YF_API platform::KeyInput FetchKeyDownState()
取键按下状态。
Definition: Input.cpp:143
platform_ex::UpdateKeyStates
YF_API void UpdateKeyStates()
更新按键状态。
Definition: Input.cpp:170
YF_API
#define YF_API
Definition: Platform.h:56
YModules.h
platform::KeyInput
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
Definition: Keys.h:67
platform_ex::FetchOldKeyState
YF_API const platform::KeyInput & FetchOldKeyState()
取上一次更新的按键状态。
Definition: Input.cpp:135
platform_ex::FetchKeyUpState
YF_API platform::KeyInput FetchKeyUpState()
取键释放状态。
Definition: Input.cpp:151
platform_ex::ClearKeyStates
YF_API void ClearKeyStates()
清除按键缓冲。
Definition: Input.cpp:159
platform_ex
平台扩展命名空间。
Definition: Android.h:45
platform_ex::FetchKeyState
YF_API const platform::KeyInput & FetchKeyState()
取按键状态。
Definition: Input.cpp:127