diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llhudtext.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llhudtext.h')
-rw-r--r-- | linden/indra/newview/llhudtext.h | 174 |
1 files changed, 174 insertions, 0 deletions
diff --git a/linden/indra/newview/llhudtext.h b/linden/indra/newview/llhudtext.h new file mode 100644 index 0000000..962bd1d --- /dev/null +++ b/linden/indra/newview/llhudtext.h | |||
@@ -0,0 +1,174 @@ | |||
1 | /** | ||
2 | * @file llhudtext.h | ||
3 | * @brief LLHUDText class definition | ||
4 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_LLHUDTEXT_H | ||
29 | #define LL_LLHUDTEXT_H | ||
30 | |||
31 | #include "llmemory.h" | ||
32 | #include "lldarrayptr.h" | ||
33 | |||
34 | #include "llhudobject.h" | ||
35 | #include "v4color.h" | ||
36 | #include "v4coloru.h" | ||
37 | #include "v2math.h" | ||
38 | #include "llrect.h" | ||
39 | #include "llframetimer.h" | ||
40 | #include "llfontgl.h" | ||
41 | #include <set> | ||
42 | #include <vector> | ||
43 | #include "lldarray.h" | ||
44 | |||
45 | // Renders a 2D text billboard floating at the location specified. | ||
46 | class LLDrawable; | ||
47 | class LLHUDText; | ||
48 | |||
49 | struct lltextobject_further_away | ||
50 | { | ||
51 | bool operator()(const LLPointer<LLHUDText>& lhs, const LLPointer<LLHUDText>& rhs) const; | ||
52 | }; | ||
53 | |||
54 | class LLHUDText : public LLHUDObject | ||
55 | { | ||
56 | protected: | ||
57 | class LLHUDTextSegment | ||
58 | { | ||
59 | public: | ||
60 | LLHUDTextSegment(const LLWString& text, const LLFontGL::StyleFlags style, const LLColor4& color) | ||
61 | : mColor(color), mStyle(style), mText(text) {} | ||
62 | F32 getWidth(const LLFontGL* font); | ||
63 | const LLWString& getText() const { return mText; }; | ||
64 | void clearFontWidthMap() { mFontWidthMap.clear(); } | ||
65 | |||
66 | LLColor4 mColor; | ||
67 | LLFontGL::StyleFlags mStyle; | ||
68 | private: | ||
69 | LLWString mText; | ||
70 | std::map<const LLFontGL*, F32> mFontWidthMap; | ||
71 | }; | ||
72 | |||
73 | public: | ||
74 | typedef enum e_text_alignment | ||
75 | { | ||
76 | ALIGN_TEXT_LEFT, | ||
77 | ALIGN_TEXT_CENTER | ||
78 | } ETextAlignment; | ||
79 | |||
80 | typedef enum e_vert_alignment | ||
81 | { | ||
82 | ALIGN_VERT_TOP, | ||
83 | ALIGN_VERT_CENTER | ||
84 | } EVertAlignment; | ||
85 | |||
86 | public: | ||
87 | void setStringUTF8(const std::string &utf8string); | ||
88 | void setString(const LLWString &wstring); | ||
89 | void clearString(); | ||
90 | void addLine(const std::string &text, const LLColor4& color, const LLFontGL::StyleFlags style = LLFontGL::NORMAL); | ||
91 | void addLine(const LLWString &wtext, const LLColor4& color, const LLFontGL::StyleFlags style = LLFontGL::NORMAL); | ||
92 | void setLabel(const std::string &label); | ||
93 | void setLabel(const LLWString &label); | ||
94 | void setDropShadow(const BOOL do_shadow); | ||
95 | void setFont(const LLFontGL* font); | ||
96 | void setColor(const LLColor4 &color); | ||
97 | void setUsePixelSize(const BOOL use_pixel_size); | ||
98 | void setZCompare(const BOOL zcompare); | ||
99 | void setDoFade(const BOOL do_fade); | ||
100 | void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; } | ||
101 | |||
102 | // mMaxLines of -1 means unlimited lines. | ||
103 | void setMaxLines(S32 max_lines) { mMaxLines = max_lines; } | ||
104 | void setFadeDistance(F32 fade_distance, F32 fade_range) { mFadeDistance = fade_distance; mFadeRange = fade_range; } | ||
105 | void updateVisibility(); | ||
106 | LLVector2 updateScreenPos(LLVector2 &offset_target); | ||
107 | void updateSize(); | ||
108 | void setMass(F32 mass) { mMass = llmax(0.1f, mass); } | ||
109 | void setTextAlignment(ETextAlignment alignment) { mTextAlignment = alignment; } | ||
110 | void setVertAlignment(EVertAlignment alignment) { mVertAlignment = alignment; } | ||
111 | /*virtual*/ void markDead(); | ||
112 | friend class LLHUDObject; | ||
113 | /*virtual*/ F32 getDistance() const { return mLastDistance; } | ||
114 | void setUseBubble(BOOL use_bubble) { mUseBubble = use_bubble; } | ||
115 | S32 getLOD() { return mLOD; } | ||
116 | BOOL getVisible() { return mVisible; } | ||
117 | void setOnHUDAttachment(BOOL on_hud) { mOnHUDAttachment = on_hud; } | ||
118 | |||
119 | static void renderAllHUD(); | ||
120 | static void addPickable(std::set<LLViewerObject*> &pick_list); | ||
121 | static void reshape(); | ||
122 | protected: | ||
123 | LLHUDText(const U8 type); | ||
124 | |||
125 | /*virtual*/ void render(); | ||
126 | /*virtual*/ void renderForSelect(); | ||
127 | void renderText(BOOL for_select); | ||
128 | static void updateAll(); | ||
129 | void setLOD(S32 lod); | ||
130 | S32 getMaxLines(); | ||
131 | |||
132 | private: | ||
133 | ~LLHUDText(); | ||
134 | BOOL mOnHUD; | ||
135 | BOOL mUseBubble; | ||
136 | BOOL mDropShadow; | ||
137 | BOOL mDoFade; | ||
138 | F32 mFadeRange; | ||
139 | F32 mFadeDistance; | ||
140 | F32 mLastDistance; | ||
141 | BOOL mUsePixelSize; | ||
142 | BOOL mZCompare; | ||
143 | BOOL mVisibleOffScreen; | ||
144 | BOOL mOffscreen; | ||
145 | LLColor4 mColor; | ||
146 | LLVector3 mScale; | ||
147 | F32 mWidth; | ||
148 | F32 mHeight; | ||
149 | LLColor4U mPickColor; | ||
150 | const LLFontGL* mFontp; | ||
151 | const LLFontGL* mBoldFontp; | ||
152 | LLRectf mSoftScreenRect; | ||
153 | LLVector3 mPositionAgent; | ||
154 | LLVector2 mPositionOffset; | ||
155 | LLVector2 mTargetPositionOffset; | ||
156 | F32 mMass; | ||
157 | S32 mMaxLines; | ||
158 | S32 mOffsetY; | ||
159 | F32 mRadius; | ||
160 | std::vector<LLHUDTextSegment> mTextSegments; | ||
161 | std::vector<LLHUDTextSegment> mLabelSegments; | ||
162 | LLFrameTimer mResizeTimer; | ||
163 | ETextAlignment mTextAlignment; | ||
164 | EVertAlignment mVertAlignment; | ||
165 | S32 mLOD; | ||
166 | |||
167 | static std::set<LLPointer<LLHUDText> > sTextObjects; | ||
168 | static std::vector<LLPointer<LLHUDText> > sVisibleTextObjects; | ||
169 | static std::vector<LLPointer<LLHUDText> > sVisibleHUDTextObjects; | ||
170 | typedef std::set<LLPointer<LLHUDText> >::iterator TextObjectIterator; | ||
171 | typedef std::vector<LLPointer<LLHUDText> >::iterator VisibleTextObjectIterator; | ||
172 | }; | ||
173 | |||
174 | #endif // LL_LLHUDTEXT_H | ||