Skip to content

Commit 7324ee9

Browse files
authored
Toggleable fps counter + toggleable fps debug categories (#1060)
* wip (gotta add translations Lol!) * Added Options.fpsCounter functionality * Added options boolean for all of the framerate categories * Each said categories are toggleable wow! * Kissed my gf (not yet but soon) * maybe i shouldve slept instead of opening the pr at 1am oops
1 parent f29a9f1 commit 7324ee9

11 files changed

Lines changed: 85 additions & 8 deletions

File tree

assets/languages/en/Options.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
<str id="framerate-desc">Pretty self explanatory, isn't it?</str>
7070
<str id="framerate-unlimited">Unlimited</str>
7171

72+
<str id="fpsCounter-name">FPS Counter</str>
73+
<str id="fpsCounter-desc">If checked, displays the Framerate and Memory counter in the top left.</str>
74+
75+
<str id="fpsAdvanced-name">More Options</str>
76+
<str id="fpsAdvanced-desc">Use this menu to toggle the debug info categories on the FPS counter.</str>
77+
7278
<str id="flashingMenu-name">Flashing Menu</str>
7379
<str id="flashingMenu-desc">If unchecked, will disable menu flashing when you select an option in the Main Menu, and other flashes will be slower.</str>
7480

@@ -97,6 +103,23 @@
97103
<str id="gpuOnlyBitmaps-name">VRAM-Only Sprites</str>
98104
<str id="gpuOnlyBitmaps-desc">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.</str>
99105
</group>
106+
107+
<group name="AppearanceOptionsFramerate" prefix="Advanced.">
108+
<str id="fpsCounterConductor-name">Show Conductor Info</str>
109+
<str id="fpsCounterConductor-desc">If checked, will display information relating to the conductor on the debug FPS Counter menu.</str>
110+
111+
<str id="fpsCounterFlixel-name">Show Flixel Info</str>
112+
<str id="fpsCounterFlixel-desc">If checked, will display information relating to Flixel on the debug FPS Counter menu.</str>
113+
114+
<str id="fpsCounterSystem-name">Show System Info</str>
115+
<str id="fpsCounterSystem-desc">If checked, will display information relating to your system on the debug FPS Counter menu.</str>
116+
117+
<str id="fpsCounterAssets-name">Show Assets Tree Info</str>
118+
<str id="fpsCounterAssets-desc">If checked, will display information relating to the assets tree on the debug FPS Counter menu.</str>
119+
120+
<str id="fpsCounterStats-name">Show Stats Info</str>
121+
<str id="fpsCounterStats-desc">If checked, will Fuck idk</str>
122+
</group>
100123
</group>
101124

102125
<group name="GameplayOptions" prefix="GameplayOptions.">

source/funkin/backend/system/Main.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class Main extends Sprite
198198
if (PlayerSettings.solo.controls.DEV_CONSOLE)
199199
NativeAPI.allocConsole();
200200

201-
if (PlayerSettings.solo.controls.FPS_COUNTER)
201+
if (PlayerSettings.solo.controls.FPS_COUNTER && Options.fpsCounter)
202202
Framerate.debugMode = (Framerate.debugMode + 1) % 3;
203203
}
204204

