mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-04 13:54:22 +00:00
157 lines
3.3 KiB
Haxe
157 lines
3.3 KiB
Haxe
package funkin;
|
|
|
|
import funkin.save.Save;
|
|
|
|
/**
|
|
* A core class which provides a store of user-configurable, globally relevant values.
|
|
*/
|
|
class Preferences
|
|
{
|
|
/**
|
|
* Whether some particularly fowl language is displayed.
|
|
* @default `true`
|
|
*/
|
|
public static var naughtyness(get, set):Bool;
|
|
|
|
static function get_naughtyness():Bool
|
|
{
|
|
return Save.instance.options.naughtyness;
|
|
}
|
|
|
|
static function set_naughtyness(value:Bool):Bool
|
|
{
|
|
var save = Save.instance;
|
|
save.options.naughtyness = value;
|
|
save.flush();
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* If enabled, the strumline is at the bottom of the screen rather than the top.
|
|
* @default `false`
|
|
*/
|
|
public static var downscroll(get, set):Bool;
|
|
|
|
static function get_downscroll():Bool
|
|
{
|
|
return Save.instance.options.downscroll;
|
|
}
|
|
|
|
static function set_downscroll(value:Bool):Bool
|
|
{
|
|
var save = Save.instance;
|
|
save.options.downscroll = value;
|
|
save.flush();
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* If disabled, flashing lights in the main menu and other areas will be less intense.
|
|
* @default `true`
|
|
*/
|
|
public static var flashingLights(get, set):Bool;
|
|
|
|
static function get_flashingLights():Bool
|
|
{
|
|
return Save.instance.options.flashingLights;
|
|
}
|
|
|
|
static function set_flashingLights(value:Bool):Bool
|
|
{
|
|
var save = Save.instance;
|
|
save.options.flashingLights = value;
|
|
save.flush();
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* If disabled, the camera bump synchronized to the beat.
|
|
* @default `false`
|
|
*/
|
|
public static var zoomCamera(get, set):Bool;
|
|
|
|
static function get_zoomCamera():Bool
|
|
{
|
|
return Save.instance.options.zoomCamera;
|
|
}
|
|
|
|
static function set_zoomCamera(value:Bool):Bool
|
|
{
|
|
var save = Save.instance;
|
|
save.options.zoomCamera = value;
|
|
save.flush();
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* If enabled, an FPS and memory counter will be displayed even if this is not a debug build.
|
|
* @default `false`
|
|
*/
|
|
public static var debugDisplay(get, set):Bool;
|
|
|
|
static function get_debugDisplay():Bool
|
|
{
|
|
return Save.instance.options.debugDisplay;
|
|
}
|
|
|
|
static function set_debugDisplay(value:Bool):Bool
|
|
{
|
|
if (value != Save.instance.options.debugDisplay)
|
|
{
|
|
toggleDebugDisplay(value);
|
|
}
|
|
|
|
var save = Save.instance;
|
|
save.options.debugDisplay = value;
|
|
save.flush();
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* If enabled, the game will automatically pause when tabbing out.
|
|
* @default `true`
|
|
*/
|
|
public static var autoPause(get, set):Bool;
|
|
|
|
static function get_autoPause():Bool
|
|
{
|
|
return Save.instance.options.autoPause;
|
|
}
|
|
|
|
static function set_autoPause(value:Bool):Bool
|
|
{
|
|
if (value != Save.instance.options.autoPause) FlxG.autoPause = value;
|
|
|
|
var save = Save.instance;
|
|
save.options.autoPause = value;
|
|
save.flush();
|
|
return value;
|
|
}
|
|
|
|
public static function init():Void
|
|
{
|
|
FlxG.autoPause = Preferences.autoPause;
|
|
toggleDebugDisplay(Preferences.debugDisplay);
|
|
}
|
|
|
|
static function toggleDebugDisplay(show:Bool):Void
|
|
{
|
|
if (show)
|
|
{
|
|
// Enable the debug display.
|
|
FlxG.stage.addChild(Main.fpsCounter);
|
|
#if !html5
|
|
FlxG.stage.addChild(Main.memoryCounter);
|
|
#end
|
|
}
|
|
else
|
|
{
|
|
// Disable the debug display.
|
|
FlxG.stage.removeChild(Main.fpsCounter);
|
|
#if !html5
|
|
FlxG.stage.removeChild(Main.memoryCounter);
|
|
#end
|
|
}
|
|
}
|
|
}
|