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

Public Member Functions | Public Attributes | List of all members
CIcon Class Reference

Icon: rectangle image used in menus. More...

#include <icons.h>

Public Member Functions

const std::string & GetIdent () const
 

Public Attributes

CPlayerColorGraphicG
 
CPlayerColorGraphicGScale
 Graphic data. More...
 
int Frame
 Icon when drawn grayscaled. More...
 

icons.cpp - The icons.

 CIcon (const std::string &ident)
 Map of ident to icon. More...
 
 ~CIcon ()
 
void Load ()
 
void DrawIcon (const PixelPos &pos, const int player=-1) const
 Draw icon. More...
 
void DrawGrayscaleIcon (const PixelPos &pos, const int player=-1) const
 Draw grayscale icon. More...
 
void DrawCooldownSpellIcon (const PixelPos &pos, const int percent) const
 Draw cooldown spell. More...
 
void DrawUnitIcon (const ButtonStyle &style, unsigned flags, const PixelPos &pos, const std::string &text, const int playerIndex=-1) const
 Draw icon of a unit. More...
 
void DrawSingleSelectionIcon (const ButtonStyle &style, unsigned flags, const PixelPos &pos, const std::string &text, const CUnit &unit) const
 
void DrawGroupSelectionIcon (const ButtonStyle &style, unsigned flags, const PixelPos &pos, const std::string &text, const CUnit &unit) const
 
void DrawContainedIcon (const ButtonStyle &style, unsigned flags, const PixelPos &pos, const std::string &text, const CUnit &unit) const
 
void ClearExtraGraphics ()
 Modify the extra icon graphics. More...
 
void AddSingleSelectionGraphic (CPlayerColorGraphic *g)
 
void AddGroupSelectionGraphic (CPlayerColorGraphic *g)
 
void AddContainedGraphic (CPlayerColorGraphic *g)
 
void SetPaletteSwaps (std::vector< PaletteSwap > &newSwaps)
 
static CIconNew (const std::string &ident)
 
static CIconGet (const std::string &ident)
 

Detailed Description

Icon: rectangle image used in menus.

#include "icons.h"

This structure contains all information about an icon.

The icon structure members:

CIcon::Ident

Unique identifier of the icon, used to reference it in config files and during startup. Don't use this in game, use instead the pointer to this structure.

CIcon::G

Graphic image containing the loaded graphics. Loaded by LoadIcons(). All icons belonging to the same icon file shares this structure.

CIcon::Frame

Frame number in the graphic to display.

Constructor & Destructor Documentation

◆ CIcon()

CIcon::CIcon ( const std::string &  ident)

Map of ident to icon.

CIcon constructor

◆ ~CIcon()

CIcon::~CIcon ( )

CIcon destructor

Member Function Documentation

◆ AddContainedGraphic()

void CIcon::AddContainedGraphic ( CPlayerColorGraphic g)

◆ AddGroupSelectionGraphic()

void CIcon::AddGroupSelectionGraphic ( CPlayerColorGraphic g)

◆ AddSingleSelectionGraphic()

void CIcon::AddSingleSelectionGraphic ( CPlayerColorGraphic g)

◆ ClearExtraGraphics()

void CIcon::ClearExtraGraphics ( )

Modify the extra icon graphics.

◆ DrawContainedIcon()

void CIcon::DrawContainedIcon ( const ButtonStyle style,
unsigned  flags,
const PixelPos pos,
const std::string &  text,
const CUnit unit 
) const

◆ DrawCooldownSpellIcon()

void CIcon::DrawCooldownSpellIcon ( const PixelPos pos,
const int  percent 
) const

Draw cooldown spell.

Draw cooldown spell effect on icon at pos.

Parameters
posdisplay pixel position
percentcooldown percent

◆ DrawGrayscaleIcon()

void CIcon::DrawGrayscaleIcon ( const PixelPos pos,
const int  player = -1 
) const

Draw grayscale icon.

Draw grayscale icon at pos.

Parameters
posdisplay pixel position

◆ DrawGroupSelectionIcon()

void CIcon::DrawGroupSelectionIcon ( const ButtonStyle style,
unsigned  flags,
const PixelPos pos,
const std::string &  text,
const CUnit unit 
) const

◆ DrawIcon()

void CIcon::DrawIcon ( const PixelPos pos,
const int  player = -1 
) const

Draw icon.

Draw icon at pos.

Parameters
playerPlayer pointer used for icon colors
posdisplay pixel position

◆ DrawSingleSelectionIcon()

void CIcon::DrawSingleSelectionIcon ( const ButtonStyle style,
unsigned  flags,
const PixelPos pos,
const std::string &  text,
const CUnit unit 
) const

◆ DrawUnitIcon()

void CIcon::DrawUnitIcon ( const ButtonStyle style,
unsigned  flags,
const PixelPos pos,
const std::string &  text,
const int  playerIndex = -1 
) const

Draw icon of a unit.

Draw unit icon 'icon' with border on x,y

Parameters
styleButton style
flagsState of icon (clicked, mouse over...)
posdisplay pixel position
textOptional text to display

◆ Get()

CIcon * CIcon::Get ( const std::string &  ident)
static

Get an icon

Parameters
identIcon identifier
Returns
The icon

◆ GetIdent()

const std::string& CIcon::GetIdent ( ) const
inline

◆ Load()

void CIcon::Load ( )

◆ New()

CIcon * CIcon::New ( const std::string &  ident)
static

Create a new icon

Parameters
identIcon identifier
Returns
New icon

◆ SetPaletteSwaps()

void CIcon::SetPaletteSwaps ( std::vector< PaletteSwap > &  newSwaps)

Member Data Documentation

◆ Frame

int CIcon::Frame

Icon when drawn grayscaled.

◆ G

◆ GScale

CPlayerColorGraphic* CIcon::GScale

Graphic data.


The documentation for this class was generated from the following files:
(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.