A long time ago I made a CListNode class and a corresponding CListT<type> class, just like a lot of programmers out there I guess. The CListNode class simply has next and previous pointers, and objects that need to be stored in an intrusive list needed to derive from CListNode. I also had a CTreeNode class which derived from CListNode, and a CTreeT<> template class which implemented an intrusive tree. Well that approach worked well enough in a lot of situations, but it has limitations. Then I came across John McCutchan's Intrusive Lists post on #AltDevBlogADay, and I liked what he was doing. But if we're going to have an intrusive list, we might as well have an intrusive tree as well, in case we need to go hierarchical.Read More
Not much to say. I've created this to help myself better-understand how projecting textures works, and thought I'd post it. I initially thought about writing a full description of the theory, but there are LOTS of resources on the internet already about this subject. For example, this is a good one.
I've stolen the texture used in this sample from http://www.thief-thecircle.com/. Don't tell.
There is actually nothing special about fullscreen windows. A fullscreen window is just a window which has no borders or caption bar, and which has the same size as the screen. This little snippet of code and accompanying demo demonstrate this.Read More
TinyXML2 (and possibly 1) does the following:
As a first step, all newlines / carriage-returns / line-feeds are normalized to a line-feed character, as required by the XML spec.
The practical meaning of this is that when your application stores text retrieved from an edit control to xml, tinyxml will “normalize” it. When you set the text in an edit control from xml that was saved previously using tinyxml, the edit control will not show new lines appropriately. To “fix” this, here is what you do:Read More
If you decide that you want to use global variables, you may find yourself needing to declare those globals in a header file and defining (and initializing) them in a cpp file. As the list of globals grows longer, the inconvenience of keeping the declaration list and definition list in sync grows.Read More
This post is, as the title appropriately suggests, about the implementation of a simple event system for use in C++ applications, which is a fancy name for a list of function/method pointers. The main purpose of an event system is to have some code in a part of the application (module) be called whenever an event in another module takes place. An event system is a great tool for increasing code modularity and reducing dependencies and unnecessarily complex class hierarchies.Read More
I've written a small wrapper class for the uxtheme API called UXThemeProxy. It attempts to load uxtheme.dll at run-time, and if it fails (like if theming is not available, as in Win2K), the application can respond accordingly, typically by using classic drawing routines. The alternative is to link to uxtheme.lib and use the API functions directly, introducing a hard-dependency on uxtheme.dll, and your application won't run on pre-XP Windows (win2K), or (and I could be wrong here) if theming is disabled.Read More
This sample demonstrates how to create a win32 dialog box in memory (in code) without using a dialog template resource, which are typically created using a resource editor. This is especially useful for generating dynamic dialog boxes based on varying inputs. I clearly remember spending too much time with an MSDN sample demonstrating "dialog templates from memory" only to discover later it had a bug in it that makes it crash. Not the awesomest of memories.Read More
[Update 25/3/2013] Normal-mapping version has been added. See below.
[Update: 15/7/2012] While there are newer and better file formats for storing and exchanging geometry or meshes between applications, the OBJ file format is still rather widely in use by many of the largest content authoring applications. If you find yourself in need of loading OBJ meshes in your application without using the FBX SDK, this demo/sample should be very helpful!
bbtablet, developed by William Baxter, is a bare-bones WinTab wrapper C++ API for making the lives of Win32 programmers who wish to have tablet support in their apps a lot easier. Long story short, Curver, an application I'm working on, uses it, and it suddenly broke. I toyed around with it and I think I fixed the problem. I could be wrong here, as I haven't delved too deep into the WinTAB API.Read More