____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

interface.h File Reference

The user interface header file. More...

#include "icons.h"

Go to the source code of this file.

Classes

class  ButtonAction

Defines

#define ModifierShift   1
 any shift key pressed
#define ModifierControl   2
 any control key pressed
#define ModifierAlt   4
 any alt key pressed
#define ModifierSuper   8
 super key (reserved for WM)
#define ModifierDoublePress   16
 key double pressed
#define MouseDoubleShift   8
 shift for double click button
#define MouseDragShift   16
 shift for drag button
#define MouseHoldShift   24
 shift for hold button
#define NoButton   0
 No button.
#define LeftButton   2
 Left button on mouse.
#define MiddleButton   4
 Middle button on mouse.
#define RightButton   8
 Right button on mouse.
#define UpButton   16
 Scroll up button on mouse.
#define DownButton   32
 Scroll down button on mouse.
#define LeftAndMiddleButton   (LeftButton | MiddleButton)
 Left + Middle button on mouse.
#define LeftAndRightButton   (LeftButton | RightButton)
 Left + Right button on mouse.
#define MiddleAndRightButton   (MiddleButton | RightButton)
 Middle + Right button on mouse.
#define ScrollNone   0
 not scrolling
#define ScrollUp   1
 scroll up only
#define ScrollDown   2
 scroll down only
#define ScrollLeft   4
 scroll left only
#define ScrollRight   8
 scroll right only
#define ScrollLeftUp   5
 scroll left + up
#define ScrollLeftDown   6
 scroll left + down
#define ScrollRightUp   9
 scroll right + up
#define ScrollRightDown   10
 scroll right + down

Typedefs

typedef bool(* ButtonCheckFunc )(const CUnit *, const ButtonAction *)
 Action of button.

Enumerations

enum  ButtonCmd {
  ButtonMove, ButtonAttack, ButtonRepair, ButtonHarvest,
  ButtonBuild, ButtonPatrol, ButtonAttackGround, ButtonSpellCast,
  ButtonUnload, ButtonStop, ButtonButton, ButtonTrain,
  ButtonStandGround, ButtonCancel, ButtonCancelTrain, ButtonCancelBuild
}
 < Button Commands that need target selection More...
enum  _button_area_ {
  ButtonAreaSelected, ButtonAreaTraining, ButtonAreaTransporting, ButtonAreaButton,
  ButtonAreaMenu
}
enum  _menu_button_under_ { ButtonUnderMenu, ButtonUnderNetworkMenu, ButtonUnderNetworkDiplomacy }
enum  _iface_state_ { IfaceStateNormal, IfaceStateMenu }
enum  _key_state_ { KeyStateCommand = 0, KeyStateInput }
enum  _cursor_on_ {
  CursorOnUnknown = -1, CursorOnMinimap, CursorOnButton, CursorOnMap,
  CursorOnScrollUp, CursorOnScrollDown, CursorOnScrollLeft, CursorOnScrollRight,
  CursorOnScrollLeftUp, CursorOnScrollLeftDown, CursorOnScrollRightUp, CursorOnScrollRightDown
}

Functions

void InitButtons (void)
 < Generate all buttons
void CleanButtons (void)
 Make a new button.
int AddButton (int pos, int level, const std::string &IconIdent, ButtonCmd action, const std::string &value, const ButtonCheckFunc func, const std::string &arg, const std::string &hint, const std::string &umask)
void HandleButtonDown (unsigned button)
 < Called if any mouse button is pressed down
void HandleButtonUp (unsigned button)
 Keep coordinates in window and update cursor position.
void HandleCursorMove (int *x, int *y)
 Called if the mouse is moved.
void HandleMouseMove (int x, int y)
 Called if the mouse exits the game window (only for some videomodes).
void HandleMouseExit (void)
 Update KeyModifiers if a key is pressed.
int HandleKeyModifiersDown (unsigned keycode, unsigned keychar)
 Update KeyModifiers if a key is released.
int HandleKeyModifiersUp (unsigned keycode, unsigned keychar)
 Called if a key is pressed.
void HandleKeyDown (unsigned keycode, unsigned keychar)
 Called when a key is released.
void HandleKeyUp (unsigned keycode, unsigned keychar)
 Called when a key is repeated.
void HandleKeyRepeat (unsigned keycode, unsigned keychar)
void InputMouseButtonPress (const struct _event_callback_ *callbacks, unsigned ticks, unsigned button)
 < Called if any mouse button is pressed down
