_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          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
contenttype.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-2012 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 __CONTENT_TYPE_H__
31 #define __CONTENT_TYPE_H__
32 
34 
35 #include "script.h"
36 #include "vec2i.h"
37 #include <vector>
38 
39 class CUnit;
40 class CFont;
41 class ConditionPanel;
42 
47 {
48 public:
49  CContentType() : Pos(0, 0), Condition(NULL) {}
50  virtual ~CContentType();
51 
53  virtual void Draw(const CUnit &unit, CFont *defaultfont) const = 0;
54 
55  virtual void Parse(lua_State *l) = 0;
56 
57 public:
60 };
61 
66 {
67 public:
68  CContentTypeText() : Text(NULL), Font(NULL), Centered(0), Index(-1),
69  Component(VariableValue), ShowName(0), Stat(0) {}
71  {
72  FreeStringDesc(Text);
73  delete Text;
74  }
75 
76  virtual void Draw(const CUnit &unit, CFont *defaultfont) const;
77  virtual void Parse(lua_State *l);
78 
79 private:
80  StringDesc *Text;
81  CFont *Font;
82  char Centered;
83  int Index;
84  EnumVariable Component;
85  char ShowName;
86  char Stat;
87 };
88 
93 {
94 public:
95  CContentTypeFormattedText() : Font(NULL), Centered(false),
96  Index(-1), Component(VariableValue) {}
98 
99  virtual void Draw(const CUnit &unit, CFont *defaultfont) const;
100  virtual void Parse(lua_State *l);
101 
102 private:
103  std::string Format;
104  CFont *Font;
105  bool Centered;
106  int Index;
107  EnumVariable Component;
108 };
109 
114 {
115 public:
116  CContentTypeFormattedText2() : Font(NULL), Centered(false),
117  Index1(-1), Component1(VariableValue), Index2(-1), Component2(VariableValue) {}
119 
120  virtual void Draw(const CUnit &unit, CFont *defaultfont) const;
121  virtual void Parse(lua_State *l);
122 
123 private:
124  std::string Format;
125  CFont *Font;
126  bool Centered;
127  int Index1;
128  EnumVariable Component1;
129  int Index2;
130  EnumVariable Component2;
131 };
132 
137 {
138 public:
139  virtual void Draw(const CUnit &unit, CFont *defaultfont) const;
140  virtual void Parse(lua_State *l);
141 
142 private:
143  EnumUnit UnitRef;
144 };
145 
150 {
151 public:
152  CContentTypeLifeBar() : Index(-1), Width(0), Height(0) {}
153 
154  virtual void Draw(const CUnit &unit, CFont *defaultfont) const;
155  virtual void Parse(lua_State *l);
156 
157 private:
158  int Index;
159  int Width;
160  int Height;
161 #if 0 // FIXME : something for color and value parametrisation (not implemented)
162  Color *colors;
163  int *values;
164 #endif
165 };
166 
171 {
172 public:
173  CContentTypeCompleteBar() : varIndex(-1), width(0), height(0), hasBorder(false), colorIndex(-1) {}
174 
175  virtual void Draw(const CUnit &unit, CFont *defaultfont) const;
176  virtual void Parse(lua_State *l);
177 
178 private:
179  int varIndex;
180  int width;
181  int height;
182  bool hasBorder;
183  int colorIndex;
184 };
185 
186 
188 
189 #endif // __CONTENT_TYPE_H__
Definition: contenttype.h:65
CContentType()
Definition: contenttype.h:49
virtual ~CContentType()
Definition: contenttype.cpp:59
CContentTypeText()
Definition: contenttype.h:68
Definition: contenttype.h:136
virtual void Parse(lua_State *l)
Definition: contenttype.cpp:485
virtual void Parse(lua_State *l)
Definition: contenttype.cpp:543
unsigned short UnitRef
Definition: commands.h:127
virtual void Parse(lua_State *l)
Definition: contenttype.cpp:384
virtual void Draw(const CUnit &unit, CFont *defaultfont) const
Definition: contenttype.cpp:180
virtual ~CContentTypeFormattedText()
Definition: contenttype.h:97
Definition: ui.h:185
virtual ~CContentTypeText()
Definition: contenttype.h:70
EnumUnit
Definition: script.h:169
Definition: contenttype.h:92
The big unit structure.
Definition: unit.h:119
virtual void Draw(const CUnit &unit, CFont *defaultfont) const
Definition: contenttype.cpp:141
Definition: contenttype.h:170
Definition: contenttype.h:46
CContentTypeFormattedText()
Definition: contenttype.h:95
PixelPos Pos
Definition: contenttype.h:58
virtual void Parse(lua_State *l)=0
Font definition.
Definition: font.h:73
Definition: script.h:158
virtual void Parse(lua_State *l)
Definition: contenttype.cpp:497
CContentTypeFormattedText2()
Definition: contenttype.h:116
Definition: script.h:258
virtual ~CContentTypeFormattedText2()
Definition: contenttype.h:118
virtual void Draw(const CUnit &unit, CFont *defaultfont) const
Definition: contenttype.cpp:274
CContentTypeLifeBar()
Definition: contenttype.h:152
EnumVariable
Definition: script.h:157
virtual void Draw(const CUnit &unit, CFont *defaultfont) const
Definition: contenttype.cpp:311
Definition: contenttype.h:113
virtual void Draw(const CUnit &unit, CFont *defaultfont) const
Definition: contenttype.cpp:70
Definition: png2stratagus.cpp:57
Definition: contenttype.h:149
ConditionPanel * Condition
Coordinate where to display.
Definition: contenttype.h:59
CContentTypeCompleteBar()
Definition: contenttype.h:173
virtual void Parse(lua_State *l)
Definition: contenttype.cpp:348
virtual void Draw(const CUnit &unit, CFont *defaultfont) const =0
Tell how show the variable Index.
virtual void Parse(lua_State *l)
Definition: contenttype.cpp:410
void FreeStringDesc(StringDesc *s)
Free unit description content. (no pointer itself).
Definition: script.cpp:1229
virtual void Draw(const CUnit &unit, CFont *defaultfont) const
Definition: contenttype.cpp:255
(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.