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

script_ui.cpp File Reference
#include "stratagus.h"
#include "ui.h"
#include "font.h"
#include "interface.h"
#include "map.h"
#include "menus.h"
#include "script.h"
#include "spells.h"
#include "title.h"
#include "util.h"
#include "ui/contenttype.h"
#include "ui/popup.h"
#include "unit.h"
#include "unit_manager.h"
#include "unittype.h"
#include "video.h"

script_ui.cpp - The ui ccl functions.

std::string ClickMissile
 The user interface. More...
 
std::string DamageMissile
 FIXME:docu. More...
 
std::map< std::string, ButtonStyle * > ButtonStyleHash
 FIXME:docu. More...
 
static int HandleCount = 1
 
CPreference Preference
 Lua handler count. More...
 
static int CclSetKeyScrollSpeed (lua_State *l)
 
static int CclGetKeyScrollSpeed (lua_State *l)
 
static int CclSetMouseScrollSpeed (lua_State *l)
 
static int CclGetMouseScrollSpeed (lua_State *l)
 
static int CclSetMouseScrollSpeedDefault (lua_State *l)
 
static int CclGetMouseScrollSpeedDefault (lua_State *l)
 
static int CclSetMouseScrollSpeedControl (lua_State *l)
 
static int CclGetMouseScrollSpeedControl (lua_State *l)
 
static int CclSetClickMissile (lua_State *l)
 
static int CclSetDamageMissile (lua_State *l)
 
static int CclSetVideoResolution (lua_State *l)
 
static int CclGetVideoResolution (lua_State *l)
 
static int CclSetVideoFullScreen (lua_State *l)
 
static int CclGetVideoFullScreen (lua_State *l)
 
static int CclSetWindowSize (lua_State *l)
 
static int CclSetVerticalPixelSize (lua_State *l)
 
static int CclShowTitleScreens (lua_State *l)
 
static int CclSetTitleScreens (lua_State *l)
 
EnumVariable Str2EnumVariable (lua_State *l, const char *s)
 Damage calculation for missile. More...
 
static ConditionPanelParseConditionPanel (lua_State *l)
 
static CContentTypeCclParseContent (lua_State *l)
 
static int CclDefinePanelContents (lua_State *l)
 
static int CclDefinePopup (lua_State *l)
 
static int CclDefineViewports (lua_State *l)
 
static int CclRightButtonAttacks (lua_State *l)
 
static int CclRightButtonMoves (lua_State *l)
 
static int CclSetFancyBuildings (lua_State *l)
 
ButtonStyleFindButtonStyle (const std::string &style)
 Find a button style. More...
 
static void ParseButtonStyleProperties (lua_State *l, ButtonStyleProperties *p)
 
static int CclDefineButtonStyle (lua_State *l)
 
int AddHandler (lua_State *l)
 
void CallHandler (unsigned int handle, int value)
 
static int CclClearButtons (lua_State *l)
 
static int CclDefineButton (lua_State *l)
 
static int CclCopyButtonsForUnitType (lua_State *l)
 
void SelectionChanged ()
 Called whenever the units selection is altered. More...
 
void SelectedUnitChanged ()
 Called whenever the selected unit was updated. More...
 
static int CclSetSelectionStyle (lua_State *l)
 
static int CclAddMessage (lua_State *l)
 
static int CclSetGroupKeys (lua_State *l)
 
static int CclPresentMap (lua_State *l)
 
static int CclDefineMapSetup (lua_State *l)
 
static int CclSetFontCodePage (lua_State *l)
 
void UserInterfaceCclRegister ()
 Register ccl features. More...
 

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

◆ CclAddMessage()

static int CclAddMessage ( lua_State *  l)
static

Description

Add a new message.

Example:

AddMessage("Hello World!")
Parameters
lLua state.

◆ CclClearButtons()

static int CclClearButtons ( lua_State *  l)
static

Clear all buttons

Parameters
lLua state.

◆ CclCopyButtonsForUnitType()

static int CclCopyButtonsForUnitType ( lua_State *  l)
static

◆ CclDefineButton()

static int CclDefineButton ( lua_State *  l)
static

Define a button.

