Fix unintented newline in rP20809.
[0ad.git] / source / ps / Hotkey.h
blobcfad324af822883cfdc1bca7a367ab9bfe6c9f7e
1 /* Copyright (C) 2014 Wildfire Games.
2 * This file is part of 0 A.D.
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.
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.
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/>.
18 #ifndef INCLUDED_HOTKEY
19 #define INCLUDED_HOTKEY
21 /**
22 * @file
23 * Hotkey system.
25 * Hotkeys consist of a name (an arbitrary string), and a key mapping.
26 * The names and mappings are loaded from the config system (any
27 * config setting with the name prefix "hotkey.").
28 * When a hotkey is pressed or released, SDL_HOTKEYDOWN and SDL_HOTKEYUP
29 * events are triggered, with the hotkey name stored in ev.user.data1
30 * as a const char*.
33 #include "CStr.h"
34 #include "lib/input.h"
35 #include "lib/external_libraries/libsdl.h" // see note below
37 // note: we need the real SDL header - it defines SDL_USEREVENT, which is
38 // required for our HOTKEY event type definition. this is OK since
39 // hotkey.h is not included from any headers.
41 const int SDL_HOTKEYDOWN = SDL_USEREVENT;
42 const int SDL_HOTKEYUP = SDL_USEREVENT + 1;
44 extern void LoadHotkeys();
45 extern void UnloadHotkeys();
46 extern InReaction HotkeyInputHandler(const SDL_Event_* ev);
48 extern bool HotkeyIsPressed(const CStr& keyname);
50 #endif // INCLUDED_HOTKEY