git-svn-id: https://scorched3d.svn.sourceforge.net/svnroot/scorched3d/trunk/scorched...
[scorched3d/parasti.git] / src / client / GLW / GLWFont.cpp
blob7d9ffda8297e42d89774d626f43ab23a7002eba7
1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2009
3 //
4 // This file is part of Scorched3D.
5 //
6 // Scorched3D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // Scorched3D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #include <GLW/GLWFont.h>
22 #include <common/Defines.h>
23 #include <console/ConsoleRuleMethodIAdapter.h>
24 #include <common/Logger.h>
26 Vector GLWFont::widgetFontColor = Vector(0.2f, 0.2f, 0.2f);
27 Vector GLWFont::disabledWidgetFontColor = Vector(0.4f, 0.4f, 0.4f);
29 GLWFont *GLWFont::instance_ = 0;
31 GLWFont *GLWFont::instance()
33 if (!instance_)
35 instance_ = new GLWFont;
38 return instance_;
41 GLWFont::GLWFont()
43 gameFont_ = new GLFont2d;
44 gameFont_->createFont(
45 S3D::getDataFile("data/fonts/dejavusconbd.ttf"),
46 16);
47 gameShadowFont_ = new GLFont2d;
48 gameShadowFont_->createFont(
49 S3D::getDataFile("data/fonts/dejavusconbd.ttf"),
50 16,
51 true);
52 courierFont_ = new GLFont2d;
53 courierFont_->createFont(
54 S3D::getDataFile("data/fonts/dejavusmobd.ttf"),
55 16);
56 normalFont_ = new GLFont2d;
57 normalFont_->createFont(
58 S3D::getDataFile("data/fonts/dejavusans.ttf"),
59 16);
60 normalShadowFont_ = new GLFont2d;
61 normalShadowFont_->createFont(
62 S3D::getDataFile("data/fonts/dejavusans.ttf"),
63 16,
64 true);
66 new ConsoleRuleMethodIAdapter<GLWFont>(
67 this, &GLWFont::displayCharacterInfo, "CharacterInfo");
70 GLWFont::~GLWFont()
75 void GLWFont::displayCharacterInfo()
77 Logger::log(S3D::formatStringBuffer("Characters : %u\nCharacter Blocks : %u\n",
78 GLFont2d::getTotalCharacters(),
79 GLFont2dStorage::getTotalCharacterBlocks()));