void InputMouseButtonRelease (const struct _event_callback_ *callbacks, unsigned ticks, unsigned button)
 Called if the mouse is moved.
void InputMouseMove (const struct _event_callback_ *callbacks, unsigned ticks, int x, int y)
 Called if the mouse exits the game window (when supported by videomode).
void InputMouseExit (const struct _event_callback_ *callbacks, unsigned ticks)
 Called to look for mouse timeouts.
void InputMouseTimeout (const struct _event_callback_ *callbacks, unsigned ticks)
 Called if any key button is pressed down.
void InputKeyButtonPress (const struct _event_callback_ *callbacks, unsigned ticks, unsigned ikey, unsigned ikeychar)
 Called if any key button is released up.
void InputKeyButtonRelease (const struct _event_callback_ *callbacks, unsigned ticks, unsigned ikey, unsigned ikeychar)
 Called to look for key timeouts.
void InputKeyTimeout (const struct _event_callback_ *callbacks, unsigned ticks)
 Get double click delay.
int GetDoubleClickDelay (void)
 Set double click delay.
void SetDoubleClickDelay (int delay)
 Get hold click delay.
int GetHoldClickDelay (void)
 Set hold click delay.
void SetHoldClickDelay (int delay)
 Toggle pause mode.
void UiTogglePause (void)
 Handle cheats.
int HandleCheats (const std::string &input)
 Call the lua function HandleCommandKey.
bool HandleCommandKey (int key)
void DoRightButton (int tx, int ty)
 < Called if right mouse button is pressed
void CancelBuildingMode (void)
 Draw menu button area.
void DrawMenuButtonArea (void)
 Update messages.
void UpdateMessages (void)
 Draw messages as overlay over of the map.
void DrawMessages (void)
 Draw the player resource in resource line.
void DrawResources (void)
 Set message to display.
void SetMessage (const char *fmt,...)
 Set message to display with event point.
void SetMessageEvent (int x, int y, const char *fmt,...)
 Center view-point on last event message.
void CenterOnMessage (void)
 Cleanup all messages.
void CleanMessages (void)
 Draw costs in status line.
void DrawCosts (void)
 Set costs to be displayed in status line.
void SetCosts (int mana, const int *costs)
 Clear the costs displayed in status line (undisplay!).
void ClearCosts (void)
 Draw the timer.
void DrawTimer (void)
 Update the timer.
void UpdateTimer (void)
 Update the status line with hints from the button.
void UpdateStatusLineForButton (const ButtonAction *button)
 Draw the Pie Menu.
void DrawPieMenu (void)
 Handle the mouse in scroll area.
int HandleMouseScrollArea (int x, int y)
bool ButtonCheckTrue (const CUnit *unit, const ButtonAction *button)
 < Check is always true
bool ButtonCheckFalse (const CUnit *unit, const ButtonAction *button)
 Check if allowed units exists.
bool ButtonCheckUnitsOr (const CUnit *unit, const ButtonAction *button)
 Check if allowed units exists.
bool ButtonCheckUnitsAnd (const CUnit *unit, const ButtonAction *button)
 Check if have network play.
bool ButtonCheckNetwork (const CUnit *unit, const ButtonAction *button)
 Check if don't have network play.
bool ButtonCheckNoNetwork (const CUnit *unit, const ButtonAction *button)
 Check if unit isn't working (train).
bool ButtonCheckNoWork (const CUnit *unit, const ButtonAction *button)
 Check if all requirements for an attack to are meet.
bool ButtonCheckAttack (const CUnit *unit, const ButtonAction *button)
void SelectionChanged (void)
 < Called whenever the units selection is altered
void SelectedUnitChanged (void)
void SetGamePaused (bool paused)
 < Set the game paused or unpaused
bool GetGamePaused ()
 Set the game speed.
void SetGameSpeed (int speed)
 Get the game speed.
int GetGameSpeed ()

Variables

bool GameRunning
 < Flag telling if the game is running
bool GamePaused
 Flag telling if the game is in observe mode.
bool GameObserve
 Flag telling not to advance to the next game cycle.
char SkipGameCycle
 Invincibility cheat.
bool GodMode
 Whether the map is the only thing displayed or not.
char BigMapMode
 pressed mouse buttons (normal,double,dragged,long)
int MouseButtons
 current active modifiers
int KeyModifiers
 current interface state
