_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Classes
ui.h File Reference
#include "cursor.h"
#include "interface.h"
#include "script.h"
#include "minimap.h"
#include "color.h"
#include "viewport.h"
#include "ui/statusline.h"
#include "ui/uitimer.h"
#include <vector>
#include <string>
#include <map>

Go to the source code of this file.

Classes

class  ButtonStyleProperties
 
class  ButtonStyle
 
class  CUIButton
 buttons on screen themselves More...
 
class  CMapArea
 
class  ConditionPanel
 
class  CUnitInfoPanel
 
class  CFiller
 
class  CButtonPanel
 
class  CPieMenu
 
class  CResourceInfo
 
class  CInfoPanel
 
class  CUIUserButton
 
class  CUserInterface
 

ui.h - The user interface header file.

#define MAX_NUM_VIEWPORTS   8
 
#define MaxResourceInfo   MaxCosts + 4
 
enum  TextAlignment { TextAlignUndefined, TextAlignCenter, TextAlignLeft, TextAlignRight }
 
enum  ViewportModeType {
  VIEWPORT_SINGLE = 0, VIEWPORT_SPLIT_HORIZ, VIEWPORT_SPLIT_HORIZ3, VIEWPORT_SPLIT_VERT,
  VIEWPORT_QUAD, NUM_VIEWPORT_MODES
}
 
std::vector< ButtonActionCurrentButtons
 Pointer to current buttons. More...
 
CUserInterface UI
 Current Selected Buttons. More...
 
std::string ClickMissile
 The user interface. More...
 
std::string DamageMissile
 Missile to show when you click. More...
 
std::map< std::string, ButtonStyle * > ButtonStyleHash
 Missile to show damage caused. More...
 
bool RightButtonAttacks
 
const char DefaultGroupKeys []
 right button attacks More...
 
std::string UiGroupKeys
 Default group keys. More...
 
bool FancyBuildings
 Up to 11 keys used for group selection. More...
 
void InitUserInterface ()
 Mirror buildings 1 yes, 0 now. More...
 
void SaveUserInterface (CFile &file)
 Save the ui state. More...
 
void CleanUserInterface ()
 Clean up the ui module. More...
 
void FreeButtonStyles ()
 
void UserInterfaceCclRegister ()
 Register ccl features. More...
 
CPopupPopupByIdent (const std::string &ident)
 return popup by ident string More...
 
ButtonStyleFindButtonStyle (const std::string &style)
 Find a button style. More...
 
void UIHandleMouseMove (const PixelPos &pos)
 Called if the mouse is moved in Normal interface state. More...
 
void UIHandleButtonDown (unsigned button)
 Called if any mouse button is pressed down. More...
 
void UIHandleButtonUp (unsigned button)
 Called if any mouse button is released up. More...
 
void RestrictCursorToViewport ()
 Restrict mouse cursor to viewport. More...
 
void RestrictCursorToMinimap ()
 Restrict mouse cursor to minimap. More...
 
CViewportGetViewport (const PixelPos &screenPos)
 Get viewport for screen pixel position. More...
 
void CycleViewportMode (int)
 Cycle through all available viewport modes. More...
 
void SetViewportMode (ViewportModeType mode)
 Select viewport mode. More...
 
void SetNewViewportMode (ViewportModeType mode)
 
void CheckViewportMode ()
 
bool GetMouseScroll ()
 Check if mouse scrolling is enabled. More...
 
void SetMouseScroll (bool enabled)
 Enable/disable scrolling with the mouse. More...
 
bool GetKeyScroll ()
 Check if keyboard scrolling is enabled. More...
 
void SetKeyScroll (bool enabled)
 Enable/disable scrolling with the keyboard. More...
 
bool GetGrabMouse ()
 Check if mouse grabbing is enabled. More...
 
void SetGrabMouse (bool enabled)
 Enable/disable grabbing the mouse. More...
 
