Snippets

Ringbuffer Memory Stream

A well tested ring buffer class for binary data that uses the System.IO.Stream interface for efficiency

Heightmap Class

A heightmap utility class for doing ray-based collision detection and finding the exact height of any arbitrary point in the heightmap.

XNA ReferenceGraphicsDeviceManager

The GraphicsDeviceManager in the final XNA 1.0 release does not allow for XNA games to be run on systems without a shader-capable graphics card installed. It can use the reference rasterizer, but only if there is shader-capable graphics hardware installed.

Disassembling the XNA source code is prohibited, but theoretically, if one would clone the reference rasterizer class and modify it a little bit to work in systems without shader-capable graphics hardware, one would probably end up with this code snippet!

License Key encoder and decoder in C#

Small code snippet which converts up to four 32 bit values into a 5x5 letter code like seen in Microsoft(tm) product keys. Bit shuffling protects your keys even from other users in possession of this code snippet.

License Key encoder and decoder in C++

Small code snippet which converts up to four 32 bit values into a 5x5 letter code like seen in Microsoft(tm) product keys. Bit shuffling protects your keys even from other users in possession of this code snippet.

Base64 encoder and decoder in C++

Small code snippet that encodes binary data into base64 strings, suitable to be saved in XML files or sent via email