enum _iface_state_ InterfaceState
 current scroll state of keyboard
int KeyScrollState
 current scroll state of mouse
int MouseScrollState
 current key state
enum _key_state_ KeyState
 pointer to unit under the cursor
CUnitUnitUnderCursor
 button area under the cursor
int ButtonAreaUnderCursor
 button number under the cursor
int ButtonUnderCursor
 menu button was clicked down
bool GameMenuButtonClicked
 diplomacy button was clicked down
bool GameDiplomacyButtonClicked
 Mouse leaves windows stops scroll.
bool LeaveStops
 current CursorOn field
enum _cursor_on_ CursorOn
 vladi: used for unit buttons sub-menus etc
int CurrentButtonLevel
 Time to detect double clicks.
int DoubleClickDelay
 Time to detect hold clicks.
int HoldClickDelay
 Time to detect hold clicks.


Detailed Description

The user interface header file.

Definition in file interface.h.


Define Documentation

#define DownButton   32

Scroll down button on mouse.

Definition at line 139 of file interface.h.

Referenced by tolua_stratagus_open().

#define LeftAndMiddleButton   (LeftButton | MiddleButton)

Left + Middle button on mouse.

Definition at line 141 of file interface.h.

#define LeftAndRightButton   (LeftButton | RightButton)

Left + Right button on mouse.

Definition at line 142 of file interface.h.

#define LeftButton   2

#define MiddleAndRightButton   (MiddleButton | RightButton)

Middle + Right button on mouse.

Where is our cursor ?

Definition at line 143 of file interface.h.

#define MiddleButton   4

Middle button on mouse.

Definition at line 135 of file interface.h.

Referenced by EditorCallbackButtonDown(), tolua_stratagus_open(), and UIHandleButtonDown().

#define ModifierAlt   4

#define ModifierControl   2

#define ModifierDoublePress   16

key double pressed

Definition at line 126 of file interface.h.

Referenced by CommandKey(), and InputKeyButtonPress().

#define ModifierShift   1

#define ModifierSuper   8

super key (reserved for WM)

Definition at line 125 of file interface.h.

Referenced by HandleKeyDown(), HandleKeyModifiersDown(), and HandleKeyModifiersUp().

#define MouseDoubleShift   8

shift for double click button

Definition at line 128 of file interface.h.

Referenced by DoSelectionButtons(), InputMouseButtonPress(), InputMouseButtonRelease(), and UIHandleButtonUp().

#define MouseDragShift   16

shift for drag button

Definition at line 129 of file interface.h.

Referenced by InputMouseButtonRelease().

#define MouseHoldShift   24

shift for hold button

pressed mouse button flags

Definition at line 130 of file interface.h.

Referenced by EditorCallbackButtonDown(), InputMouseButtonRelease(), and InputMouseTimeout().

#define NoButton   0

No button.

Definition at line 133 of file interface.h.

Referenced by tolua_stratagus_open().

#define RightButton   8

Right button on mouse.

Definition at line 136 of file interface.h.

Referenced by tolua_stratagus_open(), UIHandleButtonDown(), and UIHandleMouseMove().

#define ScrollDown   2

#define ScrollLeft   4

#define ScrollLeftDown   6

scroll left + down

Definition at line 168 of file interface.h.

Referenced by HandleMouseScrollArea().

#define ScrollLeftUp   5

scroll left + up

Definition at line 167 of file interface.h.

Referenced by HandleMouseScrollArea().

#define ScrollNone   0

not scrolling

Definition at line 162 of file interface.h.

Referenced by DoScroll(), DoScrollArea(), EditorCallbackMouse(), EditorMainLoop(), HandleMouseExit(), and HandleMouseOn().

#define ScrollRight   8

#define ScrollRightDown   10

scroll right + down

Definition at line 170 of file interface.h.

Referenced by HandleMouseScrollArea().

#define ScrollRightUp   9

scroll right + up

Definition at line 169 of file interface.h.

Referenced by HandleMouseScrollArea().

#define ScrollUp   1

#define UpButton   16

Scroll up button on mouse.

Definition at line 138 of file interface.h.

Referenced by tolua_stratagus_open().


Typedef Documentation

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

Action of button.

Definition at line 71 of file interface.h.


Enumeration Type Documentation

Enumerator:
ButtonAreaSelected  Selected button.
ButtonAreaTraining  Training button.
ButtonAreaTransporting  Transporting button.
ButtonAreaButton  Button panel button.
ButtonAreaMenu  Menu button.

