Welcome back. This is Part III of the "Implementing a GUI in C++ And DirectX" Article. (Follow these links to part one and part two of the series). Continuing with the overall theme (showing how I implemented a GUI for my upcoming game, Quaternion), this article will walk through the creation of a few common controls you'll need for your GUI. We'll take a close look at several different control types, including pushbuttons, listboxes, textboxes, etc. This section of the article doesn't have as much code as the others - this is mainly because we programmers are fairly picky when it comes to the appearance of our GUI. We like to code things up so that our buttons, our textboxes, and our GUI appear unique, and fit our own aesthetic tastes. Consequently, everyone's control code will be slightly (or maybe drastically different), and it wouldn't make sense to include my particular drawing code. Besides, writing code to draw all the GUI elements is fun, in fact, in my opinion, it's the most fun you can have implementing a GUI. Go wild. One very important thing, before we get started - make your gui_window destructor virtual. I didn't mention it in Part II, because at that point we weren't subclassing any windows from gui_window, but I'm mentioning it now - making your destructors virtual for gui_window and all of its derivatives is a very smart thing to do, as it will ensure that no memory is leaked because of derived destructors not being called. Be wary of the traps of C++. That being said, let's start by determining which GUI controls we need.
|
|