@@ -1722,6 +1722,12 @@ Font::Text::Text(const char* text) : _vertexCount(0), _indexCount(0)
_indices = new unsigned short[((length - 1) * 6) + 4];
}
+Font::Text::~Text()
+{
+ SAFE_DELETE_ARRAY(_vertices);
+ SAFE_DELETE_ARRAY(_indices);
+}
+
const char* Font::Text::getText()
{
return _text.c_str();
@@ -76,13 +76,29 @@ public:
float uvs[4];
};
+ /**
+ * Vertex coordinates, UVs and indices can be computed and stored in a Text object.
+ * For static text labels that do not change frequently, this means these computations
+ * need not be performed every frame.
+ */
class Text
friend class Font;
public:
+ * Constructor.
Text(const char* text);
+ * Destructor.
+ ~Text();
+ * Get the string that will be drawn from this Text object.
const char* getText();
private:
@@ -164,6 +164,7 @@ void Form::setSize(float width, float height)
RenderTarget* rt = RenderTarget::create(_id.c_str(), w, h);
GP_ASSERT(rt);
_frameBuffer->setRenderTarget(rt);
+ SAFE_RELEASE(rt);
// Re-create projection matrix.
Matrix::createOrthographicOffCenter(0, width, height, 0, 0, 1, &_projectionMatrix);