[tsc-devel] Status of SFML video port of TSC
Quintus |
Tue, 01 Dec 2015 20:26:22 UTC
Hi all,
based on datahead’s suggestion I have retried the SFML port now with the
goal to keep as much of the current architecture as possible. This has
resulted in creation of a new branch in Git named “feature-sfml-port2”,
which is the main development branch for the SFML port now.
Today I have had success with porting video.cpp to SFML. The
implementation still has its rough edges (and uses some poor code), but
it works. The results are in the “sfml-port-video” branch (which is a
branch based off “feature-sfml-port2”). That branch has removed all
calls to SDL_Image in video.cpp and replaced them with use of SFML’s
sf::Image class instead. It also throws out SDL’s window management and
instead uses SFML’s sf::Window, so it was possible to reduce
initialisation of SDL to SDL_Mixer only. Luckily, as you all know,
kirbyfan has already filed a PR to wipe out SDL_Mixer from our codebase
as well.
What remains is input handling, i.e. handling of keyboard and joystick
events. The current “feature-sfml-port2” branch has input handling
commented out in the mainloop, so you can’t input anything into the game
window. This is what I’m up to do next.
On the video side, while the implementation I provide in the
“sfml-port-video” branch (which, as you probably already guessed, I have
already merged into “feature-sfml-port2”) does work basically, it is
completely untested and I’m pretty sure it doesn’t support fullscreen or
even mode switching, simply because the game input is missing still so
it is impossible to test. I also can’t remember changing any code
related to mode switching in video.cpp, so I guess this is hidden in the
menu source code files and it is likely that there are still calls to
SDL there.
If you wish to try it out, get a copy of the “sfml-port-video” branch
(or the current “feature-sfml-port2”, they are equal currently) and
compile and run it. You can’t interact with the game, but you can see
that it can successfully load graphics.
As a sidenote, I find it astonishing that SDL’ſ “pixels” pointer and
SFML’s sf::Image::getPixelsPtr() return pixels in the same format
appearently. I had severe worries that I had to write conversion
routines…
Valete,
Quintus
--
#!/sbin/quintus
Blog: http://www.guelkerdev.de
GnuPG key: F1D8799FBCC8BC4F