1 /***************************************************************************
2                           label.cpp  -  A simple text label widget
3                              -------------------
4     begin                : za jun 9 2007
5     copyright            : (C) 2007 by CJP
6     email                : cornware-cjp@users.sourceforge.net
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 #include <GL/gl.h>
18 
19 #include "console.h"
20 
21 #include "label.h"
22 
CLabel()23 CLabel::CLabel()
24  : CWidget()
25 {
26 	loadConsoleFont();
27 }
28 
29 
~CLabel()30 CLabel::~CLabel()
31 {
32 }
33 
onRedraw()34 int CLabel::onRedraw()
35 {
36 	CWidget::onRedraw();
37 
38 	glPushMatrix();
39 	glTranslatef(m_W/2 - 0.5*theConsoleFont->getFontW()*m_Text.size(), 0.0, 0.0);
40 
41 	theConsoleFont->enable();
42 	theConsoleFont->drawString(m_Text);
43 	theConsoleFont->disable();
44 	glPopMatrix();
45 
46 	return 0;
47 }
48 
49