Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
key.h
Go to the documentation of this file.
1 // * This file is part of the COLOBOT source code
2 // * Copyright (C) 2012, Polish Portal of Colobot (PPC)
3 // *
4 // * This program 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 3 of the License, or
7 // * (at your option) any later version.
8 // *
9 // * This program 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 this program. If not, see http://www.gnu.org/licenses/.
16 
22 #pragma once
23 
24 
25 #include <SDL_keysym.h>
26 
27 /* Key definitions are specially defined here so that it is clear in other parts of the code
28  that these are used. It is to avoid having SDL-related enum values or #defines lying around
29  unchecked. With this approach it will be easier to maintain the code later on. */
30 
31 // Key symbol defined as concatenation to SDLK_...
32 // If need arises, it can be changed to custom function or anything else
33 #define KEY(x) SDLK_ ## x
34 
35 
36 // Key modifier defined as concatenation to KMOD_...
37 // If need arises, it can be changed to custom function or anything else
38 #define KEY_MOD(x) KMOD_ ## x
39 
47 {
48  VIRTUAL_KMOD_CTRL = SDLK_LAST + 100,
49  VIRTUAL_KMOD_SHIFT = SDLK_LAST + 101,
50  VIRTUAL_KMOD_ALT = SDLK_LAST + 102,
51  VIRTUAL_KMOD_META = SDLK_LAST + 103
52 };
53 
54 // Just syntax sugar
55 // So it is the same as other macros
56 #define VIRTUAL_KMOD(x) VIRTUAL_KMOD_ ## x
57 
58 // Virtual key code generated on joystick button presses
59 // num is number of joystick button
60 #define VIRTUAL_JOY(num) (SDLK_LAST + 200 + num)
61 
63 const unsigned int KEY_INVALID = SDLK_LAST + 1000;
64 
const unsigned int KEY_INVALID
Special value for invalid key bindings.
Definition: key.h:63
&lt; shift (left or right)
Definition: key.h:50
VirtualKmod
Virtual key codes generated on kmod presses.
Definition: key.h:46
&lt; control (left or right)
Definition: key.h:49
&lt; alt (left or right)
Definition: key.h:51