Code / February 26, 2014

Boolean Function Parameters

Consider the following code, which might be part of a custom Font class to draw fancy text. Looks good, right? Parameters are clear, order makes sense, and it’s easy to understand what the code does when you find it invoked: No need to go searching for the function implementation, or hovering over using the IDE

Read More
Code / February 22, 2014

Puzzle: FPC’s TEventObject, in Windows

This post is kind of an open question. I’m hoping that I can get some comments, any comments, on it 🙂 Let’s set up a situation with a problem, and look at different solutions for addressing the problem. Which one do you think is best, and more importantly, why? The Setup There is a multithreaded

Read More
Good coding guidelines / February 12, 2014

Default Audio Device

In Windows Vista and earlier, the operating system managed a list of audio (playback) devices, and one of them was always specified as the ‘default’. This is how audio devices may have looked on such a system: Speakers (Default) USB Headset Realtek rear audio jack Applications using Windows’ built-in sound functions such as PlaySound() always

Read More
Code / February 4, 2014

Playing video in FPC

A short and simple post for today. Playing a video file in Freepascal, without using Lazarus. I honestly couldn’t find any examples on the internet of how to do this, so I made one. The DirectX9SDK has examples of how to use DirectShow/ActiveMovie to play back video files in C++, however, the common version of

Read More
Code / February 1, 2014

Direct3D – Optimizing for different hardware

When your project is nearing completion, it’s time to look at optimization. For Direct3D, this typically means grouping and reordering of things to make the hardware work as efficiently as possible. For Direct3D 9, Microsoft have published a handy guide of things to look at optimizing here. But it’s interesting to look at the difference these

Read More