Remove the framerate options on web

This commit is contained in:
MAJigsaw77
2026-03-14 22:13:54 -06:00
committed by Hundrec
parent 139940f9ec
commit bed249dca0
3 changed files with 7 additions and 38 deletions
-7
View File
@@ -164,13 +164,6 @@ class Main extends Sprite
});
#end
// Don't call anything from the preferences until the save is loaded!
#if web
// set this variable (which is a function) from the lime version at lime/_internal/backend/html5/HTML5Application.hx
// The framerate cap will more thoroughly initialize via Preferences in InitState.hx
funkin.Preferences.lockedFramerateFunction = untyped js.Syntax.code("window.requestAnimationFrame");
#end
WindowUtil.setVSyncMode(funkin.Preferences.vsyncMode);
// Force a `FunkinCamera` to be the default camera.
+5 -29
View File
@@ -344,7 +344,7 @@ class Preferences
static function get_vsyncMode():lime.ui.WindowVSyncMode
{
#if mobile
#if (mobile || web)
return lime.ui.WindowVSyncMode.OFF;
#else
var value = Save?.instance?.options?.vsyncMode ?? "Off";
@@ -365,7 +365,7 @@ class Preferences
static function set_vsyncMode(value:lime.ui.WindowVSyncMode):lime.ui.WindowVSyncMode
{
#if mobile
#if (mobile || web)
return lime.ui.WindowVSyncMode.OFF;
#else
var string;
@@ -395,7 +395,7 @@ class Preferences
static function get_unlockedFramerate():Bool
{
#if mobile
#if (mobile || web)
return false;
#else
return Save?.instance?.options?.unlockedFramerate ?? false;
@@ -404,7 +404,7 @@ class Preferences
static function set_unlockedFramerate(value:Bool):Bool
{
#if mobile
#if (mobile || web)
return false;
#else
if (value != Save.instance.options.unlockedFramerate)
@@ -419,27 +419,6 @@ class Preferences
#end
}
#if web
// We create a haxe version of this just for readability.
// We use these to override `window.requestAnimationFrame` in Javascript to uncap the framerate / "animation" request rate
// Javascript is crazy since u can just do stuff like that lol
public static function unlockedFramerateFunction(callback, element)
{
var currTime = Date.now().getTime();
var timeToCall = 0;
var id = js.Browser.window.setTimeout(function()
{
callback(currTime + timeToCall);
}, timeToCall);
return id;
}
// Lime already implements their own little framerate cap, so we can just use that
// This also gets set in the init function in Main.hx, since we need to definitely override it
public static var lockedFramerateFunction = untyped js.Syntax.code("window.requestAnimationFrame");
#end
/**
* If >0, the game will display a semi-opaque background under the notes.
* `0` for no background, `100` for solid black if you're freaky like that
@@ -539,10 +518,7 @@ class Preferences
static function toggleFramerateCap(unlocked:Bool):Void
{
#if web
var framerateFunction = unlocked ? unlockedFramerateFunction : lockedFramerateFunction;
untyped js.Syntax.code("window.requestAnimationFrame = framerateFunction;");
#else
#if !(mobile || web)
FlxG.drawFramerate = unlocked ? 0 : framerate;
FlxG.updateFramerate = unlocked ? 0 : framerate;
#end
+2 -2
View File
@@ -177,8 +177,8 @@ class PreferencesMenu extends Page<OptionsState.OptionsMenuPageName>
}, Preferences.autoFullscreen);
#end
// disable on mobile since it barely has any effect
#if !mobile
// disable on mobile and web since it barely has any effect
#if !(mobile || web)
createPrefItemEnum('VSync', "When enabled, the game attempts to match the framerate with your monitor's refresh rate.",
["Off" => WindowVSyncMode.OFF, "On" => WindowVSyncMode.ON, "Adaptive" => WindowVSyncMode.ADAPTIVE,], function(key:String, value:WindowVSyncMode):Void
{