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

ui.h
Go to the documentation of this file.
1 // _________ __ __
2 // / _____// |_____________ _/ |______ ____ __ __ ______
3 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
4 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
5 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
6 // \/ \/ \//_____/ \/
7 // ______________________ ______________________
8 // T H E W A R B E G I N S
9 // Stratagus - A free fantasy real time strategy game engine
10 //
12 //
13 // (c) Copyright 1999-2007 by Lutz Sammer and Jimmy Salmon
14 //
15 // This program is free software; you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation; only version 2 of the License.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 // 02111-1307, USA.
28 //
29 
30 #ifndef __UI_H__
31 #define __UI_H__
32 
34 
37 
38 /*----------------------------------------------------------------------------
39 -- Includes
40 ----------------------------------------------------------------------------*/
41 
42 #ifndef __CURSOR_H__
43 #include "cursor.h"
44 #endif
45 #ifndef __INTERFACE_H__
46 #include "interface.h"
47 #endif
48 #ifndef __SCRIPT_H__
49 #include "script.h"
50 #endif
51 #ifndef __MINIMAP_H__
52 #include "minimap.h"
53 #endif
54 
55 #include "color.h"
56 #include "viewport.h"
57 #include "ui/statusline.h"
58 #include "ui/uitimer.h"
59 #include <vector>
60 #include <string>
61 #include <map>
62 
63 /*----------------------------------------------------------------------------
64 -- Declarations
65 ----------------------------------------------------------------------------*/
66 
67 class CContentType;
68 class CUnit;
69 class CFile;
70 class CFont;
71 class LuaActionListener;
72 class CPopup;
73 
74 /*----------------------------------------------------------------------------
75 -- Definitions
76 ----------------------------------------------------------------------------*/
77 
83 };
84 
86 {
87 public:
90  TextPos(0, 0)
91  {}
92 
94  int Frame;
100  std::string TextNormalColor;
101  std::string TextReverseColor;
102 };
103 
105 {
106 public:
107  ButtonStyle() : Width(0), Height(0), Font(0),
109 
110  int Width;
111  int Height;
113  std::string TextNormalColor;
114  std::string TextReverseColor;
116  int TextX;
117  int TextY;
121 };
122 
125 {
126 public:
127  CUIButton() : X(0), Y(0), Style(NULL), Callback(NULL) {} //OLD BUTTON STYLE CODE
128  // NEW CODE BELOW, THANKS TO ANDRETTIN - MODIFIED BY DINKY
129  // CUIButton() : X(0), Y(0), Clicked(false), HotKeyPressed(false), Style(NULL), Callback(NULL) {}
131 
132  bool Contains(const PixelPos &screenPos) const;
133 
134 public:
135  int X;
136  int Y;
137  //NEW CODE START
138  //bool Clicked; /// whether the button is currently clicked or not
139  //bool HotKeyPressed; /// whether the buttons hotkey is currently pressed or not
140  // NEW CODE END
141  std::string Text;
144 };
145 
146 #define MAX_NUM_VIEWPORTS 8
147 
148 
160 };
161 
162 class CMapArea
163 {
164 public:
165  CMapArea() : X(0), Y(0), EndX(0), EndY(0),
168 
169  bool Contains(const PixelPos &screenPos) const;
170 
171 public:
172  int X;
173  int Y;
174  int EndX;
175  int EndY;
180 };
181 
186 {
187 public:
189  HideAllied(false), ShowOpponent(false), BoolFlags(NULL),
190  Variables(NULL) {}
192  {
193  delete[] BoolFlags;
194  delete[] Variables;
195  }
196 
198 
199  bool HideNeutral;
200  bool HideAllied;
202 
203  char *BoolFlags;
204  char *Variables;
205 };
206 
211 {
212 public:
214  Contents(), Condition(NULL) {}
215  ~CUnitInfoPanel();
216 
217 public:
218  std::string Name;
219  int PosX;
220  int PosY;
222 
223  std::vector<CContentType *>Contents;
224 
226 };
227 
228 
229 class CFiller
230 {
231  struct bits_map {
232  bits_map() : Width(0), Height(0), bstore(NULL) {}
233  ~bits_map();
234 
235  void Init(CGraphic *g);
236 
237  bool TransparentPixel(int x, int y)
238  {
239  if (bstore) {
240  const unsigned int x_index = x / 32;
241  y *= Width;
242  y /= 32;
243  x -= (x_index * 32);
244  return ((bstore[y + x_index] & (1 << x)) == 0);
245  }
246  return false;
247  };
248 
249  int Width;
250  int Height;
251  unsigned int *bstore;
252  };
253 
254  bits_map map;
255 public:
256  CFiller() : G(NULL), X(0), Y(0) {}
257 
258  void Load();
259 
260  bool OnGraphic(int x, int y)
261  {
262  x -= X;
263  y -= Y;
264  if (x >= 0 && y >= 0 && x < map.Width && y < map.Height) {
265  return !map.TransparentPixel(x, y);
266  }
267  return false;
268  }
270  int X;
271  int Y;
272 };
273 
275 {
276 public:
277  CButtonPanel() : G(NULL), X(0), Y(0), ShowCommandKey(true)
278  {}
279 
280  void Draw();
281  void Update();
282  void DoClicked(int button);
283  int DoKey(int key);
284 
285 private:
286  void DoClicked_SelectTarget(int button);
287 
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);
304 
305 
306 public:
308  int X;
309  int Y;
310  std::vector<CUIButton> Buttons;
313 };
314 
315 class CPieMenu
316 {
317 public:
319  {
320  memset(this->X, 0, sizeof(this->X));
321  memset(this->Y, 0, sizeof(this->Y));
322  }
323 
326  int X[9];
327  int Y[9];
328 
329  void SetRadius(int radius)
330  {
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;
336  }
337  }
338 };
339 
341 {
342 public:
343  CResourceInfo() : G(NULL), IconFrame(0), IconX(0), IconY(0), IconWidth(-1),
344  TextX(-1), TextY(-1) {}
345 
347  int IconFrame;
348  int IconX;
349  int IconY;
350  int IconWidth;
351  int TextX;
352  int TextY;
353 };
354 #define MaxResourceInfo MaxCosts + 4
355 
357 {
358 public:
359  CInfoPanel() : G(NULL), X(0), Y(0) {}
360 
361  void Draw();
362 
364  int X;
365  int Y;
366 };
367 
369 {
370 public:
371  CUIUserButton() : Clicked(false) {}
372 
373  bool Clicked; // true if button is clicked, false otherwise
374  CUIButton Button; // User button
375 };
376 
381 {
382 public:
383  CUserInterface();
384  ~CUserInterface();
385 
386  void Load();
387 
388 
389  bool MouseScroll;
390  bool KeyScroll;
391  int KeyScrollSpeed;
399 
401 
402  std::string NormalFontColor;
403  std::string ReverseFontColor;
404 
405  std::vector<CFiller> Fillers;
406 
408 
410  std::vector<CUnitInfoPanel *> InfoPanelContents;
411  std::string DefaultUnitPortrait;
412  std::vector<CPopup *> ButtonPopups;
413 
415 
416  std::vector<CUIButton> SelectedButtons;
420 
422  std::string SingleTrainingText;
426 
427  std::vector<CUIButton> TrainingButtons;
428  std::string TrainingText;
432 
434 
436 
437  std::vector<CUIButton> TransportingButtons;
438 
439  std::vector<std::string> LifeBarColorNames;
440  std::vector<int> LifeBarPercents;
441  std::vector<IntColor> LifeBarColorsInt;
445 
446  // Completed bar
450 
451  // Button panel
453 
454  // Pie Menu
456 
457  // Map area
466 
467  // Menu buttons
471 
472  // Used defined buttons
473  std::vector<CUIUserButton> UserButtons;
474 
475  // The minimap
478 
479  // The status line
481 
482  // Game timer
484 
485  // Offsets used by editor
490 
491  // Offsets for 640x480 center used by menus
494 
495  //
496  // Cursors used.
497  //
505 
514 
520 
523 };
524 
525 extern std::vector<ButtonAction> CurrentButtons;
526 
527 /*----------------------------------------------------------------------------
528 -- Variables
529 ----------------------------------------------------------------------------*/
530 
531 extern CUserInterface UI;
532 
533 extern std::string ClickMissile;
534 extern std::string DamageMissile;
535 
536 
538 extern std::map<std::string, ButtonStyle *> ButtonStyleHash;
539 
540 extern bool RightButtonAttacks;
541 
542 extern const char DefaultGroupKeys[];
543 extern std::string UiGroupKeys;
544 
545 extern bool FancyBuildings;
546 
547 // only exported to save them
548 
549 /*----------------------------------------------------------------------------
550 -- Functions
551 ----------------------------------------------------------------------------*/
552 
554 extern void InitUserInterface();
556 extern void SaveUserInterface(CFile &file);
558 extern void CleanUserInterface();
559 
560 extern void FreeButtonStyles();
561 
563 extern void UserInterfaceCclRegister();
564 
566 extern CPopup *PopupByIdent(const std::string &ident);
567 
569 extern ButtonStyle *FindButtonStyle(const std::string &style);
570 
572 extern void UIHandleMouseMove(const PixelPos &pos);
574 extern void UIHandleButtonDown(unsigned button);
576 extern void UIHandleButtonUp(unsigned button);
577 
579 extern void RestrictCursorToViewport();
581 extern void RestrictCursorToMinimap();
582 
584 extern CViewport *GetViewport(const PixelPos &screenPos);
586 extern void CycleViewportMode(int);
588 extern void SetViewportMode(ViewportModeType mode);
589 extern void SetNewViewportMode(ViewportModeType mode);
590 extern void CheckViewportMode();
591 
593 extern bool GetMouseScroll();
595 extern void SetMouseScroll(bool enabled);
597 extern bool GetKeyScroll();
599 extern void SetKeyScroll(bool enabled);
601 extern bool GetGrabMouse();
603 extern void SetGrabMouse(bool enabled);
605 extern bool GetLeaveStops();
607 extern void SetLeaveStops(bool enabled);
608 
609 extern int AddHandler(lua_State *l);
610 extern void CallHandler(unsigned int handle, int value);
611 
613 extern void ShowLoadProgress(const char *fmt, ...) PRINTF_VAARG_ATTRIBUTE(1, 2);
615 extern bool IsDemoMode();
616 
618 
619 #endif // !__UI_H__
CMapArea::X
int X
Definition: ui.h:172
CMapArea::ScrollPaddingRight
int ScrollPaddingRight
Scrollable area past the left of map.
Definition: ui.h:177
TextAlignUndefined
@ TextAlignUndefined
Definition: ui.h:79
CUserInterface::MouseScrollSpeedDefault
int MouseScrollSpeedDefault
Middle-Mouse Scroll Speed (screenpixels per mousepixel)
Definition: ui.h:396
CleanUserInterface
void CleanUserInterface()
Clean up the ui module.
Definition: ui.cpp:357
CUserInterface::SingleTrainingFont
CFont * SingleTrainingFont
Text for single training.
Definition: ui.h:423
CUserInterface::Glass
CursorConfig Glass
General pointing cursor.
Definition: ui.h:499
RestrictCursorToViewport
void RestrictCursorToViewport()
Restrict mouse cursor to viewport.
Definition: mouse.cpp:894
CUserInterface::MouseScrollSpeed
int MouseScrollSpeed
Mouse Scroll Speed (screenpixels per mousepixel)
Definition: ui.h:394
GetLeaveStops
bool GetLeaveStops()
Check if scrolling stops when leaving the window.
Definition: ui.cpp:813
CUserInterface::Minimap
CMinimap Minimap
User buttons.
Definition: ui.h:476
CUnitInfoPanel::Contents
std::vector< CContentType * > Contents
Default font for content.
Definition: ui.h:223
ButtonStyle::TextNormalColor
std::string TextNormalColor
Font.
Definition: ui.h:113
CResourceInfo::IconFrame
int IconFrame
icon graphic
Definition: ui.h:347
LuaActionListener
Definition: widgets.h:50
CPieMenu::SetRadius
void SetRadius(int radius)
Y position of the pies.
Definition: ui.h:329
CUserInterface::SelectedButtons
std::vector< CUIButton > SelectedButtons
Button for single selected unit.
Definition: ui.h:416
CMapArea::ScrollPaddingLeft
int ScrollPaddingLeft
Screen pixel bottom y coordinate adjusted for current map size.
Definition: ui.h:176
CUserInterface::ArrowSE
CursorConfig ArrowSE
Cursor pointing south.
Definition: ui.h:513
ButtonStyleProperties::Sprite
CGraphic * Sprite
Definition: ui.h:93
CContentType
Definition: contenttype.h:47
CUserInterface::KeyScroll
bool KeyScroll
Enable mouse scrolling.
Definition: ui.h:390
CUserInterface::InfoPanel
CInfoPanel InfoPanel
Icon+Text of all resources.
Definition: ui.h:409
ConditionPanel
Definition: ui.h:185
CPieMenu::X
int X[9]
Which mouse button pops up the piemenu, deactivate with NoButton.
Definition: ui.h:326
CUserInterface::TrainingFont
CFont * TrainingFont
Multiple Training Text.
Definition: ui.h:429
CUserInterface::MouseScroll
bool MouseScroll
Definition: ui.h:389
CUIUserButton
Definition: ui.h:368
CUserInterface::ArrowE
CursorConfig ArrowE
Cursor for scrolling map around.
Definition: ui.h:506
VIEWPORT_SPLIT_HORIZ3
@ VIEWPORT_SPLIT_HORIZ3
Two viewports split horizontal.
Definition: ui.h:156
CResourceInfo::G
CGraphic * G
Definition: ui.h:346
CInfoPanel::Draw
void Draw()
Definition: mainscr.cpp:1254
CUIButton::~CUIButton
~CUIButton()
Definition: ui.h:130
CallHandler
void CallHandler(unsigned int handle, int value)
Definition: script_ui.cpp:951
CUserInterface::ButtonPanel
CButtonPanel ButtonPanel
should complete bar have shadow
Definition: ui.h:452
CMapArea::EndY
int EndY
Screen pixel right x coordinate adjusted for current map size.
Definition: ui.h:175
VIEWPORT_SPLIT_VERT
@ VIEWPORT_SPLIT_VERT
Three viewports split horiontal.
Definition: ui.h:157
MAX_NUM_VIEWPORTS
#define MAX_NUM_VIEWPORTS
Definition: ui.h:146
ConditionPanel::Variables
char * Variables
array of condition about user flags.
Definition: ui.h:204
VIEWPORT_SPLIT_HORIZ
@ VIEWPORT_SPLIT_HORIZ
Old single viewport.
Definition: ui.h:155
CUserInterface::MaxSelectedFont
CFont * MaxSelectedFont
Selected buttons.
Definition: ui.h:417
CUserInterface::TrainingText
std::string TrainingText
Training buttons.
Definition: ui.h:428
InitUserInterface
void InitUserInterface()
Mirror buildings 1 yes, 0 now.
Definition: ui.cpp:203
CUserInterface::TransportingButtons
std::vector< CUIButton > TransportingButtons
Button info for researching.
Definition: ui.h:437
CUIUserButton::CUIUserButton
CUIUserButton()
Definition: ui.h:371
CUnitInfoPanel::Name
std::string Name
Definition: ui.h:218
CUITimer
Definition: uitimer.h:37
IntColor
uint32_t IntColor
Definition: color.h:37
CResourceInfo::IconY
int IconY
icon X position
Definition: ui.h:349
CButtonPanel::ShowCommandKey
bool ShowCommandKey
Definition: ui.h:312
CUserInterface::RedHair
CursorConfig RedHair
Green action,attack cursor.
Definition: ui.h:503
CMapArea::CMapArea
CMapArea()
Definition: ui.h:165
CUserInterface::Cross
CursorConfig Cross
HourGlass, system is waiting.
Definition: ui.h:500
ButtonStyleProperties::TextPos
PixelPos TextPos
Text alignment.
Definition: ui.h:99
ButtonStyle::Hover
ButtonStyleProperties Hover
Default button properties.
Definition: ui.h:119
CUserInterface::LifeBarColorNames
std::vector< std::string > LifeBarColorNames
Button info for transporting.
Definition: ui.h:439
CUserInterface::SingleTrainingButton
CUIButton * SingleTrainingButton
if > maximum units selected
Definition: ui.h:421
CUserInterface::Offset640X
int Offset640X
Definition: ui.h:492
CUnitInfoPanel::DefaultFont
CFont * DefaultFont
Y coordinate of the panel.
Definition: ui.h:221
CUIButton::Contains
bool Contains(const PixelPos &screenPos) const
Definition: mouse.cpp:655
GetViewport
CViewport * GetViewport(const PixelPos &screenPos)
Get viewport for screen pixel position.
Definition: ui.cpp:446
CheckViewportMode
void CheckViewportMode()
Definition: ui.cpp:749
CUserInterface::YellowHair
CursorConfig YellowHair
Multi-select cursor.
Definition: ui.h:501
CUserInterface::SingleTrainingTextX
int SingleTrainingTextX
Font for single traning.
Definition: ui.h:424
ButtonStyleProperties::BorderColorRGB
CColor BorderColorRGB
Definition: ui.h:95
CUserInterface::ReverseFontColor
std::string ReverseFontColor
Color for normal text displayed.
Definition: ui.h:403
CUIUserButton::Clicked
bool Clicked
Definition: ui.h:373
CViewport
Definition: viewport.h:63
CUserInterface::KeyScrollSpeed
int KeyScrollSpeed
Key Scroll Speed.
Definition: ui.h:392
SetLeaveStops
void SetLeaveStops(bool enabled)
Enable/disable leaving the window stops scrolling.
Definition: ui.cpp:823
CUIButton::Style
ButtonStyle * Style
button text
Definition: ui.h:142
CurrentButtons
std::vector< ButtonAction > CurrentButtons
Pointer to current buttons.
Definition: botpanel.cpp:80
NoButton
#define NoButton
pressed mouse button flags
Definition: interface.h:158
CUserInterface::ViewportMode
ViewportModeType ViewportMode
Definition: ui.h:458
CUserInterface::MouseViewport
CViewport * MouseViewport
Current viewport mode.
Definition: ui.h:459
CUIUserButton::Button
CUIButton Button
Definition: ui.h:374
ButtonStyleProperties::TextAlign
TextAlignment TextAlign
Definition: ui.h:98
CInfoPanel::X
int X
Definition: ui.h:364
ButtonStyle::TextReverseColor
std::string TextReverseColor
Normal text color.
Definition: ui.h:114
CUserInterface::MapArea
CMapArea MapArea
Parameters of all viewports.
Definition: ui.h:463
CUserInterface::ArrowW
CursorConfig ArrowW
Cursor pointing north west.
Definition: ui.h:510
CUIButton::Y
int Y
x coordinate on the screen
Definition: ui.h:136
VIEWPORT_QUAD
@ VIEWPORT_QUAD
Two viewports split vertical.
Definition: ui.h:158
CUserInterface::MaxSelectedTextY
int MaxSelectedTextY
position to place '+#' text
Definition: ui.h:419
CUserInterface::MenuButton
CUIButton MenuButton
Scroll speed in seconds for messages.
Definition: ui.h:468
CResourceInfo
Definition: ui.h:340
CUserInterface::SingleTrainingTextY
int SingleTrainingTextY
X text position single training.
Definition: ui.h:425
CPieMenu::G
CGraphic * G
Definition: ui.h:324
Vec2T< int >
CButtonPanel::X
int X
Definition: ui.h:308
CUserInterface::EditorSettingsAreaBottomRight
Vec2i EditorSettingsAreaBottomRight
Definition: ui.h:487
ButtonStyle::Default
ButtonStyleProperties Default
Text Y location.
Definition: ui.h:118
CUnitInfoPanel
Definition: ui.h:210
CButtonPanel
Definition: ui.h:274
CFiller::Y
int Y
X coordinate.
Definition: ui.h:271
FancyBuildings
bool FancyBuildings
Up to 11 keys used for group selection.
Definition: ui.cpp:62
CFiller::X
int X
Graphic.
Definition: ui.h:270
minimap.h
CUserInterface::NormalFontColor
std::string NormalFontColor
Cursor warp screen position.
Definition: ui.h:402
CUserInterface::UserButtons
std::vector< CUIUserButton > UserButtons
network diplomacy button
Definition: ui.h:473
CButtonPanel::DoKey
int DoKey(int key)
Definition: botpanel.cpp:1459
CResourceInfo::CResourceInfo
CResourceInfo()
Definition: ui.h:343
CUserInterface::Point
CursorConfig Point
Offset for 640x480 Y position.
Definition: ui.h:498
ButtonStyle::TextY
int TextY
Text X location.
Definition: ui.h:117
CResourceInfo::IconWidth
int IconWidth
icon Y position
Definition: ui.h:350
ConditionPanel::BoolFlags
char * BoolFlags
if true, show for opponent unit.
Definition: ui.h:203
uitimer.h
CColor
A platform independent color.
Definition: color.h:43
statusline.h
CUserInterface::MessageScrollSpeed
int MessageScrollSpeed
Font used for messages.
Definition: ui.h:465
ConditionPanel::ConditionPanel
ConditionPanel()
Definition: ui.h:188
ButtonStyle::Width
int Width
Definition: ui.h:110
CUserInterface::StatusLine
CStatusLine StatusLine
minimap cursor color
Definition: ui.h:480
CResourceInfo::TextX
int TextX
icon W size
Definition: ui.h:351
CUserInterface::DefeatBackgroundG
CGraphic * DefeatBackgroundG
Victory background graphic.
Definition: ui.h:522
ButtonStyleProperties::TextNormalColor
std::string TextNormalColor
Text location.
Definition: ui.h:100
CUserInterface::ButtonPopups
std::vector< CPopup * > ButtonPopups
Name of the unit portrait to show when there is no selection.
Definition: ui.h:412
CUserInterface::CompletedBarColorRGB
CColor CompletedBarColorRGB
Definition: ui.h:447
CFiller::Load
void Load()
Definition: graphic.cpp:1358
CPieMenu::Y
int Y[9]
X position of the pies.
Definition: ui.h:327
CUserInterface::Offset480Y
int Offset480Y
Offset for 640x480 X position.
Definition: ui.h:493
SetMouseScroll
void SetMouseScroll(bool enabled)
Enable/disable scrolling with the mouse.
Definition: ui.cpp:769
CUserInterface::GreenHair
CursorConfig GreenHair
Yellow action,attack cursor.
Definition: ui.h:502
CResourceInfo::IconX
int IconX
icon frame
Definition: ui.h:348
ButtonStyle
Definition: ui.h:104
CUserInterface::ArrowS
CursorConfig ArrowS
Cursor pointing south west.
Definition: ui.h:512
CUserInterface::LifeBarPercents
std::vector< int > LifeBarPercents
Definition: ui.h:440
DamageMissile
std::string DamageMissile
Missile to show when you click.
Definition: script_ui.cpp:61
ButtonStyleProperties::BorderColor
IntColor BorderColor
Definition: ui.h:96
GetMouseScroll
bool GetMouseScroll()
Check if mouse scrolling is enabled.
Definition: ui.cpp:759
ButtonStyleProperties::TextReverseColor
std::string TextReverseColor
Normal text color.
Definition: ui.h:101
RestrictCursorToMinimap
void RestrictCursorToMinimap()
Restrict mouse cursor to minimap.
Definition: mouse.cpp:904
interface.h
GetGrabMouse
bool GetGrabMouse()
Check if mouse grabbing is enabled.
Definition: ui.cpp:795
ButtonStyleHash
std::map< std::string, ButtonStyle * > ButtonStyleHash
Missile to show damage caused.
Definition: script_ui.cpp:62
CUserInterface::TrainingTextX
int TrainingTextX
Multiple Training Font.
Definition: ui.h:430
CFiller
Definition: ui.h:229
CUnitInfoPanel::Condition
ConditionPanel * Condition
Array of contents to display.
Definition: ui.h:225
CUserInterface::EditorButtonAreaTopLeft
Vec2i EditorButtonAreaTopLeft
Definition: ui.h:488
ButtonStyleProperties::BorderSize
int BorderSize
Definition: ui.h:97
CUserInterface::Load
void Load()
Definition: ui.cpp:262
CFiller::G
CGraphic * G
Definition: ui.h:269
PopupByIdent
CPopup * PopupByIdent(const std::string &ident)
return popup by ident string
Definition: ui.cpp:190
VIEWPORT_SINGLE
@ VIEWPORT_SINGLE
Definition: ui.h:154
UIHandleButtonUp
void UIHandleButtonUp(unsigned button)
Called if any mouse button is released up.
Definition: mouse.cpp:1935
TextAlignment
TextAlignment
Definition: ui.h:78
MaxResourceInfo
#define MaxResourceInfo
Definition: ui.h:354
CButtonPanel::DoClicked
void DoClicked(int button)
Definition: botpanel.cpp:1403
CUserInterface::LifeBarBorder
bool LifeBarBorder
Definition: ui.h:444
CUserInterface::ResearchingButton
CUIButton * ResearchingButton
Button info for upgrade.
Definition: ui.h:435
UIHandleMouseMove
void UIHandleMouseMove(const PixelPos &pos)
Called if the mouse is moved in Normal interface state.
Definition: mouse.cpp:932
CButtonPanel::G
CGraphic * G
Definition: ui.h:307
CUserInterface::VictoryBackgroundG
CGraphic * VictoryBackgroundG
Cursor pointing south east.
Definition: ui.h:521
ButtonStyle::Height
int Height
Button width.
Definition: ui.h:111
CMapArea::EndX
int EndX
Screen pixel upper corner y coordinate adjusted for current map size.
Definition: ui.h:174
ConditionPanel::~ConditionPanel
~ConditionPanel()
Definition: ui.h:191
ButtonStyle::TextX
int TextX
Text alignment.
Definition: ui.h:116
CUserInterface::ViewportCursorColor
IntColor ViewportCursorColor
minimap
Definition: ui.h:477
CFiller::CFiller
CFiller()
Definition: ui.h:256
CUnitInfoPanel::PosY
int PosY
X coordinate of the panel.
Definition: ui.h:220
CUserInterface::NetworkMenuButton
CUIButton NetworkMenuButton
menu button
Definition: ui.h:469
TextAlignCenter
@ TextAlignCenter
Definition: ui.h:80
CInfoPanel::G
CGraphic * G
Definition: ui.h:363
CMapArea::ScrollPaddingBottom
int ScrollPaddingBottom
Scrollable area past the top of map.
Definition: ui.h:179
CFiller::OnGraphic
bool OnGraphic(int x, int y)
Definition: ui.h:260
FindButtonStyle
ButtonStyle * FindButtonStyle(const std::string &style)
Find a button style.
Definition: script_ui.cpp:771
CUserInterface::SingleTrainingText
std::string SingleTrainingText
Button for single training.
Definition: ui.h:422
ButtonStyle::TextAlign
TextAlignment TextAlign
Reverse text color.
Definition: ui.h:115
CUnitInfoPanel::~CUnitInfoPanel
~CUnitInfoPanel()
Definition: ui.cpp:120
SetGrabMouse
void SetGrabMouse(bool enabled)
Enable/disable grabbing the mouse.
Definition: ui.cpp:805
CUserInterface::TrainingTextY
int TrainingTextY
Multiple Training X Text position.
Definition: ui.h:431
UserInterfaceCclRegister
void UserInterfaceCclRegister()
Register ccl features.
Definition: script_ui.cpp:1350
SetKeyScroll
void SetKeyScroll(bool enabled)
Enable/disable scrolling with the keyboard.
Definition: ui.cpp:787
CPieMenu::MouseButton
int MouseButton
Optional background image.
Definition: ui.h:325
CUserInterface::~CUserInterface
~CUserInterface()
Definition: ui.cpp:350
CStatusLine
Definition: statusline.h:41
ConditionPanel::HideNeutral
bool HideNeutral
if true, show only for selected unit.
Definition: ui.h:199
viewport.h
CUserInterface::ArrowN
CursorConfig ArrowN
Cursor pointing north east.
Definition: ui.h:508
ConditionPanel::HideAllied
bool HideAllied
if true, don't show for neutral unit.
Definition: ui.h:200
CUserInterface::DefaultUnitPortrait
std::string DefaultUnitPortrait
Info panel contents.
Definition: ui.h:411
cursor.h
UI
CUserInterface UI
Current Selected Buttons.
Definition: ui.cpp:67
CUserInterface::LifeBarPadding
int8_t LifeBarPadding
Definition: ui.h:443
CButtonPanel::Update
void Update()
Definition: botpanel.cpp:1076
CMinimap
Definition: minimap.h:46
CUserInterface::LifeBarColorsInt
std::vector< IntColor > LifeBarColorsInt
Definition: ui.h:441
CursorConfig
Cursor config reference.
Definition: cursor.h:153
CUserInterface::Scroll
CursorConfig Scroll
Red action,attack cursor.
Definition: ui.h:504
CycleViewportMode
void CycleViewportMode(int)
Cycle through all available viewport modes.
Definition: ui.cpp:738
CMapArea
Definition: ui.h:162
ButtonStyle::Clicked
ButtonStyleProperties Clicked
Hover button properties.
Definition: ui.h:120
UIHandleButtonDown
void UIHandleButtonDown(unsigned button)
Called if any mouse button is pressed down.
Definition: mouse.cpp:1856
DefaultGroupKeys
const char DefaultGroupKeys[]
right button attacks
Definition: interface.cpp:81
CUserInterface::SingleSelectedButton
CUIButton * SingleSelectedButton
Popup windows for buttons.
Definition: ui.h:414
CMapArea::Y
int Y
Screen pixel left corner x coordinate adjusted for current map size.
Definition: ui.h:173
CButtonPanel::Y
int Y
Definition: ui.h:309
CUserInterface
Definition: ui.h:380
CUIButton::CUIButton
CUIButton()
Definition: ui.h:127
CButtonPanel::Buttons
std::vector< CUIButton > Buttons
Definition: ui.h:310
CUserInterface::SelectedViewport
CViewport * SelectedViewport
Viewport containing mouse.
Definition: ui.h:460
RightButtonAttacks
bool RightButtonAttacks
Definition: ui.cpp:58
CUserInterface::MaxSelectedTextX
int MaxSelectedTextX
Font type to use.
Definition: ui.h:418
CUIButton::Text
std::string Text
y coordinate on the screen
Definition: ui.h:141
CUserInterface::NetworkDiplomacyButton
CUIButton NetworkDiplomacyButton
network menu button
Definition: ui.h:470
CPieMenu
Definition: ui.h:315
CUserInterface::Fillers
std::vector< CFiller > Fillers
Color for reverse text displayed.
Definition: ui.h:405
CResourceInfo::TextY
int TextY
text X position
Definition: ui.h:352
CUserInterface::EditorButtonAreaBottomRight
Vec2i EditorButtonAreaBottomRight
Definition: ui.h:489
GetKeyScroll
bool GetKeyScroll()
Check if keyboard scrolling is enabled.
Definition: ui.cpp:777
CUserInterface::CompletedBarShadow
bool CompletedBarShadow
color for completed bar
Definition: ui.h:449
script.h
ClickMissile
std::string ClickMissile
The user interface.
Definition: script_ui.cpp:60
ButtonStyleProperties::Frame
int Frame
Definition: ui.h:94
CUserInterface::Timer
CUITimer Timer
status line
Definition: ui.h:483
CUserInterface::PieMenu
CPieMenu PieMenu
Definition: ui.h:455
TextAlignLeft
@ TextAlignLeft
Definition: ui.h:81
CUIButton::X
int X
Definition: ui.h:135
CUserInterface::EditorSettingsAreaTopLeft
Vec2i EditorSettingsAreaTopLeft
game timer
Definition: ui.h:486
TextAlignRight
@ TextAlignRight
Definition: ui.h:82
ButtonStyle::ButtonStyle
ButtonStyle()
Definition: ui.h:107
CUserInterface::MouseScrollSpeedControl
int MouseScrollSpeedControl
Middle-Mouse Scroll Speed with Control pressed.
Definition: ui.h:398
CUserInterface::Viewports
CViewport Viewports[MAX_NUM_VIEWPORTS]
Definition: ui.h:462
CUserInterface::MessageFont
CFont * MessageFont
geometry of the whole map area
Definition: ui.h:464
ConditionPanel::ShowOnlySelected
bool ShowOnlySelected
Definition: ui.h:197
ConditionPanel::ShowOpponent
bool ShowOpponent
if true, don't show for allied unit. (but show own units)
Definition: ui.h:201
CUserInterface::UpgradingButton
CUIButton * UpgradingButton
Multiple Training Y Text position.
Definition: ui.h:433
CUserInterface::LifeBarYOffset
int8_t LifeBarYOffset
Definition: ui.h:442
CUserInterface::ArrowSW
CursorConfig ArrowSW
Cursor pointing west.
Definition: ui.h:511
CUserInterface::InfoPanelContents
std::vector< CUnitInfoPanel * > InfoPanelContents
Info panel.
Definition: ui.h:410
color.h
CMapArea::Contains
bool Contains(const PixelPos &screenPos) const
Definition: ui.cpp:313
CUserInterface::Resources
CResourceInfo Resources[MaxResourceInfo]
Filler graphics.
Definition: ui.h:407
CUserInterface::ArrowNW
CursorConfig ArrowNW
Cursor pointing north.
Definition: ui.h:509
FreeButtonStyles
void FreeButtonStyles()
Definition: ui.cpp:425
ViewportModeType
ViewportModeType
Definition: ui.h:153
ButtonStyle::Font
CFont * Font
Button height.
Definition: ui.h:112
CPopup
Definition: popup.h:211
CUnitInfoPanel::PosX
int PosX
Ident of the panel.
Definition: ui.h:219
ButtonStyleProperties::ButtonStyleProperties
ButtonStyleProperties()
Definition: ui.h:88
NUM_VIEWPORT_MODES
@ NUM_VIEWPORT_MODES
Four viewports split symmetric.
Definition: ui.h:159
CButtonPanel::AutoCastBorderColorRGB
CColor AutoCastBorderColorRGB
Definition: ui.h:311
SetViewportMode
void SetViewportMode(ViewportModeType mode)
Select viewport mode.
Definition: ui.cpp:690
CButtonPanel::CButtonPanel
CButtonPanel()
Definition: ui.h:277
CUserInterface::MouseWarpPos
PixelPos MouseWarpPos
Definition: ui.h:400
CUserInterface::CUserInterface
CUserInterface()
Definition: ui.cpp:130
SetNewViewportMode
void SetNewViewportMode(ViewportModeType mode)
Definition: ui.cpp:719
CInfoPanel::Y
int Y
Definition: ui.h:365
CUIButton
buttons on screen themselves
Definition: ui.h:124
UiGroupKeys
std::string UiGroupKeys
Default group keys.
Definition: interface.cpp:82
CButtonPanel::Draw
void Draw()
Definition: botpanel.cpp:735
PRINTF_VAARG_ATTRIBUTE
#define PRINTF_VAARG_ATTRIBUTE(a, b)
Definition: stratagus.h:108
CMapArea::ScrollPaddingTop
int ScrollPaddingTop
Scrollable area past the right of map.
Definition: ui.h:178
CUserInterface::TrainingButtons
std::vector< CUIButton > TrainingButtons
Y text position single training.
Definition: ui.h:427
CFile
Definition: iolib.h:102
CUnit
The big unit structure.
Definition: unit.h:135
CUnitInfoPanel::CUnitInfoPanel
CUnitInfoPanel()
Definition: ui.h:213
SaveUserInterface
void SaveUserInterface(CFile &file)
Save the ui state.
Definition: ui.cpp:342
CUIButton::Callback
LuaActionListener * Callback
button style
Definition: ui.h:143
CInfoPanel::CInfoPanel
CInfoPanel()
Definition: ui.h:359
AddHandler
int AddHandler(lua_State *l)
Definition: script_ui.cpp:932
CFont
Font definition.
Definition: font.h:73
CPieMenu::CPieMenu
CPieMenu()
Definition: ui.h:318
ButtonStyleProperties
Definition: ui.h:85
IsDemoMode
void bool IsDemoMode()
Check if Demo/Attract mode is in progress.
Definition: ui.cpp:115
CUserInterface::ArrowNE
CursorConfig ArrowNE
Cursor pointing east.
Definition: ui.h:507
CInfoPanel
Definition: ui.h:356
CGraphic
Definition: video.h:91
CUserInterface::NumViewports
int NumViewports
Current selected active viewport.
Definition: ui.h:461
CUserInterface::CompletedBarColor
IntColor CompletedBarColor
color for completed bar
Definition: ui.h:448
ShowLoadProgress
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.