UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStarâ„¢
https://usdx.eu
GNU General Public License v2.0
832 stars 160 forks source link

Screen not correctly initialized on startup - MacOs 10.15.2 #500

Open mkinoo opened 4 years ago

mkinoo commented 4 years ago

Actual behaviour

When USDX starts in full screen modus, the screen is shifted up, showing a black band at the bottom. After going to the options, graphics menu and simply going back to the previous menu, the screen is re-initialized and correctly displayed.

Expected behaviour

At startup, the screen should display correctly centered.

Steps to reproduce

  1. open USDX app

workaround:

  1. go to tools > options > graphics
  2. go back
  3. the screen is now correctly displayed: no black band.

Details

mkinoo commented 4 years ago

Screen with black band at startup: Schermafbeelding 2019-12-22 om 16 21 19

After coming back from the graphics menu: Schermafbeelding 2019-12-22 om 16 21 23

mkinoo commented 4 years ago

It looks like lots of screen scaling and related issues are still under investigation at SDL2. At the time of writing none of the code changes resulted in resolving the issue.

https://bugzilla.libsdl.org/show_bug.cgi?id=4822

please note: I used below the commands to install the development head version of SDL2:

brew unlink sdl2
brew install mercurial
brew install --HEAD sdl2
mkinoo commented 4 years ago

I found a fix that worked for me.

When you press the "back" button on the Graphics Options screen, the screen seems to be reinitialized because of which the screen suddenly displays correctly. With this finding as basis I dived into the code. It appears that at code level the underlying action is located in UScreenOptionsGraphics.pas, below "SDLK_RETURN". It's "UGraphic.UpdateVideoMode()" that actually does the trick.

The problem described under this ticket is fixed for me by adding next lines in UGraphic.pas, at the end of the "Initialize3D" procedure (around line 550):

  // work around to force a good screen initialization on MacOS
  {$IFDEF MACOS}
  UpdateVideoMode();
  {$IFEND}

Testing fullscreen and window mode show now both screens that are filled to the corners instead of 1/4th or shifted up.

basisbit commented 4 years ago

Awesome! Please create a pull request for this change.