_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
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.
45 #ifndef __INTERFACE_H__
146 #define MAX_NUM_VIEWPORTS 8
232 bits_map() : Width(0), Height(0), bstore(NULL) {}
237 bool TransparentPixel(
int x,
int y)
240 const unsigned int x_index = x / 32;
244 return ((bstore[y + x_index] & (1 << x)) == 0);
251 unsigned int *bstore;
264 if (x >= 0 && y >= 0 && x < map.Width && y < map.Height) {
265 return !map.TransparentPixel(x, y);
286 void DoClicked_SelectTarget(
int button);
288 void DoClicked_Unload(
int button);
289 void DoClicked_SpellCast(
int button);
290 void DoClicked_Repair(
int button);
291 void DoClicked_Explore();
292 void DoClicked_Return();
293 void DoClicked_Stop();
294 void DoClicked_StandGround();
295 void DoClicked_Button(
int button);
296 void DoClicked_CancelUpgrade();
297 void DoClicked_CancelTrain();
298 void DoClicked_CancelBuild();
299 void DoClicked_Build(
int button);
300 void DoClicked_Train(
int button);
301 void DoClicked_UpgradeTo(
int button);
302 void DoClicked_Research(
int button);
303 void DoClicked_CallbackAction(
int button,
int clickingPlayer);
320 memset(this->
X, 0,
sizeof(this->
X));
321 memset(this->
Y, 0,
sizeof(this->
Y));
331 const int coeffX[] = { 0, 193, 256, 193, 0, -193, -256, -193, 0};
332 const int coeffY[] = { -256, -193, 0, 193, 256, 193, 0, -193, 0};
333 for (
int i = 0; i < 9; ++i) {
334 this->X[i] = (coeffX[i] * radius) >> 8;
335 this->Y[i] = (coeffY[i] * radius) >> 8;
354 #define MaxResourceInfo MaxCosts + 4
610 extern void CallHandler(
unsigned int handle,
int value);
int X
Definition: ui.h:172
int ScrollPaddingRight
Scrollable area past the left of map.
Definition: ui.h:177
@ TextAlignUndefined
Definition: ui.h:79
int MouseScrollSpeedDefault
Middle-Mouse Scroll Speed (screenpixels per mousepixel)
Definition: ui.h:396
void CleanUserInterface()
Clean up the ui module.
Definition: ui.cpp:357
CFont * SingleTrainingFont
Text for single training.
Definition: ui.h:423
CursorConfig Glass
General pointing cursor.
Definition: ui.h:499
void RestrictCursorToViewport()
Restrict mouse cursor to viewport.
Definition: mouse.cpp:894
int MouseScrollSpeed
Mouse Scroll Speed (screenpixels per mousepixel)
Definition: ui.h:394
bool GetLeaveStops()
Check if scrolling stops when leaving the window.
Definition: ui.cpp:813
CMinimap Minimap
User buttons.
Definition: ui.h:476
std::vector< CContentType * > Contents
Default font for content.
Definition: ui.h:223
int IconFrame
icon graphic
Definition: ui.h:347
std::vector< CUIButton > SelectedButtons
Button for single selected unit.
Definition: ui.h:416
int ScrollPaddingLeft
Screen pixel bottom y coordinate adjusted for current map size.
Definition: ui.h:176
CursorConfig ArrowSE
Cursor pointing south.
Definition: ui.h:513
Definition: contenttype.h:47
bool KeyScroll
Enable mouse scrolling.
Definition: ui.h:390
CInfoPanel InfoPanel
Icon+Text of all resources.
Definition: ui.h:409
CFont * TrainingFont
Multiple Training Text.
Definition: ui.h:429
bool MouseScroll
Definition: ui.h:389
CursorConfig ArrowE
Cursor for scrolling map around.
Definition: ui.h:506
@ VIEWPORT_SPLIT_HORIZ3
Two viewports split horizontal.
Definition: ui.h:156
CGraphic * G
Definition: ui.h:346
void Draw()
Definition: mainscr.cpp:1254
void CallHandler(unsigned int handle, int value)
Definition: script_ui.cpp:951
CButtonPanel ButtonPanel
should complete bar have shadow
Definition: ui.h:452
int EndY
Screen pixel right x coordinate adjusted for current map size.
Definition: ui.h:175
@ VIEWPORT_SPLIT_VERT
Three viewports split horiontal.
Definition: ui.h:157
#define MAX_NUM_VIEWPORTS
Definition: ui.h:146
char * Variables
array of condition about user flags.
Definition: ui.h:204
@ VIEWPORT_SPLIT_HORIZ
Old single viewport.
Definition: ui.h:155
CFont * MaxSelectedFont
Selected buttons.
Definition: ui.h:417
std::string TrainingText
Training buttons.
Definition: ui.h:428
void InitUserInterface()
Mirror buildings 1 yes, 0 now.
Definition: ui.cpp:203
std::vector< CUIButton > TransportingButtons
Button info for researching.
Definition: ui.h:437
std::string Name
Definition: ui.h:218
uint32_t IntColor
Definition: color.h:37
int IconY
icon X position
Definition: ui.h:349
CursorConfig RedHair
Green action,attack cursor.
Definition: ui.h:503
CMapArea()
Definition: ui.h:165
CursorConfig Cross
HourGlass, system is waiting.
Definition: ui.h:500
std::vector< std::string > LifeBarColorNames
Button info for transporting.
Definition: ui.h:439
CUIButton * SingleTrainingButton
if > maximum units selected
Definition: ui.h:421
int Offset640X
Definition: ui.h:492
CFont * DefaultFont
Y coordinate of the panel.
Definition: ui.h:221
CViewport * GetViewport(const PixelPos &screenPos)
Get viewport for screen pixel position.
Definition: ui.cpp:446
void CheckViewportMode()
Definition: ui.cpp:749
CursorConfig YellowHair
Multi-select cursor.
Definition: ui.h:501
int SingleTrainingTextX
Font for single traning.
Definition: ui.h:424
std::string ReverseFontColor
Color for normal text displayed.
Definition: ui.h:403
Definition: viewport.h:63
int KeyScrollSpeed
Key Scroll Speed.
Definition: ui.h:392
void SetLeaveStops(bool enabled)
Enable/disable leaving the window stops scrolling.
Definition: ui.cpp:823
std::vector< ButtonAction > CurrentButtons
Pointer to current buttons.
Definition: botpanel.cpp:80
#define NoButton
pressed mouse button flags
Definition: interface.h:158
ViewportModeType ViewportMode
Definition: ui.h:458
CViewport * MouseViewport
Current viewport mode.
Definition: ui.h:459
int X
Definition: ui.h:364
CMapArea MapArea
Parameters of all viewports.
Definition: ui.h:463
CursorConfig ArrowW
Cursor pointing north west.
Definition: ui.h:510
@ VIEWPORT_QUAD
Two viewports split vertical.
Definition: ui.h:158
int MaxSelectedTextY
position to place '+#' text
Definition: ui.h:419
CUIButton MenuButton
Scroll speed in seconds for messages.
Definition: ui.h:468
int SingleTrainingTextY
X text position single training.
Definition: ui.h:425
Vec2i EditorSettingsAreaBottomRight
Definition: ui.h:487
int Y
X coordinate.
Definition: ui.h:271
bool FancyBuildings
Up to 11 keys used for group selection.
Definition: ui.cpp:62
int X
Graphic.
Definition: ui.h:270
std::string NormalFontColor
Cursor warp screen position.
Definition: ui.h:402
std::vector< CUIUserButton > UserButtons
network diplomacy button
Definition: ui.h:473
CResourceInfo()
Definition: ui.h:343
CursorConfig Point
Offset for 640x480 Y position.
Definition: ui.h:498
int IconWidth
icon Y position
Definition: ui.h:350
char * BoolFlags
if true, show for opponent unit.
Definition: ui.h:203
A platform independent color.
Definition: color.h:43
int MessageScrollSpeed
Font used for messages.
Definition: ui.h:465
ConditionPanel()
Definition: ui.h:188
CStatusLine StatusLine
minimap cursor color
Definition: ui.h:480
int TextX
icon W size
Definition: ui.h:351
CGraphic * DefeatBackgroundG
Victory background graphic.
Definition: ui.h:522
std::vector< CPopup * > ButtonPopups
Name of the unit portrait to show when there is no selection.
Definition: ui.h:412
CColor CompletedBarColorRGB
Definition: ui.h:447
void Load()
Definition: graphic.cpp:1358
int Offset480Y
Offset for 640x480 X position.
Definition: ui.h:493
void SetMouseScroll(bool enabled)
Enable/disable scrolling with the mouse.
Definition: ui.cpp:769
CursorConfig GreenHair
Yellow action,attack cursor.
Definition: ui.h:502
int IconX
icon frame
Definition: ui.h:348
CursorConfig ArrowS
Cursor pointing south west.
Definition: ui.h:512
std::vector< int > LifeBarPercents
Definition: ui.h:440
std::string DamageMissile
Missile to show when you click.
Definition: script_ui.cpp:61
bool GetMouseScroll()
Check if mouse scrolling is enabled.
Definition: ui.cpp:759
void RestrictCursorToMinimap()
Restrict mouse cursor to minimap.
Definition: mouse.cpp:904
bool GetGrabMouse()
Check if mouse grabbing is enabled.
Definition: ui.cpp:795
std::map< std::string, ButtonStyle * > ButtonStyleHash
Missile to show damage caused.
Definition: script_ui.cpp:62
int TrainingTextX
Multiple Training Font.
Definition: ui.h:430
ConditionPanel * Condition
Array of contents to display.
Definition: ui.h:225
Vec2i EditorButtonAreaTopLeft
Definition: ui.h:488
void Load()
Definition: ui.cpp:262
CGraphic * G
Definition: ui.h:269
CPopup * PopupByIdent(const std::string &ident)
return popup by ident string
Definition: ui.cpp:190
@ VIEWPORT_SINGLE
Definition: ui.h:154
void UIHandleButtonUp(unsigned button)
Called if any mouse button is released up.
Definition: mouse.cpp:1935
TextAlignment
Definition: ui.h:78
#define MaxResourceInfo
Definition: ui.h:354
bool LifeBarBorder
Definition: ui.h:444
CUIButton * ResearchingButton
Button info for upgrade.
Definition: ui.h:435
void UIHandleMouseMove(const PixelPos &pos)
Called if the mouse is moved in Normal interface state.
Definition: mouse.cpp:932
CGraphic * VictoryBackgroundG
Cursor pointing south east.
Definition: ui.h:521
int EndX
Screen pixel upper corner y coordinate adjusted for current map size.
Definition: ui.h:174
~ConditionPanel()
Definition: ui.h:191
IntColor ViewportCursorColor
minimap
Definition: ui.h:477
CFiller()
Definition: ui.h:256
int PosY
X coordinate of the panel.
Definition: ui.h:220
CUIButton NetworkMenuButton
menu button
Definition: ui.h:469
@ TextAlignCenter
Definition: ui.h:80
CGraphic * G
Definition: ui.h:363
int ScrollPaddingBottom
Scrollable area past the top of map.
Definition: ui.h:179
bool OnGraphic(int x, int y)
Definition: ui.h:260
ButtonStyle * FindButtonStyle(const std::string &style)
Find a button style.
Definition: script_ui.cpp:771
std::string SingleTrainingText
Button for single training.
Definition: ui.h:422
~CUnitInfoPanel()
Definition: ui.cpp:120
void SetGrabMouse(bool enabled)
Enable/disable grabbing the mouse.
Definition: ui.cpp:805
int TrainingTextY
Multiple Training X Text position.
Definition: ui.h:431
void UserInterfaceCclRegister()
Register ccl features.
Definition: script_ui.cpp:1350
void SetKeyScroll(bool enabled)
Enable/disable scrolling with the keyboard.
Definition: ui.cpp:787
~CUserInterface()
Definition: ui.cpp:350
Definition: statusline.h:41
bool HideNeutral
if true, show only for selected unit.
Definition: ui.h:199
CursorConfig ArrowN
Cursor pointing north east.
Definition: ui.h:508
bool HideAllied
if true, don't show for neutral unit.
Definition: ui.h:200
std::string DefaultUnitPortrait
Info panel contents.
Definition: ui.h:411
CUserInterface UI
Current Selected Buttons.
Definition: ui.cpp:67
int8_t LifeBarPadding
Definition: ui.h:443
std::vector< IntColor > LifeBarColorsInt
Definition: ui.h:441
Cursor config reference.
Definition: cursor.h:153
CursorConfig Scroll
Red action,attack cursor.
Definition: ui.h:504
void CycleViewportMode(int)
Cycle through all available viewport modes.
Definition: ui.cpp:738
void UIHandleButtonDown(unsigned button)
Called if any mouse button is pressed down.
Definition: mouse.cpp:1856
const char DefaultGroupKeys[]
right button attacks
Definition: interface.cpp:81
CUIButton * SingleSelectedButton
Popup windows for buttons.
Definition: ui.h:414
int Y
Screen pixel left corner x coordinate adjusted for current map size.
Definition: ui.h:173
CViewport * SelectedViewport
Viewport containing mouse.
Definition: ui.h:460
bool RightButtonAttacks
Definition: ui.cpp:58
int MaxSelectedTextX
Font type to use.
Definition: ui.h:418
CUIButton NetworkDiplomacyButton
network menu button
Definition: ui.h:470
std::vector< CFiller > Fillers
Color for reverse text displayed.
Definition: ui.h:405
int TextY
text X position
Definition: ui.h:352
Vec2i EditorButtonAreaBottomRight
Definition: ui.h:489
bool GetKeyScroll()
Check if keyboard scrolling is enabled.
Definition: ui.cpp:777
bool CompletedBarShadow
color for completed bar
Definition: ui.h:449
std::string ClickMissile
The user interface.
Definition: script_ui.cpp:60
CUITimer Timer
status line
Definition: ui.h:483
CPieMenu PieMenu
Definition: ui.h:455
@ TextAlignLeft
Definition: ui.h:81
Vec2i EditorSettingsAreaTopLeft
game timer
Definition: ui.h:486
@ TextAlignRight
Definition: ui.h:82
int MouseScrollSpeedControl
Middle-Mouse Scroll Speed with Control pressed.
Definition: ui.h:398
CViewport Viewports[MAX_NUM_VIEWPORTS]
Definition: ui.h:462
CFont * MessageFont
geometry of the whole map area
Definition: ui.h:464
bool ShowOnlySelected
Definition: ui.h:197
bool ShowOpponent
if true, don't show for allied unit. (but show own units)
Definition: ui.h:201
CUIButton * UpgradingButton
Multiple Training Y Text position.
Definition: ui.h:433
int8_t LifeBarYOffset
Definition: ui.h:442
CursorConfig ArrowSW
Cursor pointing west.
Definition: ui.h:511
std::vector< CUnitInfoPanel * > InfoPanelContents
Info panel.
Definition: ui.h:410
bool Contains(const PixelPos &screenPos) const
Definition: ui.cpp:313
CResourceInfo Resources[MaxResourceInfo]
Filler graphics.
Definition: ui.h:407
CursorConfig ArrowNW
Cursor pointing north.
Definition: ui.h:509
void FreeButtonStyles()
Definition: ui.cpp:425
ViewportModeType
Definition: ui.h:153
int PosX
Ident of the panel.
Definition: ui.h:219
@ NUM_VIEWPORT_MODES
Four viewports split symmetric.
Definition: ui.h:159
void SetViewportMode(ViewportModeType mode)
Select viewport mode.
Definition: ui.cpp:690
PixelPos MouseWarpPos
Definition: ui.h:400
CUserInterface()
Definition: ui.cpp:130
void SetNewViewportMode(ViewportModeType mode)
Definition: ui.cpp:719
int Y
Definition: ui.h:365
std::string UiGroupKeys
Default group keys.
Definition: interface.cpp:82
#define PRINTF_VAARG_ATTRIBUTE(a, b)
Definition: stratagus.h:108
int ScrollPaddingTop
Scrollable area past the right of map.
Definition: ui.h:178
std::vector< CUIButton > TrainingButtons
Y text position single training.
Definition: ui.h:427
The big unit structure.
Definition: unit.h:135
CUnitInfoPanel()
Definition: ui.h:213
void SaveUserInterface(CFile &file)
Save the ui state.
Definition: ui.cpp:342
CInfoPanel()
Definition: ui.h:359
int AddHandler(lua_State *l)
Definition: script_ui.cpp:932
Font definition.
Definition: font.h:73
void bool IsDemoMode()
Check if Demo/Attract mode is in progress.
Definition: ui.cpp:115
CursorConfig ArrowNE
Cursor pointing east.
Definition: ui.h:507
int NumViewports
Current selected active viewport.
Definition: ui.h:461
IntColor CompletedBarColor
color for completed bar
Definition: ui.h:448
void ShowLoadProgress(const char *fmt,...) PRINTF_VAARG_ATTRIBUTE(1
Show load progress.
(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.