Allow changing fonts through the widget manager, plus *a lot* of code style improvements.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1369 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2007-12-25 03:23:32 +00:00
parent aa8fe0c5b3
commit 56e24ec8a6
26 changed files with 193 additions and 66 deletions

View File

@ -25,7 +25,8 @@
# define snprintf _snprintf
#endif
enum WidgetTokens {
enum WidgetTokens
{
WTOK_TITLE,
WTOK_PLYR1,
@ -43,7 +44,8 @@ ConfigControls::ConfigControls()
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED,
WGT_FONT_GUI );
widget_manager->insertColumn();
widget_manager->addWgt( WTOK_TITLE, 60, 7 );

View File

@ -30,7 +30,8 @@
# define snprintf _snprintf
#endif
enum WidgetTokens {
enum WidgetTokens
{
WTOK_TITLE,
WTOK_FULLSCREEN,
@ -57,7 +58,8 @@ ConfigDisplay::ConfigDisplay()
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED,
WGT_FONT_GUI );
widget_manager->insertColumn();
widget_manager->addWgt( WTOK_TITLE, 40, 7);

View File

@ -23,7 +23,8 @@
#include "menu_manager.hpp"
#include "translation.hpp"
enum WidgetTokens {
enum WidgetTokens
{
WTOK_TITLE,
WTOK_MUSIC,
@ -39,7 +40,8 @@ ConfigSound::ConfigSound()
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED,
WGT_FONT_GUI );
widget_manager->insertColumn();
widget_manager->addWgt(WTOK_TITLE, 40, 7);

View File

@ -69,7 +69,8 @@ CreditsMenu::CreditsMenu()
widget_manager->setInitialActivationState( true );
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", TEXT_SIZE );
widget_manager->setInitialTextState(SHOW_TEXT, "", TEXT_SIZE,
WGT_FONT_GUI );
widget_manager->addWgt( WTOK_CREDITS, 100, 93);
widget_manager->setWgtText( WTOK_CREDITS, credits_text );

View File

@ -23,7 +23,8 @@
#include "menu_manager.hpp"
#include "translation.hpp"
enum WidgetTokens {
enum WidgetTokens
{
WTOK_TITLE,
WTOK_HARD,
@ -38,7 +39,8 @@ Difficulty::Difficulty()
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED,
WGT_FONT_GUI );
widget_manager->insertColumn();
widget_manager->addWgt(WTOK_TITLE, 60, 7);

View File

@ -26,18 +26,9 @@ Font* font_race;
int init_fonts()
{
static int plib_font_was_init=0;
// Make sure that fntInit is only called once, since
// init_fonts might be called more than once
// (when switching to/from fullscreen mode, see sdldrv).
if(!plib_font_was_init)
{
fntInit();
plib_font_was_init=1;
}
font_gui = new Font("fonts/AvantGarde-Demi.txf");
font_gui = new Font("fonts/AvantGarde-Demi.txf");
font_race = new Font("fonts/DomesticManners.txf");
return (font_gui && font_race);
return ( font_gui && font_race );
} // init_fonts
// =============================================================================

View File

@ -23,7 +23,8 @@
#include "menu_manager.hpp"
#include "translation.hpp"
enum WidgetTokens {
enum WidgetTokens
{
WTOK_TITLE,
WTOK_GP,
WTOK_QUICKRACE,
@ -37,7 +38,8 @@ GameMode::GameMode()
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED,
WGT_FONT_GUI );
widget_manager->insertColumn();
widget_manager->addWgt(WTOK_TITLE, 50, 7);

View File

@ -46,7 +46,8 @@ GrandPrixSelect::GrandPrixSelect()
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED,
WGT_FONT_GUI );
widget_manager->insertColumn();
widget_manager->addWgt(WTOK_TITLE, 40, 7);

View File

@ -66,7 +66,8 @@ HelpPageOne::HelpPageOne()
const WidgetFontSize TEXT_SIZE = WGT_FNT_SML;
widget_manager->setInitialRectState( SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK );
widget_manager->setInitialTextState( SHOW_TEXT, "", TEXT_SIZE );
widget_manager->setInitialTextState( SHOW_TEXT, "", TEXT_SIZE,
WGT_FONT_GUI );
/*Help header*/
widget_manager->addWgt(WTOK_MSG1, 50, 7);

View File

@ -49,7 +49,8 @@ HelpPageTwo::HelpPageTwo()
const bool SHOW_RECT = true;
const WidgetFontSize TEXT_SIZE = WGT_FNT_SML;
widget_manager->setInitialRectState( SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK );
widget_manager->setInitialTextState( false, "", TEXT_SIZE );
widget_manager->setInitialTextState( false, "", TEXT_SIZE,
WGT_FONT_GUI );
widget_manager->addWgt(WTOK_MSG6, 100, 8);
widget_manager->setWgtText(WTOK_MSG6,

View File

@ -25,7 +25,8 @@
#include "menu_manager.hpp"
#include "translation.hpp"
enum WidgetTokens {
enum WidgetTokens
{
WTOK_SINGLE,
WTOK_MULTI,
WTOK_OPTIONS,
@ -41,7 +42,8 @@ MainMenu::MainMenu()
const bool SHOW_TEXT = true;
widget_manager->setInitialActivationState(true);
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED,
WGT_FONT_GUI );
widget_manager->insertColumn();
widget_manager->addWgt(WTOK_SINGLE, 25, 7);

View File

@ -224,8 +224,7 @@ void MenuManager::update()
widget_manager->lightenWgtColor( saved_widget );
widget_manager->pulseWgt( saved_widget );
widget_manager->setSelectedWgt(saved_widget);
} else if( widget_manager->getSelectedWgt() !=
WidgetManager::WGT_NONE )
} else if( widget_manager->getSelectedWgt() != WidgetManager::WGT_NONE )
{
widget_manager->lightenWgtColor (
widget_manager->getSelectedWgt() );

View File

@ -25,7 +25,8 @@
# define snprintf _snprintf
#endif
enum WidgetTokens {
enum WidgetTokens
{
WTOK_TITLE,
WTOK_NUMLAPS,

View File

@ -23,7 +23,8 @@
#include "menu_manager.hpp"
#include "translation.hpp"
enum WidgetTokens {
enum WidgetTokens
{
WTOK_PLAYER_2 = 2,
WTOK_PLAYER_3,
WTOK_PLAYER_4,

View File

@ -22,7 +22,8 @@
#include "menu_manager.hpp"
#include "translation.hpp"
enum WidgetTokens {
enum WidgetTokens
{
WTOK_TITLE,
WTOK_CONTROLS,
WTOK_DISPLAY,

View File

@ -70,7 +70,8 @@ PlayerControls::PlayerControls(int whichPlayer):
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED,
WGT_FONT_GUI );
widget_manager->addWgt( WTOK_TITLE, 60, 7);
sprintf(m_heading, _("Choose your controls, %s"),

View File

@ -28,9 +28,51 @@
#include "track.hpp"
#include "material_manager.hpp"
#include "menu_manager.hpp"
#include "widget_manager.hpp"
#include "translation.hpp"
#include "font.hpp"
//MAX_TOP_POS is the maximum number of racers to be shown in the bar to the
//left where the positions are drawn.
static const int MAX_TOP_POS = 10;
static const int MAX_HUMANS = 4;
enum WidgetTokens
{
WTOK_FPS,
WTOK_EMPTY1,
WTOK_CLOCK,
WTOK_EMPTY2,
WTOK_FIRST_TOP_IMG,
WTOK_LAST_TOP_IMG = WTOK_FIRST_TOP_IMG + MAX_TOP_POS,
WTOK_FIRST_TOP_TEXT,
WTOK_LAST_TOP_TEXT = WTOK_FIRST_TOP_TEXT + MAX_TOP_POS,
WTOK_FIRST_MESSAGE,
WTOK_LAST_MESSAGE = WTOK_FIRST_MESSAGE + MAX_HUMANS,
WTOK_FIRST_POWERBAR,
WTOK_LAST_POWERBAR = WTOK_FIRST_POWERBAR + MAX_HUMANS,
WTOK_FIRST_POSITION,
WTOK_LAST_POSITION = WTOK_FIRST_POSITION + MAX_HUMANS,
WTOK_MAP,
WTOK_FIRST_LAP,
WTOK_LAST_LAP = WTOK_FIRST_LAP + MAX_HUMANS,
WTOK_FIRST_WHEEL,
WTOK_LAST_WHEEL = WTOK_FIRST_WHEEL + MAX_HUMANS,
WTOK_FIRST_SPEED,
WTOK_LAST_SPEED = WTOK_FIRST_SPEED + MAX_HUMANS
};
RaceGUI::RaceGUI(): m_time_left(0.0)
{
// FIXME: translation problem
@ -60,11 +102,23 @@ RaceGUI::RaceGUI(): m_time_left(0.0)
m_fps_timer.update();
m_fps_timer.setMaxDelta(1000);
const bool HIDE_TEXT = false;
widget_manager->setInitialTextState(HIDE_TEXT, "", WGT_FNT_LRG,
WGT_FONT_RACE );
widget_manager->addWgt( WTOK_FPS, 30, 10 );
widget_manager->addWgt( WTOK_EMPTY1, 40, 10 );
widget_manager->addWgt( WTOK_CLOCK, 30, 10 );
widget_manager->breakLine();
widget_manager->layout( WGT_AREA_TOP );
} // RaceGUI
//-----------------------------------------------------------------------------
RaceGUI::~RaceGUI()
{
widget_manager->reset();
//FIXME: does all that material stuff need freeing somehow?
} // ~Racegui
@ -128,7 +182,13 @@ RaceGUI::handle(GameAction ga, int value)
m_fps_timer.reset();
m_fps_timer.setMaxDelta(1000);
m_fps_counter=0;
widget_manager->showWgtText( WTOK_FPS );
}
else
{
widget_manager->hideWgtText( WTOK_FPS );
}
break;
case GA_DEBUG_TOGGLE_WIREFRAME:
glPolygonMode(GL_FRONT_AND_BACK, isWireframe ? GL_FILL : GL_LINE);
@ -161,6 +221,8 @@ void RaceGUI::update(float dt)
assert(world != NULL);
drawStatusText(world->m_race_setup, dt);
cleanupMessages();
BaseGUI::update( dt );
} // update
//-----------------------------------------------------------------------------
@ -174,7 +236,8 @@ void RaceGUI::drawFPS ()
m_fps_counter = 0;
m_fps_timer.setMaxDelta(1000);
}
font_race->PrintShadow(m_fps_string,48, 0, user_config->m_height-50);
widget_manager->setWgtText( WTOK_FPS, m_fps_string );
} // drawFPS
//-----------------------------------------------------------------------------
@ -188,8 +251,9 @@ void RaceGUI::drawTimer ()
m_time_left = world->m_clock;
TimeToString(m_time_left, str);
font_race->PrintShadow(str, 60, user_config->m_width-260,
user_config->m_height-64);
widget_manager->showWgtText( WTOK_CLOCK );
widget_manager->setWgtText( WTOK_CLOCK, str );
} // drawTimer
//-----------------------------------------------------------------------------

View File

@ -29,7 +29,8 @@
#include "sound_manager.hpp"
#include "translation.hpp"
enum WidgetTokens {
enum WidgetTokens
{
WTOK_PAUSE,
WTOK_RETURN_RACE,
WTOK_OPTIONS,
@ -44,7 +45,8 @@ RaceMenu::RaceMenu()
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED,
WGT_FONT_GUI );
widget_manager->addWgt(WTOK_PAUSE, 30, 7);
widget_manager->setWgtText(WTOK_PAUSE, _("Paused"));

View File

@ -29,7 +29,8 @@
#include "highscore_manager.hpp"
#include "translation.hpp"
enum WidgetTokens {
enum WidgetTokens
{
WTOK_TITLE,
WTOK_EMPTY0,
WTOK_HIGHSCORES,
@ -48,7 +49,9 @@ RaceResultsGUI::RaceResultsGUI()
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED,
WGT_FONT_GUI );
widget_manager->addWgt(WTOK_TITLE, 60, 7);
widget_manager->setWgtText(WTOK_TITLE, _("Result"));
widget_manager->breakLine();

View File

@ -28,7 +28,8 @@
#include "material_manager.hpp"
#include "translation.hpp"
enum WidgetTokens {
enum WidgetTokens
{
WTOK_TITLE,
WTOK_TRACK0,
@ -68,7 +69,9 @@ TrackSel::TrackSel()
const bool SHOW_TEXT = true;
widget_manager->setInitialActivationState(true);
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_SML );
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_SML,
WGT_FONT_GUI );
for (unsigned int i = 0; i != track_manager->getTrackCount(); i += 2)
{
widget_manager->addWgt( WTOK_TRACK0 + i, 40, 7);

View File

@ -393,6 +393,7 @@ int main(int argc, char *argv[] )
//FIXME: this needs a better organization
drv_init();
ssgInit () ;
game_manager = new GameManager ();
// loadMaterials needs ssgLoadTextures (internally), which can
@ -407,6 +408,12 @@ int main(int argc, char *argv[] )
herring_manager -> loadDefaultHerrings();
attachment_manager -> loadModels ();
scene = new Scene();
//For some reason, calling this before the material loading screws
//the background picture.
fntInit();
init_fonts();
widget_manager = new WidgetManager;
menu_manager->switchToMainMenu();
@ -466,6 +473,7 @@ int main(int argc, char *argv[] )
fprintf(stderr,_("\nAborting SuperTuxKart\n"));
}
/* Program closing...*/
user_config->saveConfig();
drv_deinit();
@ -477,6 +485,8 @@ int main(int argc, char *argv[] )
}
delete highscore_manager;
delete_fonts();
return 0 ;
}

View File

@ -21,8 +21,6 @@
#include <SDL/SDL.h>
#include <plib/ssg.h>
#include "input.hpp"
#include "actionmap.hpp"
#include "user_config.hpp"
@ -83,8 +81,6 @@ void drv_init()
SDL_WM_SetCaption("SuperTuxKart", NULL);
ssgInit () ;
// Get into menu mode initially.
drv_setMode(MENU);
}

View File

@ -19,8 +19,6 @@
#include "widget.hpp"
#include "gui/font.hpp"
//FIXME: this should be removed when the scrolling is cleaned
#include "user_config.hpp"
@ -142,7 +140,7 @@ void Widget::update(const float DELTA)
if( m_enable_track )
{
if( m_track_num > track_manager->getTrackCount() - 1)
if( m_track_num > (int)(track_manager->getTrackCount()) - 1)
{
std::cerr << "Warning: widget tried to draw a track with a " <<
"number bigger than the amount of tracks available.\n";
@ -184,7 +182,7 @@ void Widget::update(const float DELTA)
// values to the left.
float left, right;
font_gui->getBBox(m_text.c_str(), m_text_size, false, &left, &right, NULL, NULL);
m_font->getBBox(m_text.c_str(), m_text_size, false, &left, &right, NULL, NULL);
int text_width = (int)(right - left + 0.99);
const int Y_LIMIT = lines * m_text_size + m_height;
@ -334,7 +332,7 @@ void Widget::update(const float DELTA)
line_end = m_text.find_first_of('\n', line_start);
if( draw )
{
font_gui->Print(m_text.substr(line_start, line_end - line_start).c_str(), m_text_size,
m_font->Print(m_text.substr(line_start, line_end - line_start).c_str(), m_text_size,
x_pos, y_pos,
255, 255, 255, m_text_scale, m_text_scale);
}
@ -495,7 +493,7 @@ void Widget::resizeToText()
if( !m_text.empty() )
{
float left, right, bottom, top;
font_gui->getBBox(m_text.c_str(), m_text_size, false, &left, &right, &bottom, &top);
m_font->getBBox(m_text.c_str(), m_text_size, false, &left, &right, &bottom, &top);
const int TEXT_WIDTH = (int)(right - left);
const int TEXT_HEIGHT = (int)(top - bottom);
@ -612,3 +610,18 @@ void Widget::darkenColor()
m_rect_color = WGT_TRANS_BLUE;
}
}
//-----------------------------------------------------------------------------
void Widget::setFont( const WidgetFont FONT )
{
switch( FONT )
{
case WGT_FONT_GUI:
m_font = font_gui;
break;
case WGT_FONT_RACE:
m_font = font_race;
break;
};
}

View File

@ -35,6 +35,7 @@
#if defined(WIN32) && !defined(__CYGWIN__)
# pragma warning(default:4312)
#endif
#include "gui/font.hpp"
#ifdef __APPLE__
@ -61,8 +62,14 @@ enum WidgetArea //One of the uses of this, is for rounded corners
WGT_AREA_ALL = (WGT_AREA_TOP | WGT_AREA_BOT)
};
//The lowest scroll values here must be bigger or lower than
//Widget::MAX_SCROLL
enum WidgetFont
{
WGT_FONT_GUI,
WGT_FONT_RACE
};
//The lowest scroll values here must be bigger than
//Widget::MAX_SCROLL or lower than -Widget::MAX_SCROLL
enum WidgetScrollPos
{
//For the X axis
@ -138,6 +145,7 @@ class Widget
bool m_enable_texture;
GLuint m_texture;
Font *m_font;
bool m_enable_text;
std::string m_text;
WidgetFontSize m_text_size;
@ -182,6 +190,8 @@ class Widget
void lightenColor();
void darkenColor();
void setFont( const WidgetFont FONT);
};
#endif

View File

@ -20,9 +20,6 @@
#include "user_config.hpp"
#include "gui/font.hpp"
//TEMP
#include <iostream>
#include <cstdlib>
#include <iterator>
@ -33,9 +30,10 @@ WidgetManager *widget_manager;
const int WidgetManager::WGT_NONE = -1;
WidgetManager::WidgetManager() :
m_prev_layout_pos(WGT_AREA_NONE), m_x( -1 ), m_y( -1 ), m_selected_wgt_token( WGT_NONE )
m_prev_layout_pos(WGT_AREA_NONE),
m_x( -1 ), m_y( -1 ),
m_selected_wgt_token( WGT_NONE )
{
init_fonts();
restoreDefaultStates();
}
@ -43,7 +41,6 @@ m_prev_layout_pos(WGT_AREA_NONE), m_x( -1 ), m_y( -1 ), m_selected_wgt_token( WG
WidgetManager::~WidgetManager()
{
reset();
delete_fonts();
}
//-----------------------------------------------------------------------------
@ -85,6 +82,7 @@ bool WidgetManager::addWgt
new_id.widget->m_enable_text = m_default_show_text;
new_id.widget->m_text.assign(m_default_text);
new_id.widget->m_text_size = m_default_text_size;
new_id.widget->setFont( m_default_font );
new_id.widget->m_enable_scroll = m_default_enable_scroll;
new_id.widget->m_scroll_pos_x = (float)m_default_scroll_preset_x;
@ -753,12 +751,14 @@ void WidgetManager::setInitialTextState
(
const bool SHOW,
const std::string TEXT,
const WidgetFontSize SIZE
const WidgetFontSize SIZE,
const WidgetFont FONT
)
{
m_default_show_text = SHOW;
m_default_text = TEXT;
m_default_text_size = SIZE;
m_default_font = FONT;
}
//-----------------------------------------------------------------------------
@ -800,6 +800,7 @@ void WidgetManager::restoreDefaultStates()
m_default_show_texture = false;
m_default_texture = 0;
m_default_show_text = false;
m_default_font = WGT_FONT_GUI;
m_default_text = "";
m_default_text_size = WGT_FNT_MED;
m_default_enable_scroll = false;
@ -956,6 +957,18 @@ void WidgetManager::setWgtTextSize( const int TOKEN, const WidgetFontSize SIZE)
}
}
//-----------------------------------------------------------------------------
void WidgetManager::setWgtFont( const int TOKEN, const WidgetFont FONT )
{
const int ID = findId(TOKEN);
if( ID != WGT_NONE ) m_widgets[ID].widget->setFont( FONT );
else
{
std::cerr << "WARNING: tried to set the font of an unnamed " <<
"widget with token " << TOKEN << '\n';
}
}
//-----------------------------------------------------------------------------
void WidgetManager::showWgtText( const int TOKEN )
{

View File

@ -39,7 +39,6 @@
* reset when you call reset() or you can use resetDefaultStates().
*/
class WidgetManager
{
struct WidgetID
@ -60,7 +59,6 @@ class WidgetManager
Widget *widget;
};
//The point of adding 'elements' is to use a vector to keep the order
enum ElementTypes
{
ET_WGT,
@ -71,7 +69,7 @@ class WidgetManager
/* I decided to waste one integer per break/column with the wgt_pos
* variable inside the WidgetElement struct, since otherwise we
* would need 2 vectors for breaks and columns, which would use more
* memory, be slower and be more complex than this. -Coz
* memory, be slower and more complex than this. -Coz
*/
struct WidgetElement
{
@ -93,14 +91,18 @@ class WidgetManager
int m_selected_wgt_token;
bool m_default_active;
bool m_default_show_rect;
bool m_default_rect_round_corners;
const GLfloat *m_default_rect_color;
bool m_default_show_texture;
int m_default_texture;
bool m_default_show_text;
std::string m_default_text;
WidgetFontSize m_default_text_size;
WidgetFont m_default_font;
bool m_default_enable_scroll;
WidgetScrollPos m_default_scroll_preset_x;
@ -130,7 +132,6 @@ class WidgetManager
int handleFinish(const int);
public:
//FIXME: maybe I should get this out of this class?
static const int WGT_NONE;
WidgetManager();
@ -179,7 +180,8 @@ public:
(
const bool SHOW,
const std::string TEXT,
const WidgetFontSize SIZE
const WidgetFontSize SIZE,
const WidgetFont FONT
);
void setInitialScrollState
@ -215,6 +217,7 @@ public:
void setWgtText( const int TOKEN, const char* TEXT );
void setWgtText( const int TOKEN, const std::string TEXT );
void setWgtTextSize( const int TOKEN, const WidgetFontSize SIZE);
void setWgtFont( const int TOKEN, const WidgetFont FONT);
void showWgtText( const int TOKEN );
void hideWgtText( const int TOKEN );