bool GetLeaveStops ()
 Check if scrolling stops when leaving the window. More...
 
void SetLeaveStops (bool enabled)
 Enable/disable leaving the window stops scrolling. More...
 
int AddHandler (lua_State *l)
 
void CallHandler (unsigned int handle, int value)
 
void ShowLoadProgress (const char *fmt,...) PRINTF_VAARG_ATTRIBUTE(1
 Show load progress. More...
 
void bool IsDemoMode ()
 Check if Demo/Attract mode is in progress. More...
 

Macro Definition Documentation

◆ MAX_NUM_VIEWPORTS

#define MAX_NUM_VIEWPORTS   8

◆ MaxResourceInfo

#define MaxResourceInfo   MaxCosts + 4

Enumeration Type Documentation

◆ TextAlignment

Enumerator
TextAlignUndefined 
TextAlignCenter 
TextAlignLeft 
TextAlignRight 

◆ ViewportModeType

Enumeration of the different predefined viewport configurations.

Todo:
this should be later user configurable
Enumerator
VIEWPORT_SINGLE 
VIEWPORT_SPLIT_HORIZ 

Old single viewport.

VIEWPORT_SPLIT_HORIZ3 

Two viewports split horizontal.

VIEWPORT_SPLIT_VERT 

Three viewports split horiontal.

VIEWPORT_QUAD 

Two viewports split vertical.

NUM_VIEWPORT_MODES 

Four viewports split symmetric.

Number of different viewports.

Function Documentation

◆ AddHandler()

int AddHandler ( lua_State *  l)

Add a Lua handler FIXME: when should these be freed?

◆ CallHandler()

void CallHandler ( unsigned int  handle,
int  value 
)

Call a Lua handler

◆ CheckViewportMode()

void CheckViewportMode ( )

◆ CleanUserInterface()

void CleanUserInterface ( )

Clean up the ui module.

Clean up the user interface module.

◆ CycleViewportMode()

void CycleViewportMode ( int  step)

Cycle through all available viewport modes.

Cycles through predefined viewport modes (geometry configurations) in order defined by the ViewportMode enumerated type.

Parameters
stepThe size of step used for cycling. Values that make sense are mostly 1 (next viewport mode) and -1 (previous viewport mode).

◆ FindButtonStyle()

ButtonStyle* FindButtonStyle ( const std::string &  style)

Find a button style.

Find a button style

Parameters
styleName of the style to find.
Returns
Button style, NULL if not found.

◆ FreeButtonStyles()

void FreeButtonStyles ( )

◆ GetGrabMouse()

bool GetGrabMouse ( )

Check if mouse grabbing is enabled.

Check if mouse grabbing is enabled

◆ GetKeyScroll()

bool GetKeyScroll ( )

Check if keyboard scrolling is enabled.

Check if keyboard scrolling is enabled

◆ GetLeaveStops()

bool GetLeaveStops ( )

Check if scrolling stops when leaving the window.

Check if scrolling stops when leaving the window

◆ GetMouseScroll()

bool GetMouseScroll ( )

Check if mouse scrolling is enabled.

Check if mouse scrolling is enabled

◆ GetViewport()

CViewport* GetViewport ( const PixelPos screenPos)

Get viewport for screen pixel position.

Takes coordinates of a pixel in stratagus's window and computes the map viewport which contains this pixel.

Parameters
screenPospixel coordinate with origin at UL corner of screen
Returns
viewport pointer or NULL if this pixel is not inside any of the viewports.
Note
This functions only works with rectangular viewports, when we support shaped map window, this must be rewritten.

◆ InitUserInterface()

void InitUserInterface ( )

Mirror buildings 1 yes, 0 now.

Initialize the ui

Initialize the user interface.

Align UI map area if at least one of the map dimensions fits completely into it.

◆ IsDemoMode()

void bool IsDemoMode ( )

Check if Demo/Attract mode is in progress.

Check if the game is running in Demo mode.

Returns
True if the game is in demo mode, false otherwise

◆ PopupByIdent()

CPopup* PopupByIdent ( const std::string &  ident)

return popup by ident string

Get popup class pointer by string identifier.

Parameters
identPopup identifier.
Returns
popup class pointer.

◆ RestrictCursorToMinimap()

void RestrictCursorToMinimap ( )

Restrict mouse cursor to minimap.

Restrict mouse cursor to minimap

◆ RestrictCursorToViewport()

void RestrictCursorToViewport ( )

Restrict mouse cursor to viewport.

Restrict mouse cursor to viewport.

◆ SaveUserInterface()

void SaveUserInterface ( CFile file)

Save the ui state.

Save the user interface module.

Parameters
fileSave file handle

◆ SetGrabMouse()

void SetGrabMouse ( bool  enabled)

Enable/disable grabbing the mouse.

Enable/disable grabbing the mouse

Parameters
enabledTrue to enable mouse grabbing, false to disable

◆ SetKeyScroll()

void SetKeyScroll ( bool  enabled)

Enable/disable scrolling with the keyboard.

Enable/disable scrolling with the keyboard

Parameters
enabledTrue to enable keyboard scrolling, false to disable

◆ SetLeaveStops()

void SetLeaveStops ( bool  enabled)

Enable/disable leaving the window stops scrolling.

Enable/disable leaving the window stops scrolling

Parameters
enabledTrue to stop scrolling, false to disable

◆ SetMouseScroll()

void SetMouseScroll ( bool  enabled)

Enable/disable scrolling with the mouse.

Enable/disable scrolling with the mouse

Parameters
enabledTrue to enable mouse scrolling, false to disable

◆ SetNewViewportMode()

void SetNewViewportMode ( ViewportModeType  new_mode)

Sets up a new viewport mode.

Parameters
new_modeNew mode's number.

◆ SetViewportMode()

void SetViewportMode ( ViewportModeType  new_mode)

Select viewport mode.

Sets up (calls geometry setup routines for) a new viewport mode.

Parameters
new_modeNew mode's number.

◆ ShowLoadProgress()

void ShowLoadProgress ( const char *  fmt,
  ... 
)

Show load progress.

◆ UIHandleButtonDown()

void UIHandleButtonDown ( unsigned  button)

Called if any mouse button is pressed down.

Called if mouse button pressed down.

Parameters
buttonButton pressed down.

◆ UIHandleButtonUp()

void UIHandleButtonUp ( unsigned  button)

Called if any mouse button is released up.

Called if mouse button released.

Parameters
buttonButton released.

◆ UIHandleMouseMove()

void UIHandleMouseMove ( const PixelPos cursorPos)

Called if the mouse is moved in Normal interface state.

Handle movement of the cursor.

Parameters
cursorPosScreen X position.

◆ UserInterfaceCclRegister()

void UserInterfaceCclRegister ( )

Register ccl features.

Register CCL features for UI.

Variable Documentation

◆ ButtonStyleHash

std::map<std::string, ButtonStyle *> ButtonStyleHash

Missile to show damage caused.

Hash table of all the button styles

Missile to show damage caused.

◆ ClickMissile

std::string ClickMissile

The user interface.

◆ CurrentButtons

std::vector<ButtonAction> CurrentButtons

Pointer to current buttons.

◆ DamageMissile

std::string DamageMissile

Missile to show when you click.

Missile to show when you click.

◆ DefaultGroupKeys

const char DefaultGroupKeys[]

right button attacks

right button attacks

◆ FancyBuildings

bool FancyBuildings

Up to 11 keys used for group selection.

◆ RightButtonAttacks

bool RightButtonAttacks

◆ UI

Current Selected Buttons.

Current Selected Buttons.

The user interface configuration

◆ UiGroupKeys

std::string UiGroupKeys

Default group keys.

(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.