+3








44c32cb0fc
Co-authored-by: Hyper_ <40342021+NotHyper-474@users.noreply.github.com> Co-authored-by: Lasercar <64717068+Lasercar@users.noreply.github.com> Co-authored-by: Lasercar <B_l_u_t_a_c_k@hotmail.com.au> Co-authored-by: anysad <anysadiscool@gmail.com> Co-authored-by: Hundrec <hundrecard@gmail.com> Co-authored-by: VioletSnowLeopard <ngzeretzke@gmail.com> Co-authored-by: unknown <47027981+ACrazyTown@users.noreply.github.com> Co-authored-by: kade-github <26305836+Kade-github@users.noreply.github.com> Co-authored-by: Abnormal <86753001+AbnormalPoof@users.noreply.github.com> Co-authored-by: CrusherNotDrip <90648119+CrusherNotDrip@users.noreply.github.com> Co-authored-by: cyn0x8 <cyn0x8+git@gmail.com>
42 lines
977 B
Haxe
42 lines
977 B
Haxe
package funkin.util.plugins;
|
|
|
|
import flixel.FlxBasic;
|
|
|
|
/**
|
|
* Handles volume control in a way that is compatible with alternate control schemes.
|
|
*/
|
|
class VolumePlugin extends FlxBasic
|
|
{
|
|
public function new()
|
|
{
|
|
super();
|
|
}
|
|
|
|
public static function initialize()
|
|
{
|
|
FlxG.plugins.addPlugin(new VolumePlugin());
|
|
}
|
|
|
|
public override function update(elapsed:Float):Void
|
|
{
|
|
super.update(elapsed);
|
|
|
|
var isHaxeUIFocused:Bool = haxe.ui.focus.FocusManager.instance?.focus != null;
|
|
|
|
if (!isHaxeUIFocused)
|
|
{
|
|
// Rebindable volume keys.
|
|
if (PlayerSettings.player1.controls.VOLUME_MUTE) FlxG.sound.toggleMuted();
|
|
else if (PlayerSettings.player1.controls.VOLUME_UP) FlxG.sound.changeVolume(0.1);
|
|
else if (PlayerSettings.player1.controls.VOLUME_DOWN) FlxG.sound.changeVolume(-0.1);
|
|
}
|
|
}
|
|
|
|
override public function destroy():Void
|
|
{
|
|
if (FlxG.plugins.list.contains(this)) FlxG.plugins.remove(this);
|
|
|
|
super.destroy();
|
|
}
|
|
}
|