The menu code sucks!
- Joystick devices now send key up events for any buttons that are held down when they are destroyed. - Changed the joystick enable-y menu items to be nonrepeatable so that you can't create several device scans per second. Changing them with a controller is also disabled so that you can't, for example, toggle XInput support using an XInput controller and have things go haywire when the game receives an infinite number of key down events when the controller is reinitialized with the other input system. - Changed menu input to use a consolidated set of buttons, so most menus can be navigated with a controller as well as a keyboard. - Changed the way that X/Y analog axes are converted to digital axes. Previously, this was done by checking if each axis was outside its deadzone. Now they are checked together based on their angle, so straight up/down/ left/right are much easier to achieve. SVN r1739 (trunk)
This commit is contained in:
parent
1c8d442c32
commit
a90bde274e
12 changed files with 615 additions and 282 deletions
|
|
@ -421,7 +421,7 @@ FButtonStatus *FindButton (unsigned int key)
|
|||
return bit ? bit->Button : NULL;
|
||||
}
|
||||
|
||||
void FButtonStatus::PressKey (int keynum)
|
||||
bool FButtonStatus::PressKey (int keynum)
|
||||
{
|
||||
int i, open;
|
||||
|
||||
|
|
@ -445,22 +445,26 @@ void FButtonStatus::PressKey (int keynum)
|
|||
}
|
||||
else if (Keys[i] == keynum)
|
||||
{ // Key is already down; do nothing
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (open < 0)
|
||||
{ // No free key slots, so do nothing
|
||||
Printf ("More than %u keys pressed for a single action!\n", MAX_KEYS);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
Keys[open] = keynum;
|
||||
}
|
||||
BYTE wasdown = bDown;
|
||||
bDown = bWentDown = true;
|
||||
// Returns true if this key caused the button to go down.
|
||||
return !wasdown;
|
||||
}
|
||||
|
||||
void FButtonStatus::ReleaseKey (int keynum)
|
||||
bool FButtonStatus::ReleaseKey (int keynum)
|
||||
{
|
||||
int i, numdown, match;
|
||||
BYTE wasdown = bDown;
|
||||
|
||||
keynum &= KEY_DBLCLICKED-1;
|
||||
|
||||
|
|
@ -488,7 +492,7 @@ void FButtonStatus::ReleaseKey (int keynum)
|
|||
}
|
||||
if (match < 0)
|
||||
{ // Key was not down; do nothing
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
Keys[match] = 0;
|
||||
bWentUp = true;
|
||||
|
|
@ -497,6 +501,8 @@ void FButtonStatus::ReleaseKey (int keynum)
|
|||
bDown = false;
|
||||
}
|
||||
}
|
||||
// Returns true if releasing this key caused the button to go up.
|
||||
return wasdown && !bDown;
|
||||
}
|
||||
|
||||
void ResetButtonTriggers ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue