Pyrogenesis
trunk
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
source
ps
KeyName.h
Go to the documentation of this file.
1
/* Copyright (C) 2015 Wildfire Games.
2
* This file is part of 0 A.D.
3
*
4
* 0 A.D. is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* 0 A.D. is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef INCLUDED_KEYNAME
19
#define INCLUDED_KEYNAME
20
21
// Need SDLK_* enum values.
22
#include "
lib/external_libraries/libsdl.h
"
23
24
class
CStr8;
25
26
extern
void
InitKeyNameMap
();
27
extern
CStr8
FindKeyName
(
int
keycode);
28
extern
int
FindKeyCode
(
const
CStr8& keyname);
29
30
enum
{
31
// Start sequential IDs in the right place
32
// Pick a code which is greater than any keycodes used by SDL itself
33
EXTRA_KEYS_BASE
= SDL_SCANCODE_TO_KEYCODE(SDL_NUM_SCANCODES),
34
// 'Keycodes' for the unified modifier keys
35
UNIFIED_SHIFT
,
36
UNIFIED_CTRL
,
37
UNIFIED_ALT
,
38
UNIFIED_SUPER
,
39
UNIFIED_LAST
,
40
// 'Keycodes' for the mouse buttons
41
// Base for mouse buttons.
42
// Everything less than MOUSE_BASE is not reported by an SDL mouse button event.
43
// Everything greater than MOUSE_BASE is reported by an SDL mouse button event.
44
MOUSE_BASE
,
45
MOUSE_LEFT
=
MOUSE_BASE
+ SDL_BUTTON_LEFT,
46
MOUSE_MIDDLE
=
MOUSE_BASE
+ SDL_BUTTON_MIDDLE,
47
MOUSE_RIGHT
=
MOUSE_BASE
+ SDL_BUTTON_RIGHT,
48
// SDL2 doesn't count wheels as buttons, so just give them the previous sequential IDs
49
MOUSE_WHEELUP
=
MOUSE_BASE
+ 4,
50
MOUSE_WHEELDOWN
=
MOUSE_BASE
+ 5,
51
MOUSE_X1
=
MOUSE_BASE
+ SDL_BUTTON_X1 + 2,
52
MOUSE_X2
=
MOUSE_BASE
+ SDL_BUTTON_X2 + 2,
53
};
54
55
#endif // #ifndef INCLUDED_KEYNAME
FindKeyName
CStr8 FindKeyName(int keycode)
Definition:
KeyName.cpp:229
EXTRA_KEYS_BASE
Definition:
KeyName.h:33
libsdl.h
MOUSE_X2
Definition:
KeyName.h:52
MOUSE_WHEELDOWN
Definition:
KeyName.h:50
UNIFIED_SUPER
Definition:
KeyName.h:38
UNIFIED_LAST
Definition:
KeyName.h:39
MOUSE_RIGHT
Definition:
KeyName.h:47
FindKeyCode
int FindKeyCode(const CStr8 &keyname)
MOUSE_MIDDLE
Definition:
KeyName.h:46
MOUSE_X1
Definition:
KeyName.h:51
UNIFIED_CTRL
Definition:
KeyName.h:36
MOUSE_LEFT
Definition:
KeyName.h:45
UNIFIED_SHIFT
Definition:
KeyName.h:35
MOUSE_WHEELUP
Definition:
KeyName.h:49
UNIFIED_ALT
Definition:
KeyName.h:37
InitKeyNameMap
void InitKeyNameMap()
Definition:
KeyName.cpp:203
MOUSE_BASE
Definition:
KeyName.h:44
Generated by
1.8.11