Renamed CGUIFont.{h,cpp} to scalable_font.{hc}pp, removed all

references to CGUIFont (so that the new mono-space-digits functions
can be used everywhere); some code cleanup. 


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5700 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-07-21 00:01:22 +00:00
parent 7557d4be8b
commit 2ad6b0a027
23 changed files with 104 additions and 81 deletions

View File

@ -77,8 +77,6 @@ supertuxkart_SOURCES = \
graphics/stars.hpp \
graphics/water_splash.hpp \
graphics/water_splash.cpp \
guiengine/CGUIFont.cpp \
guiengine/CGUIFont.h \
guiengine/CGUISpriteBank.cpp \
guiengine/CGUISpriteBank.h \
guiengine/abstract_state_manager.cpp \
@ -89,6 +87,8 @@ supertuxkart_SOURCES = \
guiengine/event_handler.hpp \
guiengine/modaldialog.cpp \
guiengine/modaldialog.hpp \
guiengine/scalable_font.cpp \
guiengine/scalable_font.hpp \
guiengine/screen_loader.cpp \
guiengine/screen.cpp \
guiengine/screen.hpp \

View File

@ -24,6 +24,7 @@
#include "graphics/material_manager.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "io/file_manager.hpp"
#include "items/item_manager.hpp"

View File

