mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-23 21:56:46 +00:00
FPS counter toggle
This commit is contained in:
parent
6b979e50cb
commit
fb7ad03083
|
@ -64,6 +64,8 @@ class Main extends Sprite
|
|||
var netStream:NetStream;
|
||||
private var overlay:Sprite;
|
||||
|
||||
public static var fpsCounter:FPS;
|
||||
|
||||
private function setupGame():Void
|
||||
{
|
||||
var stageWidth:Int = Lib.current.stage.stageWidth;
|
||||
|
@ -85,7 +87,8 @@ class Main extends Sprite
|
|||
addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen));
|
||||
|
||||
#if !mobile
|
||||
addChild(new FPS(10, 3, 0xFFFFFF));
|
||||
fpsCounter = new FPS(10, 3, 0xFFFFFF);
|
||||
addChild(fpsCounter);
|
||||
#end
|
||||
/*
|
||||
video = new Video();
|
||||
|
|
|
@ -62,9 +62,8 @@ class TitleState extends MusicBeatState
|
|||
|
||||
super.create();
|
||||
|
||||
PreferencesMenu.initPrefs();
|
||||
|
||||
FlxG.save.bind('funkin', 'ninjamuffin99');
|
||||
PreferencesMenu.initPrefs();
|
||||
PlayerSettings.init();
|
||||
Highscore.load();
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ class PreferencesMenu extends ui.OptionsState.Page
|
|||
createPrefItem('downscroll', 'downscroll', false);
|
||||
createPrefItem('flashing menu', 'flashing-menu', true);
|
||||
createPrefItem('Camera Zooming on Beat', 'camera-zoom', true);
|
||||
createPrefItem('FPS Counter', 'fps-counter', true);
|
||||
}
|
||||
|
||||
public static function getPref(pref:String):Dynamic
|
||||
|
@ -37,6 +38,10 @@ class PreferencesMenu extends ui.OptionsState.Page
|
|||
preferenceCheck('downscroll', true);
|
||||
preferenceCheck('flashing-menu', true);
|
||||
preferenceCheck('camera-zoom', true);
|
||||
preferenceCheck('fps-counter', true);
|
||||
|
||||
if (!getPref('fps-counter'))
|
||||
FlxG.stage.removeChild(Main.fpsCounter);
|
||||
}
|
||||
|
||||
private function createPrefItem(prefName:String, prefString:String, prefValue:Dynamic):Void
|
||||
|
@ -84,6 +89,14 @@ class PreferencesMenu extends ui.OptionsState.Page
|
|||
preferences.set(prefName, daSwap);
|
||||
checkboxes[items.selectedIndex].daValue = daSwap;
|
||||
trace('toggled? ' + preferences.get(prefName));
|
||||
|
||||
if (prefName == 'fps-counter')
|
||||
{
|
||||
if (getPref('fps-counter'))
|
||||
FlxG.stage.addChild(Main.fpsCounter);
|
||||
else
|
||||
FlxG.stage.removeChild(Main.fpsCounter);
|
||||
}
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
|
|
Loading…
Reference in a new issue