Switching!

Hi everyone! :)

Now when the switching between the 16-bit and 32-bit mode in the GUI is almost done, I’m going to write a longer blog post detailing the design, decision and implementation of the feature.

Some background: In the scummvm-master branch, the SDL-renderer for the GUI has a hardcoded bit-depth of 16-bits in some places. My intention has been to “un-hardcode” this, replacing the constants into variables that depend on the bit-depth set, so that arbitrary bit-depths can be used (although the code is focusing on 32-bits right now). The difference between 16 and 32 bits in the GUI can, as an example, be seen in the picture below, with the 32-bit rendering giving a nicer gradient, especially on the buttons – without having to resort to dithering:

32(Editor’s note: unfortunately, the image that was included here is lost and not available on archive.org)

One of the problems one runs into with switching to a 32-bit surface is that it does break games and scalers used, which assume a 16-bit surface is being used. To remedy this problem, my current solution involves switch back to a supported 16-bit format (using a new function setScreenFormat) when running a game from the launcher, and then switching back to the old 32-bit format used (using the new function setOverlayFormat) if the player enters a menu while playing, or re-enters the launcher.

This solution seems to work pretty fine, and only a couple of things need fixing now:

  • There is a bug regarding the color of the cursor when running 32-bits,
  • The background when entering the in-game menus renders incorrectly due to the switch between the different formats,
  • Swapping the theme seems to mess up the rendering for some reason?

As usual, the code can be found on my GitHub-page :) !