Definition at line 94 of file interface.h.

Enumerator:
CursorOnUnknown  not known
CursorOnMinimap  minimap area
CursorOnButton  button area see: ButtonUnderCursor
CursorOnMap  over map area
CursorOnScrollUp  in scroll up area
CursorOnScrollDown  in scroll down area
CursorOnScrollLeft  in scroll left area
CursorOnScrollRight  in scroll right area
CursorOnScrollLeftUp  in scroll left+up area
CursorOnScrollLeftDown  in scroll left+down area
CursorOnScrollRightUp  in scroll right+up area
CursorOnScrollRightDown  in scroll right+down area

Definition at line 146 of file interface.h.

Enumerator:
IfaceStateNormal  Normal Game state.
IfaceStateMenu  Menu active.

Definition at line 110 of file interface.h.

Enumerator:
KeyStateCommand  keys -> commands
KeyStateInput  keys -> line editor

Definition at line 116 of file interface.h.

Enumerator:
ButtonUnderMenu  Menu button.
ButtonUnderNetworkMenu  Network menu button.
ButtonUnderNetworkDiplomacy  Diplomacy button.

Definition at line 103 of file interface.h.

enum ButtonCmd

< Button Commands that need target selection

Enumerator:
ButtonMove  order move
ButtonAttack  order attack
ButtonRepair  order repair
ButtonHarvest  order harvest
ButtonBuild  order build
ButtonPatrol  order patrol
ButtonAttackGround  order attack ground
ButtonSpellCast  order cast spell
ButtonUnload  order unload unit
ButtonStop  order stop
ButtonButton  choose other button set
ButtonTrain  order train
ButtonStandGround  order stand ground
ButtonCancel  cancel
ButtonCancelTrain  cancel training
ButtonCancelBuild  cancel building

Definition at line 51 of file interface.h.


Function Documentation

int AddButton ( int  pos,
int  level,
const std::string &  icon_ident,
ButtonCmd  action,
const std::string &  value,
const ButtonCheckFunc  func,
const std::string &  allow,
const std::string &  hint,
const std::string &  umask 
)

bool ButtonCheckAttack ( const CUnit unit,
const ButtonAction button 
)

Check if all requirements for an attack are met.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 180 of file button_checks.cpp.

References CUnitType::CanAttack, and CUnit::Type.

Referenced by CclDefineButton(), and IsButtonAllowed().

bool ButtonCheckFalse ( const CUnit unit,
const ButtonAction button 
)

Check if allowed units exists.

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

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 73 of file button_checks.cpp.

Referenced by CclDefineButton().

bool ButtonCheckNetwork ( const CUnit unit,
const ButtonAction button 
)

Check if don't have network play.

Check if network play is enabled.

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

Definition at line 138 of file button_checks.cpp.

References IsNetworkGame.

Referenced by CclDefineButton().

bool ButtonCheckNoNetwork ( const CUnit unit,
const ButtonAction button 
)

Check if unit isn't working (train).

Check if network play is disabled.

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

Definition at line 153 of file button_checks.cpp.

References IsNetworkGame.

Referenced by CclDefineButton().

bool ButtonCheckNoWork ( const CUnit unit,
const ButtonAction button 
)

Check if all requirements for an attack to are meet.

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

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 167 of file button_checks.cpp.

References CUnit::Orders, and UnitActionTrain.

Referenced by CclDefineButton().

bool ButtonCheckTrue ( const CUnit unit,
const ButtonAction button 
)

< Check is always true

Check is always false

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

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 59 of file button_checks.cpp.

Referenced by CclDefineButton().

bool ButtonCheckUnitsAnd ( const CUnit unit,
const ButtonAction button 
)

Check if have network play.

Check for button enabled, if all units are available.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 111 of file button_checks.cpp.

References ButtonAction::AllowStr, CPlayer::HaveUnitTypeByIdent(), new_strdup(), and CUnit::Player.

Referenced by CclDefineButton().

bool ButtonCheckUnitsOr ( const CUnit unit,
const ButtonAction button 
)

Check if allowed units exists.

Check for button enabled, if any unit is available.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 86 of file button_checks.cpp.

References ButtonAction::AllowStr, CPlayer::HaveUnitTypeByIdent(), new_strdup(), and CUnit::Player.

Referenced by CclDefineButton().

void CancelBuildingMode ( void   ) 

Draw menu button area.

