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
107 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 Design
 The Plan
 Implementation
 Window
 Management

 Coordinate
 Systems

 Window Drawing
 Window
 Messages

 Wrapping it up

 Printable version

 


  The Series

 Part I
 Part II
 Part III
 Part IV

 

The Implementation

Here we go. Here's a good start for our base-class window definition:

Popup : Source Listing 1

As you peruse the functions we'll be talking about, keep in mind that recursion is everywhere. For example, our game will be drawing the entire GUI system by making a call to the renderall() method of the root window, which will in turn call the renderall() methods of its subwindows, which will call renderall() for their subwindows, and so on. Most of the functions follow this recursive pattern.

The whole GUI system will be contained within one global static variable - the root window. To be on the safe side, I encapsulated this variable within a global GetDesktop() function.

Now that we've got the header, let's start filling in some functions, starting with the Window Management code…


Next : Window Management