Planeshift
pseffectobjtext2d.h
Go to the documentation of this file.
1 /*
2  * Author: Andrew Robberts
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef PS_EFFECT_OBJ_TEXT_2D_HEADER
21 #define PS_EFFECT_OBJ_TEXT_2D_HEADER
22 
23 #include <csgeom/vector2.h>
24 #include <csutil/array.h>
25 
26 #include "pseffectobj.h"
28 
29 class psEffect2DRenderer;
30 class psEffect2DElement;
33 
39 {
40  EA_NONE = 0,
41 
45 
49 
53 };
55 {
57 
58  int umin;
59  int vmin;
60  int umax;
61  int vmax;
62 
63  bool scale;
64  bool tile;
65  int offsetx;
66  int offsety;
67 };
68 
70 {
71 private:
72  csRef<iGraphics3D> g3d;
73  csRef<iGraphics2D> g2d;
74  csRef<iTextureManager> txtmgr;
75 
76  // font
77  csString fontName;
78  int fontSize;
79  csRef<iFont> font;
80 
81  int maxWidth;
82  int maxHeight;
83 
84  psEffectBackgroundAlign backgroundAlign;
85  iMaterialWrapper* backgroundMat;
86  csArray<psEffectBackgroundElem> backgroundElems;
87 
88  csArray<psEffect2DElement*> elems;
89 
90 public:
91  psEffectObjText2D(iView* parentView, psEffect2DRenderer* renderer2d);
93 
94  // draws 2d text
95  bool SetText(const csArray<psEffectTextElement> &elements);
96  bool SetText(const csArray<psEffectTextRow> &rows);
97  bool SetText(int rows, ...);
98 
99  // inheritted function overloads
100  bool Load(iDocumentNode* node, iLoaderContext* ldr_context);
101  bool Render(const csVector3 &up);
102  bool AttachToAnchor(psEffectAnchor* newAnchor);
103  bool Update(csTicks elapsed);
104  psEffectObj* Clone() const;
105 
106 protected:
107 
108  bool PostSetup();
109  void DrawTextElement(const psEffectTextElement &element);
110 };
111 
114 #endif
The manager of all 2D effect elements.
Base class for all possible 2D Effect Elements.
A 2D Image Effect Element.
psEffectBackgroundAlign align
A 2D Text Effect Element.
An effect is not much more than a collection of effect objects.
Definition: pseffectobj.h:207
psEffectBackgroundAlign
Effect anchors provide a base location / anchor point for all effect objs.