Various small GUI improvements.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1364 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2007-12-19 15:10:30 +00:00
parent 0dd71cebe5
commit 1b95764c6a
3 changed files with 34 additions and 12 deletions

View File

@ -25,7 +25,6 @@
#include "menu_manager.hpp"
#include "race_manager.hpp"
#include "user_config.hpp"
#include "font.hpp"
#include "translation.hpp"
enum WidgetTokens
@ -79,7 +78,6 @@ GrandPrixSelect::GrandPrixSelect()
widget_manager->hideWgtText(WTOK_EMPTY0);
widget_manager->addWgt(WTOK_DESCRIPTION, 80, 7);
widget_manager->hideWgtRect(WTOK_DESCRIPTION);
widget_manager->setWgtText(WTOK_DESCRIPTION, _("No Grand Prix selected"));
widget_manager->setWgtTextSize(WTOK_DESCRIPTION, WGT_FNT_SML);

View File

@ -26,7 +26,6 @@
#include "user_config.hpp"
#include "material.hpp"
#include "material_manager.hpp"
#include "font.hpp"
#include "translation.hpp"
enum WidgetTokens {
@ -48,6 +47,7 @@ enum WidgetTokens {
WTOK_TRACK13,
WTOK_IMG0,
WTOK_EMPTY,
WTOK_IMG1,
WTOK_AUTHOR
@ -77,6 +77,29 @@ TrackSel::TrackSel()
widget_manager->setWgtText( WTOK_TRACK0 + i + 1, track_manager->getTrack(i+1)->getName());
widget_manager->breakLine();
}
//FIXME: till the widget can display the track map in some way, the image
//widgets will stay commented out.
widget_manager->setInitialActivationState( false );
#if 0
widget_manager->addWgt(WTOK_IMG0, 35, 35);
widget_manager->hideWgtText(WTOK_IMG0);
widget_manager->showWgtTexture(WTOK_IMG0);
#endif
widget_manager->addWgt( WTOK_EMPTY, 5, 35 );
widget_manager->hideWgtRect( WTOK_EMPTY );
widget_manager->hideWgtText( WTOK_EMPTY );
#if 0
widget_manager->addWgt(WTOK_IMG1, 35, 35);
widget_manager->hideWgtText(WTOK_IMG1);
widget_manager->showWgtTexture(WTOK_IMG1);
#endif
widget_manager->breakLine();
widget_manager->addWgt( WTOK_AUTHOR, 80, 7 );
widget_manager->setWgtText( WTOK_AUTHOR, "No track selected" );
widget_manager->setWgtTextSize( WTOK_AUTHOR, WGT_FNT_MED );
//FIXME: Right now, the image and the author's name is not controlled by the widget manager.
widget_manager->layout(WGT_AREA_TOP);
@ -93,12 +116,15 @@ void TrackSel::update(float dt)
{
BaseGUI::update(dt);
glClear(GL_DEPTH_BUFFER_BIT);
// draw a track preview of the currently highlighted track menu entry
const int CLICKED_TOKEN = widget_manager->getSelectedWgt();
const Track* TRACK = track_manager->getTrack(CLICKED_TOKEN - WTOK_TRACK0);
widget_manager->setWgtText( WTOK_AUTHOR, TRACK->getDescription() );
// draw a track preview of the currently highlighted track menu entry
glClear(GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
@ -156,8 +182,6 @@ void TrackSel::update(float dt)
const GLfloat backgroundColour[4] = { 0.3f, 0.3f, 0.3f, 0.5f };
glColor4fv(backgroundColour);
glPopMatrix();
font_gui->Print(TRACK->getDescription(), WGT_FNT_MED,
Font::CENTER_OF_SCREEN, 10);
glDisable(GL_BLEND);
glMatrixMode(GL_PROJECTION);
glPopMatrix();

View File

@ -28,15 +28,15 @@
* addWgt() to specify the widgets you want, and for each widget specify the
* details of it with the 'switch features', that can be changed between
* show/hide, the initial setting for all of them is to be hidden. You will
* usually have to call it's set_*() function, then the show_*() functions.
* usually have to call it's set*() function, then the show_*() functions.
* After you have defined all the widgets in the screen, call layout(), that
* will do the actual work at creating the widgets. Call the activated
* functions during the time the widgets are alive, and make sure that
* update() is called each frame.
*
* You can use set_initial_*state() to avoid setting the state of the same
* You can use setInitial*State() to avoid setting the state of the same
* switch features with same values over and over; the default states are
* reset when you call reset() or you can use reset_default_states().
* reset when you call reset() or you can use resetDefaultStates().
*/
@ -189,7 +189,7 @@ public:
void activateWgt(const int TOKEN);
void deactivateWgt(const int TOKEN);
//FIXME: maybe this should be set_wgt_rect_color ? and put after the other rect funcs?
//FIXME: maybe this should be setWgtRectColor ? and put after the other rect funcs?
void setWgtColor(const int TOKEN, const GLfloat* const COLOR);
void setWgtRoundCorners(const int TOKEN, const WidgetArea CORNERS);
void showWgtRect(const int TOKEN);