YSTest: Keys.h 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
Keys.h
浏览该文件的文档.
1 ﻿/*
2 Copyright (C) by Franksoft 2012.
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_KEYS_H_
29 #define YCL_INC_KEYS_H_ 1
30
31 #include "ycommon.h"
32 #include <bitset>
33
34 namespace platform
35 {
36
37 #if YCL_DS
38
43 yconstexpr std::size_t KeyBitsetWidth(32);
44 #elif YCL_MINGW32
45
50 yconstexpr std::size_t KeyBitsetWidth(256);
51 #else
52 # error Unsupport platform found!
53 #endif
54
61 typedef std::bitset<KeyBitsetWidth> KeyInput;
62
63
69 namespace KeyCodes
70 {
71
72 #if YCL_DS
73 typedef enum
74 {
75 A = 0,
76 B = 1,
77 Select = 2,
78 Start = 3,
79 Right = 4,
80 Left = 5,
81 Up = 6,
82 Down = 7,
83 R = 8,
84 L = 9,
85 X = 10,
86 Y = 11,
87 Touch = 12,
88 Lid = 13
89 } NativeSet;
90
91 //按键别名。
92 const NativeSet
93 Enter = A,
94 Esc = B,
95 PgUp = L,
96 PgDn = R;
97 #elif YCL_MINGW32
98 #define VK_RETURN 0x0D
99 #define VK_ESCAPE 0x1B
100 #define VK_PRIOR 0x21
101 #define VK_NEXT 0x22
102 #define VK_LEFT 0x25
103 #define VK_UP 0x26
104 #define VK_RIGHT 0x27
105 #define VK_DOWN 0x28
106
111 typedef enum
112 {
113 Empty = 0,
114 Enter = VK_RETURN,
115 Esc = VK_ESCAPE,
116 PgUp = VK_PRIOR,
117 PgDn = VK_NEXT,
118 Left = VK_LEFT,
119 Up = VK_UP,
120 Right = VK_RIGHT,
121 Down = VK_DOWN
122 } NativeSet;
124 #undef VK_RETURN
125 #undef VK_ESCAPE
126 #undef VK_PRIOR
127 #undef VK_NEXT
128 #undef VK_LEFT
129 #undef VK_UP
130 #undef VK_RIGHT
131 #undef VK_DOWN
132 #else
133 # error Unsupport platform found!
134 #endif
135
136 } // namespace KeyCodes;
137
138 } // namespace platform_ex;
139
140 #endif
141