Skip to content

Commit

Permalink
fpsCounter -> showFps
Browse files Browse the repository at this point in the history
  • Loading branch information
CrusherNotDrip committed Jan 23, 2025
1 parent 9551b1d commit e1960dd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
48 changes: 35 additions & 13 deletions src/funkin/data/save/Save.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,16 @@ class Save
*/
public static final SAVE_VERSION_RULE:VersionRule = '1.x';

/**
* The latest instance of this class.
*/
public static var instance(get, never):Save;

static var _instance:Null<Save> = null;

static function get_instance():Save
{
if (_instance == null)
{
return _instance = loadFromSaveSlot(1);
}
return _instance;
}

/**
* The recently loaded save data.
*/
public var data:SaveStructure = null;

public function new(?data:SaveStructure)
Expand Down Expand Up @@ -109,11 +106,19 @@ class Save
*/
public function setOptionValues():Void
{
FlxG.updateFramerate = options.fps;
FlxG.drawFramerate = options.fps;
if (options.fps > FlxG.drawFramerate)
{
FlxG.updateFramerate = options.fps;
FlxG.drawFramerate = options.fps;
}
else
{
FlxG.drawFramerate = options.fps;
FlxG.updateFramerate = options.fps;
}

if (Main.performanceStats != null)
Main.performanceStats.visible = options.fpsCounter;
Main.performanceStats.visible = options.showFps;

FlxG.fullscreen = options.fullscreen;

Expand All @@ -137,23 +142,29 @@ class Save
FlxG.save.mergeData(data, true);
}

/**
* @return Returns the default save options
*/
public static function getDefault():SaveStructure
{
return {
version: SAVE_VERSION,

volume: 1.0,
mute: false,

progress: {
storyMode: new Map<String, Int>(),
highscores: {
storyMode: new Map<String, Int>(),
freeplay: new Map<String, Int>(),
}
},

options: {
// Graphics
fps: 60,
fpsCounter: true,
showFps: true,
fullscreen: false,
antialiasing: true,
flashingLights: true,
Expand All @@ -162,6 +173,7 @@ class Save
safeMode: true,
devMode: false
},

controls: Controls.getDefaultMappings()
};
}
Expand Down Expand Up @@ -214,4 +226,14 @@ class Save

return slot;
}

static function get_instance():Save
{
if (_instance == null)
{
return _instance = loadFromSaveSlot(1);
}

return _instance;
}
}
2 changes: 1 addition & 1 deletion src/funkin/data/save/SaveMigrator.hx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class SaveMigrator
}

newSave.options.fps = options.get('fps');
newSave.options.fpsCounter = options.get('fpsCounter');
newSave.options.showFps = options.get('fpsCounter');
newSave.options.fullscreen = options.get('fullscreen');
newSave.options.antialiasing = options.get('antialiasing');
newSave.options.flashingLights = options.get('flashingLights');
Expand Down

0 comments on commit e1960dd

Please sign in to comment.