4 // Copyright (C) 2005 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 #ifndef __JOYSTICKKEYBOARDCONTROLLER_H__
22 #define __JOYSTICKKEYBOARDCONTROLLER_H__
24 #include "controller.h"
25 #include "lisp/lisp.h"
26 #include "lisp/writer.h"
33 class JoystickKeyboardController : public Controller
36 JoystickKeyboardController();
37 virtual ~JoystickKeyboardController();
39 /** Process an SDL Event and return true if the event has been used
41 void process_event(const SDL_Event& event);
43 void write(lisp::Writer& writer);
44 void read(const lisp::Lisp& lisp);
45 bool check_cheatcode(const std::string& cheatcode);
47 Menu* get_key_options_menu();
48 Menu* get_joystick_options_menu();
51 void process_menu_key_event(const SDL_Event& event);
53 typedef std::map<SDLKey, Control> KeyMap;
57 std::vector<SDL_Joystick*> joysticks;
58 std::vector<std::string> joystick_names;
60 typedef std::map<int, Control> ButtonMap;
61 ButtonMap joy_button_map;
68 /// the number of buttons all joysticks have
70 /// the max number of buttons a joystick has
87 SDLKey reversemap_key(Control c);
88 int reversemap_joybutton(Control c);
89 void reset_joybutton(int button, Control c);
90 void reset_key(SDLKey key, Control c);
93 int wait_for_joybutton;
98 KeyboardMenu* key_options_menu;
99 JoystickMenu* joystick_options_menu;
100 friend class KeyboardMenu;
101 friend class JoystickMenu;