Revert last commits to the track selection and character selection screens.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1739 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2008-04-25 09:18:30 +00:00
parent 3e65eb20e4
commit 3586600d70
2 changed files with 163 additions and 99 deletions

View File

@ -158,9 +158,8 @@ void CharSel::switchCharacter(int n)
void CharSel::update(float dt)
{
m_clock += dt * 40.0f;
BaseGUI::update(dt);
if( widget_manager->selectionChanged() )
{
switchCharacter(widget_manager->getSelectedWgt() - WTOK_RACER0);
if (m_kart != NULL)
@ -194,9 +193,6 @@ void CharSel::update(float dt)
glDisable (GL_DEPTH_TEST);
oldContext->makeCurrent();
}
}
widget_manager->update(dt);
}
//----------------------------------------------------------------------------

View File

@ -117,11 +117,10 @@ TrackSel::~TrackSel()
//-----------------------------------------------------------------------------
void TrackSel::update(float dt)
{
if( widget_manager->selectionChanged() )
{
const int SELECTED_TRACK = widget_manager->getSelectedWgt() - WTOK_TRACK0;
if(SELECTED_TRACK<0 || SELECTED_TRACK>=(int)track_manager->getTrackCount())
{
BaseGUI::update(dt);
return;
}
const Track* TRACK = track_manager->getTrack( SELECTED_TRACK );
@ -187,7 +186,76 @@ void TrackSel::update(float dt)
widget_manager->hideWgtTexture( WTOK_IMG1 );
widget_manager->hideWgtTrack( WTOK_IMG1 );
}
#if 0
// draw a track preview of the currently highlighted track menu entry
glClear(GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, user_config->m_width, 0.0, user_config->m_height, -1.0, +1.0);
if(screenshot.size()==0 && topview.size()==0)
{
glDisable ( GL_TEXTURE_2D ) ;
TRACK->drawScaled2D(0.0f, 50.0f, (float)user_config->m_width,
(float)(user_config->m_height/3)); // (x, y, w, h)
glEnable ( GL_TEXTURE_2D ) ;
}
else
{ // either topview or screenshot specified
int xLeft = user_config->m_width/2;
int yBottom = 50;
int w = user_config->m_width/3;
int h = user_config->m_height/3;
if(topview.size()==0)
{ // no topview, but there is a screenshot!
glDisable ( GL_TEXTURE_2D ) ;
TRACK->drawScaled2D((float)xLeft, (float)yBottom, (float)w, (float)h);
glEnable ( GL_TEXTURE_2D ) ;
}
else
{ // topview is defined
Material *m=material_manager->getMaterial(topview);
m->apply();
glBegin(GL_QUADS) ;
glColor4f(1, 1, 1, 1 );
glTexCoord2f(0, 0); glVertex2i( xLeft, yBottom );
glTexCoord2f(1, 0); glVertex2i( xLeft+w, yBottom );
glTexCoord2f(1, 1); glVertex2i( xLeft+w, yBottom+h);
glTexCoord2f(0, 1); glVertex2i( xLeft, yBottom+h);
glEnd () ;
} // topview is defined
Material *m=material_manager->getMaterial(screenshot);
xLeft = xLeft - w - 10;
m->apply();
glBegin(GL_QUADS) ;
glColor4f(1, 1, 1, 1 );
glTexCoord2f(0, 0); glVertex2i( xLeft, yBottom );
glTexCoord2f(1, 0); glVertex2i( xLeft+w, yBottom );
glTexCoord2f(1, 1); glVertex2i( xLeft+w, yBottom+h);
glTexCoord2f(0, 1); glVertex2i( xLeft, yBottom+h);
glEnd () ;
} // either topview or screenshot specified
glMatrixMode(GL_MODELVIEW);
glEnable(GL_BLEND);
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, 0);
const GLfloat backgroundColour[4] = { 0.3f, 0.3f, 0.3f, 0.5f };
glColor4fv(backgroundColour);
glPopMatrix();
glDisable(GL_BLEND);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
#endif
//Keep the BaseGUI::update() call at the bottom of the function, otherwise
//the screen will be drawn once without being fully prepared, and this is
//noticeable sometimes.
BaseGUI::update(dt);
}
//-----------------------------------------------------------------------------