$treeview $search $mathjax
Stratagus  2.2.6
$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"

Go to the source code of this file.


Classes

class  ButtonStyleProperties
class  ButtonStyle
class  CUIButton
 buttons on screen themselves More...
class  CViewport
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  CResourceInfo
class  CInfoPanel
class  CStatusLine
class  CUITimer
class  CUserInterface
class  ButtonActionProxy

ui.h - The user interface header file.

#define MAX_NUM_VIEWPORTS   8
#define MaxResourceInfo   MaxCosts + 2
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
}
ButtonActionProxy CurrentButtons
 Pointer to current buttons.
CUserInterface UI
 Current Selected Buttons.
std::map< std::string,
ButtonStyle * > 
ButtonStyleHash
 The user interface.
bool RightButtonAttacks
const char DefaultGroupKeys []
 right button attacks
const char * 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.
ButtonStyleFindButtonStyle (const std::string &style)
 Find a button style.
void UIHandleMouseMove (int x, int y)
 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 (int x, int y)
 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 UpdateViewports ()
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)

Define Documentation

#define MAX_NUM_VIEWPORTS   8

#define MaxResourceInfo   MaxCosts + 2


Enumeration Type Documentation

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 ( int  x,
int  y 
)

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:
x x pixel coordinate with origin at UL corner of screen
y y 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.

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 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 ( int  x,
int  y 
)

Called if the mouse is moved in Normal interface state.

Handle movement of the cursor.

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

void UpdateViewports (  ) 

void UserInterfaceCclRegister (  ) 

Register ccl features.

Register CCL features for UI.


Variable Documentation

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

The user interface.

Hash table of all the button styles

Pointer to current buttons.

const char DefaultGroupKeys[]

right button attacks

Up to 11 keys used for group selection.

Current Selected Buttons.

Current Selected Buttons.

The user interface configuration

const char* UiGroupKeys

Default group keys.

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