ingame Menus

To this point, all of our focus has been on the menus you'd use before you started a game, ie. non-ingame menus. Now we will take a short look at ingame menus, those menus you use while you're playing the game.

These ingame menus are specified in the ingame.txt file in exactly the same way as the non-ingame menus are specified in the menus.txt file. See here for a description of these files.

Note : the assetGlobalDef section defined for the non-ingame menu system is also used in the ingame menus. There is no need to include a assetGlobalDef section in any ingame menu.

By default, the main ingame menu must be named ingame, in the same way that the main non-ingame menu must be named main. Like the main non-ingame menu, this name can be changed in the assetGlobalDef section. See here for details.

The biggest difference between ingame and non-ingame menus is, when you are ingame, you don't need to have a fullscreen menu open at all times. In fact, you don't even have to have a background defined for the menu if you want the items to appear over top of the game view. Since you don't have to use a fullscreen menu you can make the menu window area smaller than 640x480. Team Arena defines its main ingame menu to be 640x26 in size.

      #include "ui/menudef.h"

      menuDef
      {
        name "ingame"
        rect 0 0 640 26
        outOfBoundsClick
        focusColor 1 .75 0 1
disableColor .5 .5 .5 1
onESC { uiScript "closeingame" } }

This shows the overall menu information section of the main ingame menu, named ingame. It is a non-fullscreen menu with a window 640x26 in size whose origin is at (0,0). It uses the outOfBoundsClick command to close the menu and return to the game if you click outside this window. If you press the ESC key it runs a uiScript command that closes all ingame menus and returns to the game. This uiScript command is the only way to return to game play.

The rest of the menu (the itemDefs) is exactly the same as any other menu. It should be noted that in a single player game the game is paused when the ingame menu is activated and unpaused when the menu is closed. A multiplayer game is never paused.


Return to Home Page