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

By default, bind Alt + Enter to switch between fullscreen and windowed mode #1983

Open
iwanPlays opened this issue Dec 14, 2020 · 3 comments · May be fixed by godotengine/godot#39708
Open

Comments

@iwanPlays
Copy link

iwanPlays commented Dec 14, 2020

Describe the project you are working on

None. I am a YouTuber representing players from a convenience/usability perspective.

Describe the problem or limitation you are having in your project

Godot games usually start at 1280x720 windowed mode

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Unreal and Unity by default allow switching between windowed (multitasking) and fullscreen (immersion) using ALT+ENTER Most other games do too. It allows for fast necessary window management, because there are screens/drivers that just have issues with fullscreen but playing fullscreen is important for immersion.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

if alt-enter pressed and fullscreen then
  windowed
else
  fullscreen
end

A project settings switch could be used to disable this a la https://answers.unity.com/questions/544183/block-or-override-alt-enter-fullscreen.html but it needs to be default.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Of course, yes. But it will be used by every game unless the game is supposed to be a troll/subversive kind of game. The purpose of this is to provide usability/immersion to projects made by beginners. It is to help beginner game devs who are already overwhelmed by making a game and not have them think about window management.

Is there a reason why this should be core and not an add-on in the asset library?

It's basic functionality of nearly every game on the market. Just like ALT+F4 needs to kill applications unless there's a really good reason against or ALT+TAB should always switch applications unless there's a REALLY REALLY REALLY good reason against that.

@Calinou
Copy link
Member

Calinou commented Dec 14, 2020

This will be implemented by godotengine/godot#39708 once it's merged.

It's basic functionality of nearly every game on the market. Just like ALT+F4 needs to kill applications unless there's a really good reason against or ALT+TAB should always switch applications unless there's a REALLY REALLY REALLY good reason against that.

Note that these are handled differently to Alt + Enter though, since the OS will handle those by default. Alt + Enter needs to be implemented by the application as the OS doesn't implement it by default.

@elvisish
Copy link

For Godot 4.x, if anyone wants a quick solution, just add this to InputMap:
image

And throw this in an Autorun:

func _input(event):
	if Input.is_action_pressed("toggle_fullscreen"):
		if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_WINDOWED:
			DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
		elif DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
			DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)

@Calinou
Copy link
Member

Calinou commented Apr 16, 2024

For Godot 4.x, if anyone wants a quick solution, just add this to InputMap:

As an aside, note that WINDOW_MODE_EXCLUSIVE_FULLSCREEN should be used for games instead of WINDOW_MODE_FULLSCREEN, which is intended to be used for non-game applications. WINDOW_MODE_FULLSCREEN intentionally adds a border around the borderless fullscreen window, so that other windows can be overlaid on top (for multi-window support). This border is needed so that the graphics driver doesn't automatically convert it to exclusive fullscreen, which has various limitations that can be problematic for non-game applications (such as overlaying other windows on top).

In contrast, WINDOW_MODE_EXCLUSIVE_FULLSCREEN provides lower latency and no visible border, but no ability to overlay other windows on top. See discussion in godotengine/godot#63500 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants