refined the option menu's skeleton
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3341 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
1bd89aa969
commit
b2202d0a0f
43
data/gui/options_av.stkgui
Normal file
43
data/gui/options_av.stkgui
Normal file
@ -0,0 +1,43 @@
|
||||
<div x="5%" y="2%" width="90%" height="96%" layout="vertical-row" >
|
||||
|
||||
<label align="center" text="SuperTuxKart Options"/>
|
||||
|
||||
<ribbon id="options_choice" height="20%" width="75%" align="center">
|
||||
<icon-button id="audio_video" width="128" height="128" icon="options_audio_video.png" text="Audio/Video"/>
|
||||
<icon-button id="players" width="128" height="128" icon="options_players.png" text="Players"/>
|
||||
<icon-button id="controls" width="128" height="128" icon="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"/>
|
||||
|
||||
<div width="75%" height="30" layout="horizontal-row" >
|
||||
<label proportion="100%" height="100%" text="Music"/>
|
||||
<!-- TODO - add check box -->
|
||||
<gauge id="music_volume" proportion="100%" height="100%"/>
|
||||
</div>
|
||||
|
||||
<spacer proportion="1" width="10" proportion="1"/>
|
||||
|
||||
<div width="75%" height="30" layout="horizontal-row" >
|
||||
<label proportion="100%" height="100%" text="Sound Effects"/>
|
||||
<!-- TODO - add check box -->
|
||||
<gauge id="sfx_volume" proportion="100%" height="100%"/>
|
||||
</div>
|
||||
|
||||
|
||||
<spacer proportion="2" width="10" proportion="1"/>
|
||||
|
||||
<label align="center" text="Video"/>
|
||||
|
||||
<spacer proportion="1" width="10" proportion="1"/>
|
||||
|
||||
<!-- TODO - add resolution choice -->
|
||||
<label align="center" text="TODO"/>
|
||||
|
||||
<spacer proportion="2" width="10" proportion="1"/>
|
||||
|
||||
</div>
|
@ -2,14 +2,13 @@
|
||||
|
||||
<label align="center" text="SuperTuxKart Options"/>
|
||||
|
||||
<spacer proportion="1" width="10"/>
|
||||
|
||||
<buttonbar id="options_choice" proportion="1" width="75%" align="center">
|
||||
<ribbon id="options_choice" height="20%" width="75%" align="center">
|
||||
<icon-button id="audio_video" width="128" height="128" icon="options_audio_video.png" text="Audio/Video"/>
|
||||
<icon-button id="players" width="128" height="128" icon="options_players.png" text="Players"/>
|
||||
<icon-button id="controls" width="128" height="128" icon="options_input.png" text="Controls"/>
|
||||
</buttonbar>
|
||||
</ribbon>
|
||||
|
||||
<spacer proportion="1" width="10" proportion="1"/>
|
||||
|
||||
|
||||
</div>
|
15
data/gui/options_players.stkgui
Normal file
15
data/gui/options_players.stkgui
Normal file
@ -0,0 +1,15 @@
|
||||
<div x="5%" y="2%" width="90%" height="96%" layout="vertical-row" >
|
||||
|
||||
<label align="center" text="SuperTuxKart Options"/>
|
||||
|
||||
<ribbon id="options_choice" height="20%" width="75%" align="center">
|
||||
<icon-button id="audio_video" width="128" height="128" icon="options_audio_video.png" text="Audio/Video"/>
|
||||
<icon-button id="players" width="128" height="128" icon="options_players.png" text="Players"/>
|
||||
<icon-button id="controls" width="128" height="128" icon="options_input.png" text="Controls"/>
|
||||
</ribbon>
|
||||
|
||||
<spacer proportion="1" width="10" proportion="1"/>
|
||||
|
||||
<list id="players" proportion="5" width="75%" align="center"/>
|
||||
|
||||
</div>
|
@ -44,7 +44,7 @@ void Screen::addWidgets()
|
||||
|
||||
// And tell the device to use our custom event receiver.
|
||||
GUIEngine::getDevice()->setEventReceiver(this);
|
||||
|
||||
|
||||
// select the first widget
|
||||
Widget* w = getFirstWidget();
|
||||
if(w != NULL) GUIEngine::getGUIEnv()->setFocus( w->m_element );
|
||||
|
@ -102,6 +102,11 @@ void parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>& append_t
|
||||
type = WTYPE_MODEL_VIEW;
|
||||
append_to.push_back(new ModelViewWidget());
|
||||
}
|
||||
else if (!strcmp("list", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_LIST;
|
||||
append_to.push_back(new ListWidget());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "/!\\ Warning /!\\ : unknown tag found in STK GUI file : '" << xml->getNodeName() << "'" << std::endl;
|
||||
|
@ -94,7 +94,7 @@ namespace StateManager
|
||||
}
|
||||
else if (selection == "options")
|
||||
{
|
||||
pushMenu("options.stkgui");
|
||||
pushMenu("options_av.stkgui");
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,6 +104,24 @@ namespace StateManager
|
||||
StateManager::pushMenu("racesetup.stkgui");
|
||||
}
|
||||
|
||||
// -- options
|
||||
if(name == "options_choice")
|
||||
{
|
||||
std::string selection = ((GUIEngine::RibbonWidget*)widget)->getSelectionName().c_str();
|
||||
|
||||
if(selection == "audio_video") replaceTopMostMenu("options_av.stkgui");
|
||||
else if(selection == "players") replaceTopMostMenu("options_players.stkgui");
|
||||
else if(selection == "controls") replaceTopMostMenu("options_input.stkgui");
|
||||
|
||||
// select the right tab - FIXME - add some kind of post-screen-activation callback to do this
|
||||
GUIEngine::RibbonWidget* w = dynamic_cast<GUIEngine::RibbonWidget*>(GUIEngine::getCurrentScreen()->getWidget("options_choice"));
|
||||
if(w != NULL)
|
||||
{
|
||||
w->select(selection);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -- race setup screen
|
||||
if(name == "gamemode")
|
||||
{
|
||||
@ -207,6 +225,13 @@ namespace StateManager
|
||||
g_game_mode = false;
|
||||
GUIEngine::switchToScreen(name.c_str());
|
||||
}
|
||||
void replaceTopMostMenu(std::string name)
|
||||
{
|
||||
input_manager->setMode(InputManager::MENU);
|
||||
g_menu_stack[g_menu_stack.size()-1] = name;
|
||||
g_game_mode = false;
|
||||
GUIEngine::switchToScreen(name.c_str());
|
||||
}
|
||||
|
||||
void popMenu()
|
||||
{
|
||||
|
@ -8,6 +8,7 @@ namespace StateManager
|
||||
void initGUI();
|
||||
|
||||
void pushMenu(std::string name);
|
||||
void replaceTopMostMenu(std::string name);
|
||||
void popMenu();
|
||||
void resetAndGoToMenu(std::string name);
|
||||
void enterGameState();
|
||||
|
@ -303,6 +303,22 @@ RibbonWidget::RibbonWidget(const RibbonType type)
|
||||
updateSelection();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void RibbonWidget::select(std::string item)
|
||||
{
|
||||
const int subbuttons_amount = m_children.size();
|
||||
|
||||
for(int i=0; i<subbuttons_amount; i++)
|
||||
{
|
||||
if(m_children[i].m_properties[PROP_ID] == item)
|
||||
{
|
||||
m_selection = i;
|
||||
updateSelection();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
bool RibbonWidget::rightPressed()
|
||||
{
|
||||
m_selection++;
|
||||
@ -976,3 +992,22 @@ void ModelViewWidget::setModel(SAnimatedMesh* mesh)
|
||||
((IGUIMeshViewer*)m_element)->setMesh( mesh );
|
||||
}
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark List Widget
|
||||
#endif
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void ListWidget::add()
|
||||
{
|
||||
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
|
||||
|
||||
IGUIListBox* list = GUIEngine::getGUIEnv()->addListBox (widget_size);
|
||||
list->addItem( L"Hiker" );
|
||||
list->addItem( L"Conso" );
|
||||
list->addItem( L"Auria" );
|
||||
list->addItem( L"MiniBjorn" );
|
||||
list->addItem( L"Arthur" );
|
||||
//list->setSelected(0);
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ namespace GUIEngine
|
||||
WTYPE_SPACER,
|
||||
WTYPE_DIV,
|
||||
WTYPE_RIBBON_GRID,
|
||||
WTYPE_MODEL_VIEW
|
||||
WTYPE_MODEL_VIEW,
|
||||
WTYPE_LIST
|
||||
};
|
||||
|
||||
enum Property
|
||||
@ -226,6 +227,7 @@ namespace GUIEngine
|
||||
int getSelection() const { return m_selection; }
|
||||
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);
|
||||
|
||||
RibbonWidget(const RibbonType type=RIBBON_COMBO);
|
||||
};
|
||||
@ -291,5 +293,11 @@ namespace GUIEngine
|
||||
void setModel(SAnimatedMesh* mesh);
|
||||
};
|
||||
|
||||
class ListWidget : public Widget
|
||||
{
|
||||
public:
|
||||
void add();
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -1180,17 +1180,17 @@
|
||||
9505577D0F696A900056E88C /* my_button.hpp */,
|
||||
95C1E3FF0F699427005D33E6 /* font.cpp */,
|
||||
95C1E4020F69943D005D33E6 /* font.hpp */,
|
||||
95C1E3F10F699079005D33E6 /* race_gui.cpp */,
|
||||
95C1E3EB0F698F23005D33E6 /* race_gui.hpp */,
|
||||
9505577F0F696A900056E88C /* screen.cpp */,
|
||||
950557800F696A900056E88C /* screen.hpp */,
|
||||
950557810F696A900056E88C /* screen_loader.cpp */,
|
||||
953F038B0F6C880D00C77FE2 /* state_manager.cpp */,
|
||||
953F038E0F6C8AD800C77FE2 /* state_manager.hpp */,
|
||||
950557820F696A900056E88C /* skin.cpp */,
|
||||
950557830F696A900056E88C /* skin.hpp */,
|
||||
950557840F696A900056E88C /* widget.cpp */,
|
||||
950557850F696A900056E88C /* widget.hpp */,
|
||||
95C1E3F10F699079005D33E6 /* race_gui.cpp */,
|
||||
95C1E3EB0F698F23005D33E6 /* race_gui.hpp */,
|
||||
953F038B0F6C880D00C77FE2 /* state_manager.cpp */,
|
||||
953F038E0F6C8AD800C77FE2 /* state_manager.hpp */,
|
||||
);
|
||||
name = gui;
|
||||
path = games/supertuxkart/src/gui;
|
||||
|
Loading…
x
Reference in New Issue
Block a user