GL Studio C++ Runtime API
gls_text_box.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::GlsTextBox class.
3
4 \par Copyright Information
5
6 Copyright (c) 2017 by The DiSTI Corporation.<br>
7 11301 Corporate Blvd; Suite 100<br>
8 Orlando, Florida 32817<br>
9 USA<br>
10 <br>
11 All rights reserved.<br>
12
13 This Software contains proprietary trade secrets of DiSTI and may not be
14reproduced, in whole or part, in any form, or by any means of electronic,
15mechanical, or otherwise, without the written permission of DiSTI. Said
16permission may be derived through the purchase of applicable DiSTI product
17licenses which detail the distribution rights of this content and any
18Derivative Works based on this or other copyrighted DiSTI Software.
19
20 NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26
27 LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34EXCEED FIVE DOLLARS (US$5.00).
35
36 The aforementioned terms and restrictions are governed by the laws of the
37State of Florida and the United States of America.
38
39*/
40#ifndef _GLS_TEXT_BOX_H
41#define _GLS_TEXT_BOX_H
42
43/// Provides support for creating DLLs.
44#if( defined( GLSGEN_EXPORT_GLSTEXTBOX ) || defined( GLSGEN_IMPORT_GLSTEXTBOX ) || defined( GLSGEN_GLSTEXTBOX_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
45 && defined( _MSC_VER )
46# if defined( GLSGEN_EXPORT_GLSTEXTBOX ) || defined( GLSGEN_GLSTEXTBOX_EXPORT_GENERATED )
47# define GLSGEN_GLSTEXTBOX_EXPORT __declspec( dllexport )
48# else
49# define GLSGEN_GLSTEXTBOX_EXPORT __declspec( dllimport )
50# endif
51#else
52# define GLSGEN_GLSTEXTBOX_EXPORT
53#endif
54///////////////////////////////////////////////////////////////////////////////
55
56#include "gls_gl.h"
57#include <string>
58
60#include "gls_text.h"
61#include "unhide_globals.h"
62
63#ifdef GLES
64# include "gls_quad_storage.h"
65# include "gls_state_manager.h"
66#endif
67
68/// Automatically link the runtime library plugin (on Windows).
69#define LIB_BASE_NAME "gls_text_box"
70#include "gls_auto_lib.h"
71#undef LIB_BASE_NAME
72
73#undef GetCharWidth
74
75//===========================================================================
76// BEGIN NAMESPACE
77//===========================================================================
78namespace disti
79{
80#ifdef GLES
81// Forward Declaration
82class GlsGloFileAttribute;
83#endif
84
85//===========================================================================
86/**
87* The GlsTextBox
88*/
89class GlsTextBox : public GlsText
90{
91protected:
93
94 /// Helper function that performs the underlying text draw.
95 /// \note Not normally called by users.
96 void DrawText();
97
98#ifdef GLES
99 GlsQuadListVC_3D _backgrounds; ///< Quads used to render the backgrounds. This is rendered behind the other quads associated with this text box.
100 GlsQuadListVCT_2D _shadows; ///< Quads used to render the shadows behind the text.
101 GlsQuadListVC_3D _shadowLines; ///< Quads used to render the shadows for lines such as underlines and strikethroughs.
102 GlsQuadListVCT_2D _characters; ///< Quads used to render the characters in the foreground.
103 GlsQuadListVC_3D _lines; ///< Quads used to render lines such as underlines and strikethroughs.
104
105 /// Constructs primitives and renders each character. This function considers the text box's position, justification, character size,
106 /// and decorations (such as strikethroughs and shadows).
108#endif
109
110public:
111 /// The ResizeMode_t enumeration. Describes the resize behavior of this text object.
113 {
114 RESIZE_MODE_FIXED,
115 RESIZE_MODE_AUTO_WIDTH,
116 RESIZE_MODE_AUTO_HEIGHT
117 };
118
119 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
120 typedef GlsText _BaseClass; ///< Deprecated typedef for the base class.
121 typedef GlsText BaseClass; ///< Typedef for the base class.
122
123 friend class GlsTextBoxEditor;
124
125 /** Class Constructor. */
127
128 /// Copy constructor
129 /// \param that The object to copy from.
130 /// \param generateNames Whether or not to generate an instance name for this object.
131 GLSGEN_GLSTEXTBOX_EXPORT GlsTextBox( const GlsTextBox& that, const bool generateNames );
132
133 /** Class Constructor. */
135
136 // Need to declare using all base class methods that we overload
137 using BaseClass::Baseline;
138 using BaseClass::BgColor;
139 using BaseClass::CellHeight;
140 using BaseClass::CellWidth;
141 using BaseClass::Char;
142 using BaseClass::CharAttr;
143 using BaseClass::CharScaling;
144 using BaseClass::CharSpacing;
145 using BaseClass::Erase;
146 using BaseClass::FauxBold;
147 using BaseClass::Inverse;
148 using BaseClass::StrikeThru;
149 using BaseClass::String;
150 using BaseClass::TextColor;
151 using BaseClass::Underline;
152
154
155 /* Peform any necessary non-draw calculations like resizing
156 * the grid.
157 * \param time The time since the start of program execution
158 */
160
165
166#ifndef GLES
167 virtual GLSGEN_GLSTEXTBOX_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL ) DISTI_METHOD_OVERRIDE;
168 virtual GLSGEN_GLSTEXTBOX_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array ) DISTI_METHOD_OVERRIDE;
169#endif
170
171#ifdef GLES
173#endif
174
175 virtual GLSGEN_GLSTEXTBOX_EXPORT void SetVertices( unsigned int nPoints, Vertex* vertices ) DISTI_METHOD_OVERRIDE;
176
177 /// Sets the initial state of this object.
179
180 /// Rebuilds this text box layout. This may be an expensive call, so it should only be called when a property changes.
182
183 /* Unhides base class implementation. */
184 using BaseClass::Scale;
185
186 /**
187 We need to know the Max number of lines/rows possible to display, we
188 may run out of characters to print/display before we hit the max
189 number of lines though.
190 \return A value between Zero and INT_MAX, representing the max lines/rows to draw
191 \pre The TextBox object has been initialized
192 \post The value of max lines returned to the caller
193 */
195
196 virtual GLSGEN_GLSTEXTBOX_EXPORT void Scale( float px, float py, float pz, Vertex* anchor, int handleBar ) DISTI_METHOD_OVERRIDE;
197
198 /// Different text justifications.
200 {
201 ALIGN_CENTER,
202 ALIGN_TOP,
203 ALIGN_BOTTOM
204 };
205
206 /** Set the vertical justification for this text object
207 * \param justification The justification mode (TOP, BOTTOM, CENTER)
208 */
210
211 /** Get the vertical justification for this text object
212 * \return vertical justification
213 */
215 {
216 return _verticalAlignment;
217 }
218
219 //-----------------------------------------------------------------------
220 //-----------------------------------------------------------------------
221 // Routines for compatbility with TextDisplay.gls
222 //-----------------------------------------------------------------------
223 //-----------------------------------------------------------------------
224
225 /** Clears all of the characters and resets the attributes of all
226 * characters (TextDisplay compatability method)
227 * \deprecated use Erase instead
228 */
230 {
231 Erase();
232 }
233
234 /** Clears all of the characters. Does NOT reset the attributes
235 * of the characters (TextDisplay compatability method)
236 * \deprecated
237 */
239 {
240 _text.erase();
241 SetRebuild();
242 }
243
244 /** SetColor() meaning has changed, now use TextColor */
245
246 /** Print a string into this text object starting at index 0 and proceeding Left
247 * to right Wraps at newline characters. Does not change the color or any
248 * other modes. Replaces the entire string.
249 * (TextDisplay compatability method)
250 * \param s The string to print
251 * \deprecated use String instead
252 */
254 {
255 String( s );
256 }
257
258 /** Print a string into this text object
259 * to right. Wraps at newline characters. Does not change the color or any
260 * other modes. Replaces the entire string.
261 * \param format printf style varargs formatting string.
262 */
263 GLSGEN_GLSTEXTBOX_EXPORT void VaString( const char* format, ... );
264
265 /// \cond INTERNAL
266 // Undocumented.
267 // This method is used to calculate the lines of the text box and is likely to change in future releases.
268 GLSGEN_GLSTEXTBOX_EXPORT void NextLineInfo( const unsigned int currentStringIndex,
269 unsigned int* lineEndIndex,
270 unsigned int* nextLineStringIndex,
271 float* startXpixels,
272 float* lineLengthPixels );
273
274 // Undocumented.
275 // This method is used to calculate the lines of the text box and may change in future releases.
276 GLSGEN_GLSTEXTBOX_EXPORT unsigned int GetLineCount();
277 // \endcond
278
279 /** Sets tab space multiplier, 1.0 == same as specified in font */
281
282 /** Returns the current tab space multiplier
283 * \return the current tab space multiplier
284 */
286
287 /** Determine if the text direction is set to left->right or right->left
288 * \return true if if the text direction is set to left->right else false for right->left
289 */
291
292 /** Set the text direction
293 * \param leftToRight true for left->right else false for right->left
294 */
295 GLSGEN_GLSTEXTBOX_EXPORT void LeftToRight( bool leftToRight );
296
297 /// Set the resize behavior for this object.
298 /// \param value The new resize behavior.
300
301 /// \return The current resize behavior for this object.
303
304 /// Set the maximum resize width for this object in logical units.
305 /// \param value The new maximum width.
306 virtual GLSGEN_GLSTEXTBOX_EXPORT void MaxWidth( float value );
307
308 /// \return The current maximum resize width for this object in logical units.
310
311 /// Set the maximum resize height for this object in logical units.
312 /// \param value The new maximum height.
313 virtual GLSGEN_GLSTEXTBOX_EXPORT void MaxHeight( float value );
314
315 /// \return The current maximum resize height for this object in logical units.
317
318protected:
319#ifdef GLES
320 /** Set a single attribute from the GLO file.
321 * \param data The attribute to set and its associated data.
322 */
324#endif
325
326 /// Allocate a text buffer of the appropriate size for this grid and output snprintf style format into the buffer.
327 /// \param format snprintf style format spec
328 /// \param args Arguments for sprintf style formatting.
329 /// \return A formatted textbuffer ( must be deleted by caller ).
330 GLSGEN_GLSTEXTBOX_EXPORT char* FormatVarArgList( const char* format, va_list args );
331
332 /// true -> grid will draw characters using "per character attributes" else
333 /// false -> all characters will be drawn using the first character's attribute
334 /// NOTE: This defaults to false and automatically enables to true if the user calls
335 /// a method that requires per character attributes
337
338 /// Enable per character attribute drawing for this grid.
340 {
341 if( !_perCharAttribs )
342 {
343 _perCharAttribs = true;
344 SetRebuild();
345 }
346 }
347
348 Align_t _verticalAlignment; ///< Justification setting (TOP, CENTER, BOTTOM).
349
350 float _tabSpacing; ///< Space multiplier for tabs.
351
352 /// Helper function to calculate cell sizes based on the
353 /// scale of the object if control cell size is enabled.
354 /// \note Not normally called by users.
356
357 /// Helper function to readjust vertices back to the local origin being aligned with vertex 0.
358 /// \note Not normally called by users.
360
361 /** Populate the _rowInfo array based on the current display string
362 * \pre none
363 * \post _rowInfo array is populated based on the current display string
364 */
366
367 /// Get the row info for the row starting at the given string index
368 /// \param strIndex starting index into string
369 /// \param rowLength [out] gets number of characters in row
370 /// \param rowPixelWidth [out] gets pixel width of row
371 /// \param nextRowStartIndex [out] gets starting string index for next row
372 /// else GLSUINT32_MAX if there is no string data for the next row
373 /// \pre strIndex < _str.GetLength()
374 /// \post rowLength has the number of characters in the row,
375 /// rowPixelWidth has the pixel width of the row,
376 /// nextRowStartIndex has the starting string index for the next row
377 /// else GLSUINT32_MAX if there is no string data for the next row
378 GLSGEN_GLSTEXTBOX_EXPORT void GetNextRowInfo( const unsigned int strIndex,
379 unsigned int& rowLength,
380 float& rowPixelWidth,
381 unsigned int& nextRowStartIndex ) const;
382
383 /// Helper function that returns the maximum line length (text box width) in logical units.
384 /// \return Infinity if no limit, otherwise the limit in logical units.
386
387 /// Helper function that adjusts the vertices to contain the text based on the resize behavior.
389
390public:
391 /** Get the width for the given character taking into account cell sizing, character spacing, uppercasing
392 * and tab characters width being expanded
393 * \param c character in question
394 * \return width for given character
395 * \pre none
396 * \post none
397 */
398 GLSGEN_GLSTEXTBOX_EXPORT float GetCharWidth( const unsigned short c ) const;
399
400protected:
401 /** info for one row of text in the display */
402 struct RowInfo
403 {
404 unsigned int startingIndex; /**< starting text index into the display for row
405 * else GLSUINT32_MAX if row has no characters */
406 unsigned int length; /**< the number of characters in row */
407 float pixelWidth; /**< the width of row in pixels */
408 };
409
410 unsigned int _lineCount; ///< Number of rows of characters in the text grid (number of lines).
411 bool _lineCountChanged; ///< If true, the line count has changed, and row information needs to be rebuilt.
412
413 RowInfo* _rowInfo; /**< array ( _rows number of elements ) of RowInfo */
414
415 float _cellWidthRatio; ///< Holds cell width / max char width ratio used for horizontal advance.
416
417 float _maxLineLengthPixels; ///< Calculated maximimum line width in "pixels" (logical units).
418 float _maxTextHeightPixels; ///< Calculated maximimum height in "pixels" (logical units).
419 unsigned int _maxLinesToDraw; ///< Calculated maximum number of lines that can fit.
420
421 bool _leftToRight; ///< true to render characters from left to right else, false for right to left.
422
423 ResizeMode_t _resizeMode; ///< The current automatic resize behavior.
424 float _resizeMaxWidth; ///< The calculated maximum width in logical units based on the current resize behavior.
425 float _resizeMaxHeight; ///< The calculated maximim height in logical units based on the current resize behavior.
426
427 UTF16String _unicodeText; /**< unicode version of _text from base class, updated by CalculateRowData */
428
429 /// \details A helper class for processing underline and strike-thru when drawing text grid.
431 {
432 public:
433 /**
434 * \param cellWidth maximum width of a character cell in the text box
435 * \param cellHeight height of a character cell in the text box
436 * \param cellYScale unused
437 * \param shadow true if text box has shadow enabled
438 * \param shadowOffset offset for shadow
439 * \param shadowColor color of shadow in text box
440 * \param underlineOffset offset of underline
441 * \param underlineSize size of underline
442 * \param halo true if text box has halo enabled
443 * \param haloOffset offset for halo
444 * \param haloColor color of halo in text box
445 * \param leftToRight true if text flows left to right else false for right to left
446 */
447 UnderlineStrikeThruHelper( float cellWidth, float cellHeight, float cellYScale, bool shadow, const Vector& shadowOffset, const GlsColor& shadowColor,
448 float underlineOffset, float underlineSize, bool halo, float haloOffset, GlsColor haloColor, bool leftToRight );
449
450 /**
451 * Setup to process a new row in the text box.
452 */
453 void NewRow();
454
455 /**
456 * Pre Process the given character attributes
457 * \param charAttr attributes in question
458 * \param c the character code to process.
459 * \param cellX x coord of character cell
460 * \param charY y coord of character
461 */
462 void PreProcessCharacter( const CharAttr_t& charAttr, const Char_t& c, float cellX, float charY );
463
464 /**
465 * Post Process the given character attributes
466 * \param charAttr attributes in question
467 * \param c the character code to process.
468 * \param cellX x coord of character cell
469 * \param charY y coord of character cell
470 * \param cellWidth the width of the current character
471 * \param endOfLine true if character was the end of the current line
472 */
473 void PostProcessCharacter( const CharAttr_t& charAttr, const Char_t& c, float cellX, float charY, float cellWidth, bool endOfLine );
474
475#ifdef GLES
476 /**
477 * Render the line segments for the underline / strikethru
478 * \param quadStorage The quad storage list to render
479 */
481#else
482 /**
483 * Render the line segments for the underline / strikethru
484 */
485 void RenderLineSegments();
486#endif
487 /// Sets the underlying shadow visibility flag to false.
489
490 /// Sets the underlying shadow visibility flag to true.
492
493 protected:
494 // cell constants
495 const float _cellWidth; ///< Height of each character cell in the grid in logical units.
496 const float _cellHeight; ///< Width of each character cell in the grid in logical units.
497
498 // shadow constants
499 const bool _shadow; ///< Whether or not the shadow effect is on.
500 const Vector _shadowOffset; ///< Offset of the shadow effect from the characters. Z component is ignored.
501 const GlsColor _shadowColor; ///< Color of the shadow effect behind the characters.
502 bool _allowShadow; ///< Whether or not shadows are being drawn in general.
503
504 // underline constants
505 const float _underlineOffset; ///< Vertical offset of the underline in logical units.
506 const float _underlineSize; ///< Thickness of the underline in logical units.
507
508 // halo constants
509 const bool _halo; ///< Whether or not the halo effect is on.
510 const float _haloOffset; ///< Offset multiplier for the halo effect.
511 const GlsColor _haloColor; ///< Color of the halo effect behind the characters.
512
513 // left to right
514 const bool _leftToRight; ///< If true, characters are rendered left to right, otherwise right to left.
515
516 // state vars for underline processing
517 float _underlineX1; ///< Current underline state left X coordinate.
518 float _underlineX2; ///< Current underline state right X coordinate.
519 float _underlineY; ///< Current underline state Y coordinate.
520 float _underlineScale; ///< Current underline drawing scale.
521 GlsColor _underlineColor; ///< Current underline drawing color.
522 bool _underlineOn; ///< If true, underline drawing is enabled.
523
524 // state vars for strike-thru processing
525 float _strikeX1; ///< Current strike through state left X coordinate.
526 float _strikeX2; ///< Current strike through state right X coordinate.
527 float _strikeY; ///< Current strike through state Y coordinate.
528 float _strikeScale; ///< Current strike through drawing scale.
529 GlsColor _strikeColor; ///< Current strike through drawing color.
530 bool _strikeOn; ///< If true, strike through drawing is enabled.
531
532 // state vars for line processing
533 bool _whiteSpaceYes; ///< If true, the currently processed character is whitespace.
534
535 // line segments to draw
536 typedef std::list<LineSegment_t> LineSegmentCont_t; ///< Typedef for a list of line segments.
537 LineSegmentCont_t _lineSegments; ///< The list of line segments to draw.
538 };
539
540private:
543
544 void OnCellDimensionChanged() DISTI_METHOD_OVERRIDE
545 {
546 _needToRebuild = true;
547 }
548};
549
550/// Stream in operator
551/// \param instr The stream to read from.
552/// \param j The returned value read from the stream.
553/// \return The stream in its current state.
554inline std::istream& operator>>( std::istream& instr, disti::GlsTextBox::Align_t& j )
555{
556 std::string str;
557 instr >> str;
558
559 if( str == "ALIGN_TOP" )
560 {
561 j = disti::GlsTextBox::ALIGN_TOP;
562 }
563 else if( str == "ALIGN_CENTER" )
564 {
565 j = disti::GlsTextBox::ALIGN_CENTER;
566 }
567 else if( str == "ALIGN_BOTTOM" )
568 {
569 j = disti::GlsTextBox::ALIGN_BOTTOM;
570 }
571 return instr;
572}
573
574/// Stream out operator
575/// \param outstr The stream to write to.
576/// \param j The value to write to the stream.
577/// \return The stream in its current state.
578inline std::ostream& operator<<( std::ostream& outstr, disti::GlsTextBox::Align_t j )
579{
580 switch( j )
581 {
582 case disti::GlsTextBox::ALIGN_TOP:
583 outstr << "ALIGN_TOP";
584 break;
585 case disti::GlsTextBox::ALIGN_CENTER:
586 outstr << "ALIGN_CENTER";
587 break;
588 case disti::GlsTextBox::ALIGN_BOTTOM:
589 outstr << "ALIGN_BOTTOM";
590 break;
591 }
592 return outstr;
593}
594
595/// Stream in operator
596/// \param instr The stream to read from.
597/// \param direction The returned value read from the stream.
598/// \return The stream in its current state.
599inline std::istream& operator>>( std::istream& instr, disti::GlsTextBox::ResizeMode_t& direction )
600{
601 std::string str;
602 instr >> str;
603
604 if( str == "RESIZE_MODE_FIXED" )
605 {
606 direction = disti::GlsTextBox::RESIZE_MODE_FIXED;
607 }
608 else if( str == "RESIZE_MODE_AUTO_WIDTH" )
609 {
610 direction = disti::GlsTextBox::RESIZE_MODE_AUTO_WIDTH;
611 }
612 else if( str == "RESIZE_MODE_AUTO_HEIGHT" )
613 {
614 direction = disti::GlsTextBox::RESIZE_MODE_AUTO_HEIGHT;
615 }
616 return instr;
617}
618
619/// Stream out operator
620/// \param outstr The stream to write to.
621/// \param direction The value to write to the stream.
622/// \return The stream in its current state.
623inline std::ostream& operator<<( std::ostream& outstr, disti::GlsTextBox::ResizeMode_t direction )
624{
625 switch( direction )
626 {
627 case disti::GlsTextBox::RESIZE_MODE_FIXED:
628 outstr << "RESIZE_MODE_FIXED";
629 break;
630 case disti::GlsTextBox::RESIZE_MODE_AUTO_WIDTH:
631 outstr << "RESIZE_MODE_AUTO_WIDTH";
632 break;
633 case disti::GlsTextBox::RESIZE_MODE_AUTO_HEIGHT:
634 outstr << "RESIZE_MODE_AUTO_HEIGHT";
635 break;
636 }
637 return outstr;
638}
639
640} // namespace disti
641
642#endif
Definition: cull.h:50
Definition: display.h:96
virtual void Scale(float px, float py, float pz, Vertex *anchor, int handleBar=0)
Definition: dynamic_array.h:79
Definition: gls_color.h:54
Definition: gls_glo_file.h:1243
Definition: gls_quad_storage.h:160
Definition: gls_quad_storage.h:64
Definition: gls_text_box.h:431
void AllowShadow()
Sets the underlying shadow visibility flag to true.
float _underlineY
Current underline state Y coordinate.
Definition: gls_text_box.h:519
bool _whiteSpaceYes
If true, the currently processed character is whitespace.
Definition: gls_text_box.h:533
bool _allowShadow
Whether or not shadows are being drawn in general.
Definition: gls_text_box.h:502
const float _cellHeight
Width of each character cell in the grid in logical units.
Definition: gls_text_box.h:496
const bool _leftToRight
If true, characters are rendered left to right, otherwise right to left.
Definition: gls_text_box.h:514
bool _strikeOn
If true, strike through drawing is enabled.
Definition: gls_text_box.h:530
bool _underlineOn
If true, underline drawing is enabled.
Definition: gls_text_box.h:522
float _underlineX1
Current underline state left X coordinate.
Definition: gls_text_box.h:517
LineSegmentCont_t _lineSegments
The list of line segments to draw.
Definition: gls_text_box.h:537
float _underlineScale
Current underline drawing scale.
Definition: gls_text_box.h:520
const GlsColor _shadowColor
Color of the shadow effect behind the characters.
Definition: gls_text_box.h:501
const GlsColor _haloColor
Color of the halo effect behind the characters.
Definition: gls_text_box.h:511
const float _underlineOffset
Vertical offset of the underline in logical units.
Definition: gls_text_box.h:505
float _strikeX2
Current strike through state right X coordinate.
Definition: gls_text_box.h:526
UnderlineStrikeThruHelper(float cellWidth, float cellHeight, float cellYScale, bool shadow, const Vector &shadowOffset, const GlsColor &shadowColor, float underlineOffset, float underlineSize, bool halo, float haloOffset, GlsColor haloColor, bool leftToRight)
float _strikeY
Current strike through state Y coordinate.
Definition: gls_text_box.h:527
std::list< LineSegment_t > LineSegmentCont_t
Typedef for a list of line segments.
Definition: gls_text_box.h:536
const bool _shadow
Whether or not the shadow effect is on.
Definition: gls_text_box.h:499
const bool _halo
Whether or not the halo effect is on.
Definition: gls_text_box.h:509
void PostProcessCharacter(const CharAttr_t &charAttr, const Char_t &c, float cellX, float charY, float cellWidth, bool endOfLine)
float _underlineX2
Current underline state right X coordinate.
Definition: gls_text_box.h:518
const float _haloOffset
Offset multiplier for the halo effect.
Definition: gls_text_box.h:510
GlsColor _underlineColor
Current underline drawing color.
Definition: gls_text_box.h:521
const float _underlineSize
Thickness of the underline in logical units.
Definition: gls_text_box.h:506
void PreProcessCharacter(const CharAttr_t &charAttr, const Char_t &c, float cellX, float charY)
const float _cellWidth
Height of each character cell in the grid in logical units.
Definition: gls_text_box.h:495
void IgnoreShadow()
Sets the underlying shadow visibility flag to false.
void RenderLineSegments(GlsQuadListVC_3D &quadStorage)
float _strikeScale
Current strike through drawing scale.
Definition: gls_text_box.h:528
GlsColor _strikeColor
Current strike through drawing color.
Definition: gls_text_box.h:529
float _strikeX1
Current strike through state left X coordinate.
Definition: gls_text_box.h:525
const Vector _shadowOffset
Offset of the shadow effect from the characters. Z component is ignored.
Definition: gls_text_box.h:500
Definition: gls_text_box.h:90
GlsQuadListVCT_2D _shadows
Quads used to render the shadows behind the text.
Definition: gls_text_box.h:100
char * FormatVarArgList(const char *format, va_list args)
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
virtual Align_t VerticalAlignment() const
Definition: gls_text_box.h:214
virtual void Draw() DISTI_METHOD_OVERRIDE
float _tabSpacing
Space multiplier for tabs.
Definition: gls_text_box.h:350
float _cellWidthRatio
Holds cell width / max char width ratio used for horizontal advance.
Definition: gls_text_box.h:415
GlsQuadListVCT_2D _characters
Quads used to render the characters in the foreground.
Definition: gls_text_box.h:102
void EnablePerCharAttribs()
Enable per character attribute drawing for this grid.
Definition: gls_text_box.h:339
UTF16String _unicodeText
Definition: gls_text_box.h:427
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
bool _leftToRight
true to render characters from left to right else, false for right to left.
Definition: gls_text_box.h:421
virtual void CalculateRowData()
void VerticalAlignment(Align_t justification)
void GetNextRowInfo(const unsigned int strIndex, unsigned int &rowLength, float &rowPixelWidth, unsigned int &nextRowStartIndex) const
virtual unsigned int MaxLinesToDraw()
Align_t
Different text justifications.
Definition: gls_text_box.h:200
float _resizeMaxWidth
The calculated maximum width in logical units based on the current resize behavior.
Definition: gls_text_box.h:424
virtual void SetFromGloData(GlsGloFileAttribute &data) DISTI_METHOD_OVERRIDE
bool _perCharAttribs
Definition: gls_text_box.h:336
float GetCharWidth(const unsigned short c) const
void PopulateQuadStorage()
unsigned int _lineCount
Number of rows of characters in the text grid (number of lines).
Definition: gls_text_box.h:410
void VaString(const char *format,...)
void LeftToRight(bool leftToRight)
GlsQuadListVC_3D _shadowLines
Quads used to render the shadows for lines such as underlines and strikethroughs.
Definition: gls_text_box.h:101
virtual ResizeMode_t ResizeMode()
void SetVerticesToTextBounds()
Helper function that adjusts the vertices to contain the text based on the resize behavior.
virtual void PreDraw(const OpenGLMatrices &current, Culler &culler) DISTI_METHOD_OVERRIDE
virtual void MaxWidth(float value)
void ClearChars()
Definition: gls_text_box.h:238
ResizeMode_t _resizeMode
The current automatic resize behavior.
Definition: gls_text_box.h:423
virtual void Calculate(double time) DISTI_METHOD_OVERRIDE
virtual void CopyGeometry(DisplayObject *src) DISTI_METHOD_OVERRIDE
virtual void SetVertices(unsigned int nPoints, Vertex *vertices) DISTI_METHOD_OVERRIDE
void TabSpacing(float)
void SetString(const char *s)
Definition: gls_text_box.h:253
virtual void ResizeMode(ResizeMode_t value)
float _maxLineLengthPixels
Calculated maximimum line width in "pixels" (logical units).
Definition: gls_text_box.h:417
virtual float MaxHeight()
void Clear()
Definition: gls_text_box.h:229
unsigned int _maxLinesToDraw
Calculated maximum number of lines that can fit.
Definition: gls_text_box.h:419
virtual float MaxWidth()
GlsQuadListVC_3D _backgrounds
Quads used to render the backgrounds. This is rendered behind the other quads associated with this te...
Definition: gls_text_box.h:99
GlsQuadListVC_3D _lines
Quads used to render lines such as underlines and strikethroughs.
Definition: gls_text_box.h:103
virtual void MaxHeight(float value)
bool _lineCountChanged
If true, the line count has changed, and row information needs to be rebuilt.
Definition: gls_text_box.h:411
virtual void Initialize()
Sets the initial state of this object.
virtual void Scale(float px, float py, float pz, Vertex *anchor, int handleBar) DISTI_METHOD_OVERRIDE
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
RowInfo * _rowInfo
Definition: gls_text_box.h:413
Align_t _verticalAlignment
Justification setting (TOP, CENTER, BOTTOM).
Definition: gls_text_box.h:348
ResizeMode_t
The ResizeMode_t enumeration. Describes the resize behavior of this text object.
Definition: gls_text_box.h:113
float GetMaxLineLengthForResizeMode() const
float _resizeMaxHeight
The calculated maximim height in logical units based on the current resize behavior.
Definition: gls_text_box.h:425
void Rebuild()
Rebuilds this text box layout. This may be an expensive call, so it should only be called when a prop...
float _maxTextHeightPixels
Calculated maximimum height in "pixels" (logical units).
Definition: gls_text_box.h:418
Definition: gls_text.h:154
float CellHeight() const
Definition: gls_text.h:260
CharAttr_t CharAttr(unsigned int index) const
Definition: gls_text.h:297
float Baseline()
float CharScaling()
float CellWidth() const
Definition: gls_text.h:274
bool _needToRebuild
Definition: gls_text.h:703
void Char(Char_t code)
void SetRebuild()
Definition: gls_text.h:583
float CharSpacing()
GlsColor BgColor()
GlsFontBase::Char_t Char_t
Typedef shorthand for GlsFontBase::Char_t.
Definition: gls_text.h:160
std::string String() const
Definition: gls_text.h:539
std::string _text
Definition: gls_text.h:714
GlsColor TextColor()
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:544
Definition: vertex.h:85
Definition: vertex.h:420
The gls_auto_lib.
Macros and helper code to determine what subset of C++11/14/17 is available.
#define DISTI_SPECIAL_MEM_FUN_DELETE
Macro to wrap function deletion, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:246
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:488
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:222
The gls_gl.
The disti::GlsQuadListVC_3D and GlsQuadListVCT_2D classes.
The disti::GlsStateManager factory class. Creates an instance of a state manager that manages the GL ...
The disti::GlsText class.
#define GLSGEN_GLSTEXTBOX_EXPORT
Provides support for creating DLLs.
Definition: gls_text_box.h:52
Definition: bmpimage.h:47
std::ostream & operator<<(std::ostream &outstr, const AttributeName &name)
std::istream & operator>>(std::istream &instr, GlsColor &color)
std::basic_string< unsigned short, CharTraitsUnsignedShort > UTF16String
A cross platform UTF-16 encoded string.
Definition: util.h:428
Definition: gls_text_box.h:403
unsigned int startingIndex
Definition: gls_text_box.h:404
float pixelWidth
Definition: gls_text_box.h:407
unsigned int length
Definition: gls_text_box.h:406
Attributes for each character position in the grid.
Definition: gls_text.h:179
The DistiUnhideGlobalsDummyClass class.