GUI improvements

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1297 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2007-11-21 01:51:57 +00:00
parent 44f9f6a538
commit aa3ad745ce
3 changed files with 39 additions and 62 deletions

View File

@ -58,8 +58,6 @@ GrandPrixEnd::GrandPrixEnd()
m_context = new ssgContext;
oldContext->makeCurrent();
// m_menu_id = widgetSet -> vstack(0);
int highest = 0;
//FIXME: We go from the back to the front because the players are in the
//back and in case of a tie they will win against the AI, *but* if it's
@ -80,14 +78,11 @@ GrandPrixEnd::GrandPrixEnd()
widget_manager->set_wgt_text(WTOK_TITLE, output);
widget_manager->set_wgt_text_size(WTOK_TITLE, WGT_FNT_LRG);
widget_manager->break_line();
// widgetSet -> label(m_menu_id, output, GUI_LRG, GUI_ALL, 0, 0);
const unsigned int MAX_STR_LEN = 60;
const unsigned int NUM_KARTS = world->getNumKarts();
// const int VA = widgetSet->varray(m_menu_id);
Kart *kart;
int *scores = new int[NUM_KARTS];
int *position = new int[NUM_KARTS];
@ -142,13 +137,13 @@ GrandPrixEnd::GrandPrixEnd()
delete []scores;
delete []position;
widget_manager->add_wgt(WTOK_QUIT, 40, 7);
widget_manager->add_wgt(WTOK_QUIT, 50, 7);
widget_manager->activate_wgt(WTOK_QUIT);
widget_manager->show_wgt_rect(WTOK_QUIT);
widget_manager->show_wgt_text(WTOK_QUIT);
widget_manager->set_wgt_text(WTOK_QUIT, _("Back to the main menu"));
widget_manager->layout(WGT_AREA_ALL);
widget_manager->layout(WGT_AREA_TOP);
m_kart = new ssgTransform;
m_kart->ref();
@ -172,7 +167,6 @@ GrandPrixEnd::GrandPrixEnd()
GrandPrixEnd::~GrandPrixEnd()
{
widget_manager->delete_wgts();
//widgetSet -> delete_widget(m_menu_id);
ssgDeRefDelete(m_kart);
delete m_context;

View File

@ -126,28 +126,6 @@ void GrandPrixSelect::update(float dt)
const CupData &cup = m_all_cups[CLICKED_TOKEN - WTOK_FIRSTPRIX];
widget_manager->set_wgt_text(WTOK_DESCRIPTION, cup.getDescription());
//FIXME: The following triggers a crash; it is left to be investigated later.
#if 0
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, user_config->m_width, 0.0, user_config->m_height, -1.0, +1.0);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_BLEND);
const CupData &cup = m_all_cups[CLICKED_TOKEN-WTOK_FIRSTPRIX];
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, 0);
const GLfloat BACKGROUND_COLOUR[4] = { 0.3f, 0.3f, 0.3f, 0.5f };
glColor4fv(BACKGROUND_COLOUR);
glPopMatrix();
font_gui->Print(cup.getDescription(), WGT_FNT_MED,
Font::ALIGN_CENTER, -1, Font::ALIGN_BOTTOM, 10);
glDisable(GL_BLEND);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
#endif
return;
}

View File

