Planeshift
pseffect2drenderer.h
Go to the documentation of this file.
1 /*
2 * Author: Andrew Robberts
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_2D_RENDERER
21 #define PS_EFFECT_2D_RENDERER
22 
23 #include <csutil/parray.h>
24 #include <cstool/cspixmap.h>
25 #include <csgeom/csrect.h>
26 #include <ivideo/texture.h>
27 #include <ivideo/graph3d.h>
28 #include <ivideo/graph2d.h>
29 #include <ivideo/fontserv.h>
30 
35 #define PS_EFFECT_2D_TEXT_MAX_CHARS 512
36 
40 {
41 protected:
42  int zOrder;
43  int alpha;
44 
45 public:
46  int originx;
47  int originy;
48 
49 public:
50  psEffect2DElement(int zOrder, int alpha);
51  virtual ~psEffect2DElement();
52  int GetZOrder() const;
53  int GetAlpha() const;
54  void SetAlpha(int alpha);
55  virtual void Draw(iGraphics3D* g3d, iGraphics2D* g2d);
56 };
57 
61 {
62 public:
63  csRef<iFont> font;
65  int x;
66  int y;
67  int fgColor;
68  int bgColor;
71 
72 public:
73  psEffect2DTextElement(int zOrder, iFont* font, const char* text, int x, int y, int fgColor, int bgColor, int outlineColor, int shadowColor, int alpha);
74  virtual ~psEffect2DTextElement();
75  virtual void Draw(iGraphics3D* g3d, iGraphics2D* g2d);
76 };
77 
81 {
82 public:
83  csRef<iTextureHandle> texHandle;
84  csRect texRect;
85  csRect destRect;
86  bool tiled;
87 
88 public:
89  psEffect2DImgElement(int zOrder, iTextureHandle* texHandle, const csRect &texRect, const csRect &destRect, int alpha, bool tiled);
90  virtual ~psEffect2DImgElement();
91  virtual void Draw(iGraphics3D* g3d, iGraphics2D* g2d);
92 };
93 
97 {
98 private:
99  csPDelArray<psEffect2DElement> effect2DElements;
100 
101 public:
104 
105  psEffect2DElement* Add2DElement(psEffect2DElement* elem);
106  void Remove2DElement(psEffect2DElement* elem);
107  void Remove2DElementByIndex(size_t index);
108  void RemoveAll2DElements();
109  size_t Get2DElementCount() const;
110 
111  void Render(iGraphics3D* g3d, iGraphics2D* g2d);
112 };
113 
116 #endif // PS_EFFECT_2D_RENDERER
psEffect2DElement(int zOrder, int alpha)
int GetAlpha() const
The manager of all 2D effect elements.
Base class for all possible 2D Effect Elements.
virtual void Draw(iGraphics3D *g3d, iGraphics2D *g2d)
#define PS_EFFECT_2D_TEXT_MAX_CHARS
virtual ~psEffect2DElement()
csRef< iTextureHandle > texHandle
A 2D Image Effect Element.
A 2D Text Effect Element.
int GetZOrder() const
void SetAlpha(int alpha)