@ -409,9 +409,9 @@
#include "io/file_manager.hpp"
#include "input/input_manager.hpp"
#include "guiengine/CGUIFont.h"
#include "guiengine/event_handler.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/skin.hpp"
#include "guiengine/widget.hpp"
@ -427,9 +427,9 @@ namespace GUIEngine
{
IGUIEnvironment* g_env;
Skin* g_skin = NULL;
IGUIFont* g_font;
IGUIFont* g_title_font;
IGUIFont* g_small_font;
ScalableFont* g_font;
ScalableFont* g_title_font;
ScalableFont* g_small_font;
IrrlichtDevice* g_device;
IVideoDriver* g_driver;

View File

@ -29,6 +29,13 @@
#include "utils/constants.hpp"
#include "utils/ptr_vector.hpp"
namespace irr
{
namespace gui
{
class ScalableFont;
}
}
/**
* \ingroup guiengine
@ -73,9 +80,9 @@ namespace GUIEngine
{
extern irr::gui::IGUIEnvironment* g_env;
extern Skin* g_skin;
extern irr::gui::IGUIFont* g_small_font;
extern irr::gui::IGUIFont* g_font;
extern irr::gui::IGUIFont* g_title_font;
extern irr::gui::ScalableFont* g_small_font;
extern irr::gui::ScalableFont* g_font;
extern irr::gui::ScalableFont* g_title_font;
extern irr::IrrlichtDevice* g_device;
extern irr::video::IVideoDriver* g_driver;
@ -120,17 +127,17 @@ namespace GUIEngine
/**
* \return the smaller font (useful for less important messages)
*/
inline irr::gui::IGUIFont* getSmallFont() { return Private::g_small_font; }
inline irr::gui::ScalableFont* getSmallFont() { return Private::g_small_font; }
/**
* \return the "normal" font (useful for text)
*/
inline irr::gui::IGUIFont* getFont() { return Private::g_font; }
inline irr::gui::ScalableFont* getFont() { return Private::g_font; }
/**
* \return the "title" font (it's bigger and orange, useful for headers/captions)
*/
inline irr::gui::IGUIFont* getTitleFont() { return Private::g_title_font; }
inline irr::gui::ScalableFont* getTitleFont() { return Private::g_title_font; }
/**
* \return the currently shown screen, or NULL if none

View File

@ -2,14 +2,15 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CGUIFont.h"
#include "guiengine/scalable_font.hpp"
#include <iostream>
#include "IGUIEnvironment.h"
#include "IXMLReader.h"
#include "IReadFile.h"
#include "IVideoDriver.h"
#include "IGUISpriteBank.h"
#include <iostream>
#include "guiengine/engine.hpp"
#include "io/file_manager.hpp"
#include "utils/translation.hpp"
@ -340,19 +341,11 @@ core::dimension2d<u32> ScalableFont::getDimension(const wchar_t* text) const
for (const wchar_t* p = text; *p; ++p)
{
bool lineBreak=false;
if (*p == L'\r') // Windows breaks
if (*p == L'\r' || // Windows breaks
*p == L'\n' ) // Unix breaks
{
lineBreak = true;
if (p[1] == L'\n') // Windows breaks
if (*p==L'\r' && p[1] == L'\n') // Windows breaks
++p;
}
else if (*p == L'\n') // Unix breaks
{
lineBreak = true;
}
if (lineBreak)
{
dim.Height += thisLine.Height;
if (dim.Width < thisLine.Width)
dim.Width = thisLine.Width;
@ -437,7 +430,6 @@ void ScalableFont::draw(const core::stringw& text,
continue;
}
bool lineBreak=false;
if (c == L'\r' || // Windows breaks
c == L'\n' ) // Unix breaks
{

View File

@ -15,19 +15,21 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "guiengine/skin.hpp"
#include <cassert>
#include <stdexcept>
#include <iostream>
#include "config/user_config.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/skin.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/widgets.hpp"
#include "io/file_manager.hpp"
#include "states_screens/state_manager.hpp"
#include <cassert>
#include <stdexcept>
#include <iostream>
using namespace GUIEngine;
using namespace irr;

View File

@ -30,6 +30,7 @@ using namespace gui;
#include "graphics/irr_driver.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "io/file_manager.hpp"
#include "utils/string_utils.hpp"

View File

@ -15,8 +15,11 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "guiengine/engine.hpp"
#include "guiengine/widgets/label_widget.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
using namespace GUIEngine;
using namespace irr::core;
using namespace irr::gui;

View File

@ -17,17 +17,17 @@
#include "guiengine/widgets/ribbon_widget.hpp"
#include <cmath>
#include "graphics/irr_driver.hpp"
#include "guiengine/widgets/button_widget.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/widgets/button_widget.hpp"
#include "input/input_manager.hpp"
#include "io/file_manager.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/string_utils.hpp"
#include <cmath>
using namespace GUIEngine;
using namespace irr::core;
using namespace irr::gui;

View File

@ -296,10 +296,6 @@
RelativePath="..\..\guiengine\abstract_state_manager.cpp"
>
</File>
<File
RelativePath="..\..\guiengine\CGUIFont.cpp"
>
</File>
<File
RelativePath="..\..\guiengine\CGUISpriteBank.cpp"
>
@ -334,6 +330,10 @@
RelativePath="..\..\guiengine\modaldialog.cpp"
>
</File>
<File
RelativePath="..\..\guiengine\scalable_font.cpp"
>
</File>
<File
RelativePath="..\..\guiengine\screen.cpp"
>
@ -1092,10 +1092,6 @@
RelativePath="..\..\guiengine\abstract_state_manager.hpp"
>
</File>
<File
RelativePath="..\..\guiengine\CGUIFont.h"
>
</File>
<File
RelativePath="..\..\guiengine\engine.hpp"
>
@ -1108,6 +1104,10 @@
RelativePath="..\..\guiengine\modaldialog.hpp"
>
</File>
<File
RelativePath="..\..\guiengine\scalable_font.hpp"
>
</File>
<File
RelativePath="..\..\guiengine\screen.hpp"
>

View File

@ -15,10 +15,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "guiengine/screen.hpp"
#include "guiengine/widget.hpp"
#include "states_screens/credits.hpp"
#include "states_screens/state_manager.hpp"
#include <fstream>
@ -28,12 +25,14 @@ using irr::core::stringc;
#include "config/user_config.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/widget.hpp"
#include "io/file_manager.hpp"
#include "states_screens/state_manager.hpp"
DEFINE_SCREEN_SINGLETON( CreditsScreen );
using namespace GUIEngine;
const float TIME_SECTION_FADE = 0.8f;
const float ENTRIES_FADE_TIME = 0.3f;

View File

@ -15,14 +15,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "states_screens/dialogs/add_device_dialog.hpp"
#include "config/player.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/widget.hpp"
#include "guiengine/widgets/button_widget.hpp"
#include "input/device_manager.hpp"
#include "input/input_manager.hpp"
#include "states_screens/dialogs/add_device_dialog.hpp"
#include "states_screens/options_screen_players.hpp"
#include "states_screens/options_screen_input.hpp"
#include "states_screens/state_manager.hpp"
@ -37,7 +38,7 @@ using namespace irr::core;
AddDeviceDialog::AddDeviceDialog() : ModalDialog(0.7f, 0.7f)
{
IGUIFont* font = GUIEngine::getFont();
ScalableFont* font = GUIEngine::getFont();
const int textHeight = GUIEngine::getFontHeight();
const int buttonHeight = textHeight + 10;

View File

@ -15,14 +15,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "states_screens/dialogs/confirm_resolution_dialog.hpp"
#include "config/player.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/widgets/button_widget.hpp"
#include "input/device_manager.hpp"
#include "input/input_manager.hpp"
#include "states_screens/dialogs/confirm_resolution_dialog.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/string_utils.hpp"
#include "utils/translation.hpp"
@ -37,7 +38,7 @@ ConfirmResolutionDialog::ConfirmResolutionDialog() : ModalDialog(0.7f, 0.7f)
{
m_countdown_message = NULL;
IGUIFont* font = GUIEngine::getFont();
ScalableFont* font = GUIEngine::getFont();
const int textHeight = GUIEngine::getFontHeight();
const int buttonHeight = textHeight + 10;

View File

@ -15,11 +15,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "states_screens/dialogs/player_info_dialog.hpp"
#include "config/player.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/widgets.hpp"
#include "states_screens/dialogs/player_info_dialog.hpp"
#include "states_screens/options_screen_players.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/string_utils.hpp"
@ -47,7 +48,7 @@ void PlayerInfoDialog::showRegularDialog()
const int y3 = m_area.getHeight()*3/6;
const int y4 = m_area.getHeight()*5/6;
IGUIFont* font = GUIEngine::getFont();
ScalableFont* font = GUIEngine::getFont();
const int textHeight = GUIEngine::getFontHeight();
const int buttonHeight = textHeight + 10;

View File

@ -15,8 +15,11 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "states_screens/dialogs/race_over_dialog.hpp"
#include "challenges/unlock_manager.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/widgets.hpp"
#include "io/file_manager.hpp"
#include "input/input_manager.hpp"
@ -26,7 +29,6 @@
#include "modes/world.hpp"
#include "network/network_manager.hpp"
#include "race/race_manager.hpp"
#include "states_screens/dialogs/race_over_dialog.hpp"
#include "states_screens/feature_unlocked.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/race_setup_screen.hpp"

View File

@ -17,7 +17,10 @@
#include "states_screens/dialogs/race_paused_dialog.hpp"
#include <string>
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/widgets.hpp"
#include "input/input_manager.hpp"
#include "io/file_manager.hpp"
@ -31,7 +34,6 @@
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include <string>
using namespace GUIEngine;
using namespace irr::core;
using namespace irr::gui;
@ -43,7 +45,7 @@ RacePausedDialog::RacePausedDialog(const float percentWidth, const float percent
{
World::getWorld()->pause(WorldStatus::IN_GAME_MENU_PHASE);
IGUIFont* font = GUIEngine::getTitleFont();
ScalableFont* font = GUIEngine::getTitleFont();
const int text_height = GUIEngine::getFontHeight();
IGUIFont* titlefont = GUIEngine::getTitleFont();

View File

@ -1,8 +1,11 @@
#include "states_screens/feature_unlocked.hpp"
#include <SColor.h>
#include "challenges/challenge.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "io/file_manager.hpp"
#include "items/item_manager.hpp"
#include "karts/kart.hpp"
@ -15,8 +18,6 @@
#include "tracks/track_manager.hpp"
#include "utils/translation.hpp"
#include <SColor.h>
using namespace irr::core;
using namespace irr::gui;
using namespace irr::video;

View File

@ -1,11 +1,15 @@
#include "states_screens/grand_prix_lose.hpp"
#include <SColor.h>
#include <iostream>
#include "audio/music_manager.hpp"
#include "audio/sfx_manager.hpp"
#include "challenges/unlock_manager.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/widgets/label_widget.hpp"
#include "io/file_manager.hpp"
#include "items/item_manager.hpp"
@ -14,9 +18,6 @@
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include <SColor.h>
#include <iostream>
using namespace irr::core;
using namespace irr::gui;
using namespace irr::video;

View File

@ -1,11 +1,15 @@
#include "states_screens/grand_prix_win.hpp"
#include <SColor.h>
#include <iostream>
#include "audio/music_manager.hpp"
#include "audio/sfx_manager.hpp"
#include "challenges/unlock_manager.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/widgets/label_widget.hpp"
#include "io/file_manager.hpp"
#include "items/item_manager.hpp"
@ -14,9 +18,6 @@
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include <SColor.h>
#include <iostream>
using namespace irr::core;
using namespace irr::gui;
using namespace irr::video;

View File

@ -30,6 +30,7 @@ using namespace irr;
#include "graphics/material_manager.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/scalable_font.hpp"
#include "io/file_manager.hpp"
#include "input/input.hpp"
#include "input/input_manager.hpp"
@ -316,7 +317,7 @@ void RaceGUI::drawGlobalTimer()
pos += core::vector2d<s32>(0, UserConfigParams::m_height/2);
}
gui::IGUIFont* font = GUIEngine::getFont();
gui::ScalableFont* font = GUIEngine::getFont();
font->draw(sw.c_str(), pos, time_color);
} // DRAWGLOBALTimer
@ -385,8 +386,8 @@ void RaceGUI::drawGlobalPlayerIcons(const KartIconDisplayInfo* info)
ICON_PLAYER_WIDTH = 35;
}
gui::IGUIFont* font = GUIEngine::getFont();
World *world = World::getWorld();
gui::ScalableFont* font = GUIEngine::getFont();
World *world = World::getWorld();
const unsigned int kart_amount = world->getNumKarts();
for(unsigned int i = 0; i < kart_amount ; i++)
{
@ -646,9 +647,8 @@ void RaceGUI::drawLap(const KartIconDisplayInfo* info, const Kart* kart,
pos.UpperLeftCorner.X = viewport.UpperLeftCorner.X + (int)(0.05f*UserConfigParams::m_width);
}
gui::IGUIFont* font = GUIEngine::getFont();
int font_height = (int)(font->getDimension(L"X").Height);
gui::ScalableFont* font = GUIEngine::getFont();
int font_height = (int)(font->getDimension(L"X").Height);
if (kart->hasFinishedRace())
{

View File

@ -20,6 +20,7 @@
#include "states_screens/race_result_gui.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "modes/world.hpp"
#include "states_screens/dialogs/race_over_dialog.hpp"
#include "utils/string_utils.hpp"
@ -28,19 +29,19 @@
*/
RaceResultGUI::RaceResultGUI()
{
#undef USE_NEW_RACE_RESULT
#define USE_NEW_RACE_RESULT
#ifndef USE_NEW_RACE_RESULT
// FIXME: for now disable the new race result display
// by just firing up the old display (which will make sure
// that the rendering for this object is not called anymore).
new RaceOverDialog(0.6f, 0.9f);
return;
// FIXME: for now disable the new race result display
// by just firing up the old display (which will make sure
// that the rendering for this object is not called anymore).
new RaceOverDialog(0.6f, 0.9f);
return;
#else
determineLayout();
m_timer = 0;
m_animation_state = RR_BEGIN_FIRST_TABLE;
#endif
#endif
} // RaceResultGUI
//-----------------------------------------------------------------------------
@ -67,7 +68,7 @@ void RaceResultGUI::nextPhase()
*/
void RaceResultGUI::determineLayout()
{
m_font = dynamic_cast<gui::ScalableFont*>(GUIEngine::getFont());
m_font = GUIEngine::getFont();
assert(m_font);
World *world = World::getWorld();
world->raceResultOrder(&m_order);

View File

@ -20,11 +20,18 @@
#ifndef HEADER_RACE_RESULT_GUI_HPP
#define HEADER_RACE_RESULT_GUI_HPP
#include "states_screens/race_gui_base.hpp"
#include <assert.h>
#include <vector>
#include "states_screens/race_gui_base.hpp"
#include "guiengine/CGUIFont.h"
namespace irr
{
namespace gui
{
class ScalableFont;
}
}
/**
* \brief Displays the results (while the end animation is shown).