1// SuperTux
2// Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
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
17#ifndef HEADER_SUPERTUX_CONTROL_KEYBOARD_CONFIG_HPP
18#define HEADER_SUPERTUX_CONTROL_KEYBOARD_CONFIG_HPP
19
20#include <SDL.h>
21#include <map>
22
23#include "control/controller.hpp"
24
25class ReaderMapping;
26class Writer;
27
28class KeyboardConfig final
29{
30 friend class KeyboardManager;
31 friend class KeyboardMenu;
32
33public:
34 KeyboardConfig();
35
36 SDL_Keycode reversemap_key(Control c) const;
37 void bind_key(SDL_Keycode key, Control c);
38
39 void read(const ReaderMapping& keymap_mapping);
40 void write(Writer& writer);
41
42private:
43 std::map<SDL_Keycode, Control> m_keymap;
44 bool m_jump_with_up_kbd;
45
46private:
47 KeyboardConfig(const KeyboardConfig&) = delete;
48 KeyboardConfig& operator=(const KeyboardConfig&) = delete;
49};
50
51#endif
52
53/* EOF */
54