Cancel building cursor mode.

Definition at line 88 of file mouse.cpp.

References CUserInterface::ButtonPanel, CStatusLine::Clear(), ClearCosts(), CurrentButtonLevel, CursorBuilding, CUserInterface::StatusLine, UI, and CButtonPanel::Update().

Referenced by DoActionMove(), CUnit::Remove(), and UIHandleButtonDown().

void CenterOnMessage ( void   ) 

Cleanup all messages.

Goto message origin.

Definition at line 722 of file mainscr.cpp.

References _, CViewport::Center(), MessagesEvent, MessagesEventCount, MessagesEventIndex, MessagesEventX, MessagesEventY, CUserInterface::SelectedViewport, SetMessage(), TileSizeX, TileSizeY, and UI.

Referenced by CommandKey().

void CleanButtons ( void   ) 

Make a new button.

Cleanup buttons.

Definition at line 163 of file botpanel.cpp.

References Assert, CurrentButtonLevel, int(), and UnitButtonTable.

Referenced by CleanModules().

void CleanMessages ( void   ) 

Draw costs in status line.

Clean messages

Definition at line 643 of file mainscr.cpp.

References MessagesDisplay::CleanMessages().

Referenced by CleanGame(), and CleanModules().

void ClearCosts ( void   ) 

void DoRightButton ( int  sx,
int  sy 
)

void DrawCosts ( void   ) 

Set costs to be displayed in status line.

Draw costs in status line.

Todo:
FIXME: make DrawCosts more configurable.

Definition at line 791 of file mainscr.cpp.

References Costs, CostsMana, CYCLES_PER_SECOND, CGraphic::DrawFrameClip(), EnergyCost, CResourceInfo::G, GameFont, CResourceInfo::IconFrame, MaxCosts, CUserInterface::Resources, CUserInterface::StatusLine, CStatusLine::TextX, CStatusLine::TextY, UI, Video, VideoDrawNumber(), and CVideo::Width.

Referenced by UpdateDisplay().

void DrawMenuButtonArea ( void   ) 

void DrawMessages ( void   ) 

Draw the player resource in resource line.

Draw messages

Definition at line 651 of file mainscr.cpp.

References MessagesDisplay::DrawMessages().

Referenced by UpdateDisplay().

void DrawPieMenu ( void   ) 

void DrawResources ( void   ) 

Set message to display.

Draw the player resource in top line.

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

Definition at line 373 of file mainscr.cpp.

References _, CYCLES_PER_SECOND, GameFont, MaxCosts, CPlayer::ProductionRate, CPlayer::RequestedUtilizationRate, sprintf_s(), CPlayer::StorageCapacity, CPlayer::StoredResources, ThisPlayer, and VideoDrawText().

Referenced by UpdateDisplay().

void DrawTimer ( void   ) 

Update the timer.

Draw the timer

Definition at line 955 of file mainscr.cpp.

References CTimer::Cycles, CYCLES_PER_SECOND, CUITimer::Font, GameTimer, CTimer::Init, sprintf_s(), CUserInterface::Timer, UI, VideoDrawText(), CUITimer::X, and CUITimer::Y.

Referenced by UpdateDisplay().

int GetDoubleClickDelay ( void   ) 

Set double click delay.

Get double click delay

Definition at line 1418 of file interface.cpp.

Referenced by tolua_stratagus_GetDoubleClickDelay00().

bool GetGamePaused (  ) 

Set the game speed.

Get the game paused or unpaused

Returns:
True if the game is paused, false otherwise

Definition at line 346 of file game.cpp.

References GamePaused.

Referenced by tolua_get_GamePaused(), and tolua_stratagus_GetGamePaused00().

int GetGameSpeed (  ) 

Get the game speed

Returns:
Game speed

Definition at line 369 of file game.cpp.

References CYCLES_PER_SECOND, and VideoSyncSpeed.

Referenced by tolua_get_GameSpeed(), and tolua_stratagus_GetGameSpeed00().

int GetHoldClickDelay ( void   ) 

Set hold click delay.

Get hold click delay

Definition at line 1436 of file interface.cpp.

Referenced by tolua_stratagus_GetHoldClickDelay00().

void HandleButtonDown ( unsigned  button  ) 

< Called if any mouse button is pressed down

Called if any mouse button is released up

Called if mouse button pressed down.

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

Definition at line 1184 of file interface.cpp.

References UIHandleButtonDown().

