Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fullscreen toggle unreliable? (MacOS) #3089

Open
increpare opened this issue Mar 21, 2024 · 1 comment
Open

Fullscreen toggle unreliable? (MacOS) #3089

increpare opened this issue Mar 21, 2024 · 1 comment

Comments

@increpare
Copy link

increpare commented Mar 21, 2024

  • Haxe version: 4.2.5
  • Flixel version: 5.6.2
  • OpenFL version: 9.3.3-L3uoGG
  • Lime version: 8.1.2
  • Affected targets: MacOS 14.0 (23A344)

Code snippet reproducing the issue:


import flixel.FlxG;
import flixel.FlxState;

class PlayState extends FlxState
{
	override public function create()
	{
		super.create();
	}

	var fullscreen_cached:Bool = false;

	override public function update(elapsed:Float)
	{
		super.update(elapsed);
		// trace elapsed
		FlxG.watch.addQuick("FlxG.fullscreen", FlxG.fullscreen);
		// FlxG.watch.addQuick("displaystate", stage.displayState);
		if (FlxG.keys.justPressed.F)
		{
			FlxG.fullscreen = !FlxG.fullscreen;
		}
		if (FlxG.keys.justPressed.G)
		{
			FlxG.stage.window.fullscreen = !FlxG.stage.window.fullscreen;
		}
		if (FlxG.keys.justPressed.H)
		{
			fullscreen_cached = !fullscreen_cached;
			FlxG.stage.window.fullscreen = fullscreen_cached;
		}
	}
}

Observed behavior:
The game starts windowed mode (either neko or CPP builds have it).
Optional: Press F2 to open debug window to see FlxG.fullscreen in the watch panel.
1: Press F to toggle to fullscreen
2: Press F again. Note in the debug window that FlxG.fullscreen is now false, even though the game remains in windowed mode.
3: Press F again. FlxG.fullscreen is now true, and the game remains in fullscreen.
4: Press F again. This time it switches to windowed mode, and in the debugger, FlxG.fullscreen is now negative
(you can keep pressing F and the behaviour loops)

Expected behavior:
I expect step 2 to bring me back to windowed mode.

Also note, pressing G to assign FlxG.state.window.fullscreen also has errors, but you press it three times to go back to windowed rather than four. Caching the value yourself as in H works. (But doesn't keep track of the user manually maximising the window by pressing the button).

I guess I should see if Lime... has this behaviour as well. Indeed it does, though...slightly different behaviour - openfl/lime#1771

@Geokureli
Copy link
Member

Geokureli commented Mar 21, 2024

Also note, pressing G to assign FlxG.state.window.fullscreen also has errors, but you press it three times to go back to windowed rather than four.

Sounds like lime's behavior matches this description, my initial guess is that flixel takes 4 presses because it's actually setting FlxG.fullscreen to true in step 3, while the game is already fullscreened. I think the crux of the issue lies with lime, but it's worth looking into as a possible flixel issue, either way I do think flixel needs some changes with how it handles fullscreen

@increpare increpare changed the title Fullscreen toggle unreliable? Fullscreen toggle unreliable? (MacOS) Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants