code

Declarative Functional APIs - A.K.A. Abusing Lambda Parameters

May 19 2018



Functional APIs are a joy to work with. Not only do they help eliminate certain bug categories, but they tend to be very flexible and reusable. Today I present a technique that has emerged while I was simplifying some lambda based APIs. C++17 makes template meta-programming much more palatable, I dare not imagine what this would look like in C++11.

Simplifying Compile-Time Options With if constexpr

November 20 2017



My latest little experiment relates to compile-time options and eliminating preprocessor checks in user code. I’m not a big fan of MACROs, especially when they are simply used to make compile-time branches. I am also not a fan of other techniques used to minimize this problem. With C++17, we now have a beautiful and simple tool that can help remove all these preprocessor checks, if constexpr.

Friendly Data-Oriented Entity-Component Managers

September 30 2017



In the past months, I’ve rewritten the entity-component system of my engine pet project about three times. Finally, something that ticks all the boxes has emerged. Today, I’d like to present this architecture. So far it has worked wonders for me, though I wouldn’t guarantee this to scale up to AAA sized projects. I still have much testing to do.

Static Duck Typing in C++

May 09 2017



Update : Walter Brown has come up with a much much more elegant way to do this. You can find the updated technique at the bottom of this post, or read more about it on cppreference.

A little while ago, I watched Jason Turner’s great cppcon talk, where he uses C++17 to write a commodore game. At that point, I decided it was quite time I confirm my (now proven false) beliefs on templates. If you ever want to convince a game programmer that templates are fine, show him that talk, and some assembly ;)

Not Impossible : Storing C++ Virtual Method Pointers in C Callbacks.

February 05 2017



A good friend challenged me while we where investigating vtables and various ways to create a reflection system without macros. He stated, “It is impossible to store a virtual method pointer in a C callback”. I decided to prove him wrong. Here, I present the result of this investigation.

GLSL Quicktip: Stringify Macro

February 05 2017



I’ve seen a lot of examples, tutorials and open-source code that use quotes to assign their shader programs to a const char*. Fully fledged engines would have a way to parse text-files, but if you are doing quick and dirty tests like me, you can use this macro to make editing easier.

Fun with std::threads!

August 21 2015



I’ve recently gotten more and more involved with the Wine project. I am a gamer, after all, and having only a Mac laptop and OS X makes it somewhat hard to play games. While debugging wine logs, I’ve encountered a problem many face when using +relay. You can’t just ignore those 4 GB logs, as they often contain the exact reason, or more precisely, the exact location your game/software crashed. I use Sublime Text to read those, it is so far the most performant editor when handling huge text files, quickly and easily dealing with gigabytes of logs. Consider me impressed.

Adding a huge image gallery to wordpress.com

July 23 2015



I am hitting many of the imposed limits on my free blog. I recently wanted to share a ton of textures, but since they were to big for the free space allowed, I resorted to a little “trick” if you will. I ended up creating a script to generate a huge html thumbnail gallery, using a table. It seemed like the best of the available options.

LibAV, libAO and QT5 audio player tutorial.

April 11 2015



A while back I was working on some audio prototyping. I made a simple audio player prototype and was experiencing with different audio plugin APIs. I decided to use libAV (not libavcodec from ffmpeg) for the simple reason that its’ documentation is much much better than ffmpeg. I highly recommend to take advantage of that. There are many examples, code snippets and explanations here. Of course, API documentation is a bit dry when you first start using a library, so here is a tutorial and a good base you can use to build upon.