Ejemplo n.º 1
0
void loadingscreen(string s)
{
	extern FTGLPixmapFont* font;
	int size=36;
	font->FaceSize(size);
	
	FTSimpleLayout status;
	status.SetFont(font);
	status.SetAlignment(FTGL::ALIGN_CENTER);
	status.SetLineLength(WINDOW_X);
	FTBBox box=status.BBox(s.c_str());
	float boxx=box.Upper().Xf()-box.Lower().Xf(),
		boxy=box.Upper().Yf()-box.Lower().Yf();
	
	glDisable(GL_LIGHTING);

	glViewport(0,0,WINDOW_X,WINDOW_Y);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	
		
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluOrtho2D(0,1,0,1);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	glEnable(GL_TEXTURE_2D);
	glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);	
	glBindTexture(GL_TEXTURE_2D, textures[LOADTX]);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	glBegin(GL_QUADS);
			glTexCoord2i(0,0);
			glVertex2i(0,0);
			glTexCoord2i(1,0);
			glVertex2i(1,0);
			glTexCoord2i(1,1);
			glVertex2i(1,1);
			glTexCoord2i(0,1);
			glVertex2i(0,1);
	glEnd();
	glDisable(GL_TEXTURE_2D);
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluOrtho2D(0,WINDOW_X,0,WINDOW_Y);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glRasterPos2i(0,WINDOW_Y/2+boxy/2-size-status.GetLineSpacing());
	status.Render(s.c_str());
	glRasterPos2i(0,0);

	glfwSwapBuffers();
}
Ejemplo n.º 2
0
        void Chowdren::RenderText( Gwen::Font* pFont, Gwen::Point pos,
            const Gwen::UnicodeString & text )
        {
            if (!init_font())
                return;

            FTTextureFont* font = get_font(pFont->size);
            if (font) {
			    Translate(pos.x, pos.y);
                FTTextureFont::color = m_Color;
                FTSimpleLayout layout;
                layout.SetLineLength(10000);
                layout.SetFont(font);
                layout.Render(text.c_str(), -1, FTPoint(pos.x, pos.y + font->Ascender()));
            }
        }