Parameters
lLua state.

◆ CclDefineButtonStyle()

static int CclDefineButtonStyle ( lua_State *  l)
static

Define a button style

Parameters
lLua state.

◆ CclDefineMapSetup()

static int CclDefineMapSetup ( lua_State *  l)
static

Description

Define the lua file that will build the map

Parameters
lLua state.

Example:

– Load map setup from file DefineMapSetup("Setup.sms")

◆ CclDefinePanelContents()

static int CclDefinePanelContents ( lua_State *  l)
static

Define the Panels. Define what is shown in the panel(text, icon, variables)

Parameters
lLua state.
Returns
0.

◆ CclDefinePopup()

static int CclDefinePopup ( lua_State *  l)
static

Define the Panels. Define what is shown in the panel(text, icon, variables)

Parameters
lLua state.
Returns
0.

◆ CclDefineViewports()

static int CclDefineViewports ( lua_State *  l)
static

Define the viewports.

Parameters
lLua state.

◆ CclGetKeyScrollSpeed()

static int CclGetKeyScrollSpeed ( lua_State *  l)
static

Description

Get speed of key scroll

Parameters
lLua state.

Example:

scroll_speed = GetKeyScrollSpeed() print(scroll_speed)

◆ CclGetMouseScrollSpeed()

static int CclGetMouseScrollSpeed ( lua_State *  l)
static

Description

Get speed of mouse scroll

Parameters
lLua state.

Example:

scroll_speed = GetMouseScrollSpeed() print(scroll_speed)

◆ CclGetMouseScrollSpeedControl()

static int CclGetMouseScrollSpeedControl ( lua_State *  l)
static

Get speed of ctrl-middle-mouse scroll

Parameters
lLua state.

◆ CclGetMouseScrollSpeedDefault()

static int CclGetMouseScrollSpeedDefault ( lua_State *  l)
static

Get speed of middle-mouse scroll

Parameters
lLua state.

◆ CclGetVideoFullScreen()

static int CclGetVideoFullScreen ( lua_State *  l)
static

Description

Get the video fullscreen mode.

Parameters
lLua state.

Example:

fullscreenmode = GetVideoFullScreen() print(fullscreenmode)

◆ CclGetVideoResolution()

static int CclGetVideoResolution ( lua_State *  l)
static

Description

Get the video resolution.

Parameters
lLua state.

Example:

width,height = GetVideoResolution() print("Resolution is " .. width .. "x" .. height)

◆ CclParseContent()

static CContentType* CclParseContent ( lua_State *  l)
static

◆ CclPresentMap()

static int CclPresentMap ( lua_State *  l)
static

Description

Set basic map caracteristics.

Parameters
lLua state.

Example:

PresentMap("Map description", 1, 128, 128, 17)

◆ CclRightButtonAttacks()

static int CclRightButtonAttacks ( lua_State *  l)
static

Fighter right button attacks as default.

Parameters
lLua state.

◆ CclRightButtonMoves()

static int CclRightButtonMoves ( lua_State *  l)
static

Fighter right button moves as default.

Parameters
lLua state.

◆ CclSetClickMissile()

static int CclSetClickMissile ( lua_State *  l)
static

Set which missile is used for right click

Parameters
lLua state.

◆ CclSetDamageMissile()

static int CclSetDamageMissile ( lua_State *  l)
static

Set which missile shows Damage

Parameters
lLua state.

◆ CclSetFancyBuildings()

static int CclSetFancyBuildings ( lua_State *  l)
static

Description

Enable/disable the fancy buildings.

Parameters
lLua state.

Example:

– Enable fancy buildings SetFancyBuildings(true) – Disable fancy buildings SetFancyBuildings(false)

◆ CclSetFontCodePage()

static int CclSetFontCodePage ( lua_State *  l)
static

Description

Declare which codepage the font files are in. Text is handled internally as UTF-8 everywhere, but the font rendering system uses graphics with 256 symbols. Commonly, DOS and early Windows games used codepage 437 or 1252 for western European languages, or 866 for Russian and some other cyrillic writing systems. These are the only ones that are currently supported, but more can easily be added. All text is mapped into the codepage that is set for the font files. If the codepage is not one of the supported ones, or if something doesn't map (for example, some accented characters with codepage 866, or cyrillic letters with codepage 437), a simple "visual" mapping to 7-bit ASCII is used to at least print something that may be recognizable.

