Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
108 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Introduction
 The Basics
 The Mouse
 Using DirectInput
 Drawing the Mouse
 Stay Tuned...

 Printable version

 


  The Series

 Part I
 Part II
 Part III
 Part IV

 

At first glance, it may seem like I'm reinventing the wheel; Windows already comes with a very complex, very functional GUI. Unfortunately, while the Windows GUI is great for office apps, quite frequently, it's not suited for games. Games tend to want a more precise control over the GUI than Windows can provide (for example, you may want to use alpha-blending to implement partially transparent windows – easy if you've written your own GUI, but next to impossible using the Windows GUI).

This article series will walk you though how to create a GUI using C++ and DirectX. The series is divided into several parts, each dealing with a specific aspect of GUI programming. They're meant to be read in order, so you've picked the right article to start with.

I'm making several assumptions about your knowledge. I'm assuming you know the basics of how event-driven programming works (message queues, etc), and I'm assuming you have a strong grasp of PDL (the commenting language – if you don't know what this is, read Code Complete) and C++. I used C++ to implement my GUI system, because I'm a card-carrying member of the C++ fan club, and because the OOP of C++ works great for implementing window and control types. Note the power of OOP in this solution, and ask yourself if you could do the same thing as easily in C.

Let's start by defining our scope. It's important to realize up front that we're not remaking Windows 95, we're just trying to get a simple GUI up for a game, so we don't have to implement every single control and GUI construct. We only need a few parts for this simple GUI: a mouse pointer, a generic window, and some dialog controls to place within that window. We're also going to need a resource editor, a program that will allow us to design dialogs by graphically dropping controls at various places.


Next : The Basics