joystick_timer.stop();
}
break;
+ case SDL_JOYHATMOTION:
+ if(event.jhat.value & SDL_HAT_UP) {
+ menuaction = MENU_ACTION_UP;
+ } else if(event.jhat.value & SDL_HAT_DOWN) {
+ menuaction = MENU_ACTION_DOWN;
+ }
+ break;
case SDL_JOYBUTTONDOWN:
if (item.size() > 0 && item[active_item].kind == MN_CONTROLFIELD_JS)
{
tux.input.down = UP;
}
break;
+
+ case SDL_JOYHATMOTION:
+ if(event.jhat.value & SDL_HAT_UP) {
+ tux.input.up = DOWN;
+ tux.input.down = UP;
+ } else if(event.jhat.value & SDL_HAT_DOWN) {
+ tux.input.up = UP;
+ tux.input.down = DOWN;
+ } else if(event.jhat.value & SDL_HAT_LEFT) {
+ tux.input.left = DOWN;
+ tux.input.right = UP;
+ } else if(event.jhat.value & SDL_HAT_RIGHT) {
+ tux.input.left = UP;
+ tux.input.right = DOWN;
+ } else if(event.jhat.value == SDL_HAT_CENTERED) {
+ tux.input.left = UP;
+ tux.input.right = UP;
+ tux.input.up = UP;
+ tux.input.down = UP;
+ }
+ break;
case SDL_JOYBUTTONDOWN:
if (event.jbutton.button == joystick_keymap.a_button)
#include <cmath>
#include <cassert>
+#include <cmath>
#include <iostream>
#include "app/globals.h"
break;
}
break;
+
+ case SDL_JOYHATMOTION:
+ if(event.jhat.value & SDL_HAT_UP) {
+ tux->set_direction(D_NORTH);
+ } else if(event.jhat.value & SDL_HAT_DOWN) {
+ tux->set_direction(D_SOUTH);
+ } else if(event.jhat.value & SDL_HAT_LEFT) {
+ tux->set_direction(D_WEST);
+ } else if(event.jhat.value & SDL_HAT_RIGHT) {
+ tux->set_direction(D_EAST);
+ }
+ break;
case SDL_JOYAXISMOTION:
if (event.jaxis.axis == joystick_keymap.x_axis)