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

Classes
interface.h File Reference
#include "icons.h"
#include "unitsound.h"
#include "vec2i.h"
#include <vector>

Go to the source code of this file.

Classes

class  ButtonAction
 Action of button. More...
 

interface.h - The user interface header file.

#define ModifierShift   1
 current keyboard state More...
 
#define ModifierControl   2
 
#define ModifierAlt   4
 
#define ModifierSuper   8
 
#define ModifierDoublePress   16
 
#define MouseDoubleShift   8
 
#define MouseDragShift   16
 
#define MouseHoldShift   24
 
#define NoButton   0
 pressed mouse button flags More...
 
#define LeftButton   2
 
#define MiddleButton   4
 
#define RightButton   8
 
#define UpButton   16
 
#define DownButton   32
 
#define LeftAndMiddleButton   (LeftButton | MiddleButton)
 
#define LeftAndRightButton   (LeftButton | RightButton)
 
#define MiddleAndRightButton   (MiddleButton | RightButton)
 
#define ScrollNone   0
 Are We Scrolling With the Keyboard ? More...
 
#define ScrollUp   1
 
#define ScrollDown   2
 
#define ScrollLeft   4
 
#define ScrollRight   8
 
#define ScrollLeftUp   5
 
#define ScrollLeftDown   6
 
#define ScrollRightUp   9
 
#define ScrollRightDown   10
 
enum  ButtonCmd {
  ButtonMove, ButtonAttack, ButtonRepair, ButtonHarvest,
  ButtonBuild, ButtonPatrol, ButtonExplore, ButtonAttackGround,
  ButtonSpellCast, ButtonUnload, ButtonStop, ButtonButton,
  ButtonTrain, ButtonStandGround, ButtonReturn, ButtonResearch,
  ButtonUpgradeTo, ButtonCancel, ButtonCancelUpgrade, ButtonCancelTrain,
  ButtonCancelBuild, ButtonCallbackAction
}
 Button Commands that need target selection. More...
 
enum  _button_area_ {
  ButtonAreaSelected, ButtonAreaTraining, ButtonAreaUpgrading, ButtonAreaResearching,
  ButtonAreaTransporting, ButtonAreaButton, ButtonAreaMenu, ButtonAreaUser
}
 Button area under cursor. More...
 
enum  _menu_button_under_ { ButtonUnderMenu, ButtonUnderNetworkMenu, ButtonUnderNetworkDiplomacy, ButtonUnderFreeWorkers }
 Menu button under cursor. More...
 
enum  _iface_state_ { IfaceStateNormal, IfaceStateMenu }
 current interface state More...
 
enum  _key_state_ { KeyStateCommand = 0, KeyStateInput }
 current key state More...
 
enum  _cursor_on_ {
  CursorOnUnknown = -1, CursorOnMinimap, CursorOnButton, CursorOnMap,
  CursorOnScrollUp, CursorOnScrollDown, CursorOnScrollLeft, CursorOnScrollRight,
  CursorOnScrollLeftUp, CursorOnScrollLeftDown, CursorOnScrollRightUp, CursorOnScrollRightDown
}
 Where is our cursor ? More...
 
typedef bool(* ButtonCheckFunc) (const CUnit &, const ButtonAction &)
 
std::vector< ButtonAction * > UnitButtonTable
 All buttons for units. More...
 
bool GameRunning
 Flag telling if the game is running. More...
 
bool GamePaused
 Flag telling if the game is paused. More...
 
bool GameObserve
 Flag telling if the game is in observe mode. More...
 
bool GameEstablishing
 Flag telling if the game is in establishing mode. More...
 
char SkipGameCycle
 Flag telling not to advance to the next game cycle. More...
 
bool GodMode
 Invincibility cheat. More...
 
char BigMapMode
 Whether the map is the only thing displayed or not. More...
 
bool IsSDLWindowVisible
 Flag telling if the SDL window is visible. More...
 
int MouseButtons
 pressed mouse buttons (normal,double,dragged,long) More...
 
int KeyModifiers
 current active modifiers More...
 
enum _iface_state_ InterfaceState
 current interface state More...
 
int KeyScrollState
 current scroll state of keyboard More...
 
int MouseScrollState
 current scroll state of mouse More...
 
enum _key_state_ KeyState
 current key state More...
 
CUnitUnitUnderCursor
 shared pointer to unit under the cursor More...
 
int ButtonAreaUnderCursor
 button area under the cursor More...
 
int ButtonUnderCursor
 button number under the cursor More...
 
int OldButtonUnderCursor
 oldbutton number under the cursor More...
 
