Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions source/funkin/backend/system/FunkinGame.hx
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
package funkin.backend.system;

import flixel.FlxGame;
import flixel.FlxG;
import flixel.FlxState;
import openfl.events.KeyboardEvent;

class FunkinGame extends FlxGame {
var skipNextTickUpdate:Bool = false;

#if desktop
var fullscreenListener:KeyboardEvent->Void;

public function new(gameWidth:Int, gameHeight:Int, entryState:Class<FlxState>, updateFramerate:Int = 60, drawFramerate:Int = 60, skipSplash:Bool = false, startFullscreen:Bool = false) {
super(gameWidth, gameHeight, entryState, updateFramerate, drawFramerate, skipSplash, startFullscreen);

fullscreenListener = function(e:KeyboardEvent) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be in override create(_):Void instead of in public function new?
and the fullscreenListener function should be just a normal function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I'll change it later.

if (e.keyCode == 122) {
FlxG.fullscreen = !FlxG.fullscreen;
}
};
FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN, fullscreenListener);
}
#end

public override function switchState() {
super.switchState();
// draw once to put all images in gpu then put the last update time to now to prevent lag spikes or whatever
Expand Down
2 changes: 0 additions & 2 deletions source/funkin/menus/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ class TitleState extends MusicBeatState

override function update(elapsed:Float)
{
if (FlxG.keys.justPressed.F) FlxG.fullscreen = !FlxG.fullscreen;

var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;

#if mobile
Expand Down