Referenced by InitGameCallbacks().

void HandleButtonUp ( unsigned  button  ) 

Keep coordinates in window and update cursor position.

Called if mouse button released.

Todo:
FIXME: the mouse handling should be complete rewritten
Todo:
FIXME: this is needed for double click, long click,...
Parameters:
button Mouse button number (0 left, 1 middle, 2 right)

Definition at line 1197 of file interface.cpp.

References UIHandleButtonUp().

Referenced by InitGameCallbacks().

int HandleCheats ( const std::string &  input  ) 

Call the lua function HandleCommandKey.

Handle cheats

Returns:
1 if a cheat was handled, 0 otherwise

Definition at line 693 of file interface.cpp.

References CPlayer::Ai, CPlayer::AiEnabled, AiInit(), DebugPrint, Lua, LuaCall(), LuaToBoolean(), PlayerComputer, PlayerPerson, SetMessage(), ThisPlayer, and CPlayer::Type.

Referenced by DoNextReplay(), and InputKey().

bool HandleCommandKey ( int  key  ) 

Call the lua function HandleCommandKey

Definition at line 472 of file interface.cpp.

References DebugPrint, KeyModifiers, Lua, LuaCall(), LuaError, LuaToBoolean(), ModifierAlt, ModifierControl, ModifierShift, and SdlKey2Str().

Referenced by CommandKey(), EditorCallbackKeyDown(), and PatchEditorCallbackKeyDown().

void HandleCursorMove ( int *  x,
int *  y 
)

Called if the mouse is moved.

Keep coordinates in window and update cursor position

Parameters:
x screen pixel X position.
y screen pixel Y position.

Definition at line 1147 of file interface.cpp.

References CursorX, CursorY, CVideo::Height, Video, and CVideo::Width.

Referenced by EditorCallbackMouse(), HandleMouseMove(), MenuHandleMouseMove(), and PatchEditorCallbackMouse().

void HandleKeyDown ( unsigned  key,
unsigned  keychar 
)

Called when a key is released.

Handle key down.

Parameters:
key Key scancode.
keychar Character code.

Definition at line 1016 of file interface.cpp.

References CUserInterface::ButtonPanel, CommandKey(), CButtonPanel::DoKey(), GameObserve, GamePaused, HandleKeyModifiersDown(), InputKey(), IsKeyPad(), KeyModifiers, KeyState, KeyStateInput, ModifierAlt, ModifierControl, ModifierSuper, and UI.

Referenced by InitGameCallbacks().

int HandleKeyModifiersDown ( unsigned  key,
unsigned  keychar 
)

Update KeyModifiers if a key is released.

Update KeyModifiers if a key is pressed.

Parameters:
key Key scancode.
keychar Character code.
Returns:
1 if modifier found, 0 otherwise

Definition at line 907 of file interface.cpp.

References _, GameRunning, IfaceStateNormal, InterfaceState, KeyModifiers, ModifierAlt, ModifierControl, ModifierShift, ModifierSuper, Screenshot(), SelectedUnitChanged(), and SetMessage().

Referenced by EditorCallbackKeyDown(), HandleKeyDown(), MenuHandleKeyDown(), MenuHandleKeyRepeat(), and PatchEditorCallbackKeyDown().

int HandleKeyModifiersUp ( unsigned  key,
unsigned  keychar 
)

Called if a key is pressed.

Update KeyModifiers if a key is released.

Parameters:
key Key scancode.
keychar Character code.
Returns:
1 if modifier found, 0 otherwise

Definition at line 953 of file interface.cpp.

References IfaceStateNormal, InterfaceState, KeyModifiers, ModifierAlt, ModifierControl, ModifierShift, ModifierSuper, and SelectedUnitChanged().

Referenced by EditorCallbackKeyUp(), HandleKeyUp(), MenuHandleKeyUp(), and PatchEditorCallbackKeyUp().

void HandleKeyRepeat ( unsigned  key,
unsigned  keychar 
)

Handle key up.

Parameters:
key Key scancode.
keychar Character code.

Definition at line 1082 of file interface.cpp.

References InputKey(), KeyState, and KeyStateInput.

Referenced by InitGameCallbacks().

void HandleKeyUp ( unsigned  key,
unsigned  keychar 
)

Called when a key is repeated.

Handle key up.

Parameters:
key Key scancode.
keychar Character code.

Definition at line 1048 of file interface.cpp.

