|
@@ -107,6 +107,7 @@ public:
|
|
|
unsigned short* _indices;
|
|
unsigned short* _indices;
|
|
|
unsigned int _vertexCount;
|
|
unsigned int _vertexCount;
|
|
|
unsigned int _indexCount;
|
|
unsigned int _indexCount;
|
|
|
|
|
+ Vector4 _color;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -159,10 +160,20 @@ public:
|
|
|
void end();
|
|
void end();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Create a Text object from a given string.
|
|
|
|
|
- * Vertex coordinates, UVs and indices will be computed and stored in the Text object.
|
|
|
|
|
- * For static text labels that do not change frequently, this means these computations
|
|
|
|
|
- * need not be performed every frame.
|
|
|
|
|
|
|
+ * Draws the specified text in a solid color, with a scaling factor.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param text The text to draw.
|
|
|
|
|
+ * @param x The viewport x position to draw text at.
|
|
|
|
|
+ * @param y The viewport y position to draw text at.
|
|
|
|
|
+ * @param color The color of text.
|
|
|
|
|
+ * @param size The size to draw text (0 for default size).
|
|
|
|
|
+ * @param rightToLeft Whether to draw text from right to left.
|
|
|
|
|
+ */
|
|
|
|
|
+ void drawText(const char* text, int x, int y, const Vector4& color, unsigned int size = 0, bool rightToLeft = false);
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Draws the specified text within a rectangular area, with a specified alignment and scale.
|
|
|
|
|
+ * Clips text outside the viewport. Optionally wraps text to fit within the width of the viewport.
|
|
|
*
|
|
*
|
|
|
* @param text The text to draw.
|
|
* @param text The text to draw.
|
|
|
* @param area The viewport area to draw within. Text will be clipped outside this rectangle.
|
|
* @param area The viewport area to draw within. Text will be clipped outside this rectangle.
|
|
@@ -172,11 +183,9 @@ public:
|
|
|
* @param wrap Wraps text to fit within the width of the viewport if true.
|
|
* @param wrap Wraps text to fit within the width of the viewport if true.
|
|
|
* @param rightToLeft Whether to draw text from right to left.
|
|
* @param rightToLeft Whether to draw text from right to left.
|
|
|
* @param clip A region to clip text within after applying justification to the viewport area.
|
|
* @param clip A region to clip text within after applying justification to the viewport area.
|
|
|
- *
|
|
|
|
|
- * @return A Text object.
|
|
|
|
|
*/
|
|
*/
|
|
|
- Text* createText(const char* text, const Rectangle& area, const Vector4& color, unsigned int size = 0,
|
|
|
|
|
- Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false, const Rectangle* clip = NULL);
|
|
|
|
|
|
|
+ void drawText(const char* text, const Rectangle& area, const Vector4& color, unsigned int size = 0,
|
|
|
|
|
+ Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false, const Rectangle* clip = NULL);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Draw a string from a precomputed Text object.
|
|
* Draw a string from a precomputed Text object.
|
|
@@ -186,20 +195,10 @@ public:
|
|
|
void drawText(Text* text);
|
|
void drawText(Text* text);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Draws the specified text in a solid color, with a scaling factor.
|
|
|
|
|
- *
|
|
|
|
|
- * @param text The text to draw.
|
|
|
|
|
- * @param x The viewport x position to draw text at.
|
|
|
|
|
- * @param y The viewport y position to draw text at.
|
|
|
|
|
- * @param color The color of text.
|
|
|
|
|
- * @param size The size to draw text (0 for default size).
|
|
|
|
|
- * @param rightToLeft Whether to draw text from right to left.
|
|
|
|
|
- */
|
|
|
|
|
- void drawText(const char* text, int x, int y, const Vector4& color, unsigned int size = 0, bool rightToLeft = false);
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Draws the specified text within a rectangular area, with a specified alignment and scale.
|
|
|
|
|
- * Clips text outside the viewport. Optionally wraps text to fit within the width of the viewport.
|
|
|
|
|
|
|
+ * Create an immutable Text object from a given string.
|
|
|
|
|
+ * Vertex coordinates, UVs and indices will be computed and stored in the Text object.
|
|
|
|
|
+ * For static text labels that do not change frequently, this means these computations
|
|
|
|
|
+ * need not be performed every frame.
|
|
|
*
|
|
*
|
|
|
* @param text The text to draw.
|
|
* @param text The text to draw.
|
|
|
* @param area The viewport area to draw within. Text will be clipped outside this rectangle.
|
|
* @param area The viewport area to draw within. Text will be clipped outside this rectangle.
|
|
@@ -209,9 +208,11 @@ public:
|
|
|
* @param wrap Wraps text to fit within the width of the viewport if true.
|
|
* @param wrap Wraps text to fit within the width of the viewport if true.
|
|
|
* @param rightToLeft Whether to draw text from right to left.
|
|
* @param rightToLeft Whether to draw text from right to left.
|
|
|
* @param clip A region to clip text within after applying justification to the viewport area.
|
|
* @param clip A region to clip text within after applying justification to the viewport area.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return A Text object.
|
|
|
*/
|
|
*/
|
|
|
- void drawText(const char* text, const Rectangle& area, const Vector4& color, unsigned int size = 0,
|
|
|
|
|
- Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false, const Rectangle* clip = NULL);
|
|
|
|
|
|
|
+ Text* createText(const char* text, const Rectangle& area, const Vector4& color, unsigned int size = 0,
|
|
|
|
|
+ Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false, const Rectangle* clip = NULL);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Measures a string's width and height without alignment, wrapping or clipping.
|
|
* Measures a string's width and height without alignment, wrapping or clipping.
|
|
@@ -239,10 +240,10 @@ public:
|
|
|
Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool ignoreClip = false);
|
|
Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool ignoreClip = false);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Get an index into a string corresponding to the character nearest the given location within the clip region.
|
|
|
|
|
|
|
+ * Get an character index into a string corresponding to the character nearest the given location within the clip region.
|
|
|
*/
|
|
*/
|
|
|
int getIndexAtLocation(const char* text, const Rectangle& clip, unsigned int size, const Vector2& inLocation, Vector2* outLocation,
|
|
int getIndexAtLocation(const char* text, const Rectangle& clip, unsigned int size, const Vector2& inLocation, Vector2* outLocation,
|
|
|
- Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false);
|
|
|
|
|
|
|
+ Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Get the location of the character at the given index.
|
|
* Get the location of the character at the given index.
|
|
@@ -286,10 +287,10 @@ private:
|
|
|
~Font();
|
|
~Font();
|
|
|
|
|
|
|
|
void getMeasurementInfo(const char* text, const Rectangle& area, unsigned int size, Justify justify, bool wrap, bool rightToLeft,
|
|
void getMeasurementInfo(const char* text, const Rectangle& area, unsigned int size, Justify justify, bool wrap, bool rightToLeft,
|
|
|
- std::vector<int>* xPositions, int* yPosition, std::vector<unsigned int>* lineLengths);
|
|
|
|
|
|
|
+ std::vector<int>* xPositions, int* yPosition, std::vector<unsigned int>* lineLengths);
|
|
|
|
|
|
|
|
int getIndexOrLocation(const char* text, const Rectangle& clip, unsigned int size, const Vector2& inLocation, Vector2* outLocation,
|
|
int getIndexOrLocation(const char* text, const Rectangle& clip, unsigned int size, const Vector2& inLocation, Vector2* outLocation,
|
|
|
- const int destIndex = -1, Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false);
|
|
|
|
|
|
|
+ const int destIndex = -1, Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false);
|
|
|
|
|
|
|
|
unsigned int getTokenWidth(const char* token, unsigned int length, unsigned int size, float scale);
|
|
unsigned int getTokenWidth(const char* token, unsigned int length, unsigned int size, float scale);
|
|
|
|
|
|