// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
-
#include <config.h>
#include <sstream>
-#include "joystickkeyboardcontroller.h"
-#include "gui/menu.h"
-#include "gettext.h"
-#include "lisp/lisp.h"
-#include "lisp/list_iterator.h"
-#include "game_session.h"
+#include "joystickkeyboardcontroller.hpp"
+#include "gui/menu.hpp"
+#include "gettext.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/list_iterator.hpp"
+#include "game_session.hpp"
class JoystickKeyboardController::JoystickMenu : public Menu
{
};
JoystickKeyboardController::JoystickKeyboardController()
- : wait_for_key(-1), wait_for_joybutton(-1)
+ : wait_for_key(-1), wait_for_joybutton(-1), key_options_menu(0),
+ joystick_options_menu(0)
{
memset(last_keys, 0, sizeof(last_keys));
if(i != min_joybuttons-1)
joy_button_map.insert(std::make_pair(i, MENU_SELECT));
}
+
+ // some joysticks or SDL seem to produce some bogus events after being opened
+ Uint32 ticks = SDL_GetTicks();
+ while(SDL_GetTicks() - ticks < 200) {
+ SDL_Event event;
+ SDL_PollEvent(&event);
+ }
}
JoystickKeyboardController::~JoystickKeyboardController()
}
void
+JoystickKeyboardController::reset()
+{
+ Controller::reset();
+ for(size_t i = 0; i < sizeof(last_keys); ++i)
+ last_keys[i] = 0;
+}
+
+void
JoystickKeyboardController::process_event(const SDL_Event& event)
{
switch(event.type) {