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

src/ui/mainscr.cpp File Reference

#include "stratagus.h"
#include "action/action_built.h"
#include "action/action_research.h"
#include "action/action_train.h"
#include "action/action_upgradeto.h"
#include "font.h"
#include "icons.h"
#include "interface.h"
#include "map.h"
#include "menus.h"
#include "network.h"
#include "player.h"
#include "sound.h"
#include "spells.h"
#include "tileset.h"
#include "translate.h"
#include "trigger.h"
#include "ui.h"
#include "unit.h"
#include "unitsound.h"
#include "unittype.h"
#include "upgrade.h"
#include "video.h"
#include <sstream>

Classes

struct  UStrInt
class  MessagesDisplay
 FIXME: docu. More...

mainscr.cpp - The main screen.

#define MESSAGES_MAX   10
enum  UStrIntType { USTRINT_STR, USTRINT_INT, USTRINT_STR, USTRINT_INT }
static char MessagesEvent [MESSAGES_MAX][64]
static int MessagesEventX [MESSAGES_MAX]
 Array of event messages.
static int MessagesEventY [MESSAGES_MAX]
 X coordinate of event.
static int MessagesEventCount
 Y coordinate of event.
static int MessagesEventIndex
 Number of event messages.
static MessagesDisplay allmessages
static int Costs [MaxCosts+2]
void DrawMenuButtonArea ()
 Draw menu button area.
static void UiDrawLifeBar (const CUnit &unit, int x, int y)
static void UiDrawManaBar (const CUnit &unit, int x, int y)
static bool CanShowContent (const ConditionPanel *condition, const CUnit &unit)
UStrInt GetComponent (const CUnit &unit, int index, EnumVariable e, int t)
 Get component for unit variable.
UStrInt GetComponent (const CUnitType &type, int index, EnumVariable e)
 Get component for unit type variable.
static const CUnitGetUnitRef (const CUnit &unit, EnumUnit e)
static void DrawUnitInfo_Training (const CUnit &unit)
static void DrawUnitInfo (CUnit &unit)
void DrawResources ()
 Draw the player resource in resource line.
void UpdateMessages ()
 Update messages.
void CleanMessages ()
 Cleanup all messages.
void DrawMessages ()
 Draw messages as overlay over of the map.
void SetMessage (const char *fmt,...)
void ShiftMessagesEvent ()
void SetMessageEvent (const Vec2i &pos, const char *fmt,...)
void CenterOnMessage ()
 Center view-point on last event message.
void ToggleShowMessages ()
 show/hide messages
void DrawCosts ()
 costs to display in status line
void SetCosts (int mana, int food, const int *costs)
 Set costs to be displayed in status line.
void ClearCosts ()
 Clear the costs displayed in status line (undisplay!).
static void DrawInfoPanelMultipleSelected ()
static void DrawInfoPanelSingleSelected ()
static void DrawInfoPanelNoneSelected ()
void DrawTimer ()
 Draw the timer.
void UpdateTimer ()
 Update the timer.

Define Documentation

#define MESSAGES_MAX   10


Enumeration Type Documentation

Enumerator:
USTRINT_STR 
USTRINT_INT 
USTRINT_STR 
USTRINT_INT 


Function Documentation

static bool CanShowContent ( const ConditionPanel condition,
const CUnit unit 
) [static]

Tell if we can show the content. verify each sub condition for that.

Parameters:
condition condition to verify.
unit unit that certain condition can refer.
Returns:
0 if we can't show the content, else 1.

void CenterOnMessage (  ) 

Center view-point on last event message.

Goto message origin.

void CleanMessages (  ) 

Cleanup all messages.

Clean messages

void ClearCosts (  ) 

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

Clear costs in status line.

void DrawCosts (  ) 

costs to display in status line

Draw costs in status line.

Draw costs in status line.

Todo:
FIXME : make DrawCosts more configurable.
Todo:
FIXME : 'time' resource should be shown too.

static void DrawInfoPanelMultipleSelected (  )  [static]

Draw info panel with more than one unit selected

static void DrawInfoPanelNoneSelected (  )  [static]

Draw info panel with no units selected

static void DrawInfoPanelSingleSelected (  )  [static]

Draw info panel with one unit selected

void DrawMenuButtonArea (  ) 

Draw menu button area.

Draw menu button area.

void DrawMessages (  ) 

Draw messages as overlay over of the map.

Draw messages

void DrawResources (  ) 

Draw the player resource in resource line.

Draw the player resource in top line.

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

void DrawTimer (  ) 

Draw the timer.

Draw the timer

Todo:
FIXME : make DrawTimer more configurable (Pos, format).

static void DrawUnitInfo ( CUnit unit  )  [static]

Draw the unit info into top-panel.

Parameters:
unit Pointer to unit.

static void DrawUnitInfo_Training ( const CUnit unit  )  [static]

UStrInt GetComponent ( const CUnitType type,
int  index,
EnumVariable  e 
)

Get component for unit type variable.

UStrInt GetComponent ( const CUnit unit,
int  index,
EnumVariable  e,
int  t 
)

Get component for unit variable.

Return the value corresponding.

Parameters:
unit Unit.
index Index of the variable.
e Component of the variable.
t Which var use (0:unit, 1:Type, 2:Stats)
Returns:
Value corresponding

static const CUnit* GetUnitRef ( const CUnit unit,
EnumUnit  e 
) [static]

Get unit from a unit depending of the relation.

Parameters:
unit unit reference.
e relation with unit.
Returns:
The desired unit.

void SetCosts ( int  mana,
int  food,
const int *  costs 
)

Set costs to be displayed in status line.

Set costs in status line.

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

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

Set message to display.

Parameters:
fmt To be displayed in text overlay.

void SetMessageEvent ( const Vec2i pos,
const char *  fmt,
  ... 
)

Set message to display.

Parameters:
x Message X map origin.
y Message Y map origin.
fmt To be displayed in text overlay.
Note:
FIXME: vladi: I know this can be just separated func w/o msg but it is handy to stick all in one call, someone?

void ShiftMessagesEvent (  ) 

Shift messages events array by one.

void ToggleShowMessages (  ) 

show/hide messages

static void UiDrawLifeBar ( const CUnit unit,
int  x,
int  y 
) [static]

Draw life bar of a unit at x,y. Placed under icons on top-panel.

Parameters:
unit Pointer to unit.
x Screen X postion of icon
y Screen Y postion of icon

static void UiDrawManaBar ( const CUnit unit,
int  x,
int  y 
) [static]

Draw mana bar of a unit at x,y. Placed under icons on top-panel.

Parameters:
unit Pointer to unit.
x Screen X postion of icon
y Screen Y postion of icon

void UpdateMessages (  ) 

Update messages.

Update messages

void UpdateTimer (  ) 

Update the timer.

Update the timer


Variable Documentation

int Costs[MaxCosts+2] [static]

char MessagesEvent[MESSAGES_MAX][64] [static]

int MessagesEventCount [static]

Y coordinate of event.

int MessagesEventIndex [static]

Number of event messages.

int MessagesEventX[MESSAGES_MAX] [static]

Array of event messages.

int MessagesEventY[MESSAGES_MAX] [static]

X coordinate of event.

(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.