YSTest: Input.h 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
Input.h
浏览该文件的文档.
1 /*
2 © 2012-2014 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
35 namespace platform
36 {
37
44 #if !YCL_DS
45 # define YCL_KEY(X) (#X [0])
46 # define YCL_KEY_Start 'P'
47 #else
48 # define YCL_KEY(X) KeyCodes::X
49 # define YCL_KEY_Start 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
74 #if YF_Multithread // || ...
75 # define YCL_KEYSTATE_DIRECT 0
76 #elif defined(YCL_DS)
77 # define YCL_KEYSTATE_DIRECT 1
78 #endif
79
80
85 YF_API const platform::KeyInput&
86 FetchKeyState();
87
92 YF_API const platform::KeyInput&
93 FetchOldKeyState();
94
99 YF_API platform::KeyInput
100 FetchKeyDownState();
101
106 YF_API platform::KeyInput
107 FetchKeyUpState();
108
113 YF_API void
114 ClearKeyStates();
115
120 YF_API void
121 UpdateKeyStates();
122
123 #if YCL_KEYSTATE_DIRECT
124
128 extern YF_API platform::KeyInput KeyState, OldKeyState;
129
130 inline PDefH(const platform::KeyInput&, FetchKeyState, )
131 ImplRet(KeyState)
132
133 inline PDefH(const platform::KeyInput&, FetchOldKeyState, )
134 ImplRet(OldKeyState)
135
136 inline PDefH(void, ClearKeyStates, )
137 ImplUnseq(KeyState.reset(), OldKeyState.reset())
138
139 inline PDefH(platform::KeyInput, FetchKeyDownState, )
140 ImplRet(FetchKeyState() &~ FetchOldKeyState())
141
142 inline PDefH(platform::KeyInput, FetchKeyUpState, )
143 ImplRet((FetchKeyState() ^ FetchOldKeyState()) & ~FetchKeyState())
144
145 #endif
146
147
148 #if YCL_DS
149
153 YF_API std::pair<std::int16_t, std::int16_t>
154 FetchCursor();
155
156
161 YF_API void
162 WaitForKey(platform::KeyInput);
163
167 YF_API void
168 WaitForKeypad();
169
173 YF_API void
174 WaitForFrontKey();
175
179 YF_API void
180 WaitForFrontKeypad();
181
185 YF_API void
186 WaitForArrowKey();
187
191 YF_API void
192 WaitForABXY();
193 #elif YCL_Android
194
198 YF_API std::pair<float, float>
199 FetchCursor();
200
206 void
207 SaveInput(const ::AInputEvent&);
208 #endif
209
210 } // namespace platform_ex;
211
212 #endif
213
platform_ex::FetchKeyState
YF_API const platform::KeyInput & FetchKeyState()
取按键状态。
Definition: Input.cpp:123
ImplUnseq
#define ImplUnseq(...)
Definition: YBaseMacro.h:107
ImplRet
#define ImplRet(...)
Definition: YBaseMacro.h:97
YModules.h
YF_API
#define YF_API
Definition: Platform.h:64
platform_ex::FetchOldKeyState
YF_API const platform::KeyInput & FetchOldKeyState()
取上一次更新的按键状态。
Definition: Input.cpp:131
platform::WaitForInput
YF_API void WaitForInput()
等待任意按键。
Definition: Input.cpp:47
platform_ex::FetchKeyUpState
YF_API platform::KeyInput FetchKeyUpState()
取键释放状态。
Definition: Input.cpp:147
ystdex::reset
bool reset(std::unique_ptr< _type > &p)
Definition: memory.hpp:77
platform_ex::ClearKeyStates
YF_API void ClearKeyStates()
清除按键缓冲。
Definition: Input.cpp:155
platform_ex::FetchKeyDownState
YF_API platform::KeyInput FetchKeyDownState()
取键按下状态。
Definition: Input.cpp:139
platform_ex::UpdateKeyStates
YF_API void UpdateKeyStates()
更新按键状态。
Definition: Input.cpp:169
platform::KeyInput
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
Definition: Keys.h:68