GUI improvements: removes warnings, fixes bugs, adds some capabilities. Sorry for the late commit, I thought I had done it last night.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1806 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2008-05-02 20:58:26 +00:00
parent fa75f05429
commit 73817a99d5
11 changed files with 206 additions and 225 deletions

View File

@ -33,39 +33,22 @@ enum WidgetTokens
ChallengesMenu::ChallengesMenu() ChallengesMenu::ChallengesMenu()
{ {
const bool SHOW_RECT = true; widget_manager->addTitleWgt( WTOK_TITLE, 60, 10, _("Active Challenges"));
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, false );
widget_manager->addWgt( WTOK_TITLE, 60, 10);
widget_manager->showWgtRect( WTOK_TITLE );
widget_manager->setWgtText( WTOK_TITLE, _("Active Challenges"));
widget_manager->setWgtTextSize( WTOK_TITLE, WGT_FNT_LRG);
widget_manager->showWgtText( WTOK_TITLE );
widget_manager->breakLine(); widget_manager->breakLine();
m_all_challenges=unlock_manager->getActiveChallenges(); m_all_challenges=unlock_manager->getActiveChallenges();
for(int i=0; i<(int)m_all_challenges.size(); i++) for(int i=0; i<(int)m_all_challenges.size(); i++)
{ {
widget_manager->addWgt(WTOK_CHALLENGES+i, 60, 10); widget_manager->addTextButtonWgt(WTOK_CHALLENGES+i, 60, 10,
widget_manager->setWgtText( WTOK_CHALLENGES+i, _(m_all_challenges[i]->getName().c_str()) ); _(m_all_challenges[i]->getName().c_str()) );
widget_manager->activateWgt(WTOK_CHALLENGES+i); widget_manager->breakLine();
widget_manager->breakLine();
} }
widget_manager->addWgt( WTOK_DESCRIPTION, 60, 30); widget_manager->addTextButtonWgt( WTOK_DESCRIPTION, 60, 30, "");
widget_manager->showWgtRect( WTOK_DESCRIPTION );
widget_manager->setWgtText( WTOK_DESCRIPTION, "");
widget_manager->showWgtText( WTOK_DESCRIPTION );
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_BACK, 50, 7); widget_manager->addTextButtonWgt(WTOK_BACK, 50, 7,
widget_manager->showWgtRect(WTOK_BACK); _("Go back to the main menu"));
widget_manager->showWgtText(WTOK_BACK);
widget_manager->setWgtText(WTOK_BACK, _("Go back to the main menu"));
widget_manager->activateWgt(WTOK_BACK);
widget_manager->layout(WGT_AREA_ALL); widget_manager->layout(WGT_AREA_ALL);
} // ChallengesMenu } // ChallengesMenu
@ -83,9 +66,9 @@ void ChallengesMenu::update(float dt)
if(challenge>=0 && challenge<(int)m_all_challenges.size()) if(challenge>=0 && challenge<(int)m_all_challenges.size())
{ {
widget_manager->setWgtText(WTOK_DESCRIPTION, widget_manager->setWgtText(WTOK_DESCRIPTION,
m_all_challenges[challenge]->getChallengeDescription()); m_all_challenges[challenge]->getChallengeDescription());
} }
BaseGUI::update(dt); widget_manager->update(dt);
} // update } // update
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -63,25 +63,17 @@ CreditsMenu::CreditsMenu()
} }
const bool SHOW_RECT = true; widget_manager->addTextWgt( WTOK_CREDITS, 100, 93, credits_text );
const bool SHOW_TEXT = true; widget_manager->setWgtTextSize( WTOK_CREDITS, WGT_FNT_SML );
const WidgetFontSize TEXT_SIZE = WGT_FNT_SML;
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, false );
widget_manager->addWgt( WTOK_CREDITS, 100, 93);
widget_manager->setWgtText( WTOK_CREDITS, credits_text );
//FIXME: maybe I should make scroll names more consistent //FIXME: maybe I should make scroll names more consistent
widget_manager->activateWgt( WTOK_CREDITS );
widget_manager->enableWgtScroll( WTOK_CREDITS ); widget_manager->enableWgtScroll( WTOK_CREDITS );
widget_manager->setWgtYScrollPos( WTOK_CREDITS, WGT_SCROLL_START_BOTTOM ); widget_manager->setWgtYScrollPos( WTOK_CREDITS, WGT_SCROLL_START_BOTTOM );
widget_manager->setWgtYScrollSpeed( WTOK_CREDITS, -80 ); widget_manager->setWgtYScrollSpeed( WTOK_CREDITS, -80 );
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt( WTOK_QUIT, 40, 7); widget_manager->addTextButtonWgt( WTOK_QUIT, 40, 7,
widget_manager->setWgtText( WTOK_QUIT, _("Go back to the main menu")); _("Go back to the main menu"));
widget_manager->layout( WGT_AREA_TOP ); widget_manager->layout( WGT_AREA_TOP );
} // CreditsMenu } // CreditsMenu

View File