source/funkin/backend/system/framerate/AssetTreeInfo.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class AssetTreeInfo extends FramerateCategory {
1313

1414
public function new() {
1515
super("Asset Libraries Tree Info");
16+
visible = Options.fpsCounterAssets;
1617
}
1718

1819
public override function __enterFrame(t:Int) {

source/funkin/backend/system/framerate/ConductorInfo.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import funkin.backend.system.macros.StringMacro;
55
class ConductorInfo extends FramerateCategory {
66
public function new() {
77
super("Conductor Info");
8+
visible = Options.fpsCounterConductor;
89
}
910

1011
public override function __enterFrame(t:Int) {

source/funkin/backend/system/framerate/FlixelInfo.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import funkin.backend.system.macros.StringMacro;
66
class FlixelInfo extends FramerateCategory {
77
public function new() {
88
super("Flixel Info");
9+
visible = Options.fpsCounterFlixel;
910
}
1011

1112
public override function __enterFrame(t:Int) {

source/funkin/backend/system/framerate/Framerate.hx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ class Framerate extends Sprite {
1919
#if SHOW_BUILD_ON_FPS
2020
public static var codenameBuildField:CodenameBuildField;
2121
#end
22+
public static var conductorInfo:ConductorInfo;
23+
public static var flixelInfo:FlixelInfo;
24+
public static var systemInfo:SystemInfo;
25+
public static var assetInfo:AssetTreeInfo;
26+
#if (gl_stats && !disable_cffi && (!html5 || !canvas))
27+
public static var statsInfo:StatsInfo;
28+
#end
2229

2330
public static var fontName:String = #if windows '${Sys.getEnv("windir")}\\Fonts\\consola.ttf' #else "_typewriter" #end;
2431

@@ -27,7 +34,7 @@ class Framerate extends Sprite {
2734
* 1: FPS VISIBLE
2835
* 2: FPS & DEBUG INFO VISIBLE
2936
*/
30-
public static var debugMode:Int = 1;
37+
public static var debugMode:Int = Options.fpsCounter ? 1 : 0;
3138
public static var offset:FlxPoint = new FlxPoint();
3239

3340
public var bgSprite:Bitmap;
@@ -65,13 +72,13 @@ class Framerate extends Sprite {
6572
#if SHOW_BUILD_ON_FPS
6673
__addToList(codenameBuildField = new CodenameBuildField());
6774
#end
68-
__addCategory(new ConductorInfo());
69-
__addCategory(new FlixelInfo());
70-
__addCategory(new SystemInfo());
71-
__addCategory(new AssetTreeInfo());
75+
__addCategory(conductorInfo = new ConductorInfo());
76+
__addCategory(flixelInfo = new FlixelInfo());
77+
__addCategory(systemInfo = new SystemInfo());
78+
__addCategory(assetInfo = new AssetTreeInfo());
7279

7380
#if (gl_stats && !disable_cffi && (!html5 || !canvas))
74-
__addCategory(new StatsInfo());
81+
__addCategory(statsInfo = new StatsInfo());
7582
#end
7683
}
7784

@@ -127,6 +134,7 @@ class Framerate extends Sprite {
127134

128135
var y:Float = height + 4;
129136
for(c in categories) {
137+
if (!c.visible) continue;
130138
c.title.selectable = c.text.selectable = selectable;
131139
c.alpha = debugAlpha;
132140
c.x = FlxMath.lerp(-c.width - offset.x, 0, debugAlpha);

source/funkin/backend/system/framerate/FramerateCategory.hx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class FramerateCategory extends Sprite {
3636
this.title.multiline = this.title.wordWrap = false;
3737
this.text.multiline = true;
3838

39-
4039
this.text.y = this.title.y + this.title.height + 2;
4140
}
4241

source/funkin/backend/system/framerate/StatsInfo.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import funkin.backend.system.macros.StringMacro;
88
class StatsInfo extends FramerateCategory {
99
public function new() {
1010
super("Asset Libraries Tree Info");
11+
visible = Options.fpsCounterStats;
1112
}
1213

1314
public override function __enterFrame(t:Int) {

source/funkin/backend/system/framerate/SystemInfo.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ class SystemInfo extends FramerateCategory {
179179

180180
public function new() {
181181
super("System Info");
182+
visible = Options.fpsCounterSystem;
182183
}
183184

184185
public override function __enterFrame(t:Int) {

source/funkin/options/Options.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class Options
2626
public static var flashingMenu:Bool = true;
2727
public static var camZoomOnBeat:Bool = true;
2828
public static var fpsCounter:Bool = true;
29+
public static var fpsCounterConductor:Bool = true;
30+
public static var fpsCounterFlixel:Bool = true;
31+
public static var fpsCounterSystem:Bool = true;
32+
public static var fpsCounterAssets:Bool = true;
33+
public static var fpsCounterStats:Bool = true;
2934
public static var autoPause:Bool = true;
3035
public static var antialiasing:Bool = true;
3136
public static var volume:Float = 1;

0 commit comments

Comments
 (0)