bool GameMenuButtonClicked
 menu button was clicked down More...
 
bool GameDiplomacyButtonClicked
 diplomacy button was clicked down More...
 
bool LeaveStops
 Mouse leaves windows stops scroll. More...
 
enum _cursor_on_ CursorOn
 current CursorOn field More...
 
int CurrentButtonLevel
 vladi: used for unit buttons sub-menus etc More...
 
ButtonActionLastDrawnButtonPopup
 Last drawn popup : used to speed up drawing. More...
 
int DoubleClickDelay
 Time to detect double clicks. More...
 
int HoldClickDelay
 Time to detect hold clicks. More...
 
CUnitGetUnitUnderCursor ()
 
void InitButtons ()
 Generate all buttons. More...
 
void CleanButtons ()
 Free memory for buttons. More...
 
int AddButton (int pos, int level, const std::string &IconIdent, ButtonCmd action, const std::string &value, void *payload, const ButtonCheckFunc func, const std::string &arg, const int key, const std::string &hint, const std::string &descr, const std::string &sound, const std::string &cursor, const std::string &umask, const std::string &popup, bool alwaysShow)
 Make a new button. More...
 
bool IsButtonAllowed (const CUnit &unit, const ButtonAction &buttonaction)
 
void HandleButtonDown (unsigned button)
 Called if any mouse button is pressed down. More...
 
void HandleButtonUp (unsigned button)
 Called if any mouse button is released up. More...
 
void HandleCursorMove (int *x, int *y)
 Keep coordinates in window and update cursor position. More...
 
void HandleMouseMove (const PixelPos &pos)
 Called if the mouse is moved. More...
 
void HandleMouseExit ()
 Called if the mouse exits the game window (only for some videomodes) More...
 
int HandleKeyModifiersDown (unsigned keycode, unsigned keychar)
 Update KeyModifiers if a key is pressed. More...
 
int HandleKeyModifiersUp (unsigned keycode, unsigned keychar)
 Update KeyModifiers if a key is released. More...
 
void HandleKeyDown (unsigned keycode, unsigned keychar)
 Called if a key is pressed. More...
 
void HandleKeyUp (unsigned keycode, unsigned keychar)
 Called when a key is released. More...
 
void HandleKeyRepeat (unsigned keycode, unsigned keychar)
 Called when a key is repeated. More...
 
void InputMouseButtonPress (const EventCallback &callbacks, unsigned ticks, unsigned button)
 Called if any mouse button is pressed down. More...
 
void InputMouseButtonRelease (const EventCallback &callbacks, unsigned ticks, unsigned button)
 Called if any mouse button is released up. More...
 
void InputMouseMove (const EventCallback &callbacks, unsigned ticks, int x, int y)
 Called if the mouse is moved. More...
 
void InputMouseExit (const EventCallback &callbacks, unsigned ticks)
 Called if the mouse exits the game window (when supported by videomode) More...
 
void InputMouseTimeout (const EventCallback &callbacks, unsigned ticks)
 Called to look for mouse timeouts. More...
 
void InputKeyButtonPress (const EventCallback &callbacks, unsigned ticks, unsigned ikey, unsigned ikeychar)
 Called if any key button is pressed down. More...
 
void InputKeyButtonRelease (const EventCallback &callbacks, unsigned ticks, unsigned ikey, unsigned ikeychar)
 Called if any key button is released up. More...
 
void InputKeyTimeout (const EventCallback &callbacks, unsigned ticks)
 Called to look for key timeouts. More...
 
int GetDoubleClickDelay ()
 Get double click delay. More...
 
void SetDoubleClickDelay (int delay)
 Set double click delay. More...
 
int GetHoldClickDelay ()
 Get hold click delay. More...
 
void SetHoldClickDelay (int delay)
 Set hold click delay. More...
 
void UiTogglePause ()
 Toggle pause mode. More...
 
void UiToggleBigMap ()
 Toggle big map. More...
 
void UiToggleTerrain ()
 Toggle terrain display on/off. More...
 
void UiFindIdleWorker ()
 Find the next idle worker. More...
 
void UiTrackUnit ()
 Track unit, the viewport follows the unit. More...
 
void SetScrollMargins (unsigned int top, unsigned int right, unsigned int bottom, unsigned int left)
 Scroll margins on screen. More...
 
int HandleCheats (const std::string &input)
 Handle cheats. More...
 
bool HandleCommandKey (int key)
 Call the lua function HandleCommandKey. More...
 
void CancelBuildingMode ()
 Cancel the building input mode. More...
 