References HandleKeyModifiersUp(), KeyScrollState, ScrollDown, ScrollLeft, ScrollRight, and ScrollUp.

Referenced by InitGameCallbacks().

void HandleMouseExit ( void   ) 

Update KeyModifiers if a key is pressed.

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.

Definition at line 570 of file mouse.cpp.

References CursorConfig::Cursor, CursorOn, CursorOnUnknown, CursorX, CursorY, GameCursor, CVideo::Height, KeyScrollState, LeaveStops, MouseScrollState, CUserInterface::Point, ScrollNone, UI, Video, and CVideo::Width.

Referenced by InitGameCallbacks(), and initGuichan().

void HandleMouseMove ( int  x,
int  y 
)

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

Handle movement of the cursor.

Parameters:
x screen pixel X position.
y screen pixel Y position.

Definition at line 1173 of file interface.cpp.

References HandleCursorMove(), and UIHandleMouseMove().

Referenced by DoScrollArea(), and InitGameCallbacks().

int HandleMouseScrollArea ( int  x,
int  y 
)

void InitButtons ( void   ) 

< Generate all buttons

Free memory for buttons

Initialize the buttons.

Definition at line 82 of file botpanel.cpp.

References int(), and UnitButtonTable.

Referenced by CreateGame(), and InitModules().

void InputKeyButtonPress ( const struct _event_callback_ callbacks,
unsigned  ticks,
unsigned  ikey,
unsigned  ikeychar 
)

Called if any key button is released up.

Referenced by SdlDoEvent().

void InputKeyButtonRelease ( const struct _event_callback_ callbacks,
unsigned  ticks,
unsigned  ikey,
unsigned  ikeychar 
)

Called to look for key timeouts.

Referenced by SdlDoEvent().

void InputKeyTimeout ( const struct _event_callback_ callbacks,
unsigned  ticks 
)

Get double click delay.

Referenced by WaitEventsOneFrame().

void InputMouseButtonPress ( const struct _event_callback_ callbacks,
unsigned  ticks,
unsigned  button 
)

< Called if any mouse button is pressed down

Called if any mouse button is released up

Referenced by SdlDoEvent().

void InputMouseButtonRelease ( const struct _event_callback_ callbacks,
unsigned  ticks,
unsigned  button 
)

Called if the mouse is moved.

Referenced by SdlDoEvent().

void InputMouseExit ( const struct _event_callback_ callbacks,
unsigned  ticks 
)

Called to look for mouse timeouts.

Referenced by SdlDoEvent().

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

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

Referenced by SdlDoEvent().

void InputMouseTimeout ( const struct _event_callback_ callbacks,
unsigned  ticks 
)

Called if any key button is pressed down.

Referenced by WaitEventsOneFrame().

void SelectedUnitChanged ( void   ) 

void SelectionChanged ( void   ) 

void SetCosts ( int  mana,
const int *  costs 
)

Clear the costs displayed in status line (undisplay!).

Set costs in status line.

Parameters:
mana Mana costs.
costs Resource costs, NULL pointer if all are zero.

Definition at line 823 of file mainscr.cpp.

References Costs, CostsMana, and MaxCosts.

Referenced by ClearCosts(), and UpdateStatusLineForButton().

void SetDoubleClickDelay ( int  delay  ) 

Get hold click delay.

Set double click delay

Parameters:
delay Double click delay

Definition at line 1428 of file interface.cpp.

Referenced by tolua_stratagus_SetDoubleClickDelay00().

void SetGamePaused ( bool  paused  ) 

< Set the game paused or unpaused

Get the game paused or unpaused

Set the game paused or unpaused

Parameters:
paused True to pause game, false to unpause.

Definition at line 336 of file game.cpp.

References GamePaused.

Referenced by tolua_set_GamePaused(), and tolua_stratagus_SetGamePaused00().

void SetGameSpeed ( int  speed  ) 

Get the game speed.

Set the game speed

Parameters:
speed New game speed.

Definition at line 356 of file game.cpp.

References CYCLES_PER_SECOND, FastForwardCycle, GameCycle, SetVideoSync(), and VideoSyncSpeed.

Referenced by tolua_set_GameSpeed(), and tolua_stratagus_SetGameSpeed00().

void SetHoldClickDelay ( int  delay  ) 

Toggle pause mode.

Set hold click delay

Parameters:
delay Hold click delay

Definition at line 1446 of file interface.cpp.

Referenced by tolua_stratagus_SetHoldClickDelay00().

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

