adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Porting to SDL2


From: Kai Sterker
Subject: Re: [Adonthell-devel] Porting to SDL2
Date: Tue, 31 May 2016 16:04:55 +0200

On Sun, May 29, 2016 at 9:08 PM, Kai Sterker <address@hidden> wrote:

Today I came back full of energy and replaced SDL with SDL2 in one fell swoop. I now have it in the state where everything compiles again, but quite a bit of fixing (and more testing) is needed. But with most of the work out of the way, I can now gradually iron out the issues over the coming week.

Good progress yesterday. Main menu and intro sequence are working up to a point. There seems to be a memory corruption with the speech bubbles, so it crashes. But I think I know where to look in order to fix that.

Other small issues that need fixing are
* filling surfaces with the mask color (FF00FF) does not make them properly transparent.
* text input needs to be specifically enabled by calling SDL_StartTextInput when a input field receives focus (and stopped again when done)
* switching between Window and Fullscreen must be implemented
* some flickering while scrolling needs tracking down


There is one larger task related to the text rendering, due to a change in the scaling implementation. The original v0.3 double size mode actually doubled the size of all the graphics on loading (but to the outside reported the unscaled sizes), so it was relatively easy to render text at full resolution.

The v0.4 implementation, which I copied, keeps all graphics at original size and leaves the scaling to the renderer (so ultimately it is done by the GPU, assuming the OpenGL renderer gets used). That however makes it much more difficult to have the font rendered at the full resolution, as the UI uses intermediate surfaces, which are now too small for the letters. So either the v0.3 approach needs to be restored, which should be simple enough, if less elegant, or at least the UI text widget needs to work with full-resolution surfaces internally as well.

I guess that returning to the v0.3 way of scaling everything upfront is the better approach. While this makes scaling a bit less elegant, it'll avoid unnecessary complexity elsewhere. And having the ability to render the text at full resolution really is a must.


Apropos scaling. Unlike the SDL 1.2 implementation, which allowed only scaling to double size, the SDL 2 implementation supports any (integer) scale, so running in window mode on high-DPI displays will become feasible. I am also thinking about adding a 3rd "letterbox" screen mode that keeps the 4:3 aspect ratio intact and the display at its native resolution. This may mean black borders all around, but should result in a crisper image.

Unfortunately, most modern resolutions aren't multiples of 320 x 240, but there is no helping it. Unlike v0.4, I don't want to allow different internal resolutions, as neither the cutscene graphics nor the user interface were built to support them.


And finally, if all the above does not take too much time to implement, I do have the crazy idea of implementing smooth scrolling at higher scale factors. Because with a scaling of, say, factor 4 (1280 x 960), scrolling by a single pixel in the engine will already move 4 pixels on the screen, which could be quite jarring. Perhaps there is a way to actually scroll by fractional increments internally, depending on the scale, to get smooth scrolling of the upscaled image. I have no idea yet if this can be made to work, so don't expect any wonders, but it would be a pretty sweet feature :-). Most likely though, I will have to start looking into building the OSX and Windows binaries, if I want to meet my original deadline.

Kai

reply via email to

[Prev in Thread] Current Thread [Next in Thread]