Exemple #1
0
		void Drawer<Text>::Draw(Text& text, float x, float y, float w, float h)
		{
			::Window::GUI::TextRenderer::RenderedText RenderedInfo;
			text.font.RenderText(text.Get(), RenderedInfo, Workspace::metrics.GetDPI());
			
			glEnable(GL_TEXTURE_2D);
			glBindTexture(GL_TEXTURE_2D, RenderedInfo.texture);
			glPushMatrix();
			glTranslatef(x, y, 0.0f);
			glBegin(GL_QUADS);
				glColor4f(1.0f,1.0f,1.0f,1.0f);
				glTexCoord2f(0.0f, 0.0f);
				glVertex2f(0.0f, 0.0f);

				glTexCoord2f(RenderedInfo.maxX, 0.0f);
				glVertex2f(RenderedInfo.w, 0.0f);

				glTexCoord2f(RenderedInfo.maxX, RenderedInfo.maxY);
				glVertex2f(RenderedInfo.w, RenderedInfo.h);

				glTexCoord2f(0.0f, RenderedInfo.maxY);
				glVertex2f(0.0f, RenderedInfo.h);
			glEnd();
			glPopMatrix();
			glDisable(GL_TEXTURE_2D);
		}
Exemple #2
0
		void Drawer<Text>::GetOuterSize(Text& text, float& w, float& h)
		{
			::Window::GUI::TextRenderer::TextDimension dims;
			dims = text.font.GetTextSize(text.Get(), Workspace::metrics.GetDPI());
			w = dims.w;
			h = dims.h;
		}