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

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
icons.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 1998-2005 by Lutz Sammer
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 __ICONS_H__
31 #define __ICONS_H__
32 
34 
35 #include "vec2i.h"
36 #include <string>
37 
38 /*----------------------------------------------------------------------------
39 -- Documentation
40 ----------------------------------------------------------------------------*/
41 
87 /*----------------------------------------------------------------------------
88 -- Defines
89 ----------------------------------------------------------------------------*/
90 
91 #define IconActive 1
92 #define IconClicked 2
93 #define IconSelected 4
94 #define IconDisabled 8
95 #define IconAutoCast 16
96 
97 /*----------------------------------------------------------------------------
98 -- Declarations
99 ----------------------------------------------------------------------------*/
100 
101 class CGraphic;
102 class CPlayerColorGraphic;
103 class CPlayer;
104 class ButtonStyle;
105 
107 class CIcon
108 {
109 public:
110  CIcon(const std::string &ident);
111  ~CIcon();
112 
113  static CIcon *New(const std::string &ident);
114  static CIcon *Get(const std::string &ident);
115 
116  void Load();
117 
119  void DrawIcon(const PixelPos &pos, const int player = -1) const;
121  void DrawGrayscaleIcon(const PixelPos &pos, const int player = -1) const;
123  void DrawCooldownSpellIcon(const PixelPos &pos, const int percent) const;
125  void DrawUnitIcon(const ButtonStyle &style,
126  unsigned flags, const PixelPos &pos, const std::string &text, const int player = -1) const;
127 
128  const std::string &GetIdent() const { return this->Ident; }
129 
130 public:
133  int Frame;
134 private:
135  std::string Ident;
136 };
137 
140 {
141 public:
142  IconConfig() : Icon(NULL) {}
143 
144  bool LoadNoLog();
145  bool Load();
146 public:
147  std::string Name;
149 };
150 
151 /*----------------------------------------------------------------------------
152 -- Functions
153 ----------------------------------------------------------------------------*/
154 
155 extern void LoadIcons();
156 extern void CleanIcons();
157 
159 
160 #endif // !__ICONS_H__
Icon reference (used in config tables)
Definition: icons.h:139
static CIcon * Get(const std::string &ident)
Definition: icons.cpp:101
bool Load()
Definition: icons.cpp:267
Definition: video.h:165
IconConfig()
Definition: icons.h:142
void CleanIcons()
Load icons.
Definition: icons.cpp:294
CPlayerColorGraphic * GScale
Graphic data.
Definition: icons.h:132
void DrawUnitIcon(const ButtonStyle &style, unsigned flags, const PixelPos &pos, const std::string &text, const int player=-1) const
Draw icon of a unit.
Definition: icons.cpp:182
bool LoadNoLog()
Definition: icons.cpp:256
Definition: video.h:64
void DrawCooldownSpellIcon(const PixelPos &pos, const int percent) const
Draw cooldown spell.
Definition: icons.cpp:160
void LoadIcons()
Definition: icons.cpp:281
CIcon * Icon
config icon name
Definition: icons.h:148
void DrawIcon(const PixelPos &pos, const int player=-1) const
Draw icon.
Definition: icons.cpp:129
std::string Name
Definition: icons.h:147
Diplomacy states for CommandDiplomacy.
Definition: player.h:79
CPlayerColorGraphic * G
Definition: icons.h:131
Definition: ui.h:104
Icon: rectangle image used in menus.
Definition: icons.h:107
CIcon(const std::string &ident)
Map of ident to icon.
Definition: icons.cpp:64
const std::string & GetIdent() const
Definition: icons.h:128
~CIcon()
Definition: icons.cpp:71
int Frame
Icon when drawn grayscaled.
Definition: icons.h:133
void Load()
Definition: icons.cpp:110
void DrawGrayscaleIcon(const PixelPos &pos, const int player=-1) const
Draw grayscale icon.
Definition: icons.cpp:143
static CIcon * New(const std::string &ident)
Definition: icons.cpp:84
(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.