@ -30,9 +30,10 @@
enum WidgetTokens {
WTOK_TITLE,
WTOK_EMPTY,
WTOK_EMPTY0,
WTOK_HIGHSCORES,
WTOK_RESULTS,
WTOK_EMPTY1,
WTOK_CONTINUE,
WTOK_RESTART_RACE,
WTOK_SETUP_NEW_RACE,
@ -49,15 +50,17 @@ RaceResultsGUI::RaceResultsGUI()
widget_manager->set_wgt_text(WTOK_TITLE, _("Result"));
widget_manager->break_line();
widget_manager->add_wgt(WTOK_EMPTY, 60, 5);
widget_manager->hide_wgt_rect(WTOK_EMPTY);
widget_manager->hide_wgt_text(WTOK_EMPTY);
widget_manager->add_wgt(WTOK_EMPTY0, 60, 5);
widget_manager->hide_wgt_rect(WTOK_EMPTY0);
widget_manager->hide_wgt_text(WTOK_EMPTY0);
widget_manager->break_line();
widget_manager->add_wgt(WTOK_RESULTS, 40, 7);
widget_manager->add_wgt(WTOK_RESULTS, 50, 7);
widget_manager->set_wgt_text(WTOK_RESULTS, _("Race results"));
widget_manager->add_wgt(WTOK_HIGHSCORES, 40, 7);
#if 0
widget_manager->add_wgt(WTOK_HIGHSCORES, 50, 7);
widget_manager->set_wgt_text(WTOK_HIGHSCORES, _("Highscores"));
#endif
widget_manager->break_line();
@ -68,6 +71,10 @@ RaceResultsGUI::RaceResultsGUI()
m_score = new char[NUM_KARTS * MAX_STR_LEN];
unsigned int max_name_len = 1;
const Highscores *hs = world->getHighscores();
int num_scores = hs->getNumberEntries();
m_highscores = new char[num_scores * MAX_STR_LEN];
for(unsigned int i=0; i < NUM_KARTS; i++)
{
Kart *k = world->getKart(i);
@ -105,19 +112,19 @@ RaceResultsGUI::RaceResultsGUI()
KART->getPosition(), KART_NAME.c_str(), sTime);
}
widget_manager->add_wgt(WTOK_FIRST_RESULT + i, 80, 7);
widget_manager->add_wgt(WTOK_FIRST_RESULT + i, 50, 7);
widget_manager->set_wgt_text(WTOK_FIRST_RESULT + i,
(char*)(m_score + MAX_STR_LEN * i));
widget_manager->break_line();
}
delete[] order;
const Highscores *hs = world->getHighscores();
int num_scores = hs->getNumberEntries();
m_highscores = new char[num_scores * MAX_STR_LEN];
for(int i=0; i<num_scores; i++)
{
std::string kart_name, name;
//FIXME:Add highscore table
/* std::string kart_name, name;
float T;
hs->getEntry(i, kart_name, name, &T);
const int MINS = (int) floor ( T / 60.0 ) ;
@ -125,40 +132,38 @@ RaceResultsGUI::RaceResultsGUI()
const int TENTHS = (int) floor ( 10.0f * (T - (float)(SECS + 60*MINS)));
sprintf((char*)(m_highscores + MAX_STR_LEN * i),
"%s: %3d:%02d.%01d", name.c_str(), MINS, SECS, TENTHS);
/* widgetSet->label(HIGHSCORE_TABLE, (char*)(m_highscores+MAX_STR_LEN*i),
GUI_MED, GUI_ALL);*/
widget_manager->add_wgt(WTOK_FIRST_HIGHSCORE + i, 40, 7);
widget_manager->set_wgt_text(WTOK_FIRST_HIGHSCORE + i,
(char*)(m_highscores+MAX_STR_LEN*i));*/
}
// widgetSet -> space(m_menu_id);
// const int VA = widgetSet -> varray(m_menu_id);
#if 0
static int dev_msg_counter = 0;
if(dev_msg_counter == 2)
{
widgetSet -> label(m_menu_id, _("We need more developers! \
if you want to help contact us!"), GUI_SML, GUI_ALL, 0, 0);
dev_msg_counter = 0;
}
++dev_msg_counter;
#endif
widget_manager->add_wgt(WTOK_EMPTY1, 60, 5);
widget_manager->hide_wgt_rect(WTOK_EMPTY1);
widget_manager->hide_wgt_text(WTOK_EMPTY1);
widget_manager->break_line();
widget_manager->set_initial_activation_state(true);
widget_manager->add_wgt( WTOK_CONTINUE, 60, 7);
if(world->m_race_setup.m_mode==RaceSetup::RM_GRAND_PRIX)
{
// widgetSet -> start(m_menu_id, _("Continue Grand Prix"), GUI_MED, WTOK_CONTINUE);
widget_manager->set_wgt_text( WTOK_CONTINUE, _("Continue Grand Prix"));
}
else
{
// widgetSet -> start(m_menu_id, _("Back to the main menu"), GUI_MED, WTOK_CONTINUE);
widget_manager->set_wgt_text( WTOK_CONTINUE, _("Back to the main menu"));
}
// widgetSet -> start(m_menu_id, _("Race in this track again"), GUI_MED, WTOK_RESTART_RACE);
widget_manager->break_line();
widget_manager->add_wgt( WTOK_RESTART_RACE, 60, 7);
widget_manager->set_wgt_text( WTOK_RESTART_RACE, _("Race in this track again"));
widget_manager->break_line();
if(world->m_race_setup.m_mode==RaceSetup::RM_QUICK_RACE)
{
// widgetSet -> start(m_menu_id, _("Setup New Race"), GUI_MED, WTOK_SETUP_NEW_RACE);
widget_manager->add_wgt( WTOK_SETUP_NEW_RACE, 60, 7);
widget_manager->set_wgt_text( WTOK_SETUP_NEW_RACE, _("Setup New Race"));
}
// widgetSet -> layout(m_menu_id, 0, 0);
widget_manager->layout(WGT_AREA_ALL);
} // RaceResultsGUI