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

Full screen black bars after scaling #4

Open
sunarch opened this issue Nov 27, 2022 · 4 comments
Open

Full screen black bars after scaling #4

sunarch opened this issue Nov 27, 2022 · 4 comments

Comments

@sunarch
Copy link
Contributor

sunarch commented Nov 27, 2022

When entering full screen mode after switching scales with 1-6, I found the following alignment issues:

  • 1-2: black bar on the bottom
  • 3: black bar on the right
  • 6: the resolution stays larger than the screen (gets cropped right and at the bottom) and does not re-scale the resolution as the smaller ones do

It's the same on my laptop and external monitors under Ubuntu 22.04.1.
The other scales work as expected.

@lminiero
Copy link
Owner

lminiero commented Nov 27, 2022

I can't replicate this on my latop, where all resolutions seem to work well with fullscreen in my case, but weird things like the ones you described are indeed happening when I use my external monitor: in that case, there's also cases where after going fullscreen I can't get back to windowed mode (screen remains black).

I think this has to do with the supported resolutions on the monitors themselves, since this is the output of xrandr for my screens for instance:

[lminiero@lminiero ~]$ xrandr
Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 16384 x 16384
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 173mm
   1920x1080     60.01*+  60.01    59.97    59.96    48.01    59.93  
   1680x1050     59.95    59.88  
   1400x1050     59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1440x810      60.00    59.97  
   1368x768      59.88    59.85  
   1280x800      59.99    59.97    59.81    59.91  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   640x400       59.88    59.98  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
DP-3 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 510mm x 290mm
   1920x1080     60.00*+  50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x960      60.00  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    70.07    60.00  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    60.00    59.94  
   720x400       70.08  

Screen 0 (the laptop) has a ton of different resolutions, and they all match the resolutions the game tries to switch to (considering the 320x180 canvas multiplied by 1-6). The external monitor only supports a few instead, which explains the issues, and I probably never noticed the issue because the demo defaults at 4x (128x720) which is among the list of supported ones.

If you change the setFullscreen call in main.lua so that there's a true option as well:

-- When we press F, we get in or out of fullscreen
onUserInput('F', function()
	setFullscreen(not getFullscreen(), true)
end)

you'll tell the engine to use the SDL_WINDOW_FULLSCREEN_DESKTOP mode when going fullscreen, which doesn't actually change the resolution but adapts the content of the window to the current resolution instead. I just tried this with my external monitor and it works fine, but I remember not setting it by default because it had some issues of its own: I don't remember exactly which ones, but definitely if the aspect ratio of the game doesn't match the aspect ratio of the screen, you still get black bars; and besides, IIRC if the resolution of the game is larger than the screen, it's cropped too.

I guess a proper management of fullscreen that's more aware of the environment will be needed in the future, even though I'd rather focus on the actual engine first, and fine tune this stuff later on.

@sunarch
Copy link
Contributor Author

sunarch commented Nov 27, 2022

You're right, this is not at all urgent, I encourage you to put a "later" or "not yet important" label on it, or even close it if you see fit. I just wanted to note it, so that you're aware of it.

@lminiero
Copy link
Owner

Thanks for spotting it, since I wasn't indeed aware of this! In case you notice any other weirdness, please do send it this way 😁

@sunarch
Copy link
Contributor Author

sunarch commented Nov 28, 2022

Alright, will do :)

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