sdl: added SDL.Input.EnableOppositeDirectional option. allows/disallows simultaneous right+left / up+down

This commit is contained in:
punkrockguy318 2012-08-04 20:47:47 +00:00
parent 989e3271c6
commit 05fa7ce14e
3 changed files with 23 additions and 3 deletions

View File

@ -1,5 +1,5 @@
08-Aug-2012 - prg - sdl: added SDL.Input.EnableOppositeDirectional option. allows/disallows simultaneous right+left / up+down.
25-Jul-2012 - AnS - Taseditor: auto-starting Note editing when creating Marker by double-click
19-Jul-2012 - AnS - Taseditor: Lua registermanual allows changing the "Run function" button caption; Markers are always restored when deploying Bookmarks
01-Jul-2012 - AnS - new hotkey "Run Manual Lua function"

View File

@ -193,6 +193,9 @@ InitConfig()
// display input
config->addOption("inputdisplay", "SDL.InputDisplay", 0);
// enable / disable opposite directionals (left + right or up + down simultaneously)
config->addOption("opposite-directionals", "SDL.Input.EnableOppositeDirectionals", 1);
// pause movie playback at frame x
config->addOption("pauseframe", "SDL.PauseFrame", 0);
config->addOption("recordhud", "SDL.RecordHUD", 1);

View File

@ -1127,14 +1127,31 @@ UpdateGamepad (void)
rapid ^= 1;
int opposite_dirs;
g_config->getOption("SDL.Input.EnableOppositeDirectionals", &opposite_dirs);
// go through each of the four game pads
for (wg = 0; wg < 4; wg++)
{
// the 4 directional buttons, start, select, a, b
bool left = false;
bool up = false;
// a, b, select, start, up, down, left, right
for (x = 0; x < 8; x++)
{
if (DTestButton (&GamePadConfig[wg][x]))
{
if(opposite_dirs == 0)
{
// test for left+right and up+down
if(x == 4)
up = true;
if((x == 5) && (up == true))
continue;
if(x == 6)
left = true;
if((x == 7) && (left == true))
continue;
}
JS |= (1 << x) << (wg << 3);
}
}