Handmade Hero»Forums»Code
AndrewJDR
20 posts
Qt platform layer
Edited by AndrewJDR on
Hello everyone,

As a Christmas day project I decided to implement a Qt platform layer for HMH:
https://github.com/ajohnson23/handmade_qt

I did this as an exercise, and I don't particularly recommend Qt for this purpose -- Something like SDL is probably way more suitable for performance.

For now, it has:
* Graphics
* Most Keyboard input
* Basic performance counters
* Game memory alloc (Very simple though -- uses new)

I'd prefer to keep this a pure Qt layer without any other deps or platform specific code, so there's some things I probably won't do:
* Gamepads (No gamepad support in Qt afaik)

For the future:
* I want to make use of Qt's hardware acceleration features so I can see how much of a difference it makes. For the time being, I went out of my way to do things in naive, software based way with QImage/QPainter to see just how bad the performance is.
  • Qt does seem to have some low-level sound support, so I'll probably look at doing that at some point soon.
    * Qt is on a ton of platforms, including some obscure embeded ones, so that could also be interesting to try out down the road.
    * I'm also looking forward to comparing the various platform layers that folks create in terms of performance and code readability.
    * Hot reloading/replay using QLibrary

    For source and build instructions see the github page, thanks for reading!
    https://github.com/ajohnson23/handmade_qt
  • Mārtiņš Možeiko
    2559 posts / 2 projects
    Qt platform layer
    ajohnson
    * Hot reloading/replay (No LoadLibrary/etc abstraction in Qt afaik)

    Qt has QLibrary class for dynamic library loading.
    AndrewJDR
    20 posts
    Qt platform layer
    Edited by AndrewJDR on
    mmozeiko
    ajohnson
    * Hot reloading/replay (No LoadLibrary/etc abstraction in Qt afaik)

    Qt has QLibrary class for dynamic library loading.

    Awesome, I missed that. That's another one for the list then. Thanks!