Nebula
Loading...
Searching...
No Matches
key.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
13#include "core/types.h"
14#include "util/string.h"
15#include "util/dictionary.h"
16
17//------------------------------------------------------------------------------
18namespace Input
19{
20class Key
21{
22public:
24 enum Code
25 {
173
176 };
177
179 enum Group
180 {
181 Letters, // (A, B, ..., Z)
182 Numbers, // (Key_0, ..., Key_9)
183 NumPad, // (NumPad_0, ... NumPad9...+-*/)
184 FunctionKeys, // (F1, ... , F24)
185 CursorKeys, // (->,... ,<-)
186 HomeBlock // (Home, End, Prior, Next, Insert, Delete)
187 };
188
190 static Util::String ToString(Code code);
192 static uint ToDirectInput(Code key);
194 static uint ToRocket(Code key);
196 static Code FromRocket(uint key);
198 static char ToChar(Code key);
200 static Code FromString(const Util::String& str);
202 static bool IsValid(const Util::String& str);
205private:
207 static void SetupDict();
208};
209
210};
211//------------------------------------------------------------------------------
Define standard key codes.
Definition key.h:21
static uint ToDirectInput(Code key)
convert to cegui scan codes
Definition key.cc:179
static Code FromString(const Util::String &str)
convert from string
Definition key.cc:731
static Code FromRocket(uint key)
convert to rocket scan codes
Definition key.cc:501
static char ToChar(Code key)
convert to Unicode character (ASCII 0-127 for now)
Definition key.cc:651
Code
key codes
Definition key.h:25
@ BrowserForward
Definition key.h:120
@ Key7
Definition key.h:144
@ I
Definition key.h:155
@ Accept
Definition key.h:38
@ NumPad0
Definition key.h:60
@ F
Definition key.h:152
@ Execute
Definition key.h:51
@ N
Definition key.h:160
@ Left
Definition key.h:45
@ RightShift
Definition key.h:114
@ Underbar
Definition key.h:110
@ LaunchMail
Definition key.h:133
@ LeftMenu
Definition key.h:117
@ MediaStop
Definition key.h:131
@ Comma
Definition key.h:109
@ F20
Definition key.h:95
@ F13
Definition key.h:88
@ Snapshot
Definition key.h:52
@ Right
Definition key.h:46
@ Pause
Definition key.h:33
@ NumPad7
Definition key.h:67
@ VolumeUp
Definition key.h:128
@ Key4
Definition key.h:141
@ MediaNextTrack
Definition key.h:129
@ RightControl
Definition key.h:116
@ ModeChange
Definition key.h:39
@ Capital
Definition key.h:34
@ NumPad8
Definition key.h:68
@ Down
Definition key.h:48
@ V
Definition key.h:168
@ R
Definition key.h:164
@ O
Definition key.h:161
@ BrowserBack
Definition key.h:119
@ NumPad3
Definition key.h:63
@ F11
Definition key.h:86
@ A
Definition key.h:147
@ NumLock
Definition key.h:100
@ Next
Definition key.h:42
@ Z
Definition key.h:172
@ MediaPrevTrack
Definition key.h:130
@ Control
Definition key.h:31
@ Key8
Definition key.h:145
@ Return
Definition key.h:29
@ LeftShift
Definition key.h:113
@ LaunchMediaSelect
Definition key.h:134
@ MediaPlayPause
Definition key.h:132
@ Help
Definition key.h:55
@ BackSlash
Definition key.h:107
@ Space
Definition key.h:40
@ Tilde
Definition key.h:104
@ S
Definition key.h:165
@ NumPad6
Definition key.h:66
@ F16
Definition key.h:91
@ T
Definition key.h:166
@ F14
Definition key.h:89
@ F6
Definition key.h:81
@ Y
Definition key.h:171
@ Apps
Definition key.h:58
@ Key3
Definition key.h:140
@ Equality
Definition key.h:112
@ F21
Definition key.h:96
@ Insert
Definition key.h:53
@ M
Definition key.h:159
@ Escape
Definition key.h:35
@ F19
Definition key.h:94
@ C
Definition key.h:149
@ G
Definition key.h:153
@ NumPad4
Definition key.h:64
@ NumPad1
Definition key.h:61
@ F22
Definition key.h:97
@ Up
Definition key.h:47
@ Key2
Definition key.h:139
@ F9
Definition key.h:84
@ Select
Definition key.h:49
@ BrowserSearch
Definition key.h:123
@ Home
Definition key.h:44
@ Semicolon
Definition key.h:102
@ Sleep
Definition key.h:59
@ Key5
Definition key.h:142
@ F2
Definition key.h:77
@ VolumeMute
Definition key.h:126
@ Subtract
Definition key.h:72
@ LeftBracket
Definition key.h:105
@ Prior
Definition key.h:41
@ NumPad2
Definition key.h:62
@ Delete
Definition key.h:54
@ H
Definition key.h:154
@ U
Definition key.h:167
@ Tab
Definition key.h:27
@ NumKeyCodes
Definition key.h:174
@ Shift
Definition key.h:30
@ VolumeDown
Definition key.h:127
@ Convert
Definition key.h:36
@ Separator
Definition key.h:73
@ D
Definition key.h:150
@ F12
Definition key.h:87
@ J
Definition key.h:156
@ F15
Definition key.h:90
@ F1
Definition key.h:76
@ LaunchApp1
Definition key.h:135
@ F5
Definition key.h:80
@ Slash
Definition key.h:103
@ Multiply
Definition key.h:70
@ P
Definition key.h:162
@ Add
Definition key.h:71
@ RightWindows
Definition key.h:57
@ F23
Definition key.h:98
@ Divide
Definition key.h:75
@ NumPad9
Definition key.h:69
@ Quote
Definition key.h:108
@ F24
Definition key.h:99
@ Period
Definition key.h:111
@ F18
Definition key.h:93
@ Key1
Definition key.h:138
@ F4
Definition key.h:79
@ BrowserStop
Definition key.h:122
@ LaunchApp2
Definition key.h:136
@ NonConvert
Definition key.h:37
@ InvalidKey
Definition key.h:175
@ X
Definition key.h:170
@ LeftWindows
Definition key.h:56
@ Decimal
Definition key.h:74
@ Q
Definition key.h:163
@ Menu
Definition key.h:32
@ BrowserRefresh
Definition key.h:121
@ BrowserHome
Definition key.h:125
@ F17
Definition key.h:92
@ Key9
Definition key.h:146
@ K
Definition key.h:157
@ F7
Definition key.h:82
@ Key0
Definition key.h:137
@ Key6
Definition key.h:143
@ RightMenu
Definition key.h:118
@ W
Definition key.h:169
@ Clear
Definition key.h:28
@ NumPad5
Definition key.h:65
@ L
Definition key.h:158
@ F8
Definition key.h:83
@ F10
Definition key.h:85
@ Print
Definition key.h:50
@ End
Definition key.h:43
@ Back
Definition key.h:26
@ Scroll
Definition key.h:101
@ E
Definition key.h:151
@ RightBracket
Definition key.h:106
@ B
Definition key.h:148
@ LeftControl
Definition key.h:115
@ F3
Definition key.h:78
@ BrowserFavorites
Definition key.h:124
static bool IsValid(const Util::String &str)
check if a key string is valid
Definition key.cc:801
Group
key group
Definition key.h:180
@ CursorKeys
Definition key.h:185
@ HomeBlock
Definition key.h:186
@ Letters
Definition key.h:181
@ FunctionKeys
Definition key.h:184
@ NumPad
Definition key.h:183
@ Numbers
Definition key.h:182
static Util::Array< Key::Code > KeyCodesByGroup(Key::Group group)
get key codes by group
Definition key.cc:745
static Util::String ToString(Code code)
convert to string
Definition key.cc:17
static void SetupDict()
Definition key.cc:815
static Util::Dictionary< Util::String, Code > dict
Definition key.h:206
static uint ToRocket(Code key)
convert to rocket scan codes
Definition key.cc:342
Nebula's dynamic array class.
Definition array.h:60
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
FIXME!
Nebula's universal string class.
Definition string.h:50
unsigned int uint
Definition types.h:31