Widgets can now be resized depending on their text when calling layout(); plus, some clean ups.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1790 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -37,7 +37,7 @@ ChallengesMenu::ChallengesMenu()
|
||||
const bool SHOW_TEXT = true;
|
||||
widget_manager->setInitialActivationState(false);
|
||||
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
|
||||
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED, WGT_FONT_GUI, WGT_WHITE );
|
||||
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED, WGT_FONT_GUI, WGT_WHITE, false );
|
||||
|
||||
widget_manager->addWgt( WTOK_TITLE, 60, 10);
|
||||
widget_manager->showWgtRect( WTOK_TITLE );
|
||||
|
||||
@@ -67,10 +67,10 @@ CharSel::CharSel(int whichPlayer)
|
||||
widget_manager->setInitialActivationState(false);
|
||||
widget_manager->addWgt( WTOK_TITLE, 60, 10);
|
||||
widget_manager->showWgtRect( WTOK_TITLE );
|
||||
char HEADING[MAX_MESSAGE_LENGTH];
|
||||
snprintf(HEADING, sizeof(HEADING), _("Player %d, choose a driver"),
|
||||
char heading[MAX_MESSAGE_LENGTH];
|
||||
snprintf(heading, sizeof(heading), _("Player %d, choose a driver"),
|
||||
m_player_index + 1);
|
||||
widget_manager->setWgtText( WTOK_TITLE, HEADING);
|
||||
widget_manager->setWgtText( WTOK_TITLE, heading);
|
||||
widget_manager->setWgtTextSize( WTOK_TITLE, WGT_FNT_LRG);
|
||||
widget_manager->showWgtText( WTOK_TITLE );
|
||||
widget_manager->breakLine();
|
||||
|
||||
@@ -34,43 +34,22 @@ enum WidgetTokens
|
||||
WTOK_PLYR3,
|
||||
WTOK_PLYR4,
|
||||
|
||||
WTOK_SPACE,
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
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,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
|
||||
widget_manager->insertColumn();
|
||||
widget_manager->addWgt( WTOK_TITLE, 60, 7 );
|
||||
widget_manager->setWgtText( WTOK_TITLE, _("Edit controls for which player?"));
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, _("Edit controls for which player?"));
|
||||
|
||||
widget_manager->setInitialActivationState(true);
|
||||
widget_manager->addWgt( WTOK_PLYR1 , 60, 7 );
|
||||
widget_manager->setWgtText( WTOK_PLYR1, _("Player 1"));
|
||||
widget_manager->addTextButtonWgt( WTOK_PLYR1 , 60, 7, _("Player 1"));
|
||||
widget_manager->addTextButtonWgt( WTOK_PLYR2 , 60, 7, _("Player 2"));
|
||||
widget_manager->addTextButtonWgt( WTOK_PLYR3 , 60, 7, _("Player 3"));
|
||||
widget_manager->addTextButtonWgt( WTOK_PLYR4 , 60, 7, _("Player 4"));
|
||||
|
||||
widget_manager->addWgt( WTOK_PLYR2 , 60, 7 );
|
||||
widget_manager->setWgtText( WTOK_PLYR2, _("Player 2"));
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 60, 5);
|
||||
|
||||
widget_manager->addWgt( WTOK_PLYR3 , 60, 7 );
|
||||
widget_manager->setWgtText( WTOK_PLYR3, _("Player 3"));
|
||||
|
||||
widget_manager->addWgt( WTOK_PLYR4 , 60, 7 );
|
||||
widget_manager->setWgtText( WTOK_PLYR4, _("Player 4"));
|
||||
|
||||
widget_manager->addWgt( WTOK_SPACE, 60, 5);
|
||||
widget_manager->deactivateWgt( WTOK_SPACE );
|
||||
widget_manager->hideWgtRect( WTOK_SPACE );
|
||||
widget_manager->hideWgtText( WTOK_SPACE );
|
||||
|
||||
widget_manager->addWgt( WTOK_QUIT , 60, 7 );
|
||||
widget_manager->setWgtText( WTOK_QUIT, _("Press <ESC> to go back"));
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT , 60, 7, _("Press <ESC> to go back"));
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
|
||||
widget_manager->layout( WGT_AREA_ALL );
|
||||
|
||||
@@ -41,69 +41,24 @@ enum WidgetTokens
|
||||
WTOK_APPLY_RES,
|
||||
WTOK_CLEAR_BLACKLIST,
|
||||
|
||||
WTOK_EMPTY,
|
||||
WTOK_EMPTY1,
|
||||
WTOK_EMPTY2,
|
||||
WTOK_EMPTY3,
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
ConfigDisplay::ConfigDisplay()
|
||||
{
|
||||
//This is commented because there is no point in checking the resolution
|
||||
//when we enter the display configuration every time; this should be done
|
||||
//at the start of the program and after the resolution confirm screen.
|
||||
#if 0
|
||||
// The following code comes before the widget code because it may change
|
||||
// the fullscreen status, which is used in displaying the WTOK_FULLSCREEN
|
||||
// text.
|
||||
|
||||
if( user_config->m_width != user_config->m_prev_width &&
|
||||
user_config->m_height != user_config->m_prev_height )
|
||||
{
|
||||
changeResolution( user_config->m_prev_width, user_config->m_prev_height, true );
|
||||
}
|
||||
else if( user_config->m_prev_windowed && user_config->m_fullscreen )
|
||||
{
|
||||
inputDriver->toggleFullscreen();
|
||||
user_config->m_prev_windowed = false;
|
||||
user_config->m_crashed = false;
|
||||
user_config->saveConfig();
|
||||
}
|
||||
else //no problems detected
|
||||
{
|
||||
user_config->m_crashed = false;
|
||||
user_config->saveConfig();
|
||||
}
|
||||
#endif
|
||||
getScreenModes(); //Fill the vector m_sizes with possible resolutions
|
||||
|
||||
m_curr_width = m_sizes[m_curr_res].first;
|
||||
m_curr_height = m_sizes[m_curr_res].second;
|
||||
|
||||
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,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
|
||||
widget_manager->insertColumn();
|
||||
widget_manager->addWgt( WTOK_TITLE, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_TITLE, _("Display Settings"));
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 40, 7, _("Display Settings"));
|
||||
|
||||
widget_manager->setInitialActivationState(true);
|
||||
widget_manager->addWgt( WTOK_FULLSCREEN, 40, 7);
|
||||
if( isBlacklisted( m_curr_width, m_curr_height ))
|
||||
{
|
||||
if (!(user_config->m_fullscreen))
|
||||
{
|
||||
// widget_manager->setWgtText(WTOK_FULLSCREEN, _("Fullscreen Unavailable"));
|
||||
widget_manager->hideWgtText(WTOK_FULLSCREEN);
|
||||
widget_manager->hideWgtRect(WTOK_FULLSCREEN);
|
||||
widget_manager->deactivateWgt(WTOK_FULLSCREEN);
|
||||
}
|
||||
else
|
||||
widget_manager->addEmptyWgt( WTOK_FULLSCREEN, 40, 7);
|
||||
|
||||
if (user_config->m_fullscreen)
|
||||
{
|
||||
std::cerr << "Warning: current screen mode is blacklisted.\n";
|
||||
}
|
||||
@@ -112,74 +67,41 @@ ConfigDisplay::ConfigDisplay()
|
||||
{
|
||||
if(user_config->m_fullscreen)
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_FULLSCREEN, _("Window mode"));
|
||||
widget_manager->addTextButtonWgt( WTOK_FULLSCREEN, 40, 7,
|
||||
_("Window mode"));
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_FULLSCREEN, _("Fullscreen mode"));
|
||||
widget_manager->addTextButtonWgt( WTOK_FULLSCREEN, 40, 7,
|
||||
_("Fullscreen mode"));
|
||||
}
|
||||
}
|
||||
|
||||
widget_manager->addWgt( WTOK_EMPTY, 40, 2);
|
||||
widget_manager->deactivateWgt( WTOK_EMPTY );
|
||||
widget_manager->hideWgtRect( WTOK_EMPTY );
|
||||
widget_manager->hideWgtText( WTOK_EMPTY );
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2 );
|
||||
|
||||
widget_manager->addWgt( WTOK_CURRENT_RES, 40, 7);
|
||||
char msg [MAX_MESSAGE_LENGTH];
|
||||
snprintf( msg, MAX_MESSAGE_LENGTH, _("Current: %dx%d"), m_curr_width, m_curr_height );
|
||||
widget_manager->setWgtText( WTOK_CURRENT_RES, msg );
|
||||
widget_manager->addTextWgt( WTOK_CURRENT_RES, 40, 7, msg);
|
||||
|
||||
widget_manager->addWgt( WTOK_INCR_RES, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_INCR_RES, _("Increase Resolution"));
|
||||
widget_manager->addTextButtonWgt( WTOK_INCR_RES, 40, 7,
|
||||
_("Increase Resolution"));
|
||||
widget_manager->addTextButtonWgt( WTOK_DECR_RES, 40, 7,
|
||||
_("Decrease Resolution"));
|
||||
|
||||
widget_manager->addWgt( WTOK_DECR_RES, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_DECR_RES, _("Decrease Resolution"));
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2 );
|
||||
widget_manager->addTextButtonWgt( WTOK_APPLY_RES, 40, 7, _("Apply "));
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2 );
|
||||
|
||||
widget_manager->addWgt( WTOK_EMPTY2, 40, 2);
|
||||
widget_manager->deactivateWgt( WTOK_EMPTY2 );
|
||||
widget_manager->hideWgtRect( WTOK_EMPTY2 );
|
||||
widget_manager->hideWgtText( WTOK_EMPTY2 );
|
||||
widget_manager->addEmptyWgt( WTOK_CLEAR_BLACKLIST, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_CLEAR_BLACKLIST,
|
||||
_("Clear from Blacklist") );
|
||||
|
||||
widget_manager->addWgt( WTOK_APPLY_RES, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_APPLY_RES, _("Apply "));
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2 );
|
||||
|
||||
widget_manager->addWgt( WTOK_EMPTY3, 40, 2);
|
||||
widget_manager->deactivateWgt( WTOK_EMPTY3 );
|
||||
widget_manager->hideWgtRect( WTOK_EMPTY3 );
|
||||
widget_manager->hideWgtText( WTOK_EMPTY3 );
|
||||
|
||||
widget_manager->addWgt( WTOK_CLEAR_BLACKLIST, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_CLEAR_BLACKLIST, _("Clear from Blacklist"));
|
||||
widget_manager->deactivateWgt( WTOK_CLEAR_BLACKLIST);
|
||||
widget_manager->hideWgtRect( WTOK_CLEAR_BLACKLIST);
|
||||
widget_manager->hideWgtText( WTOK_CLEAR_BLACKLIST);
|
||||
|
||||
|
||||
widget_manager->addWgt( WTOK_EMPTY1, 40, 7);
|
||||
widget_manager->deactivateWgt( WTOK_EMPTY1 );
|
||||
widget_manager->hideWgtRect( WTOK_EMPTY1 );
|
||||
widget_manager->hideWgtText( WTOK_EMPTY1 );
|
||||
|
||||
widget_manager->addWgt( WTOK_QUIT, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_QUIT, _("Press <ESC> to go back"));
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 40, 7, _("Press <ESC> to go back"));
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
|
||||
widget_manager->layout( WGT_AREA_ALL );
|
||||
|
||||
//Custom resolutions are disabled because, SDL *should* give the all the
|
||||
//the available resolutions (i.e. there is no point in using a custom
|
||||
//res), and there is the risk of users changing the configuration to a
|
||||
//setting that causes a crash.
|
||||
#if 0
|
||||
if (m_curr_res == -1) //A custom res has been set previously that is not in list
|
||||
{
|
||||
snprintf (m_resolution, MAX_MESSAGE_LENGTH, _("Current: %dx%d"), user_config->m_width, user_config->m_height);
|
||||
widget_manager->setWgtText(WTOK_CURRENT_RES, m_resolution);
|
||||
}
|
||||
else // Find the current res from those in the list
|
||||
{}
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -252,7 +174,6 @@ void ConfigDisplay::select()
|
||||
if ( isBlacklisted( user_config->m_width,
|
||||
user_config->m_height ))
|
||||
{
|
||||
//widget_manager->setWgtText(WTOK_FULLSCREEN, _("Fullscreen Unavailable"));
|
||||
widget_manager->hideWgtText(WTOK_FULLSCREEN);
|
||||
widget_manager->hideWgtRect(WTOK_FULLSCREEN);
|
||||
widget_manager->deactivateWgt(WTOK_FULLSCREEN);
|
||||
@@ -365,25 +286,6 @@ void ConfigDisplay::getScreenModes()
|
||||
|
||||
//FIXME: blacklist all resolutions
|
||||
|
||||
#if 0
|
||||
//This isn't enabled because SDL_VideoInfo must be called before the
|
||||
//first SDL_SetVideoMode() call to get the desktop resolution.
|
||||
|
||||
//Erase any resolutions from the list that are bigger than the
|
||||
//current desktop resolution
|
||||
const SDL_VideoInfo *VIDEO_INFO = SDL_GetVideoInfo();
|
||||
|
||||
const int NUM_RES = m_sizes.size();
|
||||
for (int i = 0; i < NUM_RES; ++i)
|
||||
{
|
||||
if (m_sizes[i].first > VIDEO_INFO->current_w &&
|
||||
m_sizes[i].second > VIDEO_INFO->current_h)
|
||||
{
|
||||
m_sizes.erase( m_sizes.begin() + i, m_sizes.end() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (modes == (SDL_Rect **)-1) //Any screen size can be used
|
||||
{
|
||||
@@ -457,24 +359,6 @@ void ConfigDisplay::changeApplyButton()
|
||||
widget_manager->deactivateWgt(WTOK_CLEAR_BLACKLIST);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#if 0
|
||||
int ConfigDisplay::isBlacklisted()
|
||||
{
|
||||
int black_width, black_height = 0;
|
||||
for (int i = 0; i < m_blacklist_res_size; i++)
|
||||
{
|
||||
sscanf(user_config->m_blacklist_res[i].c_str(),
|
||||
"%dx%d",& black_width, & black_height);
|
||||
|
||||
if (m_sizes[m_curr_res].first == black_width
|
||||
&& m_sizes[m_curr_res].second == black_height)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ConfigDisplay::isBlacklisted(int width, int height)
|
||||
{
|
||||
|
||||
@@ -31,51 +31,36 @@ enum WidgetTokens
|
||||
WTOK_MUSIC,
|
||||
WTOK_SFX,
|
||||
|
||||
WTOK_EMPTY,
|
||||
|
||||
WTOK_QUIT,
|
||||
};
|
||||
|
||||
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,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
|
||||
widget_manager->insertColumn();
|
||||
widget_manager->addWgt(WTOK_TITLE, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_TITLE, _("Sound Settings"));
|
||||
widget_manager->addTitleWgt(WTOK_TITLE, 40, 7, _("Sound Settings"));
|
||||
|
||||
widget_manager->setInitialActivationState(true);
|
||||
widget_manager->addWgt(WTOK_MUSIC, 40, 7);
|
||||
if( user_config->doMusic() )
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_MUSIC, _("Turn off music"));
|
||||
widget_manager->addTextButtonWgt( WTOK_MUSIC, 40, 7, _("Turn off music"));
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_MUSIC, _("Turn on music"));
|
||||
widget_manager->addTextButtonWgt( WTOK_MUSIC, 40, 7, _("Turn on music"));
|
||||
}
|
||||
|
||||
widget_manager->addWgt(WTOK_SFX, 40, 7);
|
||||
if( user_config->doSFX() )
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_SFX, _("Turn off sound effects"));
|
||||
widget_manager->addTextButtonWgt( WTOK_SFX, 40, 7, _("Turn off sound effects"));
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_SFX, _("Turn on sound effects"));
|
||||
widget_manager->addTextButtonWgt( WTOK_SFX, 40, 7, _("Turn on sound effects"));
|
||||
}
|
||||
|
||||
widget_manager->addWgt(WTOK_EMPTY, 40, 5);
|
||||
widget_manager->deactivateWgt(WTOK_EMPTY);
|
||||
widget_manager->hideWgtRect(WTOK_EMPTY);
|
||||
widget_manager->hideWgtText(WTOK_EMPTY);
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 5);
|
||||
|
||||
widget_manager->addWgt(WTOK_QUIT, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_QUIT, _("Press <ESC> to go back"));
|
||||
widget_manager->addTextButtonWgt(WTOK_QUIT, 40, 7,_("Press <ESC> to go back"));
|
||||
widget_manager->setWgtTextSize(WTOK_QUIT, WGT_FNT_SML);
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
|
||||
@@ -70,7 +70,7 @@ CreditsMenu::CreditsMenu()
|
||||
widget_manager->setInitialActivationState( true );
|
||||
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
|
||||
widget_manager->setInitialTextState(SHOW_TEXT, "", TEXT_SIZE,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
WGT_FONT_GUI, WGT_WHITE, false );
|
||||
|
||||
widget_manager->addWgt( WTOK_CREDITS, 100, 93);
|
||||
widget_manager->setWgtText( WTOK_CREDITS, credits_text );
|
||||
|
||||
@@ -37,9 +37,6 @@ enum WidgetTokens
|
||||
WTOK_TITLE,
|
||||
WTOK_APPLY_RES,
|
||||
|
||||
WTOK_EMPTY,
|
||||
WTOK_EMPTY1,
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
@@ -49,33 +46,17 @@ DisplayResConfirm::DisplayResConfirm( const bool FROM_WINDOW_ ) :
|
||||
{
|
||||
m_counter = 5; // Number of seconds in which to confirm
|
||||
|
||||
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,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
|
||||
widget_manager->insertColumn();
|
||||
widget_manager->addWgt( WTOK_TITLE, 70, 7);
|
||||
widget_manager->setWgtText( WTOK_TITLE, _("Confirm Resolution Within 5 Seconds"));
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 70, 7,
|
||||
_("Confirm Resolution Within 5 Seconds"));
|
||||
|
||||
widget_manager->setInitialActivationState(true);
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2);
|
||||
|
||||
widget_manager->addWgt( WTOK_EMPTY, 40, 2);
|
||||
widget_manager->deactivateWgt( WTOK_EMPTY );
|
||||
widget_manager->hideWgtRect( WTOK_EMPTY );
|
||||
widget_manager->hideWgtText( WTOK_EMPTY );
|
||||
widget_manager->addTextButtonWgt( WTOK_APPLY_RES, 40, 7, _("Confirm Resolution") );
|
||||
|
||||
widget_manager->addWgt( WTOK_APPLY_RES, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_APPLY_RES, _("Confirm Resolution"));
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2);
|
||||
|
||||
widget_manager->addWgt( WTOK_EMPTY1, 40, 2);
|
||||
widget_manager->deactivateWgt( WTOK_EMPTY1 );
|
||||
widget_manager->hideWgtRect( WTOK_EMPTY1 );
|
||||
widget_manager->hideWgtText( WTOK_EMPTY1 );
|
||||
|
||||
widget_manager->addWgt( WTOK_QUIT, 40, 7);
|
||||
widget_manager->setWgtText( WTOK_QUIT, _("Press <ESC> to Cancel"));
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 40, 7, _("Press <ESC> to Cancel") );
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
|
||||
widget_manager->layout( WGT_AREA_ALL );
|
||||
@@ -85,7 +66,6 @@ DisplayResConfirm::DisplayResConfirm( const bool FROM_WINDOW_ ) :
|
||||
{
|
||||
std::cerr << "Warning: Timer could not be initialised!\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -108,7 +88,7 @@ void DisplayResConfirm::select()
|
||||
break;
|
||||
case WTOK_QUIT:
|
||||
SDL_RemoveTimer(m_timer);
|
||||
if (FROM_WINDOW)
|
||||
if (FROM_WINDOW)
|
||||
{
|
||||
inputDriver->toggleFullscreen();
|
||||
user_config->m_crashed = false;
|
||||
@@ -127,7 +107,7 @@ void DisplayResConfirm::countdown()
|
||||
{
|
||||
m_counter--;
|
||||
snprintf(m_count, MAX_MESSAGE_LENGTH, _("Confirm Resolution Within %d Seconds"), m_counter);
|
||||
widget_manager->setWgtText(WTOK_TITLE, m_count);
|
||||
widget_manager->setWgtText( WTOK_TITLE, m_count );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -159,7 +139,7 @@ void DisplayResConfirm::handle(GameAction ga, int value)
|
||||
if (value)
|
||||
break;
|
||||
SDL_RemoveTimer(m_timer);
|
||||
if (FROM_WINDOW)
|
||||
if (FROM_WINDOW)
|
||||
{
|
||||
inputDriver->toggleFullscreen();
|
||||
user_config->m_crashed = false;
|
||||
|
||||
@@ -36,7 +36,7 @@ FeatureUnlocked::FeatureUnlocked()
|
||||
const bool SHOW_TEXT = true;
|
||||
widget_manager->setInitialActivationState(false);
|
||||
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
|
||||
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED, WGT_FONT_GUI, WGT_WHITE );
|
||||
widget_manager->setInitialTextState(SHOW_TEXT, "", WGT_FNT_MED, WGT_FONT_GUI, WGT_WHITE, false );
|
||||
|
||||
widget_manager->addWgt( WTOK_TITLE, 60, 10);
|
||||
widget_manager->showWgtRect( WTOK_TITLE );
|
||||
|
||||
@@ -29,78 +29,56 @@
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
|
||||
WTOK_GP,
|
||||
WTOK_QUICKRACE,
|
||||
WTOK_TIMETRIAL,
|
||||
WTOK_FOLLOW_LEADER,
|
||||
WTOK_EMPTY,
|
||||
WTOK_BACK
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
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,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
|
||||
widget_manager->insertColumn();
|
||||
widget_manager->addWgt(WTOK_TITLE, 50, 7);
|
||||
widget_manager->setWgtText( WTOK_TITLE, _("Choose a Race Mode"));
|
||||
widget_manager->setWgtTextSize( WTOK_TITLE, WGT_FNT_LRG );
|
||||
widget_manager->addTitleWgt(WTOK_TITLE, 50, 7, _("Choose a Race Mode"));
|
||||
|
||||
widget_manager->setInitialActivationState(true);
|
||||
widget_manager->addWgt(WTOK_GP, 50, 7);
|
||||
if(unlock_manager->isLocked("grandprix"))
|
||||
{
|
||||
widget_manager->hideWgtText(WTOK_GP);
|
||||
widget_manager->deactivateWgt(WTOK_GP);
|
||||
|
||||
const Material *m = material_manager->getMaterial("gui_lock.rgb", false);
|
||||
widget_manager->setWgtColor( WTOK_GP, WGT_WHITE);
|
||||
widget_manager->setWgtTexture( WTOK_GP, m->getState()->getTextureHandle() );
|
||||
widget_manager->showWgtTexture( WTOK_GP );
|
||||
widget_manager->addImgWgt(WTOK_GP, 50, 7,
|
||||
m->getState()->getTextureHandle() );
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_GP, _("Grand Prix"));
|
||||
widget_manager->addTextButtonWgt( WTOK_GP, 50, 7, _("Grand Prix"));
|
||||
}
|
||||
|
||||
widget_manager->addWgt(WTOK_QUICKRACE, 50, 7);
|
||||
widget_manager->setWgtText( WTOK_QUICKRACE, _("Quick Race"));
|
||||
widget_manager->addTextButtonWgt(WTOK_QUICKRACE, 50, 7, _("Quick Race"));
|
||||
|
||||
if( race_manager->getNumPlayers() == 1 )
|
||||
{
|
||||
widget_manager->addWgt(WTOK_TIMETRIAL, 50, 7);
|
||||
widget_manager->setWgtText( WTOK_TIMETRIAL, _("Time Trial"));
|
||||
widget_manager->addTextButtonWgt(WTOK_TIMETRIAL, 50, 7, _("Time Trial"));
|
||||
}
|
||||
widget_manager->addWgt(WTOK_FOLLOW_LEADER, 50, 7);
|
||||
if(unlock_manager->isLocked("followleader"))
|
||||
{
|
||||
widget_manager->hideWgtText(WTOK_FOLLOW_LEADER);
|
||||
widget_manager->deactivateWgt(WTOK_FOLLOW_LEADER);
|
||||
|
||||
const Material *m = material_manager->getMaterial("gui_lock.rgb", false);
|
||||
widget_manager->setWgtColor( WTOK_FOLLOW_LEADER, WGT_WHITE);
|
||||
widget_manager->setWgtTexture( WTOK_FOLLOW_LEADER, m->getState()->getTextureHandle() );
|
||||
widget_manager->addImgWgt(WTOK_GP, 50, 7,
|
||||
m->getState()->getTextureHandle() );
|
||||
widget_manager->showWgtTexture( WTOK_FOLLOW_LEADER );
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_FOLLOW_LEADER, _("Follow the Leader"));
|
||||
widget_manager->addTextButtonWgt( WTOK_FOLLOW_LEADER, 50, 7,
|
||||
_("Follow the Leader"));
|
||||
}
|
||||
widget_manager->addWgt(WTOK_EMPTY, 50, 7);
|
||||
widget_manager->hideWgtRect( WTOK_EMPTY );
|
||||
widget_manager->hideWgtText( WTOK_EMPTY );
|
||||
widget_manager->deactivateWgt( WTOK_EMPTY );
|
||||
|
||||
widget_manager->addWgt(WTOK_BACK, 50, 7);
|
||||
widget_manager->setWgtText( WTOK_BACK, _("Press <ESC> to go back"));
|
||||
widget_manager->setWgtTextSize( WTOK_BACK, WGT_FNT_SML );
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 50, 7);
|
||||
|
||||
widget_manager->addTextButtonWgt(WTOK_QUIT, 50, 7, _("Press <ESC> to go back"));
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -130,7 +108,7 @@ void GameMode::select()
|
||||
race_manager->setRaceMode(RaceManager::RM_TIME_TRIAL);
|
||||
menu_manager->pushMenu(MENUID_CHARSEL_P1);
|
||||
break;
|
||||
case WTOK_BACK:
|
||||
case WTOK_QUIT:
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
default: break;
|
||||
|
||||
@@ -67,7 +67,7 @@ HelpPageOne::HelpPageOne()
|
||||
|
||||
widget_manager->setInitialRectState( SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK );
|
||||
widget_manager->setInitialTextState( SHOW_TEXT, "", TEXT_SIZE,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
WGT_FONT_GUI, WGT_WHITE, false );
|
||||
|
||||
/*Help header*/
|
||||
widget_manager->addWgt(WTOK_MSG1, 50, 7);
|
||||
@@ -193,15 +193,6 @@ void HelpPageOne::update(float dt)
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
#if 0
|
||||
GLint viewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT, viewport);
|
||||
|
||||
glViewport ( 0, 0, viewport[2], viewport[3]);
|
||||
m_context -> setFOV ( 45.0f, 45.0f * viewport[2]/viewport[3] ) ;
|
||||
m_context -> setNearFar ( 0.05f, 1000.0f ) ;
|
||||
#endif
|
||||
|
||||
sgCoord cam_pos;
|
||||
sgSetCoord(&cam_pos, 0, 0, 0, 0, 0, 0);
|
||||
m_context -> setCamera ( &cam_pos ) ;
|
||||
|
||||
@@ -50,7 +50,7 @@ HelpPageTwo::HelpPageTwo()
|
||||
const WidgetFontSize TEXT_SIZE = WGT_FNT_SML;
|
||||
widget_manager->setInitialRectState( SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK );
|
||||
widget_manager->setInitialTextState( false, "", TEXT_SIZE,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
WGT_FONT_GUI, WGT_WHITE, false );
|
||||
|
||||
widget_manager->addWgt(WTOK_MSG6, 100, 8);
|
||||
widget_manager->setWgtText(WTOK_MSG6,
|
||||
|
||||
@@ -67,46 +67,45 @@ PlayerControls::PlayerControls(int whichPlayer):
|
||||
m_player_index(whichPlayer),
|
||||
m_grab_input(false)
|
||||
{
|
||||
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,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
char heading[MAX_MESSAGE_LENGTH];
|
||||
snprintf(heading, sizeof(heading), _("Choose your controls, %s"),
|
||||
user_config->m_player[m_player_index].getName().c_str() );
|
||||
|
||||
widget_manager->addWgt( WTOK_TITLE, 60, 7);
|
||||
sprintf(m_heading, _("Choose your controls, %s"),
|
||||
user_config->m_player[m_player_index].getName().c_str());
|
||||
widget_manager->setWgtText( WTOK_TITLE, m_heading);
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, heading );
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addWgt( WTOK_PLYR_NAME0, 30, 7);
|
||||
widget_manager->setWgtText( WTOK_PLYR_NAME0, _("Player name"));
|
||||
widget_manager->addTextWgt( WTOK_PLYR_NAME0, 30, 7, _("Player name") );
|
||||
|
||||
|
||||
widget_manager->addTextWgt( WTOK_PLYR_NAME0, 30, 7, _("Player name") );
|
||||
|
||||
widget_manager->addWgt( WTOK_PLYR_NAME1, 30, 7);
|
||||
m_name = user_config->m_player[m_player_index].getName();
|
||||
widget_manager->setWgtText( WTOK_PLYR_NAME1, m_name);
|
||||
widget_manager->activateWgt( WTOK_PLYR_NAME1);
|
||||
widget_manager->addTextButtonWgt( WTOK_PLYR_NAME1, 30, 7, m_name );
|
||||
widget_manager->breakLine();
|
||||
|
||||
KartAction control;
|
||||
widget_manager->insertColumn();
|
||||
for(int i = KA_FIRST; i <= KA_LAST; i++)
|
||||
{
|
||||
widget_manager->addWgt( WTOK_KEY0 + i, 30, 7);
|
||||
widget_manager->setWgtText( WTOK_KEY0 + i, sKartAction2String[i]);
|
||||
widget_manager->addTextWgt( WTOK_KEY0 + i, 30, 7, sKartAction2String[i] );
|
||||
}
|
||||
widget_manager->breakLine();
|
||||
|
||||
|
||||
KartAction control;
|
||||
widget_manager->insertColumn();
|
||||
for(int i = KA_FIRST; i <= KA_LAST; i++)
|
||||
{
|
||||
control = (KartAction)i;
|
||||
m_key_names[control] = user_config->getMappingAsString(m_player_index, control);
|
||||
widget_manager->addWgt( WTOK_LEFT + i, 30, 7);
|
||||
widget_manager->setWgtText( WTOK_LEFT + i, m_key_names[control].c_str());
|
||||
widget_manager->activateWgt( WTOK_LEFT + i);
|
||||
|
||||
widget_manager->breakLine();
|
||||
widget_manager->addTextButtonWgt( WTOK_LEFT + i, 30, 7,
|
||||
m_key_names[control].c_str());
|
||||
}
|
||||
widget_manager->breakLine();
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addWgt( WTOK_QUIT, 60, 7);
|
||||
widget_manager->setWgtText( WTOK_QUIT, _("Press <ESC> to go back"));
|
||||
widget_manager->addTextWgt( WTOK_QUIT, 60, 7, _("Press <ESC> to go back") );
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML);
|
||||
widget_manager->activateWgt( WTOK_QUIT);
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
} // PlayerControls
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
void select();
|
||||
void clearMapping();
|
||||
|
||||
|
||||
void handle(GameAction, int);
|
||||
void inputKeyboard(SDLKey, int);
|
||||
void addKeyLabel(int change_id, KartAction control, bool start);
|
||||
@@ -41,20 +41,16 @@ public:
|
||||
|
||||
private:
|
||||
void updateAllKeyLabels();
|
||||
|
||||
|
||||
int m_player_index;
|
||||
bool m_grab_input;
|
||||
|
||||
|
||||
/** Stores the KartAction for which the input is being sensed. */
|
||||
KartAction m_edit_action;
|
||||
|
||||
// Stores the heading - making this an attribute here avoids
|
||||
// memory leaks or complicated memory management
|
||||
char m_heading[60];
|
||||
|
||||
|
||||
std::string m_name;
|
||||
std::string m_key_names[KC_COUNT];
|
||||
|
||||
|
||||
static const size_t PLAYER_NAME_MAX;
|
||||
};
|
||||
|
||||
|
||||
@@ -42,45 +42,24 @@ enum WidgetTokens
|
||||
|
||||
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,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
widget_manager->insertColumn();
|
||||
|
||||
widget_manager->addWgt(WTOK_PAUSE, 30, 7);
|
||||
widget_manager->setWgtText(WTOK_PAUSE, _("Paused"));
|
||||
widget_manager->breakLine();
|
||||
widget_manager->addTitleWgt( WTOK_PAUSE, 30, 7, _("Paused") );
|
||||
|
||||
widget_manager->setInitialActivationState(true);
|
||||
widget_manager->addWgt(WTOK_RETURN_RACE, 30, 7);
|
||||
widget_manager->setWgtText(WTOK_RETURN_RACE, _("Return To Race"));
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addWgt(WTOK_OPTIONS, 30, 7);
|
||||
widget_manager->setWgtText(WTOK_OPTIONS, _("Options"));
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addWgt(WTOK_HELP, 30, 7);
|
||||
widget_manager->setWgtText(WTOK_HELP, _("Help"));
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addWgt(WTOK_RESTART_RACE, 30, 7);
|
||||
widget_manager->setWgtText(WTOK_RESTART_RACE, _("Restart Race"));
|
||||
widget_manager->breakLine();
|
||||
widget_manager->addTextButtonWgt( WTOK_RETURN_RACE, 30, 7, _("Return To Race"));
|
||||
widget_manager->addTextButtonWgt( WTOK_OPTIONS, 30, 7, _("Options") );
|
||||
widget_manager->addTextButtonWgt( WTOK_HELP, 30, 7, _("Help") );
|
||||
widget_manager->addTextButtonWgt( WTOK_RESTART_RACE, 30, 7, _("Restart Race") );
|
||||
|
||||
if(race_manager->getRaceMode()==RaceManager::RM_QUICK_RACE)
|
||||
{
|
||||
widget_manager->addWgt(WTOK_SETUP_NEW_RACE, 30, 7);
|
||||
widget_manager->setWgtText(WTOK_SETUP_NEW_RACE, _("Setup New Race"));
|
||||
widget_manager->breakLine();
|
||||
widget_manager->addTextButtonWgt( WTOK_SETUP_NEW_RACE, 30, 7,
|
||||
_("Setup New Race") );
|
||||
}
|
||||
|
||||
widget_manager->addWgt(WTOK_QUIT, 30, 7);
|
||||
widget_manager->setWgtText(WTOK_QUIT, _("Exit Race"));
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 30, 7, _("Exit Race") );
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
|
||||
if(user_config->m_fullscreen) SDL_ShowCursor(SDL_ENABLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,8 @@
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
WTOK_EMPTY0,
|
||||
WTOK_HIGHSCORES,
|
||||
WTOK_RESULTS,
|
||||
WTOK_EMPTY1,
|
||||
WTOK_CONTINUE,
|
||||
WTOK_RESTART_RACE,
|
||||
WTOK_SETUP_NEW_RACE,
|
||||
@@ -47,32 +45,18 @@ enum WidgetTokens
|
||||
|
||||
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,
|
||||
WGT_FONT_GUI, WGT_WHITE );
|
||||
|
||||
widget_manager->addWgt(WTOK_TITLE, 60, 7);
|
||||
widget_manager->setWgtText(WTOK_TITLE, _("Result"));
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, _("Result") );
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addWgt(WTOK_EMPTY0, 60, 5);
|
||||
widget_manager->hideWgtRect(WTOK_EMPTY0);
|
||||
widget_manager->hideWgtText(WTOK_EMPTY0);
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 60, 5 );
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addWgt(WTOK_RESULTS, 50, 7);
|
||||
widget_manager->setWgtText(WTOK_RESULTS, _("Race results"));
|
||||
|
||||
widget_manager->addWgt(WTOK_HIGHSCORES, 50, 7);
|
||||
widget_manager->setWgtText(WTOK_HIGHSCORES, _("Highscores"));
|
||||
|
||||
widget_manager->addTextWgt( WTOK_RESULTS, 50, 7, _("Race results") );
|
||||
widget_manager->addTextWgt( WTOK_HIGHSCORES, 50, 7, _("Highscores") );
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->insertColumn();
|
||||
|
||||
|
||||
const unsigned int MAX_STR_LEN = 60;
|
||||
const unsigned int NUM_KARTS = race_manager->getNumKarts();
|
||||
|
||||
@@ -111,9 +95,8 @@ RaceResultsGUI::RaceResultsGUI()
|
||||
KART->getPosition(), KART_NAME.c_str(), sTime);
|
||||
}
|
||||
|
||||
widget_manager->addWgt(WTOK_FIRST_RESULT + i, 50, 7);
|
||||
widget_manager->setWgtText(WTOK_FIRST_RESULT + i,
|
||||
(char*)(m_score + MAX_STR_LEN * i));
|
||||
widget_manager->addTextWgt( WTOK_FIRST_RESULT + i, 50, 7,
|
||||
(char*)(m_score + MAX_STR_LEN * i) );
|
||||
}
|
||||
|
||||
delete[] order;
|
||||
@@ -127,58 +110,50 @@ RaceResultsGUI::RaceResultsGUI()
|
||||
|
||||
for(int i=0; i<num_scores; i++)
|
||||
{
|
||||
|
||||
std::string kart_name, name;
|
||||
float T;
|
||||
hs->getEntry(i, kart_name, name, &T);
|
||||
const int MINS = (int) floor ( T / 60.0 ) ;
|
||||
const int SECS = (int) floor ( T - (float) ( 60 * MINS ) ) ;
|
||||
const int TENTHS = (int) floor ( 10.0f * (T - (float)(SECS + 60*MINS)));
|
||||
sprintf((char*)(m_highscores + MAX_STR_LEN * i),
|
||||
sprintf((char*)( m_highscores + MAX_STR_LEN * i ),
|
||||
"%s: %3d:%02d.%01d", name.c_str(), MINS, SECS, TENTHS);
|
||||
widget_manager->addWgt(WTOK_FIRST_HIGHSCORE + i, 50, 7);
|
||||
widget_manager->setWgtText(WTOK_FIRST_HIGHSCORE + i,
|
||||
(char*)(m_highscores+MAX_STR_LEN*i));
|
||||
widget_manager->addTextWgt( WTOK_FIRST_HIGHSCORE + i, 50, 7,
|
||||
(char*)( m_highscores+MAX_STR_LEN*i ) );
|
||||
}
|
||||
widget_manager->breakLine();
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addWgt(WTOK_EMPTY1, 60, 5);
|
||||
widget_manager->hideWgtRect(WTOK_EMPTY1);
|
||||
widget_manager->hideWgtText(WTOK_EMPTY1);
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 60, 5 );
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->setInitialActivationState(true);
|
||||
widget_manager->addWgt( WTOK_CONTINUE, 60, 7);
|
||||
|
||||
// If a new feature was unlocked, only offer 'continue' otherwise add the
|
||||
// full menu choices. The new feature menu returns to this menu, and will
|
||||
// then display the whole menu.
|
||||
if(unlock_manager->getUnlockedFeatures().size()>0)
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_CONTINUE, _("Continue"));
|
||||
widget_manager->addTextWgt( WTOK_CONTINUE, 60, 7, _("Continue") );
|
||||
} else
|
||||
{
|
||||
if(race_manager->getRaceMode()==RaceManager::RM_GRAND_PRIX)
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_CONTINUE, _("Continue Grand Prix"));
|
||||
widget_manager->addTextWgt( WTOK_CONTINUE, 60, 7, _("Continue Grand Prix"));
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_CONTINUE, _("Back to the main menu"));
|
||||
widget_manager->addTextWgt( WTOK_CONTINUE, 60, 7, _("Back to the main menu"));
|
||||
}
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addWgt( WTOK_RESTART_RACE, 60, 7);
|
||||
widget_manager->setWgtText( WTOK_RESTART_RACE, _("Race in this track again"));
|
||||
widget_manager->addTextWgt( WTOK_RESTART_RACE, 60, 7, _("Race in this track again"));
|
||||
widget_manager->breakLine();
|
||||
|
||||
if(race_manager->getRaceMode()==RaceManager::RM_QUICK_RACE)
|
||||
{
|
||||
widget_manager->addWgt( WTOK_SETUP_NEW_RACE, 60, 7);
|
||||
widget_manager->setWgtText( WTOK_SETUP_NEW_RACE, _("Setup New Race"));
|
||||
widget_manager->addTextWgt( WTOK_SETUP_NEW_RACE, 60, 7, _("Setup New Race"));
|
||||
}
|
||||
} // if !unlock_manager has something unlocked
|
||||
} // if !unlock_manager has something unlocked*/
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
} // RaceResultsGUI
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ class Widget
|
||||
void lightenColor();
|
||||
void darkenColor();
|
||||
|
||||
void setFont( const WidgetFont FONT);
|
||||
void setFont( const WidgetFont FONT );
|
||||
|
||||
/* Functions created simply to organize the code */
|
||||
bool createRect(int radius);
|
||||
|
||||
@@ -78,6 +78,8 @@ bool WidgetManager::addWgt
|
||||
new_id.last_preset_scroll_x = m_default_scroll_preset_x;
|
||||
new_id.last_preset_scroll_y = m_default_scroll_preset_y;
|
||||
|
||||
new_id.resize_to_text = m_default_resize_to_text;
|
||||
|
||||
new_id.widget = new Widget(0, 0, 0, 0);
|
||||
|
||||
new_id.widget->m_enable_rect = m_default_show_rect;
|
||||
@@ -118,6 +120,9 @@ bool WidgetManager::addWgt
|
||||
//-----------------------------------------------------------------------------
|
||||
bool WidgetManager::insertColumn()
|
||||
{
|
||||
//FIXME: should we add a column specific break? it would be easier to read than
|
||||
//two breakLines().
|
||||
|
||||
const int LAST_ELEM = (int)m_elems.size() - 1;
|
||||
const int LAST_WGT = (int)m_widgets.size() - 1;
|
||||
|
||||
@@ -396,10 +401,9 @@ bool WidgetManager::layout(const WidgetArea POSITION)
|
||||
|
||||
m_widgets[i].widget->m_width = width;
|
||||
m_widgets[i].widget->m_height = height;
|
||||
/* TEMP
|
||||
*
|
||||
m_widgets[i].widget->resize_to_text();
|
||||
*/
|
||||
|
||||
if( m_widgets[i].resize_to_text ) m_widgets[i].widget->
|
||||
resizeToText();
|
||||
}
|
||||
|
||||
const int WGTS_WIDTH = calcWidth();
|
||||
@@ -871,7 +875,8 @@ void WidgetManager::setInitialTextState
|
||||
const std::string TEXT,
|
||||
const WidgetFontSize SIZE,
|
||||
const WidgetFont FONT,
|
||||
const GLfloat* const COLOR
|
||||
const GLfloat* const COLOR,
|
||||
const bool RESIZE
|
||||
)
|
||||
{
|
||||
m_default_show_text = SHOW;
|
||||
@@ -879,6 +884,7 @@ void WidgetManager::setInitialTextState
|
||||
m_default_text_size = SIZE;
|
||||
m_default_font = FONT;
|
||||
m_default_text_color = COLOR;
|
||||
m_default_resize_to_text = RESIZE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -940,6 +946,7 @@ void WidgetManager::restoreDefaultStates()
|
||||
m_default_text_size = WGT_FNT_MED;
|
||||
m_default_font = WGT_FONT_GUI;
|
||||
m_default_text_color = WGT_WHITE;
|
||||
m_default_resize_to_text = false;
|
||||
m_default_enable_scroll = false;
|
||||
m_default_scroll_preset_x = WGT_SCROLL_CENTER;
|
||||
m_default_scroll_preset_y = WGT_SCROLL_CENTER;
|
||||
@@ -1184,6 +1191,18 @@ void WidgetManager::setWgtTextColor( const int TOKEN, const GLfloat* const COLOR
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void WidgetManager::setWgtResizeToText( const int TOKEN, const bool RESIZE )
|
||||
{
|
||||
const int ID = findId(TOKEN);
|
||||
if( ID != WGT_NONE ) m_widgets[ID].resize_to_text = RESIZE;
|
||||
else
|
||||
{
|
||||
std::cerr << "WARNING: tried to set the resize to text value of an " <<
|
||||
"unnamed widget with token " << TOKEN << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void WidgetManager::showWgtText( const int TOKEN )
|
||||
{
|
||||
|
||||
@@ -56,6 +56,11 @@ class WidgetManager
|
||||
WidgetScrollPos last_preset_scroll_x;
|
||||
WidgetScrollPos last_preset_scroll_y;
|
||||
|
||||
bool resize_to_text; //This has to do with layout, so it shouldn't
|
||||
//inside the Widget class, even thought
|
||||
//conceptually most people will asociate it with
|
||||
//text
|
||||
|
||||
Widget *widget;
|
||||
};
|
||||
|
||||
@@ -92,6 +97,7 @@ class WidgetManager
|
||||
bool m_selection_change;
|
||||
|
||||
bool m_default_active;
|
||||
bool m_default_resize_to_text;
|
||||
|
||||
bool m_default_show_rect;
|
||||
bool m_default_rect_round_corners;
|
||||
@@ -261,7 +267,8 @@ public:
|
||||
const std::string TEXT,
|
||||
const WidgetFontSize SIZE,
|
||||
const WidgetFont FONT,
|
||||
const GLfloat* const COLOR
|
||||
const GLfloat* const COLOR,
|
||||
const bool RESIZE_WGT
|
||||
);
|
||||
|
||||
void setInitialScrollState
|
||||
@@ -313,6 +320,7 @@ public:
|
||||
void setWgtTextSize( const int TOKEN, const WidgetFontSize SIZE );
|
||||
void setWgtFont( const int TOKEN, const WidgetFont FONT );
|
||||
void setWgtTextColor( const int TOKEN, const GLfloat* const COLOR );
|
||||
void setWgtResizeToText( const int TOKEN, const bool RESIZE );
|
||||
void showWgtText( const int TOKEN );
|
||||
void hideWgtText( const int TOKEN );
|
||||
void reloadFonts();
|
||||
|
||||
Reference in New Issue
Block a user