custom controls stuff
This commit is contained in:
@@ -150,6 +150,7 @@ class Controls extends FlxActionSet
|
||||
@:pressed("switchmod") public var SWITCHMOD_HOLD(get, set): Bool;
|
||||
@:justReleased("switchmod") public var SWITCHMOD_R(get, set): Bool;
|
||||
|
||||
@:allow(funkin.backend.utils.ControlsUtil)
|
||||
var byName:Map<String, FlxActionDigital> = [];
|
||||
|
||||
public var gamepadsAdded:Array<Int> = [];
|
||||
@@ -219,13 +220,13 @@ class Controls extends FlxActionSet
|
||||
macro_forEachBound(control, (action, _) -> removeKeys(action, keys));
|
||||
}
|
||||
|
||||
inline static function addKeys(action:FlxActionDigital, keys:Array<FlxKey>, state:FlxInputState)
|
||||
public inline static function addKeys(action:FlxActionDigital, keys:Array<FlxKey>, state:FlxInputState)
|
||||
{
|
||||
for (key in keys)
|
||||
action.addKey(key, state);
|
||||
}
|
||||
|
||||
static function removeKeys(action:FlxActionDigital, keys:Array<FlxKey>)
|
||||
public static function removeKeys(action:FlxActionDigital, keys:Array<FlxKey>)
|
||||
{
|
||||
var i = action.inputs.length;
|
||||
while (i-- > 0)
|
||||
@@ -302,13 +303,13 @@ class Controls extends FlxActionSet
|
||||
macro_forEachBound(control, (action, _) -> removeButtons(action, gamepadID, buttons));
|
||||
}
|
||||
|
||||
inline static function addButtons(action:FlxActionDigital, buttons:Array<FlxGamepadInputID>, state, id)
|
||||
public inline static function addButtons(action:FlxActionDigital, buttons:Array<FlxGamepadInputID>, state, id)
|
||||
{
|
||||
for (button in buttons)
|
||||
action.addGamepad(button, state, id);
|
||||
}
|
||||
|
||||
static function removeButtons(action:FlxActionDigital, gamepadID:Int, buttons:Array<FlxGamepadInputID>)
|
||||
public static function removeButtons(action:FlxActionDigital, gamepadID:Int, buttons:Array<FlxGamepadInputID>)
|
||||
{
|
||||
var i = action.inputs.length;
|
||||
while (i-- > 0)
|
||||
@@ -319,8 +320,21 @@ class Controls extends FlxActionSet
|
||||
}
|
||||
}
|
||||
|
||||
inline static function isGamepad(input:FlxActionInput, deviceID:Int)
|
||||
public inline static function isGamepad(input:FlxActionInput, deviceID:Int)
|
||||
{
|
||||
return input.device == GAMEPAD && (deviceID == FlxInputDeviceID.ALL || input.deviceID == deviceID);
|
||||
}
|
||||
}
|
||||
|
||||
@:nullSafety(Off)
|
||||
public inline function getJustPressed(name:String) {
|
||||
return ControlsUtil.getJustPressed(this, name);
|
||||
}
|
||||
@:nullSafety(Off)
|
||||
public inline function getJustReleased(name:String) {
|
||||
return ControlsUtil.getJustReleased(this, name);
|
||||
}
|
||||
@:nullSafety(Off)
|
||||
public inline function getPressed(name:String) {
|
||||
return ControlsUtil.getPressed(this, name);
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ class MainState extends FlxState {
|
||||
#end
|
||||
Options.save();
|
||||
|
||||
ControlsUtil.resetCustomControls();
|
||||
FlxG.bitmap.reset();
|
||||
FlxG.sound.destroy(true);
|
||||
|
||||
@@ -57,6 +58,7 @@ class MainState extends FlxState {
|
||||
ModsFolder.onModSwitch.dispatch(ModsFolder.currentModFolder);
|
||||
DiscordUtil.init();
|
||||
EventsData.reloadEvents();
|
||||
ControlsUtil.loadCustomControls();
|
||||
TitleState.initialized = false;
|
||||
|
||||
if (betaWarningShown)
|
||||
|
||||
Reference in New Issue
Block a user