More graphics library stuff…

Here is a quick update on Knights development.

Unfortunately I have still been struggling with graphics libraries for what feels like ages now.

Last time I posted that I was trying out SFML and have been doing quite well with it. Unfortunately I have found what seems to be a fatal problem – SFML is completely unable to detect keypresses of the “backquote” key (that is, the key above TAB). This is important for Knights because we use that key as a chat key. Unfortunately I haven’t found any way to work around this, so it looks like we won’t be able to use SFML for Knights right now.

I also looked into SDL 2. However, I found the rendering performance to be very slow. It seems that to get decent performance out of SDL 2, you have to be making direct OpenGL calls in your code (instead of relying on the so-called “SDL_Renderer” layer). Unfortunately this would be quite a lot of work (especially since I don’t really know any OpenGL at the moment…) so this is not really feasible for me right now.

Therefore I think the plan will have to be:

  1. I will keep Knights as it always was — i.e. using DirectX on modern windows machines, and using SDL (version 1 – which uses software rendering) on Linux or older versions of Windows.
  2. I have made a few changes to my DirectX code — in particular I have removed the dependencies on D3DX and D3DCOMPILER. This should mean that the code will run on any modern Windows machine without any “DirectX runtime library” downloads being required. (I have also put in some simple UTF-8 text handling, but that is another story…)
  3. At some point I will get in touch with the author of SFML to see if the keyboard handling can be improved. That would eventually mean that I could switch Knights over to using SFML on all platforms. Not only would this bring hardware accelerated graphics to Linux (finally!), it would also mean that I only have one lot of graphics code to maintain instead of two, which will make things easier. This is a longer-term goal though.

2 thoughts on “More graphics library stuff…”

  1. Big thanks for the update on graphics options in newer Visual Studio! I’m still way behind on my version, and this topic is very important to keep Knights fanbase growing in the new world of tech toys, just imagining… Knights Game: There’s an App for that…!

Leave a Reply

Your email address will not be published. Required fields are marked *