Civ backgrounds for minimap
[0ad.git] / source / ps / Globals.h
blob3820413359a38dfe6a73654ae56804819dc9e037
1 /* Copyright (C) 2017 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_PS_GLOBALS
19 #define INCLUDED_PS_GLOBALS
21 #include "lib/input.h"
22 #include "lib/frequency_filter.h"
23 #include "ps/KeyName.h"
25 #include <unordered_map>
27 // thin abstraction layer on top of SDL.
28 // game code should use it instead of SDL_GetMouseState etc. because
29 // Atlas does not completely emulate SDL (it can only send events).
31 extern bool g_app_minimized;
32 extern bool g_app_has_focus;
34 extern int g_mouse_x, g_mouse_y;
36 /**
37 * Indicates whether the mouse is focused on the game window (mouse positions
38 * should usually be considered inaccurate if this is false)
40 extern bool g_mouse_active;
42 /**
43 * g_scancodes: Key states, indexed by SDL_Scancode constants. If an entry is true,
44 * it represents a pressed key.
45 * Updated by GlobalsInputHandler in response to key press/release events.
47 extern std::unordered_map<int32_t, bool> g_scancodes;
49 /**
50 * g_mouse_buttons: Mouse buttons states, indexed by SDL_BUTTON_* constants.
51 * If an entry is true, it represents a pressed button.
52 * Updated by GlobalsInputHandler in response to mouse button up/down events.
54 * Be aware that SDL_BUTTON_* constants start at 1. Therefore,
55 * g_mouse_buttons[0] is unused. The order of entries is as in KeyName.h for MOUSE_*
57 extern bool g_mouse_buttons[MOUSE_LAST - MOUSE_BASE];
59 extern InReaction GlobalsInputHandler(const SDL_Event_* ev);
61 extern PIFrequencyFilter g_frequencyFilter;
63 #endif // INCLUDED_PS_GLOBALS