improved presentation of audio/video options screen
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3406 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
546816d2d4
commit
ccefa05789
@ -8,11 +8,7 @@
|
||||
<icon-button id="controls" width="128" height="128" icon="gui/options_input.png" text="Controls"/>
|
||||
</ribbon>
|
||||
|
||||
<spacer proportion="1" width="10" proportion="1"/>
|
||||
|
||||
<label align="center" text="Audio/Video"/>
|
||||
|
||||
<spacer proportion="1" width="10" proportion="1"/>
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<div width="75%" height="40" layout="horizontal-row" >
|
||||
<label proportion="2" height="100%" text="Music"/>
|
||||
@ -25,11 +21,11 @@
|
||||
<gauge id="music_volume" proportion="1" height="100%"/>
|
||||
</div>
|
||||
|
||||
<spacer proportion="1" width="10" proportion="1"/>
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<div width="75%" height="40" layout="horizontal-row" >
|
||||
<label proportion="2" height="100%" text="Sound Effects"/>
|
||||
<checkbox id="sfx_enabled" width="40" icon="gui/glasscheckbox.png" height="40"/>
|
||||
<checkbox id="sfx_enabled" width="40" height="40"/>
|
||||
<spacer width="20" height="100%" />
|
||||
<label proportion="1" height="100%" text="Enabled"/>
|
||||
</div>
|
||||
@ -39,18 +35,20 @@
|
||||
</div>
|
||||
|
||||
|
||||
<spacer proportion="2" width="10" proportion="1"/>
|
||||
<spacer height="50" width="10"/>
|
||||
|
||||
<label align="center" text="Video"/>
|
||||
|
||||
<spacer proportion="1" width="10" proportion="1"/>
|
||||
<div width="75%" height="40" layout="horizontal-row" >
|
||||
<label proportion="2" height="100%" text="Video"/>
|
||||
<checkbox id="fullscreen" width="40" height="40"/>
|
||||
<spacer width="20" height="100%" />
|
||||
<label proportion="1" height="100%" text="Fullscreen"/>
|
||||
</div>
|
||||
|
||||
<ribbon_grid id="resolutions" proportion="4" text="all" width="100%" square_items="false" align="center" child_width="128" child_height="128" />
|
||||
|
||||
<!--
|
||||
<ribbon_grid id="resolutions" proportion="4" width="100%" square_items="false" align="center" child_width="128" child_height="128" />
|
||||
-->
|
||||
|
||||
|
||||
<ribbon id="resolutions" height="20%" width="100%" align="center">
|
||||
<ribbon id="resolutions" proportion="2" width="100%" align="center">
|
||||
|
||||
<icon-button id="1280x1024" text="1280x1024" icon="gui/screen54.png"width="128" height="128" />
|
||||
<icon-button id="800x600" text="800x600" icon="gui/screen43.png"width="128" height="128" />
|
||||
@ -64,5 +62,6 @@
|
||||
<icon-button id="1920x1200" text="1920x1200" icon="gui/screen1610.png"width="128" height="128" />
|
||||
<icon-button id="1280x768" text="1280x768" icon="gui/screen53.png"width="128" height="128" />
|
||||
</ribbon>
|
||||
-->
|
||||
|
||||
</div>
|
@ -11,7 +11,7 @@
|
||||
|
||||
<label width="100%" height="25" text="All Tracks" align="center" text_align="center" />
|
||||
|
||||
<ribbon_grid id="tracks" proportion="1" width="100%" square_items="true" text="-" align="center" child_width="160" child_height="120" />
|
||||
<ribbon_grid id="tracks" proportion="1" width="100%" square_items="true" text="bottom" align="center" child_width="160" child_height="120" />
|
||||
|
||||
<tabs width="100%" height="25" id="trackgroups">
|
||||
<button text="Standard"/>
|
||||
|
@ -55,7 +55,9 @@ affect the type of highlighting used). Supports an optional label at the bottom
|
||||
PROP_CHILD_WIDTH and PROP_CHILD_HEIGHT are mandatory (so at least aspect ratio of elements that will later be added isk nown)
|
||||
An interesting aspect of PROP_CHILD_WIDTH and PROP_CHILD_HEIGHT is that you can use them to show textures to any aspect ratio
|
||||
you want (so you can e.g. save textures to a power-of-two size like 256x256, but then show it in 4:3 ratio).
|
||||
|
||||
Gives a special meaning to the text parameter. A value of "bottom" means to display the name of the selected icon at the bottom.
|
||||
A value of "all" means that each icon shall have its name under it.
|
||||
|
||||
WTYPE_MODEL_VIEW "model"
|
||||
Displays a model. Currently incomplete. Contents must be set programmatically.
|
||||
|
||||
@ -76,7 +78,8 @@ used in events callbacks to determine what action occurred. Can be omitted
|
||||
on components that do not trigger events (e.g. labels)
|
||||
|
||||
PROP_TEXT "text"
|
||||
gives text (a label) to the widget where supported.
|
||||
gives text (a label) to the widget where supported. Ribbon-grids give a special meaning
|
||||
to this parameter, see ribbon-grid docs above.
|
||||
|
||||
PROP_ICON "icon"
|
||||
give an icon to the widget. Property contents is the path to the file, relative
|
||||
|
@ -67,7 +67,6 @@ namespace StateManager
|
||||
static bool karts_menu_inited = false;
|
||||
if(name == "init" /*&& !karts_menu_inited*/)
|
||||
{
|
||||
std::cout << "filling kart menu..." << std::endl;
|
||||
GUIEngine::RibbonGridWidget* w = dynamic_cast<GUIEngine::RibbonGridWidget*>(GUIEngine::getCurrentScreen()->getWidget("karts"));
|
||||
assert( w != NULL );
|
||||
|
||||
@ -105,9 +104,6 @@ namespace StateManager
|
||||
//test->setMaterialFlag(EMF_LIGHTING , false);
|
||||
|
||||
w3->setModel(test);
|
||||
|
||||
//karts_menu_inited = true;
|
||||
std::cout << "filled kart menu... done" << std::endl;
|
||||
}
|
||||
// TODO - actually check which kart was selected
|
||||
else if(name == "karts")
|
||||
@ -303,7 +299,7 @@ namespace StateManager
|
||||
|
||||
sfx->setState( user_config->doSFX() );
|
||||
music->setState( user_config->doMusic() );
|
||||
/*
|
||||
|
||||
{
|
||||
GUIEngine::RibbonGridWidget* res = dynamic_cast<GUIEngine::RibbonGridWidget*>
|
||||
(GUIEngine::getCurrentScreen()->getWidget("resolutions"));
|
||||
@ -327,7 +323,7 @@ namespace StateManager
|
||||
resolutions_inited = true;
|
||||
}
|
||||
res->updateItemDisplay();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
// -- options
|
||||
|
@ -319,6 +319,7 @@ void GaugeWidget::setValue(const float val)
|
||||
IconButtonWidget::IconButtonWidget(const bool clickable)
|
||||
{
|
||||
IconButtonWidget::clickable = clickable;
|
||||
label = NULL;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void IconButtonWidget::add()
|
||||
@ -360,7 +361,7 @@ void IconButtonWidget::add()
|
||||
if(message.size() > 0)
|
||||
{
|
||||
widget_size += position2d<s32>(0, widget_size.getHeight());
|
||||
IGUIStaticText* label = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), widget_size);
|
||||
label = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), widget_size);
|
||||
label->setTextAlignment(EGUIA_CENTER, EGUIA_UPPERLEFT);
|
||||
label->setTabStop(false);
|
||||
}
|
||||
@ -390,6 +391,17 @@ void IconButtonWidget::add()
|
||||
*/
|
||||
}
|
||||
|
||||
void IconButtonWidget::setLabel(std::string new_label)
|
||||
{
|
||||
std::cout << "trying to set label " << new_label.c_str() << std::endl;
|
||||
|
||||
if(label == NULL) return;
|
||||
|
||||
std::cout << "set label " << new_label.c_str() << std::endl;
|
||||
|
||||
label->setText( stringw(new_label.c_str()).c_str() );
|
||||
}
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark Ribbon
|
||||
@ -502,6 +514,9 @@ bool RibbonWidget::transmitEvent(Widget* w, std::string& originator)
|
||||
// -----------------------------------------------------------------------------
|
||||
void RibbonWidget::add()
|
||||
{
|
||||
m_labels.clearWithoutDeleting();
|
||||
|
||||
|
||||
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
|
||||
|
||||
IGUIButton * btn = GUIEngine::getGUIEnv()->addButton(widget_size, NULL, ++id_counter, L"");
|
||||
@ -578,7 +593,7 @@ void RibbonWidget::add()
|
||||
|
||||
// ---- label part
|
||||
if(has_label)
|
||||
{
|
||||
{
|
||||
subsize = rect<s32>(widget_x - one_button_space/2,
|
||||
(int)((button_y + m_children[i].h)*zoom) + 5 /* leave 5 pixels between button and label */,
|
||||
widget_x + (int)(one_button_space/2.0f), h);
|
||||
@ -588,6 +603,9 @@ void RibbonWidget::add()
|
||||
label->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
|
||||
label->setTabStop(false);
|
||||
label->setNotClipped(true);
|
||||
|
||||
m_labels.push_back(label);
|
||||
|
||||
const int final_y = subsize.getHeight() + label->getTextHeight();
|
||||
if(final_y > biggest_y) biggest_y = final_y;
|
||||
}
|
||||
@ -610,6 +628,15 @@ void RibbonWidget::add()
|
||||
updateSelection();
|
||||
}
|
||||
|
||||
void RibbonWidget::setLabel(const int id, std::string new_name)
|
||||
{
|
||||
if(m_labels.size() == 0) return; // ignore this call for ribbons without labels
|
||||
|
||||
assert(id >= 0);
|
||||
assert(id < m_labels.size());
|
||||
m_labels[id].setText( stringw(new_name.c_str()).c_str() );
|
||||
}
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark Spinner
|
||||
@ -779,7 +806,7 @@ void RibbonGridWidget::add()
|
||||
m_children.clearAndDeleteAll();
|
||||
m_rows.clearWithoutDeleting();
|
||||
|
||||
m_has_label = m_properties[PROP_TEXT].size() > 0;
|
||||
m_has_label = m_properties[PROP_TEXT] == "bottom";
|
||||
const int label_height = m_has_label ? 25 : 0;
|
||||
|
||||
int child_width, child_height;
|
||||
@ -825,7 +852,10 @@ void RibbonGridWidget::add()
|
||||
|
||||
// set size to get proper ratio (as most textures are saved scaled down to 256x256)
|
||||
icon->m_properties[PROP_WIDTH] = m_properties[PROP_CHILD_WIDTH];
|
||||
icon->m_properties[PROP_HEIGHT]= m_properties[PROP_CHILD_HEIGHT];
|
||||
icon->m_properties[PROP_HEIGHT] = m_properties[PROP_CHILD_HEIGHT];
|
||||
if(m_properties[PROP_TEXT] == "all") icon->m_properties[PROP_TEXT] = "hello";
|
||||
|
||||
// std::cout << "ribbon text = " << m_properties[PROP_TEXT].c_str() << std::endl;
|
||||
|
||||
icon->m_type = WTYPE_ICON_BUTTON;
|
||||
ribbon->m_children.push_back( icon );
|
||||
@ -1022,7 +1052,7 @@ void RibbonGridWidget::updateItemDisplay()
|
||||
|
||||
for(int n=0; n<row_amount; n++)
|
||||
{
|
||||
Widget& row = m_rows[n];
|
||||
RibbonWidget& row = m_rows[n];
|
||||
|
||||
for(int i=0; i<m_col_amount; i++)
|
||||
{
|
||||
@ -1039,7 +1069,7 @@ void RibbonGridWidget::updateItemDisplay()
|
||||
button->setImage( GUIEngine::getDriver()->getTexture( track_sshot.c_str() ));
|
||||
button->setPressedImage( GUIEngine::getDriver()->getTexture( track_sshot.c_str()) );
|
||||
icon->m_properties[PROP_ID] = m_items[trackid].m_code_name;
|
||||
// trackid++;
|
||||
row.setLabel(i, m_items[trackid].m_user_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -202,9 +202,11 @@ namespace GUIEngine
|
||||
{
|
||||
bool clickable;
|
||||
void add();
|
||||
IGUIStaticText* label;
|
||||
public:
|
||||
virtual ~IconButtonWidget() {}
|
||||
IconButtonWidget(const bool clickable=true);
|
||||
void setLabel(std::string new_label);
|
||||
};
|
||||
|
||||
enum RibbonType
|
||||
@ -231,6 +233,8 @@ namespace GUIEngine
|
||||
void updateSelection();
|
||||
bool transmitEvent(Widget* w, std::string& originator);
|
||||
void focused();
|
||||
|
||||
ptr_vector<IGUIStaticText, REF> m_labels;
|
||||
public:
|
||||
virtual ~RibbonWidget() {}
|
||||
|
||||
@ -240,6 +244,7 @@ namespace GUIEngine
|
||||
RibbonType getRibbonType() const { return m_ribbon_type; }
|
||||
const std::string& getSelectionName() { return m_children[m_selection].m_properties[PROP_ID]; }
|
||||
void select(std::string item);
|
||||
void setLabel(const int id, std::string new_name);
|
||||
|
||||
RibbonWidget(const RibbonType type=RIBBON_COMBO);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user