@ -32,34 +32,19 @@ enum WidgetTokens
FeatureUnlocked::FeatureUnlocked() FeatureUnlocked::FeatureUnlocked()
{ {
const bool SHOW_RECT = true; widget_manager->insertColumn();
const bool SHOW_TEXT = true; widget_manager->addTitleWgt( WTOK_TITLE, 60, 10,
widget_manager->setInitialActivationState(false); _("New Feature Unlocked"));
widget_manager->setInitialRectState(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
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 );
widget_manager->setWgtText( WTOK_TITLE, _("New Feature Unlocked"));
widget_manager->setWgtTextSize( WTOK_TITLE, WGT_FNT_LRG);
widget_manager->showWgtText( WTOK_TITLE );
widget_manager->breakLine();
m_new_features=unlock_manager->getUnlockedFeatures(); m_new_features=unlock_manager->getUnlockedFeatures();
assert(m_new_features.size()>0); assert(m_new_features.size()>0);
unlock_manager->clearUnlocked(); unlock_manager->clearUnlocked();
widget_manager->addWgt( WTOK_DESCRIPTION, 60, 30); widget_manager->addTextWgt( WTOK_DESCRIPTION, 60, 30,
widget_manager->showWgtRect( WTOK_DESCRIPTION ); m_new_features[0]->getFeatureDescription());
widget_manager->setWgtText( WTOK_DESCRIPTION, m_new_features[0]->getFeatureDescription());
widget_manager->showWgtText( WTOK_DESCRIPTION );
widget_manager->breakLine();
widget_manager->addWgt(WTOK_CONTINUE, 50, 7); widget_manager->addTextButtonWgt(WTOK_CONTINUE, 50, 7,
widget_manager->showWgtRect(WTOK_CONTINUE); _("Continue"));
widget_manager->showWgtText(WTOK_CONTINUE);
widget_manager->setWgtText(WTOK_CONTINUE, _("Continue"));
widget_manager->activateWgt(WTOK_CONTINUE);
widget_manager->layout(WGT_AREA_ALL); widget_manager->layout(WGT_AREA_ALL);
} // FeatureUnlocked } // FeatureUnlocked

View File

@ -77,8 +77,7 @@ GrandPrixSelect::GrandPrixSelect() : m_curr_track_img(0), m_clock(0.0f)
widget_manager->enableWgtScroll( WTOK_TRACKS ); widget_manager->enableWgtScroll( WTOK_TRACKS );
widget_manager->setWgtYScrollSpeed( WTOK_TRACKS, -60 ); widget_manager->setWgtYScrollSpeed( WTOK_TRACKS, -60 );
widget_manager->addEmptyWgt( WTOK_IMG, 40, 40 ); widget_manager->addImgWgt( WTOK_IMG, 40, 40, 0 );
widget_manager->showWgtRect( WTOK_IMG );
widget_manager->setWgtColor( WTOK_IMG, WGT_BLACK ); widget_manager->setWgtColor( WTOK_IMG, WGT_BLACK );
widget_manager->breakLine(); widget_manager->breakLine();

View File

@ -35,8 +35,6 @@ enum WidgetTokens
WTOK_MSG4, WTOK_MSG4,
WTOK_MSG5, WTOK_MSG5,
WTOK_EMPTY,
WTOK_FIRST_KEYNAME, WTOK_FIRST_KEYNAME,
WTOK_LAST_KEYNAME = WTOK_FIRST_KEYNAME + KA_LAST, WTOK_LAST_KEYNAME = WTOK_FIRST_KEYNAME + KA_LAST,
@ -61,24 +59,23 @@ HelpPageOne::HelpPageOne()
m_clock = 0; m_clock = 0;
const bool SHOW_RECT = true; //FIXME: instead of using setInitialTextState, the gui & widget manager macros should improve it's design
const bool SHOW_TEXT = true; widget_manager->setInitialTextState
const WidgetFontSize TEXT_SIZE = WGT_FNT_SML; (
false,
widget_manager->setInitialRectState( SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK ); "",
widget_manager->setInitialTextState( SHOW_TEXT, "", TEXT_SIZE, WGT_FNT_SML,
WGT_FONT_GUI, WGT_WHITE, false ); WGT_FONT_GUI,
WGT_WHITE,
/*Help header*/ false
widget_manager->addWgt(WTOK_MSG1, 50, 7); );
widget_manager->setWgtText( WTOK_MSG1, _("Force your rivals bite *your* dust!") ); widget_manager->addTextWgt( WTOK_MSG1, 50, 7,
_("Force your rivals bite *your* dust!") );
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_MSG2, 60, 7); widget_manager->addTextWgt( WTOK_MSG2, 60, 7,
widget_manager->setWgtText( WTOK_MSG2, _("Grab blue boxes and coins") ); _("Grab blue boxes and coins") );
widget_manager->addTextWgt( WTOK_MSG3, 30, 7, _("Avoid bananas") );
widget_manager->addWgt(WTOK_MSG3, 30, 7);
widget_manager->setWgtText( WTOK_MSG3, _("Avoid bananas") );
widget_manager->breakLine(); widget_manager->breakLine();
/*Rotating 3D models*/ /*Rotating 3D models*/
@ -107,20 +104,16 @@ HelpPageOne::HelpPageOne()
m_banana->addKid(hm); m_banana->addKid(hm);
/*Empty widget to cover the space for the 3D models*/ /*Empty widget to cover the space for the 3D models*/
widget_manager->addWgt(WTOK_EMPTY, 100, 15); widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 15);
widget_manager->hideWgtRect(WTOK_EMPTY);
widget_manager->hideWgtText(WTOK_EMPTY);
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_MSG4, 100, 10); widget_manager->addTextWgt(WTOK_MSG4, 100, 10,
widget_manager->setWgtText( WTOK_MSG4,
//Next line starts at column 0 to avoid spaces in the GUI //Next line starts at column 0 to avoid spaces in the GUI
_("At high speeds wheelies drive you faster, but you can't steer. If you\n\ _("At high speeds wheelies drive you faster, but you can't steer. If you\n\
get stuck or fall too far, use the rescue button to get back on track.")); get stuck or fall too far, use the rescue button to get back on track."));
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_MSG5, 70, 7); widget_manager->addTextWgt(WTOK_MSG5, 70, 7,
widget_manager->setWgtText( WTOK_MSG5,
_("Check the current key bindings for the first player")); _("Check the current key bindings for the first player"));
widget_manager->breakLine(); widget_manager->breakLine();
@ -129,34 +122,30 @@ get stuck or fall too far, use the rescue button to get back on track."));
* number of kart actions without changing this screen. */ * number of kart actions without changing this screen. */
for(int i = WTOK_FIRST_KEYNAME; i <= WTOK_LAST_KEYNAME; ++i) for(int i = WTOK_FIRST_KEYNAME; i <= WTOK_LAST_KEYNAME; ++i)
{ {
widget_manager->addWgt( i, 20, 4 ); widget_manager->addTextWgt( i, 20, 4,
widget_manager->setWgtRoundCorners( i, WGT_AREA_LFT );
widget_manager->setWgtText( i,
sKartAction2String[i - WTOK_FIRST_KEYNAME] ); sKartAction2String[i - WTOK_FIRST_KEYNAME] );
widget_manager->setWgtRoundCorners( i, WGT_AREA_LFT );
} }
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->insertColumn(); widget_manager->insertColumn();
for(int i = WTOK_FIRST_KEYBINDING; i <= WTOK_LAST_KEYBINDING; ++i) for(int i = WTOK_FIRST_KEYBINDING; i <= WTOK_LAST_KEYBINDING; ++i)
{ {
widget_manager->addWgt( i, 20, 4 ); widget_manager->addTextWgt( i, 20, 4,
widget_manager->setWgtRoundCorners( i, WGT_AREA_RGT );
widget_manager->setWgtText( i,
user_config->getMappingAsString( 0, user_config->getMappingAsString( 0,
(KartAction)(i - WTOK_FIRST_KEYBINDING)).c_str()); (KartAction)(i - WTOK_FIRST_KEYBINDING)).c_str());
widget_manager->setWgtRoundCorners( i, WGT_AREA_RGT );
} }
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->breakLine(); widget_manager->breakLine();
/*Buttons at the bottom*/ /*Buttons at the bottom*/
widget_manager->addWgt(WTOK_SECOND_PAGE, 20, 7); widget_manager->addTextButtonWgt(WTOK_SECOND_PAGE, 20, 7,
widget_manager->setWgtText(WTOK_SECOND_PAGE, _("Next screen")); _("Next screen"));
widget_manager->activateWgt(WTOK_SECOND_PAGE);
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_QUIT, 40, 7); widget_manager->addTextButtonWgt(WTOK_QUIT, 40, 7,
widget_manager->setWgtText(WTOK_QUIT, _("Go back to the main menu")); _("Go back to the main menu"));
widget_manager->activateWgt(WTOK_QUIT);
widget_manager->layout( WGT_AREA_TOP ); widget_manager->layout( WGT_AREA_TOP );
} // HelpPageOne } // HelpPageOne
@ -183,7 +172,6 @@ HelpPageOne::~HelpPageOne()
void HelpPageOne::update(float dt) void HelpPageOne::update(float dt)
{ {
m_clock += dt * 40.0f; m_clock += dt * 40.0f;
BaseGUI::update(dt);
if (m_box != NULL && m_silver_coin != NULL && m_gold_coin != NULL if (m_box != NULL && m_silver_coin != NULL && m_gold_coin != NULL
&& m_banana != NULL ) && m_banana != NULL )
@ -221,6 +209,8 @@ void HelpPageOne::update(float dt)
glDisable (GL_DEPTH_TEST); glDisable (GL_DEPTH_TEST);
oldContext->makeCurrent(); oldContext->makeCurrent();
} }
widget_manager->update(dt);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -229,7 +219,7 @@ void HelpPageOne::select()
switch ( widget_manager->getSelectedWgt() ) switch ( widget_manager->getSelectedWgt() )
{ {
case WTOK_SECOND_PAGE: case WTOK_SECOND_PAGE:
//This switches thee first page with the second page, so they //This switches the first page with the second page, so they
//are not stacked by the menu manager, and the menu that called //are not stacked by the menu manager, and the menu that called
//this help is the one that gets called back when the next page //this help is the one that gets called back when the next page
//is popped. //is popped.

View File

@ -29,14 +29,14 @@
enum WidgetTokens enum WidgetTokens
{ {
WTOK_MSG6, WTOK_MSG,
WTOK_ITEMIMG1, WTOK_ITEMTXT1, WTOK_IMG1, WTOK_TXT1,
WTOK_ITEMIMG2, WTOK_ITEMTXT2, WTOK_IMG2, WTOK_TXT2,
WTOK_ITEMIMG3, WTOK_ITEMTXT3, WTOK_IMG3, WTOK_TXT3,
WTOK_ITEMIMG4, WTOK_ITEMTXT4, WTOK_IMG4, WTOK_TXT4,
WTOK_ITEMIMG5, WTOK_ITEMTXT5, WTOK_IMG5, WTOK_TXT5,
WTOK_ITEMIMG6, WTOK_ITEMTXT6, WTOK_IMG6, WTOK_TXT6,
WTOK_FIRST_PAGE, WTOK_FIRST_PAGE,
WTOK_QUIT WTOK_QUIT
@ -44,110 +44,76 @@ enum WidgetTokens
HelpPageTwo::HelpPageTwo() HelpPageTwo::HelpPageTwo()
{ {
//FIXME: instead of using setInitialTextState, the gui & widget manager macros should improve it's design
widget_manager->setInitialTextState
(
false,
"",
WGT_FNT_SML,
WGT_FONT_GUI,
WGT_WHITE,
false
);
/* Add the widgets */ widget_manager->addTextWgt( WTOK_MSG, 100, 8,
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,
WGT_FONT_GUI, WGT_WHITE, false );
widget_manager->addWgt(WTOK_MSG6, 100, 8);
widget_manager->setWgtText(WTOK_MSG6,
_("To help you win, there are certain collectables you can grab:")); _("To help you win, there are certain collectables you can grab:"));
widget_manager->showWgtText( WTOK_MSG6 );
widget_manager->breakLine(); widget_manager->breakLine();
/* Collectable images and descriptions */ widget_manager->addImgWgt( WTOK_IMG1, 10, 13,
widget_manager->addWgt(WTOK_ITEMIMG1, 10, 13);
widget_manager->setWgtTexture(WTOK_ITEMIMG1,
collectable_manager->getIcon(COLLECT_MISSILE)->getState()->getTextureHandle()); collectable_manager->getIcon(COLLECT_MISSILE)->getState()->getTextureHandle());
widget_manager->setWgtColor(WTOK_ITEMIMG1, WGT_WHITE);
widget_manager->showWgtTexture(WTOK_ITEMIMG1);
widget_manager->setWgtRoundCorners(WTOK_ITEMIMG1, WGT_AREA_NONE);
widget_manager->addWgt(WTOK_ITEMTXT1, 90, 13); widget_manager->addTextWgt( WTOK_TXT1, 90, 13,
widget_manager->setWgtText( WTOK_ITEMTXT1,
_("Missile - fast stopper in a straight line")); _("Missile - fast stopper in a straight line"));
widget_manager->showWgtText( WTOK_ITEMTXT1 ); widget_manager->setWgtRoundCorners( WTOK_TXT1, WGT_AREA_RGT );
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_ITEMIMG2, 10, 13); widget_manager->addImgWgt(WTOK_IMG2, 10, 13,
widget_manager->setWgtTexture(WTOK_ITEMIMG2,
collectable_manager->getIcon(COLLECT_HOMING)->getState()->getTextureHandle()); collectable_manager->getIcon(COLLECT_HOMING)->getState()->getTextureHandle());
widget_manager->setWgtColor(WTOK_ITEMIMG2, WGT_WHITE);
widget_manager->showWgtTexture( WTOK_ITEMIMG2 );
widget_manager->setWgtRoundCorners(WTOK_ITEMIMG2, WGT_AREA_NONE);
widget_manager->addWgt(WTOK_ITEMTXT2, 90, 13); widget_manager->addTextWgt(WTOK_TXT2, 90, 13,
widget_manager->setWgtText( WTOK_ITEMTXT2,
_("Homing missile - follows rivals, but is slower than the missile")); _("Homing missile - follows rivals, but is slower than the missile"));
widget_manager->showWgtText( WTOK_ITEMTXT2 ); widget_manager->setWgtRoundCorners( WTOK_TXT2, WGT_AREA_RGT );
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_ITEMIMG3, 10, 13); widget_manager->addImgWgt(WTOK_IMG3, 10, 13,
widget_manager->setWgtTexture(WTOK_ITEMIMG3,
collectable_manager->getIcon(COLLECT_SPARK)->getState()->getTextureHandle()); collectable_manager->getIcon(COLLECT_SPARK)->getState()->getTextureHandle());
widget_manager->setWgtColor(WTOK_ITEMIMG3, WGT_WHITE);
widget_manager->showWgtTexture( WTOK_ITEMIMG3 );
widget_manager->setWgtRoundCorners(WTOK_ITEMIMG3, WGT_AREA_NONE);
widget_manager->addWgt(WTOK_ITEMTXT3, 90, 13); widget_manager->addTextWgt(WTOK_TXT3, 90, 13,
widget_manager->setWgtText( WTOK_ITEMTXT3,
_("Fuzzy blob/Spark - very slow, but bounces from walls")); _("Fuzzy blob/Spark - very slow, but bounces from walls"));
widget_manager->showWgtText( WTOK_ITEMTXT3 ); widget_manager->setWgtRoundCorners( WTOK_TXT3, WGT_AREA_RGT );
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_ITEMIMG4, 10, 13); widget_manager->addImgWgt(WTOK_IMG4, 10, 13,
widget_manager->setWgtTexture(WTOK_ITEMIMG4,
collectable_manager->getIcon(COLLECT_ZIPPER)->getState()->getTextureHandle()); collectable_manager->getIcon(COLLECT_ZIPPER)->getState()->getTextureHandle());
widget_manager->setWgtColor(WTOK_ITEMIMG4, WGT_WHITE);
widget_manager->showWgtTexture( WTOK_ITEMIMG4 );
widget_manager->setWgtRoundCorners(WTOK_ITEMIMG4, WGT_AREA_NONE);
widget_manager->addWgt(WTOK_ITEMTXT4, 90, 13); widget_manager->addTextWgt(WTOK_TXT4, 90, 13,
widget_manager->setWgtText( WTOK_ITEMTXT4,
_("Zipper - speed boost")); _("Zipper - speed boost"));
widget_manager->showWgtText( WTOK_ITEMTXT4 ); widget_manager->setWgtRoundCorners(WTOK_TXT4, WGT_AREA_RGT);
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_ITEMIMG5, 10, 13); widget_manager->addImgWgt(WTOK_IMG5, 10, 13,
widget_manager->setWgtTexture(WTOK_ITEMIMG5,
collectable_manager->getIcon(COLLECT_PARACHUTE)->getState()->getTextureHandle()); collectable_manager->getIcon(COLLECT_PARACHUTE)->getState()->getTextureHandle());
widget_manager->setWgtColor(WTOK_ITEMIMG5, WGT_WHITE);
widget_manager->showWgtTexture( WTOK_ITEMIMG5 );
widget_manager->setWgtRoundCorners(WTOK_ITEMIMG5, WGT_AREA_NONE);
widget_manager->addWgt(WTOK_ITEMTXT5, 90, 13); widget_manager->addTextWgt(WTOK_TXT5, 90, 13,
widget_manager->setWgtText( WTOK_ITEMTXT5,
_("Parachute - slows down all karts in a better position!")); _("Parachute - slows down all karts in a better position!"));
widget_manager->showWgtText( WTOK_ITEMTXT5 ); widget_manager->setWgtRoundCorners(WTOK_TXT5, WGT_AREA_RGT);
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_ITEMIMG6, 10, 13); widget_manager->addImgWgt(WTOK_IMG6, 10, 13,
widget_manager->setWgtTexture(WTOK_ITEMIMG6,
collectable_manager->getIcon(COLLECT_ANVIL)->getState()->getTextureHandle()); collectable_manager->getIcon(COLLECT_ANVIL)->getState()->getTextureHandle());
widget_manager->setWgtColor(WTOK_ITEMIMG6, WGT_WHITE);
widget_manager->showWgtTexture( WTOK_ITEMIMG6 );
widget_manager->setWgtRoundCorners(WTOK_ITEMIMG6, WGT_AREA_NONE);
widget_manager->addWgt(WTOK_ITEMTXT6, 90, 13); widget_manager->addTextWgt(WTOK_TXT6, 90, 13,
widget_manager->setWgtText( WTOK_ITEMTXT6,
_("Anvil - slows down greatly the kart in the first position")); _("Anvil - slows down greatly the kart in the first position"));
widget_manager->showWgtText( WTOK_ITEMTXT6 ); widget_manager->setWgtRoundCorners(WTOK_TXT6, WGT_AREA_RGT);
widget_manager->breakLine(); widget_manager->breakLine();
/*Buttons at the bottom*/ /*Buttons at the bottom*/
widget_manager->addWgt(WTOK_FIRST_PAGE, 25, 7); widget_manager->addTextButtonWgt(WTOK_FIRST_PAGE, 25, 7,
widget_manager->setWgtText(WTOK_FIRST_PAGE, _("Previous screen")); _("Previous screen"));
widget_manager->showWgtText( WTOK_FIRST_PAGE );
widget_manager->activateWgt(WTOK_FIRST_PAGE);
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addWgt(WTOK_QUIT, 40, 7); widget_manager->addTextButtonWgt(WTOK_QUIT, 40, 7,
widget_manager->setWgtText(WTOK_QUIT, _("Go back to the main menu")); _("Go back to the main menu"));
widget_manager->showWgtText( WTOK_QUIT );
widget_manager->activateWgt(WTOK_QUIT);
widget_manager->layout( WGT_AREA_TOP ); widget_manager->layout( WGT_AREA_TOP );
} // HelpMenu } // HelpMenu