Set message to display with event point.

Set message to display.

Parameters:
fmt To be displayed in text overlay.

Definition at line 661 of file mainscr.cpp.

References MessagesDisplay::AddUniqueMessage().

Referenced by CclAddMessage(), CenterOnMessage(), CommandQuit(), HandleCheats(), HandleKeyModifiersDown(), NetworkEvent(), NetworkRecover(), ParseNetworkCommand(), and ReplayEachCycle().

void SetMessageEvent ( int  x,
int  y,
const char *  fmt,
  ... 
)

Center view-point on last event message.

Set message to display.

Parameters:
x Message X map origin.
y Message Y map origin.
fmt To be displayed in text overlay.

Definition at line 695 of file mainscr.cpp.

References MessagesDisplay::AddUniqueMessage(), MESSAGES_MAX, MessagesEvent, MessagesEventCount, MessagesEventIndex, MessagesEventX, MessagesEventY, ShiftMessagesEvent(), and strcpy_s().

Referenced by CPlayer::Notify().

void UiTogglePause ( void   ) 

Handle cheats.

Toggle pause on / off.

Definition at line 287 of file interface.cpp.

References _, GamePaused, IsNetworkGame, CStatusLine::Set(), CUserInterface::StatusLine, and UI.

Referenced by CommandKey(), and SdlDoEvent().

void UpdateMessages ( void   ) 

Draw messages as overlay over of the map.

Update messages

Definition at line 636 of file mainscr.cpp.

References MessagesDisplay::UpdateMessages().

Referenced by GameMainLoop().

void UpdateStatusLineForButton ( const ButtonAction button  ) 

Draw the Pie Menu.

Update the status line with hints from the button

Parameters:
button Button

Definition at line 477 of file botpanel.cpp.

References ButtonAction::Action, Assert, ButtonBuild, ButtonSpellCast, ButtonTrain, ClearCosts(), ButtonAction::Hint, CStatusLine::Set(), SetCosts(), SpellTypeTable, CUserInterface::StatusLine, UI, UnitTypes, and ButtonAction::Value.

Referenced by CButtonPanel::Draw(), and DrawPieMenu().

void UpdateTimer ( void   ) 

Update the status line with hints from the button.

Update the timer

Definition at line 978 of file mainscr.cpp.

References CTimer::Cycles, GameCycle, GameTimer, CTimer::Increasing, CTimer::LastUpdate, and CTimer::Running.

Referenced by GameMainLoop().


Variable Documentation

char BigMapMode

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

Definition at line 91 of file interface.cpp.

Referenced by HandleMouseOn(), UiToggleBigMap(), and UpdateDisplay().

Time to detect hold clicks.

Definition at line 1206 of file interface.cpp.

Mouse leaves windows stops scroll.

Definition at line 75 of file mouse.cpp.

Referenced by DrawMenuButtonArea(), UIHandleButtonDown(), UIHandleButtonUp(), and UIHandleMouseMove().

bool GamePaused

bool GodMode

Whether the map is the only thing displayed or not.

Definition at line 93 of file interface.cpp.

Referenced by CclGetGodMode(), CclSetGodMode(), GameMainLoop(), HitUnit(), and SaveCcl().

Time to detect hold clicks.

Definition at line 1207 of file interface.cpp.

current scroll state of keyboard

Definition at line 92 of file interface.cpp.

Referenced by EditorMainLoop(), HandleKeyModifiersDown(), HandleKeyModifiersUp(), MenuLoop(), NetworkParseSetupEvent(), and StartMap().

current scroll state of mouse

current scroll state of mouse

variable set when we are scrolling via mouse

Definition at line 79 of file mainloop.cpp.

Referenced by CommandKey(), DoScroll(), EditorCallbackKeyDown(), EditorCallbackKeyUp(), EditorMainLoop(), GameMainLoop(), HandleKeyUp(), HandleMouseExit(), PatchEditorCallbackKeyDown(), and PatchEditorCallbackKeyUp().

bool LeaveStops

current CursorOn field

Definition at line 76 of file mouse.cpp.

Referenced by GetLeaveStops(), HandleMouseExit(), and SetLeaveStops().

Invincibility cheat.

Definition at line 90 of file interface.cpp.

Referenced by GameMainLoop(), and WaitEventsOneFrame().


Generated on Sat Feb 21 00:28:17 2009 for Bos Wars by  doxygen 1.5.6