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
"
27
#include "
effects/pseffectobjtextable.h
"
28
29
class
psEffect2DRenderer
;
30
class
psEffect2DElement
;
31
class
psEffect2DTextElement
;
32
class
psEffect2DImgElement
;
33
38
enum
psEffectBackgroundAlign
39
{
40
EA_NONE
= 0,
41
42
EA_TOP_LEFT
,
43
EA_TOP
,
44
EA_TOP_RIGHT
,
45
46
EA_LEFT
,
47
EA_CENTER
,
48
EA_RIGHT
,
49
50
EA_BOTTOM_LEFT
,
51
EA_BOTTOM
,
52
EA_BOTTOM_RIGHT
53
};
54
struct
psEffectBackgroundElem
55
{
56
psEffectBackgroundAlign
align
;
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
69
class
psEffectObjText2D
:
public
psEffectObj
,
public
psEffectObjTextable
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);
92
~
psEffectObjText2D
();
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
psEffectTextElement
Definition:
pseffectobjtextable.h:47
psEffectBackgroundElem::tile
bool tile
Definition:
pseffectobjtext2d.h:64
psEffectBackgroundElem::vmin
int vmin
Definition:
pseffectobjtext2d.h:59
EA_LEFT
Definition:
pseffectobjtext2d.h:46
psEffect2DRenderer
The manager of all 2D effect elements.
Definition:
pseffect2drenderer.h:96
psEffectObjTextable
Definition:
pseffectobjtextable.h:55
EA_BOTTOM
Definition:
pseffectobjtext2d.h:51
psEffectObjText2D
Definition:
pseffectobjtext2d.h:69
psEffect2DElement
Base class for all possible 2D Effect Elements.
Definition:
pseffect2drenderer.h:39
pseffectobjtextable.h
EA_CENTER
Definition:
pseffectobjtext2d.h:47
EA_TOP
Definition:
pseffectobjtext2d.h:43
psEffectBackgroundElem::scale
bool scale
Definition:
pseffectobjtext2d.h:63
pseffectobj.h
psEffectBackgroundElem::offsetx
int offsetx
Definition:
pseffectobjtext2d.h:65
psEffectBackgroundElem
Definition:
pseffectobjtext2d.h:54
psEffectBackgroundElem::umin
int umin
Definition:
pseffectobjtext2d.h:58
psEffect2DImgElement
A 2D Image Effect Element.
Definition:
pseffect2drenderer.h:80
psEffectBackgroundElem::align
psEffectBackgroundAlign align
Definition:
pseffectobjtext2d.h:56
psEffectBackgroundElem::umax
int umax
Definition:
pseffectobjtext2d.h:60
psEffect2DTextElement
A 2D Text Effect Element.
Definition:
pseffect2drenderer.h:60
EA_RIGHT
Definition:
pseffectobjtext2d.h:48
psEffectObj
An effect is not much more than a collection of effect objects.
Definition:
pseffectobj.h:207
EA_BOTTOM_RIGHT
Definition:
pseffectobjtext2d.h:52
EA_BOTTOM_LEFT
Definition:
pseffectobjtext2d.h:50
EA_NONE
Definition:
pseffectobjtext2d.h:40
EA_TOP_RIGHT
Definition:
pseffectobjtext2d.h:44
psEffectBackgroundElem::vmax
int vmax
Definition:
pseffectobjtext2d.h:61
psEffectBackgroundElem::offsety
int offsety
Definition:
pseffectobjtext2d.h:66
psEffectBackgroundAlign
psEffectBackgroundAlign
Definition:
pseffectobjtext2d.h:38
EA_TOP_LEFT
Definition:
pseffectobjtext2d.h:42
psEffectAnchor
Effect anchors provide a base location / anchor point for all effect objs.
Definition:
pseffectanchor.h:191
common
effects
pseffectobjtext2d.h
Generated on Sat Jun 19 2021 05:00:22 for Planeshift by
1.8.11