Skip to content

Commit

Permalink
minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Nov 8, 2024
1 parent dcc790b commit 897c29c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Main extends Sprite {

game = new FlxGame(1280, 720, TitleState, 60, 60, true);


// FlxG.game._customSoundTray wants just the class, it calls new from
// create() in there, which gets called when it's added to stage
// which is why it needs to be added before addChild(game) here
Expand Down
3 changes: 0 additions & 3 deletions source/states/MusicBeatState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ class MusicBeatState extends #if MODCHARTING_TOOLS modcharting.ModchartMusicBeat

super.update(elapsed);

if (FlxG.stage != null)
FlxG.stage.frameRate = FlxMath.bound(Options.getData("maxFPS"), 0.1, 1000);

if (!Options.getData("antialiasing")) {
forEachAlive(function(basic:FlxBasic) {
if (!(basic is FlxSprite)) {
Expand Down
15 changes: 9 additions & 6 deletions source/states/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,21 @@ class TitleState extends MusicBeatState {
#end
MusicBeatState.windowNamePrefix = Options.getData("curMod");
CoolUtil.setWindowIcon("mods/" + Options.getData("curMod") + "/_polymod_icon.png");

FlxG.drawFramerate = Options.getData("maxFPS");

#if FLX_NO_DEBUG
if (Options.getData("flixelStartupScreen") && !doneFlixelSplash) {
doneFlixelSplash = true;
FlxG.switchState(() -> new FlxSplash(new TitleState()));
return;
}
#end

if (Options.getData("flashingLights") == null)
FlxG.switchState(new FlashingLightsMenu());

curWacky = FlxG.random.getObject(getIntroTextShit());

super.create();

#if DISCORD_ALLOWED
Expand Down Expand Up @@ -411,10 +412,12 @@ class TitleState extends MusicBeatState {
textDataText(2);
case 7:
textDataText(3);
newgrounds.visible = true;
if(newgrounds != null)
newgrounds.visible = true;
case 8:
deleteCoolText();
newgrounds.visible = false;
if(newgrounds != null)
newgrounds.visible = false;
case 9:
if (curWacky[0] != null) {
createCoolText([curWacky[0]]);
Expand Down
2 changes: 2 additions & 0 deletions source/substates/MaxFPSMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class MaxFPSMenu extends MusicBeatSubstate
override function update(elapsed:Float) {
super.update(elapsed);

FlxG.stage.frameRate = flixel.math.FlxMath.bound(fps, 0.1, 1000);

var leftP = controls.LEFT_P;
var rightP = controls.RIGHT_P;

Expand Down
2 changes: 0 additions & 2 deletions source/substates/MusicBeatSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ class MusicBeatSubstate extends FlxSubState {

super.update(elapsed);

if (FlxG.stage != null)
FlxG.stage.frameRate = flixel.math.FlxMath.bound(Options.getData("maxFPS"), 0.1, 1000);

if (!Options.getData("antialiasing")) {
forEachAlive(function(basic:FlxBasic) {
Expand Down

0 comments on commit 897c29c

Please sign in to comment.