Mini fix to controller button order
This commit is contained in:
parent
87507f7f03
commit
51b9c699b8
|
@ -16,21 +16,25 @@ WITH REGARD TO THIS SOFTWARE.
|
||||||
void
|
void
|
||||||
controller_down(Device *d, Uint8 mask)
|
controller_down(Device *d, Uint8 mask)
|
||||||
{
|
{
|
||||||
|
if(mask) {
|
||||||
d->dat[2] |= mask;
|
d->dat[2] |= mask;
|
||||||
uxn_eval(d->u, d->vector);
|
uxn_eval(d->u, d->vector);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
controller_up(Device *d, Uint8 mask)
|
controller_up(Device *d, Uint8 mask)
|
||||||
{
|
{
|
||||||
|
if(mask) {
|
||||||
d->dat[2] &= (~mask);
|
d->dat[2] &= (~mask);
|
||||||
uxn_eval(d->u, d->vector);
|
uxn_eval(d->u, d->vector);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
controller_key(Device *d, Uint8 key)
|
controller_key(Device *d, Uint8 key)
|
||||||
{
|
{
|
||||||
if(!key) {
|
if(key) {
|
||||||
d->dat[3] = key;
|
d->dat[3] = key;
|
||||||
uxn_eval(d->u, d->vector);
|
uxn_eval(d->u, d->vector);
|
||||||
d->dat[3] = 0x00;
|
d->dat[3] = 0x00;
|
||||||
|
|
11
src/uxnemu.c
11
src/uxnemu.c
|
@ -505,14 +505,17 @@ run(Uxn *u)
|
||||||
clamp(event.motion.x - PAD, 0, ppu.width - 1),
|
clamp(event.motion.x - PAD, 0, ppu.width - 1),
|
||||||
clamp(event.motion.y - PAD, 0, ppu.height - 1));
|
clamp(event.motion.y - PAD, 0, ppu.height - 1));
|
||||||
/* Controller */
|
/* Controller */
|
||||||
else if(event.type == SDL_KEYDOWN) {
|
else if(event.type == SDL_KEYDOWN || event.type == SDL_TEXTINPUT) {
|
||||||
controller_down(devctrl, get_button(&event));
|
if(event.type == SDL_TEXTINPUT)
|
||||||
|
controller_key(devctrl, event.text.text[0]);
|
||||||
|
else if(get_key(&event))
|
||||||
controller_key(devctrl, get_key(&event));
|
controller_key(devctrl, get_key(&event));
|
||||||
|
else if(get_button(&event)) {
|
||||||
|
controller_down(devctrl, get_button(&event));
|
||||||
do_shortcut(u, &event);
|
do_shortcut(u, &event);
|
||||||
|
}
|
||||||
} else if(event.type == SDL_KEYUP)
|
} else if(event.type == SDL_KEYUP)
|
||||||
controller_up(devctrl, get_button(&event));
|
controller_up(devctrl, get_button(&event));
|
||||||
else if(event.type == SDL_TEXTINPUT)
|
|
||||||
controller_key(devctrl, event.text.text[0]);
|
|
||||||
else if(event.type == SDL_JOYBUTTONDOWN)
|
else if(event.type == SDL_JOYBUTTONDOWN)
|
||||||
controller_down(devctrl, get_button_joystick(&event));
|
controller_down(devctrl, get_button_joystick(&event));
|
||||||
else if(event.type == SDL_JOYBUTTONUP)
|
else if(event.type == SDL_JOYBUTTONUP)
|
||||||
|
|
Loading…
Reference in New Issue