_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"
#include "ui.h"
#include "font.h"
#include "interface.h"
#include "iolib.h"
#include "map.h"
#include "menus.h"
#include "title.h"
#include "ui/contenttype.h"
#include "ui/popup.h"
#include "unit.h"
#include "video.h"
#include <stdarg.h>
ui.cpp - The user interface globals. | |
bool | RightButtonAttacks |
static ViewportModeType | NewViewportMode = VIEWPORT_SINGLE |
right button attacks More... | |
bool | FancyBuildings |
Up to 11 keys used for group selection. More... | |
CUserInterface | UI |
Mirror buildings 1 yes, 0 now. More... | |
void | ShowLoadProgress (const char *fmt,...) |
bool | IsDemoMode () |
Check if Demo/Attract mode is in progress. More... | |
CPopup * | PopupByIdent (const std::string &ident) |
return popup by ident string More... | |
void | InitUserInterface () |
Mirror buildings 1 yes, 0 now. More... | |
static void | SaveViewports (CFile &file, const CUserInterface &ui) |
void | SaveUserInterface (CFile &file) |
Save the ui state. More... | |
void | CleanUserInterface () |
Clean up the ui module. More... | |
void | FreeButtonStyles () |
CViewport * | GetViewport (const PixelPos &screenPos) |
Get viewport for screen pixel position. More... | |
static void | FinishViewportModeConfiguration (CViewport new_vps[], int num_vps) |
static void | ClipViewport (CViewport &vp, int ClipX, int ClipY) |
static void | SetViewportModeSingle () |
static void | SetViewportModeSplitHoriz () |
static void | SetViewportModeSplitHoriz3 () |
static void | SetViewportModeSplitVert () |
static void | SetViewportModeQuad () |
void | SetViewportMode (ViewportModeType new_mode) |
Select viewport mode. More... | |
void | SetNewViewportMode (ViewportModeType new_mode) |
void | CycleViewportMode (int step) |
Cycle through all available viewport modes. More... | |
void | CheckViewportMode () |
bool | GetMouseScroll () |
Check if mouse scrolling is enabled. More... | |
void | SetMouseScroll (bool enabled) |
Enable/disable scrolling with the mouse. More... | |
bool | GetKeyScroll () |
Check if keyboard scrolling is enabled. More... | |
void | SetKeyScroll (bool enabled) |
Enable/disable scrolling with the keyboard. More... | |
bool | GetGrabMouse () |
Check if mouse grabbing is enabled. More... | |
void | SetGrabMouse (bool enabled) |
Enable/disable grabbing the mouse. More... | |
bool | GetLeaveStops () |
Check if scrolling stops when leaving the window. More... | |
void | SetLeaveStops (bool enabled) |
Enable/disable leaving the window stops scrolling. More... | |
void CheckViewportMode | ( | ) |
void CleanUserInterface | ( | ) |
Clean up the ui module.
Clean up the user interface module.
Takes a viewport which is supposed to have its CViewport::[XY] correctly filled-in and computes CViewport::End[XY] attributes according to clipping information passed in other two arguments.
vp | The viewport. |
ClipX | Maximum x-coordinate of the viewport's right side as dictated by current UI's geometry and ViewportMode. |
ClipY | Maximum y-coordinate of the viewport's bottom side as dictated by current UI's geometry and ViewportMode. |
void CycleViewportMode | ( | int | step | ) |
Cycle through all available viewport modes.
Cycles through predefined viewport modes (geometry configurations) in order defined by the ViewportMode enumerated type.
step | The size of step used for cycling. Values that make sense are mostly 1 (next viewport mode) and -1 (previous viewport mode). |
Takes an array of new Viewports which are supposed to have their pixel geometry (CViewport::[XY] and CViewport::End[XY]) already computed. Using this information as well as old viewport's parameters fills in new viewports' CViewport::Map* parameters. Then it replaces the old viewports with the new ones and finishes the set-up of the new mode.
new_vps | The array of the new viewports |
num_vps | The number of elements in the new_vps[] array. |
void FreeButtonStyles | ( | ) |
bool GetGrabMouse | ( | ) |
Check if mouse grabbing is enabled.
Check if mouse grabbing is enabled
bool GetKeyScroll | ( | ) |
Check if keyboard scrolling is enabled.
Check if keyboard scrolling is enabled
bool GetLeaveStops | ( | ) |
Check if scrolling stops when leaving the window.
Check if scrolling stops when leaving the window
bool GetMouseScroll | ( | ) |
Check if mouse scrolling is enabled.
Check if mouse scrolling is enabled
Get viewport for screen pixel position.
Takes coordinates of a pixel in stratagus's window and computes the map viewport which contains this pixel.
screenPos | pixel coordinate with origin at UL corner of screen |
void InitUserInterface | ( | ) |
Mirror buildings 1 yes, 0 now.
Initialize the user interface.
Align UI map area if at least one of the map dimensions fits completely into it.
bool IsDemoMode | ( | ) |
Check if Demo/Attract mode is in progress.
Check if the game is running in Demo mode.
CPopup* PopupByIdent | ( | const std::string & | ident | ) |
return popup by ident string
Get popup class pointer by string identifier.
ident | Popup identifier. |
Save the ui state.
Save the user interface module.
file | Save file handle |
|
static |
Save the viewports.
file | Save file handle |
ui | User interface to save |
void SetGrabMouse | ( | bool | enabled | ) |
Enable/disable grabbing the mouse.
Enable/disable grabbing the mouse
enabled | True to enable mouse grabbing, false to disable |
void SetKeyScroll | ( | bool | enabled | ) |
Enable/disable scrolling with the keyboard.
Enable/disable scrolling with the keyboard
enabled | True to enable keyboard scrolling, false to disable |
void SetLeaveStops | ( | bool | enabled | ) |
Enable/disable leaving the window stops scrolling.
Enable/disable leaving the window stops scrolling
enabled | True to stop scrolling, false to disable |
void SetMouseScroll | ( | bool | enabled | ) |
Enable/disable scrolling with the mouse.
Enable/disable scrolling with the mouse
enabled | True to enable mouse scrolling, false to disable |
void SetNewViewportMode | ( | ViewportModeType | new_mode | ) |
Sets up a new viewport mode.
new_mode | New mode's number. |
void SetViewportMode | ( | ViewportModeType | new_mode | ) |
Select viewport mode.
Sets up (calls geometry setup routines for) a new viewport mode.
new_mode | New mode's number. |
|
static |
Compute viewport parameters for 4-way split viewport mode. This mode splits the UI::MapArea vertically and horizontally to 4 (approximately) equal parts.
The parameters include viewport's width and height expressed in pixels, its position with respect to Stratagus's window origin, and the corresponding map parameters expressed in map tiles with origin at map origin (map tile (0,0)).
|
static |
Compute viewport parameters for single viewport mode.
The parameters include viewport's width and height expressed in pixels, its position with respect to Stratagus's window origin, and the corresponding map parameters expressed in map tiles with origin at map origin (map tile (0,0)).
|
static |
Compute viewport parameters for horizontally split viewport mode. This mode splits the UI::MapArea with a horizontal line to 2 (approximately) equal parts.
The parameters include viewport's width and height expressed in pixels, its position with respect to Stratagus's window origin, and the corresponding map parameters expressed in map tiles with origin at map origin (map tile (0,0)).
|
static |
Compute viewport parameters for horizontal 3-way split viewport mode. This mode splits the UI::MapArea with a horizontal line to 2 (approximately) equal parts, then splits the bottom part vertically to another 2 parts.
The parameters include viewport's width and height expressed in pixels, its position with respect to Stratagus's window origin, and the corresponding map parameters expressed in map tiles with origin at map origin (map tile (0,0)).
|
static |
Compute viewport parameters for vertically split viewport mode. This mode splits the UI::MapArea with a vertical line to 2 (approximately) equal parts.
The parameters include viewport's width and height expressed in pixels, its position with respect to Stratagus's window origin, and the corresponding map parameters expressed in map tiles with origin at map origin (map tile (0,0)).
void ShowLoadProgress | ( | const char * | fmt, |
... | |||
) |
Show load progress.
fmt | printf format string. |
bool FancyBuildings |
Up to 11 keys used for group selection.
|
static |
right button attacks
bool RightButtonAttacks |
Mirror buildings 1 yes, 0 now.
Current Selected Buttons.
The user interface configuration