2 // Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
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.
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.
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/>.
17 #ifndef HEADER_SUPERTUX_CONTROL_JOYSTICK_CONFIG_HPP
18 #define HEADER_SUPERTUX_CONTROL_JOYSTICK_CONFIG_HPP
23 #include "control/controller.hpp"
24 #include "lisp/lisp.hpp"
25 #include "util/writer.hpp"
31 typedef std::map<std::pair<JoyId, int>, Controller::Control> ButtonMap;
32 typedef std::map<std::pair<JoyId, int>, Controller::Control> AxisMap;
33 typedef std::map<std::pair<JoyId, int>, Controller::Control> HatMap;
37 bool jump_with_up_joy;
39 ButtonMap joy_button_map;
46 void print_joystick_mappings();
48 int reversemap_joybutton(Controller::Control c);
49 int reversemap_joyaxis(Controller::Control c);
50 int reversemap_joyhat(Controller::Control c);
52 void unbind_joystick_control(Controller::Control c);
54 void bind_joybutton(JoyId joy_id, int button, Controller::Control c);
55 void bind_joyaxis(JoyId joy_id, int axis, Controller::Control c);
56 void bind_joyhat(JoyId joy_id, int dir, Controller::Control c);
58 void read(const lisp::Lisp& joystick_lisp);
59 void write(Writer& writer);
62 JoystickConfig(const JoystickConfig&) = delete;
63 JoystickConfig& operator=(const JoystickConfig&) = delete;