void DrawMenuButtonArea ()
 Draw menu button area. More...
 
void DrawUserDefinedButtons ()
 Draw user defined buttons. More...
 
void UpdateMessages ()
 Update messages. More...
 
void DrawMessages ()
 Draw messages as overlay over of the map. More...
 
void DrawResources ()
 Draw the player resource in resource line. More...
 
void SetMessage (const char *fmt,...) PRINTF_VAARG_ATTRIBUTE(1
 Set message to display. More...
 
void void SetMessageEvent (const Vec2i &pos, const char *fmt,...) PRINTF_VAARG_ATTRIBUTE(2
 Set message to display with event point. More...
 
void void void CenterOnMessage ()
 Center view-point on last event message. More...
 
void CleanMessages ()
 Cleanup all messages. More...
 
void ToggleShowMessages ()
 show/hide messages More...
 
void SetMaxMessageCount (int newMax)
 max message count More...
 
void DrawTimer ()
 Draw the timer. More...
 
void UpdateTimer ()
 Update the timer. More...
 
void UpdateStatusLineForButton (const ButtonAction &button)
 Update the status line with hints from the button. More...
 
void DrawPieMenu ()
 Draw the Pie Menu. More...
 
void DrawPopup (const ButtonAction &button, const CUIButton &uibutton, int x=0, int y=0)
 Draw the button popup. More...
 
bool HandleMouseScrollArea (const PixelPos &mousePos)
 Handle the mouse in scroll area. More...
 
bool ButtonCheckTrue (const CUnit &unit, const ButtonAction &button)
 Check is always true. More...
 
bool ButtonCheckFalse (const CUnit &unit, const ButtonAction &button)
 Check is always false. More...
 
bool ButtonCheckUpgrade (const CUnit &unit, const ButtonAction &button)
 Check if allowed upgrade is ready. More...
 
bool ButtonCheckIndividualUpgrade (const CUnit &unit, const ButtonAction &button)
 Check if unit has an individual upgrade. More...
 
bool ButtonCheckUnitVariable (const CUnit &unit, const ButtonAction &button)
 Check if unit's variables pass the condition check. More...
 
bool ButtonCheckUnitsOr (const CUnit &unit, const ButtonAction &button)
 Check if allowed units exists. More...
 
bool ButtonCheckUnitsAnd (const CUnit &unit, const ButtonAction &button)
 Check if allowed units exists. More...
 
bool ButtonCheckUnitsNot (const CUnit &unit, const ButtonAction &button)
 Check if not one unit exist. More...
 
bool ButtonCheckUnitsNor (const CUnit &unit, const ButtonAction &button)
 Check if none of the units exist. More...
 
bool ButtonCheckNetwork (const CUnit &unit, const ButtonAction &button)
 Check if have network play. More...
 
bool ButtonCheckNoNetwork (const CUnit &unit, const ButtonAction &button)
 Check if don't have network play. More...
 
bool ButtonCheckNoWork (const CUnit &unit, const ButtonAction &button)
 Check if unit isn't working (train,upgrade,research) More...
 
bool ButtonCheckNoResearch (const CUnit &unit, const ButtonAction &button)
 Check if unit isn't researching or upgrading. More...
 
bool ButtonCheckAttack (const CUnit &unit, const ButtonAction &button)
 Check if all requirements for an attack to are meet. More...
 
bool ButtonCheckUpgradeTo (const CUnit &unit, const ButtonAction &button)
 Check if all requirements for an upgrade to are meet. More...
 
bool ButtonCheckResearch (const CUnit &unit, const ButtonAction &button)
 Check if all requirements for a research are meet. More...
 
bool ButtonCheckSingleResearch (const CUnit &unit, const ButtonAction &button)
 Check if all requirements for a single research are meet. More...
 
bool ButtonCheckDebug (const CUnit &unit, const ButtonAction &button)
 Check for button enabled, if requested condition passes check. Used for debug purposes. More...
 
void SelectionChanged ()
 Called whenever the units selection is altered. More...
 
void SelectedUnitChanged ()
 Called whenever the selected unit was updated. More...
 
void SetGamePaused (bool paused)
 Set the game paused or unpaused. More...
 
bool GetGamePaused ()
 Get the game paused or unpaused. More...
 
void SetGameSpeed (int speed)
 Set the game speed. More...
 
int GetGameSpeed ()
 Get the game speed. More...
 

Macro Definition Documentation

◆ DownButton

#define DownButton   32

◆ LeftAndMiddleButton

#define LeftAndMiddleButton   (LeftButton | MiddleButton)

◆ LeftAndRightButton

#define LeftAndRightButton   (LeftButton | RightButton)

◆ LeftButton

#define LeftButton   2

◆ MiddleAndRightButton

#define MiddleAndRightButton   (MiddleButton | RightButton)

◆ MiddleButton

#define MiddleButton   4

◆ ModifierAlt

#define ModifierAlt   4

◆ ModifierControl

#define ModifierControl   2

◆ ModifierDoublePress

#define ModifierDoublePress   16

◆ ModifierShift

#define ModifierShift   1

current keyboard state

Key modifier

◆ ModifierSuper

#define ModifierSuper   8

◆ MouseDoubleShift

#define MouseDoubleShift   8

◆ MouseDragShift

#define MouseDragShift   16

◆ MouseHoldShift

#define MouseHoldShift   24

◆ NoButton

#define NoButton   0

pressed mouse button flags

◆ RightButton

#define RightButton   8

◆ ScrollDown

#define ScrollDown   2

◆ ScrollLeft

#define ScrollLeft   4

◆ ScrollLeftDown

#define ScrollLeftDown   6

◆ ScrollLeftUp

#define ScrollLeftUp   5

◆ ScrollNone

#define ScrollNone   0

Are We Scrolling With the Keyboard ?

◆ ScrollRight

#define ScrollRight   8

◆ ScrollRightDown

#define ScrollRightDown   10

◆ ScrollRightUp

#define ScrollRightUp   9

◆ ScrollUp

#define ScrollUp   1

◆ UpButton

#define UpButton   16

Typedef Documentation

◆ ButtonCheckFunc

typedef bool(* ButtonCheckFunc) (const CUnit &, const ButtonAction &)

Enumeration Type Documentation

◆ _button_area_

Button area under cursor.

Enumerator
ButtonAreaSelected 
ButtonAreaTraining 

Selected button.

ButtonAreaUpgrading 

Training button.

ButtonAreaResearching 

Upgrading button.

ButtonAreaTransporting 

Researching button.

ButtonAreaButton 

Transporting button.

ButtonAreaMenu 

Button panel button.

ButtonAreaUser 

Menu button.

User buttons

◆ _cursor_on_

Where is our cursor ?

Enumerator
CursorOnUnknown 
CursorOnMinimap 

not known

CursorOnButton 

minimap area

CursorOnMap 

button area see: ButtonUnderCursor

CursorOnScrollUp 

over map area

CursorOnScrollDown 

in scroll up area

CursorOnScrollLeft 

in scroll down area

CursorOnScrollRight 

in scroll left area

CursorOnScrollLeftUp 

in scroll right area

CursorOnScrollLeftDown 

in scroll left+up area

CursorOnScrollRightUp 

in scroll left+down area

CursorOnScrollRightDown 

in scroll right+up area

in scroll right+down area

◆ _iface_state_

current interface state

Enumerator
IfaceStateNormal 
IfaceStateMenu 

Normal Game state.

Menu active

◆ _key_state_

current key state

Enumerator
KeyStateCommand 
KeyStateInput 

keys -> commands

keys -> line editor

◆ _menu_button_under_

Menu button under cursor.

Enumerator
ButtonUnderMenu 
ButtonUnderNetworkMenu 

Menu button.

ButtonUnderNetworkDiplomacy 

Network menu button.

ButtonUnderFreeWorkers 

Diplomacy button.

Free workers icon

◆ ButtonCmd

enum ButtonCmd

Button Commands that need target selection.

Enumerator
ButtonMove 
ButtonAttack 

order move

ButtonRepair 

order attack

ButtonHarvest 

order repair

ButtonBuild 

order harvest

ButtonPatrol 

order build

ButtonExplore 

order patrol

ButtonAttackGround 

order explore

ButtonSpellCast 

order attack ground

ButtonUnload 

order cast spell

ButtonStop 

order unload unit

ButtonButton 

order stop

ButtonTrain 

choose other button set

ButtonStandGround 

order train

ButtonReturn 

order stand ground

ButtonResearch 

order return goods

ButtonUpgradeTo 

order reseach

ButtonCancel 

order upgrade

ButtonCancelUpgrade 

cancel

ButtonCancelTrain 

cancel upgrade

ButtonCancelBuild 

cancel training

ButtonCallbackAction 

cancel building

Function Documentation

◆ AddButton()

int AddButton ( int  pos,
int  level,
const std::string &  icon_ident,
ButtonCmd  action,
const std::string &  value,
void actionCb,
const ButtonCheckFunc  func,
const std::string &  allow,
const int  key,
const std::string &  hint,
const std::string &  descr,
const std::string &  sound,
const std::string &  cursor,
const std::string &  umask,
const std::string &  popup,
bool  alwaysShow 
)

Make a new button.

FIXME: docu

◆ ButtonCheckAttack()

bool ButtonCheckAttack ( const CUnit unit,
const ButtonAction  
)

Check if all requirements for an attack to are meet.

Check if all requirements for an attack are met.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckDebug()

bool ButtonCheckDebug ( const CUnit ,
const ButtonAction button 
)

Check for button enabled, if requested condition passes check. Used for debug purposes.

Check for button enabled, if requested condition passes check Used for debug purposes

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if check passed.

Check if enabled walls for singleplayer games

◆ ButtonCheckFalse()

bool ButtonCheckFalse ( const CUnit ,
const ButtonAction  
)

Check is always false.

Check for button enabled, always false. This needed to overwrite the internal tests.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckIndividualUpgrade()

bool ButtonCheckIndividualUpgrade ( const CUnit unit,
const ButtonAction button 
)

Check if unit has an individual upgrade.

Check for button enabled, if unit has an individual upgrade.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckNetwork()

bool ButtonCheckNetwork ( const CUnit ,
const ButtonAction  
)

Check if have network play.

Check if network play is enabled.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.
Note
: this check could also be moved into intialisation.

◆ ButtonCheckNoNetwork()

bool ButtonCheckNoNetwork ( const CUnit ,
const ButtonAction  
)

Check if don't have network play.

Check if network play is disabled.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if disabled.
Note
: this check could also be moved into intialisation.

◆ ButtonCheckNoResearch()

bool ButtonCheckNoResearch ( const CUnit unit,
const ButtonAction  
)

Check if unit isn't researching or upgrading.

Check for button enabled, if the unit isn't researching.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckNoWork()

bool ButtonCheckNoWork ( const CUnit unit,
const ButtonAction  
)

Check if unit isn't working (train,upgrade,research)

Check for button enabled, if the unit isn't working. Working is training, upgrading, researching.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckResearch()

bool ButtonCheckResearch ( const CUnit unit,
const ButtonAction button 
)

Check if all requirements for a research are meet.

Check if all requirements for upgrade research are met.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckSingleResearch()

bool ButtonCheckSingleResearch ( const CUnit unit,
const ButtonAction button 
)

Check if all requirements for a single research are meet.

Check if all requirements for upgrade research are met only one running research allowed.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckTrue()

bool ButtonCheckTrue ( const CUnit ,
const ButtonAction  
)

Check is always true.

ButtonCheck for button enabled, always true. This needed to overwrite the internal tests.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckUnitsAnd()

bool ButtonCheckUnitsAnd ( const CUnit unit,
const ButtonAction button 
)

Check if allowed units exists.

Check for button enabled, if all units are available.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckUnitsNor()

bool ButtonCheckUnitsNor ( const CUnit unit,
const ButtonAction button 
)

Check if none of the units exist.

Check for button enabled, if none of the units are available.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckUnitsNot()

bool ButtonCheckUnitsNot ( const CUnit unit,
const ButtonAction button 
)

Check if not one unit exist.

Check for button enabled, if not all units are available.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckUnitsOr()

bool ButtonCheckUnitsOr ( const CUnit unit,
const ButtonAction button 
)

Check if allowed units exists.

Check for button enabled, if any unit is available.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckUnitVariable()

bool ButtonCheckUnitVariable ( const CUnit unit,
const ButtonAction button 
)

Check if unit's variables pass the condition check.

Check for button enabled, if unit's variables pass the condition check.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckUpgrade()

bool ButtonCheckUpgrade ( const CUnit unit,
const ButtonAction button 
)

Check if allowed upgrade is ready.

Check for button enabled, if upgrade is ready.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ ButtonCheckUpgradeTo()

bool ButtonCheckUpgradeTo ( const CUnit unit,
const ButtonAction button 
)

Check if all requirements for an upgrade to are meet.

Check for button enabled, if all requirements for an upgrade to unit are met.

Parameters
unitPointer to unit for button.
buttonPointer to button to check/enable.
Returns
True if enabled.

◆ CancelBuildingMode()

void CancelBuildingMode ( )

Cancel the building input mode.

Cancel building cursor mode.

◆ CenterOnMessage()

void void void CenterOnMessage ( )

Center view-point on last event message.

Goto message origin.

◆ CleanButtons()

void CleanButtons ( )

Free memory for buttons.

Cleanup buttons.

◆ CleanMessages()

void CleanMessages ( )

Cleanup all messages.

Clean messages

◆ DrawMenuButtonArea()

void DrawMenuButtonArea ( )

Draw menu button area.

Draw menu button area.

◆ DrawMessages()

void DrawMessages ( )

Draw messages as overlay over of the map.

Draw messages

◆ DrawPieMenu()

void DrawPieMenu ( )

Draw the Pie Menu.

Draw Pie Menu

◆ DrawPopup()

void DrawPopup ( const ButtonAction button,
const CUIButton uibutton,
int  x,
int  y 
)

Draw the button popup.

Draw popup

◆ DrawResources()

void DrawResources ( )

Draw the player resource in resource line.

Draw the player resource in top line.

Todo:
FIXME : make DrawResources more configurable (format, font).

◆ DrawTimer()

void DrawTimer ( )

Draw the timer.

Draw the timer

Todo:
FIXME : make DrawTimer more configurable (Pos, format).

◆ DrawUserDefinedButtons()

void DrawUserDefinedButtons ( )

Draw user defined buttons.

◆ GetDoubleClickDelay()

int GetDoubleClickDelay ( )

Get double click delay.

Get double click delay

◆ GetGamePaused()

bool GetGamePaused ( )

Get the game paused or unpaused.

Get the game paused or unpaused

Returns
True if the game is paused, false otherwise

◆ GetGameSpeed()

int GetGameSpeed ( )

Get the game speed.

Get the game speed

Returns
Game speed

◆ GetHoldClickDelay()

int GetHoldClickDelay ( )

Get hold click delay.

Get hold click delay

◆ GetUnitUnderCursor()

CUnit* GetUnitUnderCursor ( )

◆ HandleButtonDown()

void HandleButtonDown ( unsigned  button)

Called if any mouse button is pressed down.

Called if mouse button pressed down.

Parameters
buttonMouse button number (0 left, 1 middle, 2 right)

◆ HandleButtonUp()

void HandleButtonUp ( unsigned  button)

Called if any mouse button is released up.

Called if mouse button released.

Todo:

FIXME: the mouse handling should be complete rewritten

FIXME: this is needed for double click, long click,...

Parameters
buttonMouse button number (0 left, 1 middle, 2 right)

◆ HandleCheats()

int HandleCheats ( const std::string &  input)

Handle cheats.

Handle cheats

Returns
1 if a cheat was handled, 0 otherwise

◆ HandleCommandKey()

bool HandleCommandKey ( int  key)

Call the lua function HandleCommandKey.

Call the lua function HandleCommandKey

◆ HandleCursorMove()

void HandleCursorMove ( int *  x,
int *  y 
)

Keep coordinates in window and update cursor position.

Keep coordinates in window and update cursor position

Parameters
xscreen pixel X position.
yscreen pixel Y position.

◆ HandleKeyDown()

void HandleKeyDown ( unsigned  key,
unsigned  keychar 
)

Called if a key is pressed.

Handle key down.

Parameters
keyKey scancode.
keycharCharacter code.

◆ HandleKeyModifiersDown()

int HandleKeyModifiersDown ( unsigned  key,
unsigned   
)

Update KeyModifiers if a key is pressed.

Update KeyModifiers if a key is pressed.

Parameters
keyKey scancode.
keycharCharacter code.
Returns
1 if modifier found, 0 otherwise

◆ HandleKeyModifiersUp()

int HandleKeyModifiersUp ( unsigned  key,
unsigned   
)

Update KeyModifiers if a key is released.

Update KeyModifiers if a key is released.

Parameters
keyKey scancode.
keycharCharacter code.
Returns
1 if modifier found, 0 otherwise

◆ HandleKeyRepeat()

void HandleKeyRepeat ( unsigned  ,
unsigned  keychar 
)

Called when a key is repeated.

Handle key up.

Parameters
keyKey scancode.
keycharCharacter code.

◆ HandleKeyUp()

void HandleKeyUp ( unsigned  key,
unsigned  keychar 
)

Called when a key is released.

Handle key up.

Parameters
keyKey scancode.
keycharCharacter code.

◆ HandleMouseExit()

void HandleMouseExit ( )

Called if the mouse exits the game window (only for some videomodes)

Handle cursor exits the game window (only for some videomodes)

Todo:
FIXME: make it so that the game is partially 'paused'. Game should run (for network play), but not react on or show interactive events.

◆ HandleMouseMove()

void HandleMouseMove ( const PixelPos screenPos)

Called if the mouse is moved.

Handle movement of the cursor.

Parameters
screePosscreen pixel position.

◆ HandleMouseScrollArea()

bool HandleMouseScrollArea ( const PixelPos mousePos)

Handle the mouse in scroll area.

Handle the mouse in scroll area

Parameters
mousePosScreen position.
Returns
true if the mouse is in the scroll area, false otherwise

◆ InitButtons()

void InitButtons ( )

Generate all buttons.

Initialize the buttons.

◆ InputKeyButtonPress()

void InputKeyButtonPress ( const EventCallback callbacks,
unsigned  ticks,
unsigned  ikey,
unsigned  ikeychar 
)

Called if any key button is pressed down.

Called if any key button is pressed down.

Handle keyboard key press.

Parameters
callbacksCallback structure for events.
ticksDenotes time-stamp of video-system
ikeyKey scancode.
ikeycharCharacter code.

◆ InputKeyButtonRelease()

void InputKeyButtonRelease ( const EventCallback callbacks,
unsigned  ticks,
unsigned  ikey,
unsigned  ikeychar 
)

Called if any key button is released up.

Handle keyboard key release.

Parameters
callbacksCallback structure for events.
ticksDenotes time-stamp of video-system
ikeyKey scancode.
ikeycharCharacter code.

◆ InputKeyTimeout()

void InputKeyTimeout ( const EventCallback callbacks,
unsigned  ticks 
)

Called to look for key timeouts.

Called each frame to handle keyboard timeouts.

Parameters
callbacksCallback structure for events.
ticksDenotes time-stamp of video-system

◆ InputMouseButtonPress()

void InputMouseButtonPress ( const EventCallback callbacks,
unsigned  ticks,
unsigned  button 
)

Called if any mouse button is pressed down.

Called if any mouse button is pressed down.

Called if any mouse button is pressed down

Handles event conversion to double click, dragging, hold.

FIXME: dragging is not supported.

Parameters
callbacksCallback structure for events.
ticksDenotes time-stamp of video-system
buttonMouse button pressed.

◆ InputMouseButtonRelease()

void InputMouseButtonRelease ( const EventCallback callbacks,
unsigned  ticks,
unsigned  button 
)

Called if any mouse button is released up.

Called if any mouse button is released up

Parameters
callbacksCallback structure for events.
ticksDenotes time-stamp of video-system
buttonMouse button released.

◆ InputMouseExit()

void InputMouseExit ( const EventCallback callbacks,
unsigned   
)

Called if the mouse exits the game window (when supported by videomode)

Called if the mouse exits the game window (when supported by videomode)

Parameters
callbacksCallback structure for events.
ticksDenotes time-stamp of video-system

◆ InputMouseMove()

void InputMouseMove ( const EventCallback callbacks,
unsigned  ticks,
int  x,
int  y 
)

Called if the mouse is moved.

Called if the mouse is moved

Parameters
callbacksCallback structure for events.
ticksDenotes time-stamp of video-system
xX movement
yY movement

◆ InputMouseTimeout()

void InputMouseTimeout ( const EventCallback callbacks,
unsigned  ticks 
)

Called to look for mouse timeouts.

Called each frame to handle mouse timeouts.

Parameters
callbacksCallback structure for events.
ticksDenotes time-stamp of video-system

◆ IsButtonAllowed()

bool IsButtonAllowed ( const CUnit unit,
const ButtonAction buttonaction 
)

Check if the button is allowed for the unit.

Parameters
unitunit which checks for allow.
buttonactionbutton to check if it is allowed.
Returns
1 if button is allowed, 0 else.
Todo:

FIXME: better check. (dependency, resource, ...)

FIXME: make difference with impossible and not yet researched.

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

◆ SetDoubleClickDelay()

void SetDoubleClickDelay ( int  delay)

Set double click delay.

Set double click delay

Parameters
delayDouble click delay

◆ SetGamePaused()

void SetGamePaused ( bool  paused)

Set the game paused or unpaused.

Set the game paused or unpaused

Parameters
pausedTrue to pause game, false to unpause.

◆ SetGameSpeed()

void SetGameSpeed ( int  speed)

Set the game speed.

Set the game speed

Parameters
speedNew game speed.

◆ SetHoldClickDelay()

void SetHoldClickDelay ( int  delay)

Set hold click delay.

Set hold click delay

Parameters
delayHold click delay

◆ SetMaxMessageCount()

void SetMaxMessageCount ( int  newMax)

max message count

◆ SetMessage()

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

Set message to display.

◆ SetMessageEvent()

void void SetMessageEvent ( const Vec2i pos,
const char *  fmt,
  ... 
)

Set message to display with event point.

◆ SetScrollMargins()

void SetScrollMargins ( unsigned int  top,
unsigned int  right,
unsigned int  bottom,
unsigned int  left 
)

Scroll margins on screen.

Configure margins (in pixels) on screen where map scrolling starts.

◆ ToggleShowMessages()

void ToggleShowMessages ( )

show/hide messages

◆ UiFindIdleWorker()

void UiFindIdleWorker ( )

Find the next idle worker.

Find the next idle worker, select it, and center on it

◆ UiToggleBigMap()

void UiToggleBigMap ( )

Toggle big map.

Toggle big map mode.

Todo:
FIXME: We should try to keep the same view, if possible

◆ UiTogglePause()

void UiTogglePause ( )

Toggle pause mode.

Toggle pause on / off.

◆ UiToggleTerrain()

void UiToggleTerrain ( )

Toggle terrain display on/off.

Toggle terrain display on/off.

◆ UiTrackUnit()

void UiTrackUnit ( )

Track unit, the viewport follows the unit.

Track unit, the viewport follows the unit.

◆ UpdateMessages()

void UpdateMessages ( )

Update messages.

Update messages

◆ UpdateStatusLineForButton()

void UpdateStatusLineForButton ( const ButtonAction button)

Update the status line with hints from the button.

Update the status line with hints from the button

Parameters
buttonButton

◆ UpdateTimer()

void UpdateTimer ( )

Update the timer.

Update the timer

Variable Documentation

◆ BigMapMode

char BigMapMode

Whether the map is the only thing displayed or not.

Whether the map is the only thing displayed or not.

◆ ButtonAreaUnderCursor

int ButtonAreaUnderCursor

button area under the cursor

button area under the cursor

◆ ButtonUnderCursor

int ButtonUnderCursor

button number under the cursor

button number under the cursor

◆ CurrentButtonLevel

int CurrentButtonLevel

vladi: used for unit buttons sub-menus etc

vladi: used for unit buttons sub-menus etc

◆ CursorOn

enum _cursor_on_ CursorOn

current CursorOn field

current CursorOn field

◆ DoubleClickDelay

int DoubleClickDelay

Time to detect double clicks.

◆ GameDiplomacyButtonClicked

bool GameDiplomacyButtonClicked

diplomacy button was clicked down

diplomacy button was clicked down

◆ GameEstablishing

bool GameEstablishing

Flag telling if the game is in establishing mode.

Flag telling if the game is in establishing mode.

◆ GameMenuButtonClicked

bool GameMenuButtonClicked

menu button was clicked down

menu button was clicked down

◆ GameObserve

bool GameObserve

Flag telling if the game is in observe mode.

Flag telling if the game is in observe mode.

◆ GamePaused

bool GamePaused

Flag telling if the game is paused.

Flag telling if the game is paused.

◆ GameRunning

bool GameRunning

Flag telling if the game is running.

Flag telling if the game is running.

◆ GodMode

bool GodMode

Invincibility cheat.

Invincibility cheat.

◆ HoldClickDelay

int HoldClickDelay

Time to detect hold clicks.

Time to detect hold clicks.

◆ InterfaceState

enum _iface_state_ InterfaceState

current interface state

current interface state

◆ IsSDLWindowVisible

bool IsSDLWindowVisible

Flag telling if the SDL window is visible.

◆ KeyModifiers

int KeyModifiers

current active modifiers

current active modifiers

◆ KeyScrollState

int KeyScrollState

current scroll state of keyboard

current scroll state of keyboard

◆ KeyState

enum _key_state_ KeyState

current key state

current key state

◆ LastDrawnButtonPopup

ButtonAction* LastDrawnButtonPopup

Last drawn popup : used to speed up drawing.

◆ LeaveStops

bool LeaveStops

Mouse leaves windows stops scroll.

Mouse leaves windows stops scroll.

◆ MouseButtons

int MouseButtons

pressed mouse buttons (normal,double,dragged,long)

◆ MouseScrollState

int MouseScrollState

current scroll state of mouse

current scroll state of mouse

◆ OldButtonUnderCursor

int OldButtonUnderCursor

oldbutton number under the cursor

oldbutton number under the cursor

◆ SkipGameCycle

char SkipGameCycle

Flag telling not to advance to the next game cycle.

Flag telling not to advance to the next game cycle.

◆ UnitButtonTable

std::vector<ButtonAction *> UnitButtonTable

All buttons for units.

◆ UnitUnderCursor

CUnit* UnitUnderCursor

shared pointer to unit under the cursor

shared pointer to unit under the cursor

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