1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-30 18:53:35 +00:00

me sad cause haxe 4.0.0

This commit is contained in:
Brandon 2020-11-02 01:38:01 -05:00
parent 88b08d3dc3
commit 0590fc59b6

View file

@ -108,7 +108,11 @@ class Controls extends FlxActionSet
var _pause = new FlxActionDigital(Action.PAUSE); var _pause = new FlxActionDigital(Action.PAUSE);
var _reset = new FlxActionDigital(Action.RESET); var _reset = new FlxActionDigital(Action.RESET);
#if (haxe >= "4.0.0")
var byName:Map<String, FlxActionDigital> = []; var byName:Map<String, FlxActionDigital> = [];
#else
var byName:Map<String, FlxActionDigital> = new Map<String, FlxActionDigital>();
#end
public var gamepadsAdded:Array<Int> = []; public var gamepadsAdded:Array<Int> = [];
public var keyboardScheme = KeyboardScheme.None; public var keyboardScheme = KeyboardScheme.None;
@ -386,7 +390,7 @@ class Controls extends FlxActionSet
#if (haxe >= "4.0.0") #if (haxe >= "4.0.0")
inline forEachBound(control, (action, state) -> addKeys(action, keys, state)); inline forEachBound(control, (action, state) -> addKeys(action, keys, state));
#else #else
forEachBound(control, (action, state) -> addKeys(action, keys, state)); forEachBound(control, action => addKeys(action, keys, state), state => addKeys(action, keys, state));
#end #end
} }
@ -399,7 +403,7 @@ class Controls extends FlxActionSet
#if (haxe >= "4.0.0") #if (haxe >= "4.0.0")
inline forEachBound(control, (action, _) -> removeKeys(action, keys)); inline forEachBound(control, (action, _) -> removeKeys(action, keys));
#else #else
forEachBound(control, (action, _) -> removeKeys(action, keys)); forEachBound(control, action => removeKeys(action, keys), _ => removeKeys(action, keys));
#end #end
} }
@ -426,6 +430,8 @@ class Controls extends FlxActionSet
removeKeyboard(); removeKeyboard();
keyboardScheme = scheme; keyboardScheme = scheme;
#if (haxe >= "4.0.0")
switch (scheme) switch (scheme)
{ {
case Solo: case Solo:
@ -458,6 +464,40 @@ class Controls extends FlxActionSet
case None: // nothing case None: // nothing
case Custom: // nothing case Custom: // nothing
} }
#else
switch (scheme)
{
case Solo:
bindKeys(Control.UP, [W, FlxKey.UP]);
bindKeys(Control.DOWN, [S, FlxKey.DOWN]);
bindKeys(Control.LEFT, [A, FlxKey.LEFT]);
bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]);
bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
bindKeys(Control.RESET, [R]);
case Duo(true):
bindKeys(Control.UP, [W]);
bindKeys(Control.DOWN, [S]);
bindKeys(Control.LEFT, [A]);
bindKeys(Control.RIGHT, [D]);
bindKeys(Control.ACCEPT, [G, Z]);
bindKeys(Control.BACK, [H, X]);
bindKeys(Control.PAUSE, [ONE]);
bindKeys(Control.RESET, [R]);
case Duo(false):
bindKeys(Control.UP, [FlxKey.UP]);
bindKeys(Control.DOWN, [FlxKey.DOWN]);
bindKeys(Control.LEFT, [FlxKey.LEFT]);
bindKeys(Control.RIGHT, [FlxKey.RIGHT]);
bindKeys(Control.ACCEPT, [O]);
bindKeys(Control.BACK, [P]);
bindKeys(Control.PAUSE, [ENTER]);
bindKeys(Control.RESET, [BACKSPACE]);
case None: // nothing
case Custom: // nothing
}
#end
} }
function removeKeyboard() function removeKeyboard()
@ -485,7 +525,11 @@ class Controls extends FlxActionSet
{ {
gamepadsAdded.push(id); gamepadsAdded.push(id);
for (control => buttons in buttonMap) for (control => buttons in buttonMap)
#if (haxe >= "4.0.0")
inline bindButtons(control, id, buttons); inline bindButtons(control, id, buttons);
#else
bindButtons(control, id, buttons);
#end
} }
public function removeGamepad(deviceID:Int = FlxInputDeviceID.ALL):Void public function removeGamepad(deviceID:Int = FlxInputDeviceID.ALL):Void
@ -527,7 +571,7 @@ class Controls extends FlxActionSet
#if (haxe >= "4.0.0") #if (haxe >= "4.0.0")
inline forEachBound(control, (action, state) -> addButtons(action, buttons, state, id)); inline forEachBound(control, (action, state) -> addButtons(action, buttons, state, id));
#else #else
forEachBound(control, (action, state) -> addButtons(action, buttons, state, id)); forEachBound(control, action => addButtons(action, buttons, state, id), state => addButtons(action, buttons, state, id));
#end #end
} }
@ -540,7 +584,7 @@ class Controls extends FlxActionSet
#if (haxe >= "4.0.0") #if (haxe >= "4.0.0")
inline forEachBound(control, (action, _) -> removeButtons(action, gamepadID, buttons)); inline forEachBound(control, (action, _) -> removeButtons(action, gamepadID, buttons));
#else #else
forEachBound(control, (action, _) -> removeButtons(action, gamepadID, buttons)); forEachBound(control, action => removeButtons(action, gamepadID, buttons), _ => removeButtons(action, gamepadID, buttons));
#end #end
} }