View File

@ -73,11 +73,11 @@ TrackSel::TrackSel()
} }
} }
widget_manager->addEmptyWgt(WTOK_IMG0, 35, 35); widget_manager->addImgWgt(WTOK_IMG0, 35, 35, 0);
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 5, 35 ); widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 5, 35 );
widget_manager->addEmptyWgt(WTOK_IMG1, 35, 35); widget_manager->addImgWgt(WTOK_IMG1, 35, 35, 0);
widget_manager->breakLine(); widget_manager->breakLine();
widget_manager->addTextWgt( WTOK_AUTHOR, 80, 9, _("No track selected") ); widget_manager->addTextWgt( WTOK_AUTHOR, 80, 9, _("No track selected") );

View File

@ -252,7 +252,7 @@ void Widget::setFont( const WidgetFont FONT )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Widget::setTexture( const char* FILENAME ) void Widget::setTexture( const char* FILENAME )
{ {
Material *m = material_manager->getMaterial( FILENAME ); Material *m = material_manager->getMaterial( FILENAME, true );
m_texture = m->getState()->getTextureHandle(); m_texture = m->getState()->getTextureHandle();
} }
@ -261,21 +261,22 @@ void Widget::setTexture( const char* FILENAME )
* map to the rectangle as though the corners were not rounded . Returns * map to the rectangle as though the corners were not rounded . Returns
* false if the call to glGenLists failed, otherwise it returns true. * false if the call to glGenLists failed, otherwise it returns true.
*/ */
bool Widget::createRect(int radius) bool Widget::createRect()
{ {
//TODO: show warning if text > rect //TODO: show warning if text > rect
if(radius > m_width * 0.5) if(m_radius > m_width * 0.5)
{ {
std::cerr << "Warning: widget's radius > half width.\n"; std::cerr << "Warning: widget's radius > half width.\n";
} }
if(radius > m_height * 0.5) if(m_radius > m_height * 0.5)
{ {
std::cerr << "Warning: widget's radius > half height.\n"; std::cerr << "Warning: widget's radius > half height.\n";
} }
if(radius < 1) if(m_radius < 1)
{ {
std::cerr << "Warning: widget's radius < 1, setting to 1.\n"; std::cerr << "Warning: widget's radius < 1, setting to 1.\n";
radius = 1; m_radius = 1;
} }
if(m_width == 0) if(m_width == 0)
@ -305,7 +306,7 @@ bool Widget::createRect(int radius)
//isn't based just on logic, since it went through visual testing to give //isn't based just on logic, since it went through visual testing to give
//the perception of roundness. //the perception of roundness.
const int MIN_QUADS = 2; const int MIN_QUADS = 2;
const int NUM_QUADS = MIN_QUADS + radius; const int NUM_QUADS = MIN_QUADS + m_radius;
int i; int i;
@ -348,8 +349,8 @@ bool Widget::createRect(int radius)
//+ 1 parts, and use the angles at those parts to find the //+ 1 parts, and use the angles at those parts to find the
//X and Y position of the points. //X and Y position of the points.
angle = 0.5f * M_PI * (float)i / (float)NUM_QUADS; angle = 0.5f * M_PI * (float)i / (float)NUM_QUADS;
circle_x = radius * cos(angle); circle_x = m_radius * cos(angle);
circle_y = radius * sin(angle); circle_y = m_radius * sin(angle);
//After we generate the positions in circle for the angles, //After we generate the positions in circle for the angles,
//we have to position each rounded corner properly depending //we have to position each rounded corner properly depending
@ -359,12 +360,12 @@ bool Widget::createRect(int radius)
//for a rectangle without rounder corners. //for a rectangle without rounder corners.
inner_vertex[i].resize(3); inner_vertex[i].resize(3);
outer_vertex[i].resize(3); outer_vertex[i].resize(3);
outer_vertex[i][0] = radius - circle_x; outer_vertex[i][0] = m_radius - circle_x;
inner_vertex[i][0] = outer_vertex[i][0] + BORDER_LENGTH; inner_vertex[i][0] = outer_vertex[i][0] + BORDER_LENGTH;
if( m_round_corners & WGT_AREA_NW ) if( m_round_corners & WGT_AREA_NW )
{ {
outer_vertex[i][1] = m_height + circle_y - radius; outer_vertex[i][1] = m_height + circle_y - m_radius;
inner_vertex[i][1] = outer_vertex[i][1] - BORDER_LENGTH; inner_vertex[i][1] = outer_vertex[i][1] - BORDER_LENGTH;
} }
else else
@ -375,7 +376,7 @@ bool Widget::createRect(int radius)
if( m_round_corners & WGT_AREA_SW ) if( m_round_corners & WGT_AREA_SW )
{ {
outer_vertex[i][2] = radius - circle_y; outer_vertex[i][2] = m_radius - circle_y;
inner_vertex[i][2] = outer_vertex[i][2] + BORDER_LENGTH; inner_vertex[i][2] = outer_vertex[i][2] + BORDER_LENGTH;
} }
else else
@ -398,17 +399,17 @@ bool Widget::createRect(int radius)
//By inverting the use of sin and cos we get corners that are //By inverting the use of sin and cos we get corners that are
//drawn from left to right instead of right to left //drawn from left to right instead of right to left
circle_x = radius * sin(angle); circle_x = m_radius * sin(angle);
circle_y = radius * cos(angle); circle_y = m_radius * cos(angle);
inner_vertex[i+1].resize(3); inner_vertex[i+1].resize(3);
outer_vertex[i+1].resize(3); outer_vertex[i+1].resize(3);
outer_vertex[i+1][0] = m_width - radius + circle_x; outer_vertex[i+1][0] = m_width - m_radius + circle_x;
inner_vertex[i+1][0] = outer_vertex[i+1][0] - BORDER_LENGTH; inner_vertex[i+1][0] = outer_vertex[i+1][0] - BORDER_LENGTH;
if( m_round_corners & WGT_AREA_NE ) if( m_round_corners & WGT_AREA_NE )
{ {
outer_vertex[i+1][1] = m_height - radius + circle_y; outer_vertex[i+1][1] = m_height - m_radius + circle_y;
inner_vertex[i+1][1] = outer_vertex[i+1][1] - BORDER_LENGTH; inner_vertex[i+1][1] = outer_vertex[i+1][1] - BORDER_LENGTH;
} }
else else
@ -419,7 +420,7 @@ bool Widget::createRect(int radius)
if( m_round_corners & WGT_AREA_SE ) if( m_round_corners & WGT_AREA_SE )
{ {
outer_vertex[i+1][2] = radius - circle_y; outer_vertex[i+1][2] = m_radius - circle_y;
inner_vertex[i+1][2] = outer_vertex[i+1][2] + BORDER_LENGTH; inner_vertex[i+1][2] = outer_vertex[i+1][2] + BORDER_LENGTH;
} }
else else
@ -693,6 +694,7 @@ void Widget::draw()
{ {
if( m_enable_border ) if( m_enable_border )
{ {
glDisable ( GL_TEXTURE_2D );
glColor4fv(m_border_color); glColor4fv(m_border_color);
//FIXME: I should probably revert the values to the defaults within the widget manager //FIXME: I should probably revert the values to the defaults within the widget manager

View File

@ -130,12 +130,13 @@ class Widget
friend class WidgetManager; friend class WidgetManager;
/* Basic widget properties that will always be used. */ /* Basic widget properties that will always be used. */
int m_x, m_y; int m_x, m_y;
int m_width, m_height; int m_width, m_height;
int m_radius;
/* Low level features. They are off by default. */ /* Low level features. They are off by default. */
bool m_enable_rect; bool m_enable_rect;
GLuint m_rect_list; //A display list number that draws the rectangle with GLuint m_rect_list; //A display list number that draws the rectangle with
//possibly rounded corners. //possibly rounded corners.
const GLfloat *m_rect_color; //This const cannot change the value it points to, but it const GLfloat *m_rect_color; //This const cannot change the value it points to, but it
//can change where it points to. //can change where it points to.
@ -207,7 +208,7 @@ class Widget
void setTexture( const char* FILENAME ); void setTexture( const char* FILENAME );
/* Functions created simply to organize the code */ /* Functions created simply to organize the code */
bool createRect(int radius); bool createRect();
void updateVariables( const float DELTA ); void updateVariables( const float DELTA );
void draw(); void draw();
void applyTransformations(); void applyTransformations();

View File

@ -74,6 +74,7 @@ bool WidgetManager::addWgt
new_id.min_width = MIN_WIDTH; new_id.min_width = MIN_WIDTH;
new_id.min_height = MIN_HEIGHT; new_id.min_height = MIN_HEIGHT;
new_id.min_radius = m_default_rect_radius;
new_id.last_preset_scroll_x = m_default_scroll_preset_x; new_id.last_preset_scroll_x = m_default_scroll_preset_x;
new_id.last_preset_scroll_y = m_default_scroll_preset_y; new_id.last_preset_scroll_y = m_default_scroll_preset_y;
@ -83,9 +84,9 @@ bool WidgetManager::addWgt
new_id.widget = new Widget(0, 0, 0, 0); new_id.widget = new Widget(0, 0, 0, 0);
new_id.widget->m_enable_rect = m_default_show_rect; new_id.widget->m_enable_rect = m_default_show_rect;
new_id.widget->m_round_corners = m_default_rect_round_corners;
new_id.widget->m_rect_color = m_default_rect_color; new_id.widget->m_rect_color = m_default_rect_color;
new_id.widget->m_enable_border = m_default_show_border;
new_id.widget->m_border_percentage = m_default_border_percentage; new_id.widget->m_border_percentage = m_default_border_percentage;
new_id.widget->m_border_color = m_default_border_color; new_id.widget->m_border_color = m_default_border_color;
@ -388,22 +389,37 @@ bool WidgetManager::layout(const WidgetArea POSITION)
const int NUM_WIDGETS = (int)m_widgets.size(); const int NUM_WIDGETS = (int)m_widgets.size();
if( NUM_WIDGETS < 1 ) return true; if( NUM_WIDGETS < 1 ) return true;
int SCREEN_WIDTH = user_config->m_width; const int SCREEN_WIDTH = user_config->m_width;
int SCREEN_HEIGHT = user_config->m_height; const int SCREEN_HEIGHT = user_config->m_height;
int width; int width, height;
int height; //Set the widgets' rect shape properties in pixels.
//Resize the widgets.
for( int i = 0; i < NUM_WIDGETS; ++i ) for( int i = 0; i < NUM_WIDGETS; ++i )
{ {
width = (SCREEN_WIDTH * m_widgets[i].min_width) / 100; width = (int)(SCREEN_WIDTH * m_widgets[i].min_width * 0.01);
height = (SCREEN_HEIGHT * m_widgets[i].min_height) / 100; height = (int)(SCREEN_HEIGHT * m_widgets[i].min_height * 0.01);
m_widgets[i].widget->m_width = width; m_widgets[i].widget->m_width = width;
m_widgets[i].widget->m_height = height; m_widgets[i].widget->m_height = height;
if( m_widgets[i].resize_to_text ) m_widgets[i].widget-> if( m_widgets[i].resize_to_text ) m_widgets[i].widget->
resizeToText(); resizeToText();
if( width < height )
{
m_widgets[i].widget->m_radius = (int)( m_widgets[i].min_radius *
m_widgets[i].widget->m_width * 0.01 );
}
else
{
m_widgets[i].widget->m_radius = (int)( m_widgets[i].min_radius *
m_widgets[i].widget->m_height * 0.01 );
}
if( m_widgets[i].widget->m_radius < 1 )
{
m_widgets[i].widget->m_radius = 1;
}
} }
const int WGTS_WIDTH = calcWidth(); const int WGTS_WIDTH = calcWidth();
@ -477,14 +493,6 @@ bool WidgetManager::layout(const WidgetArea POSITION)
break; break;
} }
//This formula seems not to have much theory behind it, we pick the
//smallest from the screen height and width because if we pick the
//biggest one, it might look bad for the smaller one, but it doesn't
//happens the other way around, and it's divided by 60, maybe because
//it results in small enough values to be of use, or maybe because it's
//divided by 60 minutes? The formula was taken from the old Widget Set.
const int RADIUS = ( SCREEN_HEIGHT < SCREEN_WIDTH ? SCREEN_HEIGHT : SCREEN_WIDTH ) / 60;
/* In this loop we give each widget it's true position on the screen and /* In this loop we give each widget it's true position on the screen and
* create their rect; we start at the position where the first widget * create their rect; we start at the position where the first widget
* will be, and move right first and down on breaks if the widget is * will be, and move right first and down on breaks if the widget is
@ -532,7 +540,7 @@ bool WidgetManager::layout(const WidgetArea POSITION)
m_widgets[curr_wgt].widget->m_y = widget_y; m_widgets[curr_wgt].widget->m_y = widget_y;
//Create widget's rect //Create widget's rect
if( !(m_widgets[curr_wgt].widget->createRect(RADIUS)) ) if( !(m_widgets[curr_wgt].widget->createRect()) )
{ {
return false; return false;
} }
@ -745,6 +753,8 @@ bool WidgetManager::addTitleWgt
setWgtTextSize( TOKEN, WGT_FNT_LRG ); setWgtTextSize( TOKEN, WGT_FNT_LRG );
showWgtText( TOKEN ); showWgtText( TOKEN );
setWgtText( TOKEN, TEXT ); setWgtText( TOKEN, TEXT );
setWgtRoundCorners( TOKEN, WGT_AREA_ALL );
setWgtCornerRadius( TOKEN, 20 );
return true; return true;
} }
@ -761,6 +771,8 @@ bool WidgetManager::addTextWgt
if( !( addWgt( TOKEN, MIN_WIDTH, MIN_HEIGHT ))) return false; if( !( addWgt( TOKEN, MIN_WIDTH, MIN_HEIGHT ))) return false;
showWgtRect( TOKEN ); showWgtRect( TOKEN );
setWgtRoundCorners( TOKEN, WGT_AREA_ALL );
setWgtCornerRadius( TOKEN, 20 );
showWgtText( TOKEN ); showWgtText( TOKEN );
setWgtText( TOKEN, TEXT ); setWgtText( TOKEN, TEXT );
@ -779,6 +791,8 @@ bool WidgetManager::addTextButtonWgt
if( !( addWgt( TOKEN, MIN_WIDTH, MIN_HEIGHT ))) return false; if( !( addWgt( TOKEN, MIN_WIDTH, MIN_HEIGHT ))) return false;
showWgtRect( TOKEN ); showWgtRect( TOKEN );
setWgtRoundCorners( TOKEN, WGT_AREA_ALL );
setWgtCornerRadius( TOKEN, 20 );
showWgtText( TOKEN ); showWgtText( TOKEN );
setWgtText( TOKEN, TEXT ); setWgtText( TOKEN, TEXT );
activateWgt( TOKEN ); activateWgt( TOKEN );
@ -799,6 +813,9 @@ bool WidgetManager::addImgWgt
setWgtColor( TOKEN, WGT_WHITE ); setWgtColor( TOKEN, WGT_WHITE );
showWgtRect( TOKEN ); showWgtRect( TOKEN );
setWgtBorderPercentage( TOKEN, 5 );
setWgtBorderColor( TOKEN, WGT_BLACK );
showWgtBorder( TOKEN );
setWgtTexture( TOKEN, IMG ); setWgtTexture( TOKEN, IMG );
showWgtTexture( TOKEN ); showWgtTexture( TOKEN );
@ -818,6 +835,8 @@ bool WidgetManager::addImgButtonWgt
setWgtColor( TOKEN, WGT_GRAY ); setWgtColor( TOKEN, WGT_GRAY );
showWgtRect( TOKEN ); showWgtRect( TOKEN );
setWgtRoundCorners( TOKEN, WGT_AREA_ALL );
setWgtCornerRadius( TOKEN, 20 );
setWgtTexture( TOKEN, IMG ); setWgtTexture( TOKEN, IMG );
showWgtTexture( TOKEN ); showWgtTexture( TOKEN );
activateWgt( TOKEN ); activateWgt( TOKEN );
@ -836,11 +855,13 @@ void WidgetManager::setInitialRectState
( (
const bool SHOW, const bool SHOW,
const WidgetArea ROUND_CORNERS, const WidgetArea ROUND_CORNERS,
const int RADIUS,
const GLfloat* const COLOR const GLfloat* const COLOR
) )
{ {
m_default_show_rect = SHOW; m_default_show_rect = SHOW;
m_default_rect_round_corners = (ROUND_CORNERS!= WGT_AREA_NONE); m_default_rect_round_corners = ROUND_CORNERS;
m_default_rect_radius = RADIUS;
m_default_rect_color = COLOR; m_default_rect_color = COLOR;
} }
@ -934,8 +955,9 @@ void WidgetManager::restoreDefaultStates()
//FIXME: maybe instead of 'default' these variables should be 'initial' //FIXME: maybe instead of 'default' these variables should be 'initial'
m_default_active = false; m_default_active = false;
m_default_show_rect = false; m_default_show_rect = false;
m_default_rect_round_corners = WGT_AREA_NONE;
m_default_rect_color = WGT_TRANS_BLACK; m_default_rect_color = WGT_TRANS_BLACK;
m_default_rect_round_corners = WGT_AREA_NONE;
m_default_rect_radius = 1;
m_default_show_border = false; m_default_show_border = false;
m_default_border_percentage = 0.0; m_default_border_percentage = 0.0;
m_default_border_color = WGT_TRANS_WHITE; m_default_border_color = WGT_TRANS_WHITE;
@ -1006,6 +1028,34 @@ void WidgetManager::setWgtRoundCorners(const int TOKEN, const WidgetArea CORNERS
"unnamed widget with token " << TOKEN << '\n'; "unnamed widget with token " << TOKEN << '\n';
} }
} }
//-----------------------------------------------------------------------------
void WidgetManager::setWgtCornerRadius(const int TOKEN, const int RADIUS)
{
if( RADIUS > 50 )
{
std::cerr << "WARNING: tried to set the corner's radius " <<
"percentage of a widget with token " << TOKEN << " to " <<
"something bigger than 50% \n";
return;
}
else if( RADIUS < 1 )
{
std::cerr << "WARNING: tried to set the corner's radius " <<
"percentage of a widget with token " << TOKEN << " to " <<
"something smaller than 1% \n";
return;
}
const int ID = findId(TOKEN);
if( ID != WGT_NONE ) m_widgets[ID].min_radius = RADIUS;
else
{
std::cerr << "WARNING: tried to change the corner radius of an " <<
"unnamed widget with token " << TOKEN << '\n';
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void WidgetManager::showWgtRect(const int TOKEN) void WidgetManager::showWgtRect(const int TOKEN)
{ {

View File

@ -47,9 +47,10 @@ class WidgetManager
bool active; //If true, then this widget is interactive(though by bool active; //If true, then this widget is interactive(though by
//definition, widgets are supposed to be interactive). //definition, widgets are supposed to be interactive).
//The percentages of the container this widget takes //The percentages for the widget's rect
int min_width; int min_width;
int min_height; int min_height;
int min_radius;
//The last given preset scroll position is stored, to restore it in //The last given preset scroll position is stored, to restore it in
//case that the text is changed it needs to be restored. //case that the text is changed it needs to be restored.
@ -100,7 +101,8 @@ class WidgetManager
bool m_default_resize_to_text; bool m_default_resize_to_text;
bool m_default_show_rect; bool m_default_show_rect;
bool m_default_rect_round_corners; WidgetArea m_default_rect_round_corners;
int m_default_rect_radius;
const GLfloat *m_default_rect_color; const GLfloat *m_default_rect_color;
bool m_default_show_border; bool m_default_show_border;
@ -150,6 +152,7 @@ class WidgetManager
void setSelectedWgtToken(const int TOKEN); void setSelectedWgtToken(const int TOKEN);
public: public:
//TODO: remove return values that we don't check
static const int WGT_NONE; static const int WGT_NONE;
WidgetManager(); WidgetManager();
@ -197,7 +200,8 @@ public:
//FIXME: Temporal, till I rename addWgt() to addEmptyWgt() //FIXME: Temporal, till I rename addWgt() to addEmptyWgt()
bool addEmptyWgt(const int TOKEN, const int MIN_WIDTH, const int MIN_HEIGHT) {return addWgt(TOKEN,MIN_WIDTH,MIN_HEIGHT);} bool addEmptyWgt(const int TOKEN, const int MIN_WIDTH, const int MIN_HEIGHT) {return addWgt(TOKEN,MIN_WIDTH,MIN_HEIGHT);}
//Widget that adds visible rect & text, sets the text and large font //Widget that adds visible rect & text, rounded corners with 20% radius,
//sets the text, and large font
bool addTitleWgt bool addTitleWgt
( (
const int TOKEN, const int TOKEN,
@ -206,7 +210,8 @@ public:
const std::string TEXT const std::string TEXT
); );
//Widget that adds visible rect & text, and sets the text //Widget that adds visible rect & text, rounded corners with 20% radius,
//and sets the text
bool addTextWgt bool addTextWgt
( (
const int TOKEN, const int TOKEN,
@ -215,7 +220,8 @@ public:
const std::string TEXT const std::string TEXT
); );
//Widget that adds visible rect & text, sets the text and is selectable //Widget that adds visible rect & text, rounded corners with 20% radius,
//sets the text and is selectable
bool addTextButtonWgt bool addTextButtonWgt
( (
const int TOKEN, const int TOKEN,
@ -224,7 +230,8 @@ public:
const std::string TEXT const std::string TEXT
); );
//Widget that adds visible rect & image, white rect, and sets the texture //Widget that adds visible rect & image, white rect, 5% black
//border, and sets the texture
bool addImgWgt bool addImgWgt
( (
const int TOKEN, const int TOKEN,
@ -233,7 +240,8 @@ public:
const int IMG const int IMG
); );
//Selectable widget with visible rect & image, gray rect and texture //Selectable widget with visible rect & image, rounded corners with 20% radius,
//gray rect and texture
bool addImgButtonWgt bool addImgButtonWgt
( (
const int TOKEN, const int TOKEN,
@ -249,6 +257,7 @@ public:
( (
const bool SHOW, const bool SHOW,
const WidgetArea ROUND_CORNERS, const WidgetArea ROUND_CORNERS,
const int RADIUS,
const GLfloat* const COLOR const GLfloat* const COLOR
); );
@ -302,6 +311,10 @@ public:
//FIXME: maybe this should be setWgtRectColor ? 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 setWgtColor(const int TOKEN, const GLfloat* const COLOR);
void setWgtRoundCorners(const int TOKEN, const WidgetArea CORNERS); void setWgtRoundCorners(const int TOKEN, const WidgetArea CORNERS);
//The radius given is the percentage of the height or the width of the
//widget, whatever is smaller; however, the maximum is 50% (the corner's
//size).
void setWgtCornerRadius(const int TOKEN, const int RADIUS);
void showWgtRect(const int TOKEN); void showWgtRect(const int TOKEN);
void hideWgtRect(const int TOKEN); void hideWgtRect(const int TOKEN);