diff --git a/assets/languages/en/Options.xml b/assets/languages/en/Options.xml index 1cde775d71..e1385e43d1 100644 --- a/assets/languages/en/Options.xml +++ b/assets/languages/en/Options.xml @@ -68,6 +68,12 @@ Framerate Pretty self explanatory, isn't it? + FPS Counter + If checked, displays the Framerate and Memory counter in the top left. + + More Options + Use this menu to toggle the debug info categories on the FPS counter. + Flashing Menu If unchecked, will disable menu flashing when you select an option in the Main Menu, and other flashes will be slower. @@ -96,6 +102,23 @@ VRAM-Only Sprites If checked, will only store the bitmaps in the GPU, freeing a LOT of memory (EXPERIMENTAL). Turning this off will consume a lot of memory, especially on bigger sprites. If you aren't sure, leave this on. + + + Show Conductor Info + If checked, will display information relating to the conductor on the debug FPS Counter menu. + + Show Flixel Info + If checked, will display information relating to Flixel on the debug FPS Counter menu. + + Show System Info + If checked, will display information relating to your system on the debug FPS Counter menu. + + Show Assets Tree Info + If checked, will display information relating to the assets tree on the debug FPS Counter menu. + + Show Stats Info + If checked, will Fuck idk + diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index 31d270d9d2..91d2645784 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -198,7 +198,7 @@ class Main extends Sprite if (PlayerSettings.solo.controls.DEV_CONSOLE) NativeAPI.allocConsole(); - if (PlayerSettings.solo.controls.FPS_COUNTER) + if (PlayerSettings.solo.controls.FPS_COUNTER && Options.fpsCounter) Framerate.debugMode = (Framerate.debugMode + 1) % 3; } diff --git a/source/funkin/backend/system/framerate/AssetTreeInfo.hx b/source/funkin/backend/system/framerate/AssetTreeInfo.hx index f81218879e..4e63cec327 100644 --- a/source/funkin/backend/system/framerate/AssetTreeInfo.hx +++ b/source/funkin/backend/system/framerate/AssetTreeInfo.hx @@ -13,6 +13,7 @@ class AssetTreeInfo extends FramerateCategory { public function new() { super("Asset Libraries Tree Info"); + visible = Options.fpsCounterAssets; } public override function __enterFrame(t:Int) { diff --git a/source/funkin/backend/system/framerate/ConductorInfo.hx b/source/funkin/backend/system/framerate/ConductorInfo.hx index d5fc9a1737..a63729e2ae 100644 --- a/source/funkin/backend/system/framerate/ConductorInfo.hx +++ b/source/funkin/backend/system/framerate/ConductorInfo.hx @@ -5,6 +5,7 @@ import funkin.backend.system.macros.StringMacro; class ConductorInfo extends FramerateCategory { public function new() { super("Conductor Info"); + visible = Options.fpsCounterConductor; } public override function __enterFrame(t:Int) { diff --git a/source/funkin/backend/system/framerate/FlixelInfo.hx b/source/funkin/backend/system/framerate/FlixelInfo.hx index 0ce42c299a..05b8409996 100644 --- a/source/funkin/backend/system/framerate/FlixelInfo.hx +++ b/source/funkin/backend/system/framerate/FlixelInfo.hx @@ -6,6 +6,7 @@ import funkin.backend.system.macros.StringMacro; class FlixelInfo extends FramerateCategory { public function new() { super("Flixel Info"); + visible = Options.fpsCounterFlixel; } public override function __enterFrame(t:Int) { diff --git a/source/funkin/backend/system/framerate/Framerate.hx b/source/funkin/backend/system/framerate/Framerate.hx index c33b416c68..6ab4c12955 100644 --- a/source/funkin/backend/system/framerate/Framerate.hx +++ b/source/funkin/backend/system/framerate/Framerate.hx @@ -19,6 +19,13 @@ class Framerate extends Sprite { #if SHOW_BUILD_ON_FPS public static var codenameBuildField:CodenameBuildField; #end + public static var conductorInfo:ConductorInfo; + public static var flixelInfo:FlixelInfo; + public static var systemInfo:SystemInfo; + public static var assetInfo:AssetTreeInfo; + #if (gl_stats && !disable_cffi && (!html5 || !canvas)) + public static var statsInfo:StatsInfo; + #end public static var fontName:String = #if windows '${Sys.getEnv("windir")}\\Fonts\\consola.ttf' #else "_typewriter" #end; @@ -27,7 +34,7 @@ class Framerate extends Sprite { * 1: FPS VISIBLE * 2: FPS & DEBUG INFO VISIBLE */ - public static var debugMode:Int = 1; + public static var debugMode:Int = Options.fpsCounter ? 1 : 0; public static var offset:FlxPoint = new FlxPoint(); public var bgSprite:Bitmap; @@ -65,13 +72,13 @@ class Framerate extends Sprite { #if SHOW_BUILD_ON_FPS __addToList(codenameBuildField = new CodenameBuildField()); #end - __addCategory(new ConductorInfo()); - __addCategory(new FlixelInfo()); - __addCategory(new SystemInfo()); - __addCategory(new AssetTreeInfo()); + __addCategory(conductorInfo = new ConductorInfo()); + __addCategory(flixelInfo = new FlixelInfo()); + __addCategory(systemInfo = new SystemInfo()); + __addCategory(assetInfo = new AssetTreeInfo()); #if (gl_stats && !disable_cffi && (!html5 || !canvas)) - __addCategory(new StatsInfo()); + __addCategory(statsInfo = new StatsInfo()); #end } @@ -127,6 +134,7 @@ class Framerate extends Sprite { var y:Float = height + 4; for(c in categories) { + if (!c.visible) continue; c.title.selectable = c.text.selectable = selectable; c.alpha = debugAlpha; c.x = FlxMath.lerp(-c.width - offset.x, 0, debugAlpha); diff --git a/source/funkin/backend/system/framerate/FramerateCategory.hx b/source/funkin/backend/system/framerate/FramerateCategory.hx index 0bae85b2db..fddc40e06a 100644 --- a/source/funkin/backend/system/framerate/FramerateCategory.hx +++ b/source/funkin/backend/system/framerate/FramerateCategory.hx @@ -36,7 +36,6 @@ class FramerateCategory extends Sprite { this.title.multiline = this.title.wordWrap = false; this.text.multiline = true; - this.text.y = this.title.y + this.title.height + 2; } diff --git a/source/funkin/backend/system/framerate/StatsInfo.hx b/source/funkin/backend/system/framerate/StatsInfo.hx index bc98c39223..1dc6c3968e 100644 --- a/source/funkin/backend/system/framerate/StatsInfo.hx +++ b/source/funkin/backend/system/framerate/StatsInfo.hx @@ -8,6 +8,7 @@ import funkin.backend.system.macros.StringMacro; class StatsInfo extends FramerateCategory { public function new() { super("Asset Libraries Tree Info"); + visible = Options.fpsCounterStats; } public override function __enterFrame(t:Int) { diff --git a/source/funkin/backend/system/framerate/SystemInfo.hx b/source/funkin/backend/system/framerate/SystemInfo.hx index 4562b338a1..ce3fdaf280 100644 --- a/source/funkin/backend/system/framerate/SystemInfo.hx +++ b/source/funkin/backend/system/framerate/SystemInfo.hx @@ -179,6 +179,7 @@ class SystemInfo extends FramerateCategory { public function new() { super("System Info"); + visible = Options.fpsCounterSystem; } public override function __enterFrame(t:Int) { diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx index b3984580fe..17d00fa1fe 100644 --- a/source/funkin/options/Options.hx +++ b/source/funkin/options/Options.hx @@ -26,6 +26,11 @@ class Options public static var flashingMenu:Bool = true; public static var camZoomOnBeat:Bool = true; public static var fpsCounter:Bool = true; + public static var fpsCounterConductor:Bool = true; + public static var fpsCounterFlixel:Bool = true; + public static var fpsCounterSystem:Bool = true; + public static var fpsCounterAssets:Bool = true; + public static var fpsCounterStats:Bool = true; public static var autoPause:Bool = true; public static var antialiasing:Bool = true; public static var volume:Float = 1; diff --git a/source/funkin/options/categories/AppearanceOptions.hx b/source/funkin/options/categories/AppearanceOptions.hx index f6cf1783d0..8c65872558 100644 --- a/source/funkin/options/categories/AppearanceOptions.hx +++ b/source/funkin/options/categories/AppearanceOptions.hx @@ -1,6 +1,11 @@ package funkin.options.categories; +import funkin.backend.system.framerate.Framerate; + class AppearanceOptions extends TreeMenuScreen { + var fpsAdvancedOption:TextOption; + var lastFPSDebugMode:Int = 1; + public function new() { super('optionsTree.appearance-name', 'optionsTree.appearance-desc', 'AppearanceOptions.'); @@ -8,6 +13,7 @@ class AppearanceOptions extends TreeMenuScreen { 30, 240, 1, 'framerate', __changeFPS )); + add(new Checkbox(getNameID('fpsCounter'), getDescID('fpsCounter'), 'fpsCounter', __changeFPSCounter)); add(new Checkbox(getNameID('flashingMenu'), getDescID('flashingMenu'), 'flashingMenu')); add(new Checkbox(getNameID('colorHealthBar'), getDescID('colorHealthBar'), 'colorHealthBar')); add(new Checkbox(getNameID('week6PixelPerfect'), getDescID('week6PixelPerfect'), 'week6PixelPerfect')); @@ -15,6 +21,8 @@ class AppearanceOptions extends TreeMenuScreen { add(new Separator()); add(new TextOption('optionsMenu.advanced', 'optionsTree.appearance.advanced-desc', ' >', () -> parent.addMenu(new AdvancedAppearanceOptions()))); + + __changeFPSCounter(); } private function __changeFPS(value:Float) { @@ -22,6 +30,21 @@ class AppearanceOptions extends TreeMenuScreen { if (FlxG.updateFramerate < framerate) FlxG.drawFramerate = FlxG.updateFramerate = framerate; else FlxG.updateFramerate = FlxG.drawFramerate = framerate; } + + private function __changeFPSCounter() { + if (Framerate.debugMode != 0 && !Options.fpsCounter) lastFPSDebugMode = Framerate.debugMode; + Framerate.debugMode = Options.fpsCounter ? (lastFPSDebugMode ?? 1) : 0; + + if (Options.fpsCounter) { + if (fpsAdvancedOption == null) { + insert(2, fpsAdvancedOption = new TextOption(getNameID('fpsAdvanced'), getDescID('fpsAdvanced'), ' >', () -> parent.addMenu(new FramerateAppearanceOptions()))); + } + } else if (fpsAdvancedOption != null) { + remove(fpsAdvancedOption, true); + fpsAdvancedOption = flixel.util.FlxDestroyUtil.destroy(fpsAdvancedOption); + if (curSelected >= length) changeSelection(0, true); + } + } } class AdvancedAppearanceOptions extends TreeMenuScreen { @@ -78,3 +101,17 @@ class AdvancedAppearanceOptions extends TreeMenuScreen { FlxG.game.stage.quality = (FlxG.enableAntialiasing = Options.antialiasing) ? BEST : LOW; } } + +class FramerateAppearanceOptions extends TreeMenuScreen { + public function new() { + super('AppearanceOptions.fpsAdvanced-name', 'AppearanceOptions.fpsAdvanced-desc', 'AppearanceOptions.Advanced.'); + + add(new Checkbox(getNameID('fpsCounterConductor'), getDescID('fpsCounterConductor'), 'fpsCounterConductor', () -> Framerate.conductorInfo.visible = Options.fpsCounterConductor)); + add(new Checkbox(getNameID('fpsCounterFlixel'), getDescID('fpsCounterFlixel'), 'fpsCounterFlixel', () -> Framerate.flixelInfo.visible = Options.fpsCounterFlixel)); + add(new Checkbox(getNameID('fpsCounterSystem'), getDescID('fpsCounterSystem'), 'fpsCounterSystem', () -> Framerate.systemInfo.visible = Options.fpsCounterSystem)); + add(new Checkbox(getNameID('fpsCounterAssets'), getDescID('fpsCounterAssets'), 'fpsCounterAssets', () -> Framerate.assetInfo.visible = Options.fpsCounterAssets)); + #if (gl_stats && !disable_cffi && (!html5 || !canvas)) + add(new Checkbox(getNameID('fpsCounterStats'), 'optionsMenu.desc-missing', 'fpsCounterStats', () -> Framerate.statsInfo.visible = Options.fpsCounterStats)); + #end + } +}