Planeshift
pseffectobjlabel.h
Go to the documentation of this file.
1 /*
2  * Author: Roland Schulz
3  *
4  * Copyright (C) 2007 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_LABEL_HEADER
21 #define PS_EFFECT_OBJ_LABEL_HEADER
22 
23 #include "pseffectobj.h"
24 #include <imesh/genmesh.h>
25 #include <csutil/cscolor.h>
26 #include "pseffectobjtextable.h"
27 
28 struct iGraphics3D;
29 struct iGraphics2D;
30 struct iTextureManager;
31 struct iTextureWrapper;
32 struct iFont;
33 struct iParticle;
34 class psEffect2DRenderer;
35 
41 {
42 private:
43  // needed managers
44  csRef<iTextureManager> txtmgr;
45  csRef<iGeneralFactoryState> facState;
46  csRef<iGeneralMeshState> genState;
47 
48  // font
49  csString sizeFileName;
50  float labelwidth;
51  csArray<uint16> xpos;
52  csArray<uint16> ypos;
53  csArray<uint16> width;
54  csArray<uint16> height;
55 
56 public:
57  psEffectObjLabel(iView* parentView, psEffect2DRenderer* renderer2d);
58  virtual ~psEffectObjLabel();
59 
62  virtual bool SetText(const csArray<psEffectTextElement> &elements);
63  virtual bool SetText(const csArray<psEffectTextRow> &rows);
64  virtual bool SetText(int rows, ...);
65 
66  bool Load(iDocumentNode* node, iLoaderContext* ldr_context);
67  void LoadGlyphs(csString name);
68  psEffectObj* Clone() const;
69  // inherited function overloads
70  virtual bool Render(const csVector3 &up);
71  virtual bool Update(csTicks elapsed);
72  virtual void CloneBase(psEffectObj* newObj) const;
73 
74 protected:
78  bool PostSetup();
79 
80  void DrawTextElement(const psEffectTextElement &element);
81 
84  virtual bool CreateMeshFact();
85 
86 };
87 
90 #endif
void LoadGlyphs(csString name)
csString name
Definition: pseffectobj.h:502
virtual void CloneBase(psEffectObj *newObj) const
Convenience function to clone the base member variables.
The manager of all 2D effect elements.
virtual bool Render(const csVector3 &up)
Renders the effect.
psEffectObj * Clone() const
Clones the effect object.
bool PostSetup()
performs the post setup (after the effect obj has been loaded).
virtual bool SetText(const csArray< psEffectTextElement > &elements)
Creates a material that will fit an array of text elements and draws those elements.
An effect is not much more than a collection of effect objects.
Definition: pseffectobj.h:207
void DrawTextElement(const psEffectTextElement &element)
virtual ~psEffectObjLabel()
bool Load(iDocumentNode *node, iLoaderContext *ldr_context)
Loads the effect object from an xml node.
virtual bool Update(csTicks elapsed)
Updates the spell effect – called every frame.
psEffectObjLabel(iView *parentView, psEffect2DRenderer *renderer2d)
psEffect2DRenderer * renderer2d
Definition: pseffectobj.h:529
virtual bool CreateMeshFact()
Creates a mesh factory for this quad.