_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
Go to the documentation of this file.
30 #ifndef __INTERFACE_H__
31 #define __INTERFACE_H__
147 #define ModifierShift 1
148 #define ModifierControl 2
149 #define ModifierAlt 4
150 #define ModifierSuper 8
151 #define ModifierDoublePress 16
153 #define MouseDoubleShift 8
154 #define MouseDragShift 16
155 #define MouseHoldShift 24
160 #define MiddleButton 4
161 #define RightButton 8
164 #define DownButton 32
166 #define LeftAndMiddleButton (LeftButton | MiddleButton)
167 #define LeftAndRightButton (LeftButton | RightButton)
168 #define MiddleAndRightButton (MiddleButton | RightButton)
191 #define ScrollRight 8
192 #define ScrollLeftUp 5
193 #define ScrollLeftDown 6
194 #define ScrollRightUp 9
195 #define ScrollRightDown 10
272 extern int AddButton(
int pos,
int level,
const std::string &IconIdent,
274 const std::string &arg,
const int key,
const std::string &hint,
const std::string &descr,
275 const std::string &sound,
const std::string &cursor,
const std::string &umask,
276 const std::string &popup,
bool alwaysShow);
300 extern void HandleKeyDown(
unsigned keycode,
unsigned keychar);
302 extern void HandleKeyUp(
unsigned keycode,
unsigned keychar);
348 extern void SetScrollMargins(
unsigned int top,
unsigned int right,
unsigned int bottom,
unsigned int left);
461 #endif // !__INTERFACE_H__
void InputMouseButtonRelease(const EventCallback &callbacks, unsigned ticks, unsigned button)
Called if any mouse button is released up.
Definition: interface.cpp:1393
@ ButtonCancelBuild
cancel training
Definition: interface.h:80
void void SetMessageEvent(const Vec2i &pos, const char *fmt,...) PRINTF_VAARG_ATTRIBUTE(2
Set message to display with event point.
int GetDoubleClickDelay()
Get double click delay.
Definition: interface.cpp:1554
void SetHoldClickDelay(int delay)
Set hold click delay.
Definition: interface.cpp:1582
void HandleButtonDown(unsigned button)
Called if any mouse button is pressed down.
Definition: interface.cpp:1316
bool GameObserve
Flag telling if the game is in observe mode.
Definition: interface.cpp:85
void HandleCursorMove(int *x, int *y)
Keep coordinates in window and update cursor position.
Definition: interface.cpp:1290
bool ButtonCheckSingleResearch(const CUnit &unit, const ButtonAction &button)
Check if all requirements for a single research are meet.
Definition: button_checks.cpp:371
int HandleKeyModifiersUp(unsigned keycode, unsigned keychar)
Update KeyModifiers if a key is released.
Definition: interface.cpp:1089
void UiFindIdleWorker()
Find the next idle worker.
Definition: interface.cpp:446
void InputMouseMove(const EventCallback &callbacks, unsigned ticks, int x, int y)
Called if the mouse is moved.
Definition: interface.cpp:1430
@ IfaceStateNormal
Definition: interface.h:136
@ ButtonCancelTrain
cancel upgrade
Definition: interface.h:79
bool ButtonCheckUnitVariable(const CUnit &unit, const ButtonAction &button)
Check if unit's variables pass the condition check.
Definition: button_checks.cpp:115
void SetScrollMargins(unsigned int top, unsigned int right, unsigned int bottom, unsigned int left)
Scroll margins on screen.
Definition: interface.cpp:1590
bool ButtonCheckAttack(const CUnit &unit, const ButtonAction &button)
Check if all requirements for an attack to are meet.
Definition: button_checks.cpp:331
enum _iface_state_ InterfaceState
current interface state
Definition: interface.cpp:89
void InputKeyButtonRelease(const EventCallback &callbacks, unsigned ticks, unsigned ikey, unsigned ikeychar)
Called if any key button is released up.
Definition: interface.cpp:1523
@ ButtonUnderNetworkDiplomacy
Network menu button.
Definition: interface.h:130
bool ButtonCheckUnitsNot(const CUnit &unit, const ButtonAction &button)
Check if not one unit exist.
Definition: button_checks.cpp:227
void HandleMouseExit()
Called if the mouse exits the game window (only for some videomodes)
Definition: mouse.cpp:872
@ CursorOnScrollRightDown
in scroll right+up area
Definition: interface.h:183
Icon reference (used in config tables)
Definition: icons.h:172
bool GameMenuButtonClicked
menu button was clicked down
Definition: mouse.cpp:81
@ ButtonAreaMenu
Button panel button.
Definition: interface.h:122
void SetMaxMessageCount(int newMax)
max message count
Definition: mainscr.cpp:1104
void DrawMenuButtonArea()
Draw menu button area.
Definition: mainscr.cpp:111
bool HandleCommandKey(int key)
Call the lua function HandleCommandKey.
Definition: interface.cpp:506
bool ButtonCheckNoWork(const CUnit &unit, const ButtonAction &button)
Check if unit isn't working (train,upgrade,research)
Definition: button_checks.cpp:284
@ CursorOnScrollLeft
in scroll down area
Definition: interface.h:178
@ ButtonRepair
order attack
Definition: interface.h:62
int MouseScrollState
current scroll state of mouse
Definition: mainloop.cpp:78
void DrawUserDefinedButtons()
Draw user defined buttons.
Definition: mainscr.cpp:120
@ KeyStateCommand
Definition: interface.h:142
Definition: unitsound.h:54
bool ButtonCheckFalse(const CUnit &unit, const ButtonAction &button)
Check is always false.
Definition: button_checks.cpp:76
@ ButtonUnderMenu
Definition: interface.h:128
bool ButtonCheckNoResearch(const CUnit &unit, const ButtonAction &button)
Check if unit isn't researching or upgrading.
Definition: button_checks.cpp:300
bool GameDiplomacyButtonClicked
diplomacy button was clicked down
Definition: mouse.cpp:82
bool(* ButtonCheckFunc)(const CUnit &, const ButtonAction &)
Definition: interface.h:85
bool LeaveStops
Mouse leaves windows stops scroll.
Definition: mouse.cpp:83
bool GetGamePaused()
Get the game paused or unpaused.
Definition: game.cpp:632
bool ButtonCheckResearch(const CUnit &unit, const ButtonAction &button)
Check if all requirements for a research are meet.
Definition: button_checks.cpp:344
@ ButtonButton
order stop
Definition: interface.h:71
void HandleKeyDown(unsigned keycode, unsigned keychar)
Called if a key is pressed.
Definition: interface.cpp:1152
void DrawTimer()
Draw the timer.
Definition: mainscr.cpp:1277
int KeyScrollState
current scroll state of keyboard
Definition: mainloop.cpp:75
@ ButtonUpgradeTo
order reseach
Definition: interface.h:76
@ KeyStateInput
keys -> commands
Definition: interface.h:143
void InputKeyTimeout(const EventCallback &callbacks, unsigned ticks)
Called to look for key timeouts.
Definition: interface.cpp:1541
@ ButtonCancel
order upgrade
Definition: interface.h:77
@ IfaceStateMenu
Normal Game state.
Definition: interface.h:137
bool ButtonCheckNetwork(const CUnit &unit, const ButtonAction &button)
Check if have network play.
Definition: button_checks.cpp:255
bool ButtonCheckTrue(const CUnit &unit, const ButtonAction &button)
Check is always true.
Definition: button_checks.cpp:62
int CurrentButtonLevel
vladi: used for unit buttons sub-menus etc
Definition: botpanel.cpp:76
@ CursorOnScrollLeftUp
in scroll right area
Definition: interface.h:180
@ ButtonTrain
choose other button set
Definition: interface.h:72
@ ButtonReturn
order stand ground
Definition: interface.h:74
void DrawResources()
Draw the player resource in resource line.
Definition: mainscr.cpp:615
bool IsButtonAllowed(const CUnit &unit, const ButtonAction &buttonaction)
Definition: botpanel.cpp:865
bool ButtonCheckUpgrade(const CUnit &unit, const ButtonAction &button)
Check if allowed upgrade is ready.
Definition: button_checks.cpp:89
bool HandleMouseScrollArea(const PixelPos &mousePos)
Handle the mouse in scroll area.
Definition: interface.cpp:1238
void HandleButtonUp(unsigned button)
Called if any mouse button is released up.
Definition: interface.cpp:1329
@ CursorOnMap
button area see: ButtonUnderCursor
Definition: interface.h:175
void CleanButtons()
Free memory for buttons.
Definition: botpanel.cpp:192
void DrawPopup(const ButtonAction &button, const CUIButton &uibutton, int x=0, int y=0)
Draw the button popup.
Definition: botpanel.cpp:548
@ ButtonUnload
order cast spell
Definition: interface.h:69
char BigMapMode
Whether the map is the only thing displayed or not.
Definition: interface.cpp:88
void CancelBuildingMode()
Cancel the building input mode.
Definition: mouse.cpp:100
int HoldClickDelay
Time to detect hold clicks.
Definition: interface.cpp:1339
@ ButtonAreaButton
Transporting button.
Definition: interface.h:121
void UiToggleTerrain()
Toggle terrain display on/off.
Definition: interface.cpp:433
std::vector< ButtonAction * > UnitButtonTable
All buttons for units.
Definition: botpanel.cpp:78
void SelectedUnitChanged()
Called whenever the selected unit was updated.
Definition: script_ui.cpp:1210
void HandleMouseMove(const PixelPos &pos)
Called if the mouse is moved.
Definition: interface.cpp:1304
int HandleKeyModifiersDown(unsigned keycode, unsigned keychar)
Update KeyModifiers if a key is pressed.
Definition: interface.cpp:1045
CUnit * GetUnitUnderCursor()
Definition: mouse.cpp:92
@ ButtonAreaTraining
Selected button.
Definition: interface.h:117
void InputMouseExit(const EventCallback &callbacks, unsigned ticks)
Called if the mouse exits the game window (when supported by videomode)
Definition: interface.cpp:1451
@ ButtonPatrol
order build
Definition: interface.h:65
_cursor_on_
Where is our cursor ?
Definition: interface.h:171
int DoubleClickDelay
Time to detect double clicks.
Definition: interface.cpp:1338
void DrawPieMenu()
Draw the Pie Menu.
Definition: mouse.cpp:2187
@ ButtonResearch
order return goods
Definition: interface.h:75
void UiTrackUnit()
Track unit, the viewport follows the unit.
Definition: interface.cpp:489
bool GodMode
Invincibility cheat.
Definition: interface.cpp:90
@ CursorOnScrollLeftDown
in scroll left+up area
Definition: interface.h:181
void HandleKeyUp(unsigned keycode, unsigned keychar)
Called when a key is released.
Definition: interface.cpp:1190
void SetGamePaused(bool paused)
Set the game paused or unpaused.
Definition: game.cpp:622
void SetMessage(const char *fmt,...) PRINTF_VAARG_ATTRIBUTE(1
Set message to display.
void ToggleShowMessages()
show/hide messages
Definition: mainscr.cpp:1092
bool GameEstablishing
Flag telling if the game is in establishing mode.
Definition: interface.cpp:86
void InputMouseButtonPress(const EventCallback &callbacks, unsigned ticks, unsigned button)
Called if any mouse button is pressed down.
Definition: interface.cpp:1362
@ ButtonUnderFreeWorkers
Diplomacy button.
Definition: interface.h:131
@ ButtonAreaUser
Menu button.
Definition: interface.h:123
void SetGameSpeed(int speed)
Set the game speed.
Definition: game.cpp:642
@ CursorOnScrollUp
over map area
Definition: interface.h:176
bool ButtonCheckIndividualUpgrade(const CUnit &unit, const ButtonAction &button)
Check if unit has an individual upgrade.
Definition: button_checks.cpp:102
@ ButtonMove
Definition: interface.h:60
int OldButtonUnderCursor
oldbutton number under the cursor
Definition: mouse.cpp:80
@ ButtonAttack
order move
Definition: interface.h:61
_key_state_
current key state
Definition: interface.h:141
void HandleKeyRepeat(unsigned keycode, unsigned keychar)
Called when a key is repeated.
Definition: interface.cpp:1224
bool ButtonCheckUnitsNor(const CUnit &unit, const ButtonAction &button)
Check if none of the units exist.
Definition: button_checks.cpp:240
void InitButtons()
Generate all buttons.
Definition: botpanel.cpp:89
ButtonAction * LastDrawnButtonPopup
Last drawn popup : used to speed up drawing.
Definition: botpanel.cpp:74
_iface_state_
current interface state
Definition: interface.h:135
void CleanMessages()
Cleanup all messages.
Definition: mainscr.cpp:999
void UiToggleBigMap()
Toggle big map.
Definition: interface.cpp:310
void InputMouseTimeout(const EventCallback &callbacks, unsigned ticks)
Called to look for mouse timeouts.
Definition: interface.cpp:1466
@ ButtonCancelUpgrade
cancel
Definition: interface.h:78
@ ButtonCallbackAction
cancel building
Definition: interface.h:81
@ ButtonAreaResearching
Upgrading button.
Definition: interface.h:119
@ ButtonBuild
order harvest
Definition: interface.h:64
void UpdateStatusLineForButton(const ButtonAction &button)
Update the status line with hints from the button.
Definition: botpanel.cpp:827
int ButtonUnderCursor
button number under the cursor
Definition: mouse.cpp:79
int KeyModifiers
current active modifiers
Definition: mouse.cpp:75
bool ButtonCheckNoNetwork(const CUnit &unit, const ButtonAction &button)
Check if don't have network play.
Definition: button_checks.cpp:270
@ ButtonStop
order unload unit
Definition: interface.h:70
bool GamePaused
Flag telling if the game is paused.
Definition: interface.cpp:84
ButtonCmd
Button Commands that need target selection.
Definition: interface.h:59
char SkipGameCycle
Flag telling not to advance to the next game cycle.
Definition: interface.cpp:87
void SelectionChanged()
Called whenever the units selection is altered.
Definition: script_ui.cpp:1192
_menu_button_under_
Menu button under cursor.
Definition: interface.h:127
@ ButtonHarvest
order repair
Definition: interface.h:63
void void void CenterOnMessage()
Center view-point on last event message.
Definition: mainscr.cpp:1078
int GetHoldClickDelay()
Get hold click delay.
Definition: interface.cpp:1572
enum _key_state_ KeyState
current key state
Definition: interface.cpp:91
int MouseButtons
pressed mouse buttons (normal,double,dragged,long)
Definition: mouse.cpp:73
@ CursorOnButton
minimap area
Definition: interface.h:174
bool ButtonCheckDebug(const CUnit &unit, const ButtonAction &button)
Check for button enabled, if requested condition passes check. Used for debug purposes.
Definition: button_checks.cpp:390
int GetGameSpeed()
Get the game speed.
Definition: game.cpp:655
bool GameRunning
Flag telling if the game is running.
Definition: interface.cpp:83
@ ButtonUnderNetworkMenu
Menu button.
Definition: interface.h:129
bool IsSDLWindowVisible
Flag telling if the SDL window is visible.
Definition: sdl.cpp:106
void DrawMessages()
Draw messages as overlay over of the map.
Definition: mainscr.cpp:1007
bool ButtonCheckUnitsOr(const CUnit &unit, const ButtonAction &button)
Check if allowed units exists.
Definition: button_checks.cpp:181
void SetDoubleClickDelay(int delay)
Set double click delay.
Definition: interface.cpp:1564
int HandleCheats(const std::string &input)
Handle cheats.
Definition: interface.cpp:764
@ CursorOnScrollRight
in scroll left area
Definition: interface.h:179
void UiTogglePause()
Toggle pause mode.
Definition: interface.cpp:293
@ CursorOnMinimap
not known
Definition: interface.h:173
bool ButtonCheckUnitsAnd(const CUnit &unit, const ButtonAction &button)
Check if allowed units exists.
Definition: button_checks.cpp:204
void InputKeyButtonPress(const EventCallback &callbacks, unsigned ticks, unsigned ikey, unsigned ikeychar)
Called if any key button is pressed down.
Definition: interface.cpp:1499
@ ButtonAreaSelected
Definition: interface.h:116
@ ButtonExplore
order patrol
Definition: interface.h:66
@ ButtonAreaUpgrading
Training button.
Definition: interface.h:118
enum _cursor_on_ CursorOn
current CursorOn field
Definition: mouse.cpp:85
void UpdateMessages()
Update messages.
Definition: mainscr.cpp:991
@ CursorOnUnknown
Definition: interface.h:172
@ ButtonSpellCast
order attack ground
Definition: interface.h:68
void UpdateTimer()
Update the timer.
Definition: mainscr.cpp:1290
int ButtonAreaUnderCursor
button area under the cursor
Definition: mouse.cpp:78
#define PRINTF_VAARG_ATTRIBUTE(a, b)
Definition: stratagus.h:108
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.
Definition: botpanel.cpp:105
The big unit structure.
Definition: unit.h:135
bool ButtonCheckUpgradeTo(const CUnit &unit, const ButtonAction &button)
Check if all requirements for an upgrade to are meet.
Definition: button_checks.cpp:315
@ CursorOnScrollRightUp
in scroll left+down area
Definition: interface.h:182
_button_area_
Button area under cursor.
Definition: interface.h:115
@ ButtonStandGround
order train
Definition: interface.h:73
CUnit * UnitUnderCursor
shared pointer to unit under the cursor
Definition: mouse.cpp:77
@ ButtonAreaTransporting
Researching button.
Definition: interface.h:120
@ CursorOnScrollDown
in scroll up area
Definition: interface.h:177
@ ButtonAttackGround
order explore
Definition: interface.h:67
(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.