Translations of this page:

12. Windows, widgets and other GUI

In this chapter we'll focus on creating in game windows and their components. Before it was necessary to create all windows by hand, but now we have a great tool called Window Edit, which simplifies the process of window creating. But before we dive deep into the internals of windows editor, we have to say a few words about windows in general.

First of all, why we would want to have in game windows? There are quite a few occasions when you want to have certain graphical user's interface ready for the course of the whole game. Let's say Main menu, which contains "New Game", "Load Game", "Save Game", "Exit Game" etc. You can of course have a separate scene, which loads whenever you enter the menu, but also you can have a window (like we do have in our test game for example) which loads upon some escape key pressing.

Another usage of windows can be for example some permanently present on screen icon (for example if we wanted to click on an icon instead of pressing the escape key for entering the menu, or if we wanted to open an inventory by clicking on the icon of backpack instead of having our sliding inventory thing).

Lastly, many of adventure game developers like to have icon based dialogues (instead of text based) which are again easily implemented by in game windows.

So our first question is - What is the window? Window is a rectangular area on the screen which you can use as a container for the window components. You can also use nested windows (other windows inside your parent window) and of course you can modify the look and feel of such windows entirely to your liking.

Let's start by speaking about the components we can put onto our window:

Button - is as written in the documentation - "either graphical or rectangular with a text label, or a combination of both" representation of (gasp) a button. So anything what you need to push. As a tradeoff for using button instead of entity container (see below) you got the fast way how to set up hover, focus or pressed image and couple of other goodies.

Editors - are the way how you can almost comfortably enter the text using an input line. The user can enter text in the editor, select part of the text and copy/paste text to/from clipboard. But here's a big bad catch. No support for UTF-8 together with nonwritten necessity to localize the game using UTF, you can use this control only for obtaining basic input (alphanumeric characters).

Static controls - are used for various non-interactive (thus static) component of the window (think labels, icons, images you name it).

Entity containers - are advanced containers which you can use to place a real entities inside. Entities will create a whole new level of interaction to your windows and with using them you can easily make your windows integral part of (even very dynamic) game design.

With those components we already can do quite a lot. Back in the old days you had to create windows by hand as a text file (similary to actors etc.). Nowadays though you can easily create your windows in a new tool called Window Editor, which will be our next step.

wmebook/ch12.txt · Last modified: 2007/12/13 11:30 by metamorphium
Recent changes RSS feed Creative Commons License Driven by DokuWiki