Hello everybody,
I am currently working on a 2D platformer game using various libraries for certain tasks. But for the most general functions - window, graphics - I am using two libraries: SFML and SDL. Nope, I am not using them both the same time. Instead I am developing two versions of the game: one based on SFML, the other one on SDL.
Reasons why I am doing this is because I like SFML and I believe that the new SDL 2 isn't bad, either. Both have their pros and cons (there are tons of discussions, speed tests etc. on the web), but I will do the
direct comparison in a real case example. There are issues I am encountering and I want to share them with you while developing on that game. When the game is (almost) finished, I will propably decide for only one of the two versions, but as of now, I am developing both.
Note, that I an not using any of these two libraries for loading graphics from the files or playing music/sfx.
Feel free to discuss about my points.
Key MappingThe first "issue" I encountered is the key mapping. I am using a configuration file where the key mapping is set. Each action (jump, move, confirm, ...) is assigned a "key" to. That might be a key of the keyboard, a button of the joystick etc. I wanted to use a common config file for both game versions, but I found out that the both the keyboard "key codes" and the gamepad "button indices" differs in SFML and SDL. I'd prefer SDL's way of identifying the keys either by standardized scancodes or physical location. SFML instead gives the keys completely different IDs, making the configuration incompatible to each other. There was already a discussion about it in the SFML forums, and I think, it's even an issue in the SFML tracker.
I am confused about the different button IDs of the same gamepad in the libraries (using Windows), more details to come...
Graphics EngineSFML is completely OpenGL based, whereas with SDL the programmer has the choice (Direct3D, OpenGL or even Software-rendered). I tested the SDL version on WinXP in a virtual machine, but I couldn't initialize Direct3D nor OpenGL, only the software-version worked (which is propably the slowest of these). I feared that SFML wouldn't work at all (OpenGL), although it might only be a VM issue. But luckily, the SFML version runned in the VM without any issues!
Threaded Loading (Textures)Loading textures in a separate thread is quite easy in SFML. You need to care about activiating the OpenGL context in the thread, you are currently working in, but that's all. There's even a tutorail about this in SFML's wiki.
SDL, however, does not support this feature, as far, as I know. There is even a ticket about that issue.