Skip to content

Commit

Permalink
FlxKeyboard: fix debugger and VCR keys not using the native correction
Browse files Browse the repository at this point in the history
For instance, this made it impossible to use one of the F-keys as a debugger toggle key.
  • Loading branch information
Gama11 committed Sep 3, 2016
1 parent b9e082c commit 470c8e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions flixel/input/FlxKeyManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,18 @@ class FlxKeyManager<Key:Int, KeyList:FlxBaseKeyList> implements IFlxInputManager
* A Helper function to check whether an array of keycodes contains
* a certain key safely (returns false if the array is null).
*/
private function inKeyArray(KeyArray:Array<Key>, Key:Key):Bool
private function inKeyArray(KeyArray:Array<Key>, Event:KeyboardEvent):Bool
{
if (KeyArray == null)
{
return false;
}
else
{
var code = resolveKeyCode(Event);
for (key in KeyArray)
{
if (key == Key || key == -2)
if (key == code || key == -2)
{
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions flixel/input/keyboard/FlxKeyboard.hx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class FlxKeyboard extends FlxKeyManager<FlxKey, FlxKeyList>

// Debugger toggle
#if FLX_DEBUG
if (FlxG.game.debugger != null && inKeyArray(FlxG.debugger.toggleKeys, event.keyCode))
if (FlxG.game.debugger != null && inKeyArray(FlxG.debugger.toggleKeys, event))
{
FlxG.debugger.visible = !FlxG.debugger.visible;
}
Expand All @@ -108,7 +108,7 @@ class FlxKeyboard extends FlxKeyManager<FlxKey, FlxKeyList>

// Attempted to cancel the replay?
#if FLX_RECORD
if (FlxG.game.replaying && !inKeyArray(FlxG.debugger.toggleKeys, event.keyCode) && inKeyArray(FlxG.vcr.cancelKeys, event.keyCode))
if (FlxG.game.replaying && !inKeyArray(FlxG.debugger.toggleKeys, event) && inKeyArray(FlxG.vcr.cancelKeys, event))
{
FlxG.vcr.cancelReplay();
}
Expand Down

0 comments on commit 470c8e8

Please sign in to comment.