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
99 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
 Saving Windows
 Loading Windows
 Resource Editors
 Subclassing
 Speeding Up
 GUI Rendering

 Conclusion

 Printable version

 


  The Series

 Part I
 Part II
 Part III
 Part IV

 

Resource Editors

To really make your game GUI shine, you're going to need a resource editor. Certainly you don't need one as slick and functional as Developer Studio's, but you at least need a basic application that will let you add, edit, delete, and arrange things, and will save you the trouble of calculating out virtual coordinate positions for all of the controls in your dialogs.

Writing a full-featured, WYSIWYG resource editor is beyond the scope of this article, but I can give you a few miscellaneous tips for if you do decide to attempt such a beast:

  • Share your code. Specifically, make the resource editor share the same rendering code as your actual game. This way, you get WYSIWYG support, and you save yourself the trouble of having to implement two sets of GUI code. I guarantee you, it's easier to tweak your DirectX code so that it renders to a GDI surface instead of to a double-buffered system than it is to re-implement an entirely new drawing core. Remember also that it's quite likely your GUI system will change over time – you don't want to constantly have to change code in two different places.
  • Don't try to emulate DevStudio's look and feel. In other words, don't waste time trying to figure out how to mimic the various features of the DevStudio GUI (like, say, tabbed property sheets and preview windows). Don't feel bad if your Resource Editor is ugly in comparison; yes, it's true that the productivity of a team is directly proportional to how useful its tools are, but at the same time, it's very unlikely that anyone outside your team will be using your Resource Editor, and you're not using it to create a full-fledged GUI app; you're just making a few dialogs. You don't need context sensitive help. You don't need context menus, unless in your opinion they ease a particularly tedious operation. It's OK if your resource editor isn't polished, just so long as it gets the job done.
  • Emphasize data integrity over speed. The Resource Editor is a data wrangler, not a high-performance app, and there's nothing more annoying than when a dialog you've spent an hour designing goes down the tubes because of a program crash. When writing your GUI, preserving data should be your highest goal – implement autosaves, undo buffers, etc, and go easy on the optimization.



Next : Subclassing