◆ CclSetGroupKeys()

static int CclSetGroupKeys ( lua_State *  l)
static

Set the keys which are use for grouping units, helpful for other keyboards

Parameters
lLua state.

◆ CclSetKeyScrollSpeed()

static int CclSetKeyScrollSpeed ( lua_State *  l)
static

Description

Set speed of key scroll

Parameters
lLua state.

Example:

SetKeyScrollSpeed(4)

◆ CclSetMouseScrollSpeed()

static int CclSetMouseScrollSpeed ( lua_State *  l)
static

Description

Set speed of mouse scroll

Parameters
lLua state.

Example:

SetMouseScrollSpeed(2)

◆ CclSetMouseScrollSpeedControl()

static int CclSetMouseScrollSpeedControl ( lua_State *  l)
static

Set speed of ctrl-middle-mouse scroll

Parameters
lLua state.

◆ CclSetMouseScrollSpeedDefault()

static int CclSetMouseScrollSpeedDefault ( lua_State *  l)
static

Set speed of middle-mouse scroll

Parameters
lLua state.

◆ CclSetSelectionStyle()

static int CclSetSelectionStyle ( lua_State *  l)
static

Set selection style.

Parameters
lLua state.

◆ CclSetTitleScreens()

static int CclSetTitleScreens ( lua_State *  l)
static

Default title screens.

Parameters
lLua state.

◆ CclSetVerticalPixelSize()

static int CclSetVerticalPixelSize ( lua_State *  l)
static

For games with non-square pixels, this sets the scale of vertical pixels versus horizontal pixels. e.g., if your assets are 320x200, but you render at 320x240, this is 1.2.

◆ CclSetVideoFullScreen()

static int CclSetVideoFullScreen ( lua_State *  l)
static

Description

Set the video fullscreen mode.

Parameters
lLua state.

Example:

– Full Screen mode enabled SetVideoFullScreen(true) – Full Screen mode disabled SetVideoFullScreen(false)

◆ CclSetVideoResolution()

static int CclSetVideoResolution ( lua_State *  l)
static

Description

Set the video resolution.

Parameters
lLua state.

Example:

SetVideoResolution(640,480)

◆ CclSetWindowSize()

static int CclSetWindowSize ( lua_State *  l)
static

Request a specific initial window size

◆ CclShowTitleScreens()

static int CclShowTitleScreens ( lua_State *  l)
static

◆ 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.

◆ ParseButtonStyleProperties()

static void ParseButtonStyleProperties ( lua_State *  l,
ButtonStyleProperties p 
)
static

Parse button style properties

Parameters
lLua state.
pProperties to fill in.

◆ ParseConditionPanel()

static ConditionPanel* ParseConditionPanel ( lua_State *  l)
static

Parse the condition Panel.

Parameters
lLua State.

◆ SelectedUnitChanged()

void SelectedUnitChanged ( )

Called whenever the selected unit was updated.

The selected unit has been altered.

◆ SelectionChanged()

void SelectionChanged ( )

Called whenever the units selection is altered.

Run the set-selection-changed-hook.

◆ Str2EnumVariable()

EnumVariable Str2EnumVariable ( lua_State *  l,
const char *  s 
)

Damage calculation for missile.

Return enum from string about variable component.

Parameters
lLua State.
sstring to convert.
Returns
Corresponding value.
Note
Stop on error.

◆ UserInterfaceCclRegister()

void UserInterfaceCclRegister ( )

Register ccl features.

Register CCL features for UI.

Variable Documentation

◆ ButtonStyleHash

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

FIXME:docu.

Missile to show damage caused.

◆ ClickMissile

std::string ClickMissile

The user interface.

◆ DamageMissile

std::string DamageMissile

FIXME:docu.

Missile to show when you click.

◆ HandleCount

int HandleCount = 1
static

◆ Preference

CPreference Preference

Lua handler count.

(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.