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

src/include/ui.h File Reference

#include <vector>
#include <string>
#include <map>
#include "SDL.h"
#include "upgrade_structs.h"
#include "cursor.h"
#include "interface.h"
#include "script.h"
#include "minimap.h"
#include "video.h"
#include "viewport.h"

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  CContentType
class  CContentTypeText
class  CContentTypeFormattedText
class  CContentTypeFormattedText2
class  CContentTypeIcon
class  CContentTypeLifeBar
class  CContentTypeCompleteBar
class  CUnitInfoPanel
class  CFiller
struct  CFiller::bits_map
class  CButtonPanel
class  CPieMenu
class  PopupConditionPanel
class  CPopupContentType
class  CPopupContentTypeButtonInfo
class  CPopupContentTypeCosts
class  CPopupContentTypeLine
class  CPopupContentTypeVariable
class  CPopup
class  CResourceInfo
class  CInfoPanel
class  CStatusLine
class  CUITimer
class  CUserInterface
class  ButtonActionProxy

ui.h - The user interface header file.

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

Define Documentation

#define MARGIN_X   4

Popup System.

#define MARGIN_Y   2

#define MAX_NUM_VIEWPORTS   8

#define MaxResourceInfo   MaxCosts + 3


Enumeration Type Documentation

Enumerator:
PopupButtonInfo_Hint 
PopupButtonInfo_Description 

Enumerator:
TextAlignUndefined 
TextAlignCenter 
TextAlignLeft 
TextAlignRight 

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

int AddHandler ( lua_State *  l  ) 

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

void CallHandler ( unsigned int  handle,
int  value 
)

Call a Lua handler

void CheckViewportMode (  ) 

void CleanUserInterface (  ) 

Clean up the ui module.

Clean up the user interface module.

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:
step The size of step used for cycling. Values that make sense are mostly 1 (next viewport mode) and -1 (previous viewport mode).

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

Find a button style.

Find a button style

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

bool GetGrabMouse (  ) 

Check if mouse grabbing is enabled.

Check if mouse grabbing is enabled

bool GetKeyScroll (  ) 

Check if keyboard scrolling is enabled.

Check if keyboard scrolling is enabled

bool GetLeaveStops (  ) 

Check if scrolling stops when leaving the window.

Check if scrolling stops when leaving the window

bool GetMouseScroll (  ) 

Check if mouse scrolling is enabled.

Check if mouse scrolling is enabled

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:
screenPos pixel 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.

void InitUserInterface (  ) 

Mirror buildings 1 yes, 0 now.

Initialize the ui

Initialize the user interface.

void MouseScrollMap ( int  x,
int  y 
)

Use the mouse to scroll the map.

Use the mouse to scroll the map

Parameters:
x Screen X position.
y Screen Y position.

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

return popup by ident string

Get popup class pointer by string identifier.

Parameters:
ident Popup identifier.
Returns:
popup class pointer.

void RestrictCursorToMinimap (  ) 

Restrict mouse cursor to minimap.

Restrict mouse cursor to minimap

void RestrictCursorToViewport (  ) 

Restrict mouse cursor to viewport.

Restrict mouse cursor to viewport.

void SaveUserInterface ( CFile file  ) 

Save the ui state.

Save the user interface module.

Parameters:
file Save file handle

void SetGrabMouse ( bool  enabled  ) 

Enable/disable grabbing the mouse.

Enable/disable grabbing the mouse

Parameters:
enabled True to enable mouse grabbing, false to disable

void SetKeyScroll ( bool  enabled  ) 

Enable/disable scrolling with the keyboard.

Enable/disable scrolling with the keyboard

Parameters:
enabled True to enable keyboard scrolling, false to disable

void SetLeaveStops ( bool  enabled  ) 

Enable/disable leaving the window stops scrolling.

Enable/disable leaving the window stops scrolling

Parameters:
enabled True to stop scrolling, false to disable

void SetMouseScroll ( bool  enabled  ) 

Enable/disable scrolling with the mouse.

Enable/disable scrolling with the mouse

Parameters:
enabled True to enable mouse scrolling, false to disable

void SetViewportMode ( ViewportModeType  new_mode  ) 

Select viewport mode.

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

Parameters:
new_mode New mode's number.

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

Show load progress.

void UIHandleButtonDown ( unsigned  button  ) 

Called if any mouse button is pressed down.

Called if mouse button pressed down.

Parameters:
button Button pressed down.

Detect long left selection click

Detect double left click

void UIHandleButtonUp ( unsigned  button  ) 

Called if any mouse button is released up.

Called if mouse button released.

Parameters:
button Button released.

void UIHandleMouseMove ( const PixelPos cursorPos  ) 

Called if the mouse is moved in Normal interface state.

Handle movement of the cursor.

Parameters:
mousePos Screen X position.

void UserInterfaceCclRegister (  ) 

Register ccl features.

Register CCL features for UI.


Variable Documentation

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

Missile to show damage caused.

Hash table of all the button styles

std::string ClickMissile

The user interface.

Pointer to current buttons.

std::string DamageMissile

Missile to show when you click.

const char DefaultGroupKeys[]

right button attacks

Up to 11 keys used for group selection.

Current Selected Buttons.

Current Selected Buttons.

The user interface configuration

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.