Reorganize options in more screens, use 'accordion tabs' to fit everything in the available space, I *think* the result is good, feedback welcome
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7996 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -6,20 +6,19 @@
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
|
||||
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"
|
||||
I18N="Section in the settings menu" text="Graphics"/>
|
||||
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/>
|
||||
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
|
||||
I18N="Section in the settings menu" text="Audio"/>
|
||||
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
|
||||
I18N="Section in the settings menu" text="Players"/>
|
||||
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
|
||||
I18N="Section in the settings menu" text="Controls"/>
|
||||
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
|
||||
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"/>
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row">
|
||||
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<!-- ******** Music ******** -->
|
||||
<label width="100%" I18N="Section in the audio/video settings submenu" text="Music"/>
|
||||
|
||||
<!-- FIXME: don't hardcode height! -->
|
||||
@@ -31,7 +30,7 @@
|
||||
<checkbox id="music_enabled" width="40" height="40"/>
|
||||
</div>
|
||||
</div>
|
||||
<div width="75%" height="30" layout="horizontal-row" >
|
||||
<div width="75%" height="40" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="Music volume in options" text="Volume"/>
|
||||
<div proportion="1" height="40" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
@@ -41,6 +40,7 @@
|
||||
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<!-- ******** SFX ******** -->
|
||||
<label width="100%" I18N="Section in audio/video settings submenu" text="Sound Effects"/>
|
||||
|
||||
<div width="75%" height="40" layout="horizontal-row" >
|
||||
@@ -50,7 +50,7 @@
|
||||
<checkbox id="sfx_enabled" width="40" height="40"/>
|
||||
</div>
|
||||
</div>
|
||||
<div width="75%" height="30" layout="horizontal-row" >
|
||||
<div width="75%" height="40" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="Sound volume in options" text="Volume"/>
|
||||
<div proportion="1" height="40" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
|
||||
@@ -6,12 +6,10 @@
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
|
||||
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"
|
||||
I18N="Section in the settings menu" text="Graphics"/>
|
||||
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
|
||||
I18N="Section in the settings menu" text="Audio"/>
|
||||
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
|
||||
I18N="Section in the settings menu" text="Players"/>
|
||||
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/>
|
||||
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
|
||||
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
|
||||
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
|
||||
I18N="Section in the settings menu" text="Controls"/>
|
||||
</tabs>
|
||||
|
||||
@@ -6,14 +6,12 @@
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
|
||||
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"
|
||||
I18N="Section in the settings menu" text="Graphics"/>
|
||||
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
|
||||
I18N="Section in the settings menu" text="Audio"/>
|
||||
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/>
|
||||
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
|
||||
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
|
||||
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
|
||||
I18N="Section in the settings menu" text="Players"/>
|
||||
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
|
||||
I18N="Section in the settings menu" text="Controls"/>
|
||||
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"/>
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row">
|
||||
|
||||
BIN
data/gui/options_ui.png
Normal file
BIN
data/gui/options_ui.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
46
data/gui/options_ui.stkgui
Normal file
46
data/gui/options_ui.stkgui
Normal file
@@ -0,0 +1,46 @@
|
||||
<stkgui>
|
||||
|
||||
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
|
||||
|
||||
<header text_align="center" width="100%" text="SuperTuxKart Options"/>
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
|
||||
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/>
|
||||
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
|
||||
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"
|
||||
I18N="Section in the settings menu" text="User Interface"/>
|
||||
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"/>
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row">
|
||||
|
||||
<spacer height="20" width="10"/>
|
||||
|
||||
<!-- ************ SKIN CHOICE ************ -->
|
||||
<label width="100%" I18N="In the graphics settings" text="Skin"/>
|
||||
|
||||
<!-- FIXME: don't hardcode size -->
|
||||
<spinner id="skinchoice" width="300" height="50" />
|
||||
|
||||
<spacer width="20" height="40" />
|
||||
|
||||
<!-- FIXME don't hardcode height, should depend on text height -->
|
||||
<div width="75%" height="40" layout="horizontal-row" >
|
||||
<checkbox id="showfps" width="40" height="40"/>
|
||||
<spacer width="20" height="100%" />
|
||||
<label proportion="1" height="100%" I18N="In the ui settings" text="Display FPS"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="4"/>
|
||||
|
||||
</box>
|
||||
|
||||
<spacer width="50" height="10" />
|
||||
<button id="back" x="20" width="250" align="left"
|
||||
I18N="In the options menu, to go back to the main menu or game" text="Back"/>
|
||||
|
||||
</div>
|
||||
|
||||
</stkgui>
|
||||
@@ -8,39 +8,35 @@
|
||||
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
|
||||
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"
|
||||
I18N="Section in the settings menu" text="Graphics"/>
|
||||
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
|
||||
I18N="Section in the settings menu" text="Audio"/>
|
||||
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
|
||||
I18N="Section in the settings menu" text="Players"/>
|
||||
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
|
||||
I18N="Section in the settings menu" text="Controls"/>
|
||||
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
|
||||
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
|
||||
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"/>
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row">
|
||||
|
||||
<spacer height="20" width="10"/>
|
||||
|
||||
<!-- FIXME don't hardcode height, should depend on text height -->
|
||||
<div width="100%" proportion="2" layout="horizontal-row" >
|
||||
<!-- ************ GRAPHICAL EFFECTS SETTINGS ************ -->
|
||||
<div width="75%" height="50" layout="horizontal-row" >
|
||||
<label I18N="In the graphics settings" text="Graphical Effects Settings"/>
|
||||
<spacer width="20" height="20"/>
|
||||
|
||||
<!-- ************ SKIN CHOICE ************ -->
|
||||
<div layout="vertical-row" proportion="2" height="100%">
|
||||
<label width="100%" I18N="In the graphics settings" text="Skin"/>
|
||||
|
||||
<!-- FIXME: don't hardcode size -->
|
||||
<spinner id="skinchoice" width="300" height="50" />
|
||||
</div>
|
||||
|
||||
<!-- ************ GRAPHICAL EFFECTS SETTINGS ************ -->
|
||||
<div layout="vertical-row" proportion="3" height="100%">
|
||||
|
||||
<label width="100%" I18N="In the graphics settings" text="Graphical Effects Settings"/>
|
||||
|
||||
<!-- FIXME: don't hardcode size -->
|
||||
<gauge id="gfx_level" min_value="1" max_value="5" width="300" height="50"/>
|
||||
</div>
|
||||
<!-- FIXME: don't hardcode size -->
|
||||
<gauge id="gfx_level" min_value="1" max_value="5" width="300" height="50"/>
|
||||
</div>
|
||||
|
||||
<!-- ************ VSYNC ************ -->
|
||||
<!-- FIXME don't hardcode height, should depend on text height -->
|
||||
<div width="75%" height="40" layout="horizontal-row" >
|
||||
<checkbox id="vsync" width="40" height="40"/>
|
||||
<spacer width="20" height="100%" />
|
||||
<label proportion="1" height="100%" I18N="In the video settings" text="Vertical Sync (requires restart)"/>
|
||||
</div>
|
||||
|
||||
<spacer width="20" height="20"/>
|
||||
|
||||
<!-- ************ RESOLUTION CHOICE ************ -->
|
||||
<spacer height="10" width="10"/>
|
||||
<label width="100%" I18N="In the graphics settings" text="Resolution"/>
|
||||
@@ -61,8 +57,11 @@
|
||||
|
||||
<spacer height="10" width="10"/>
|
||||
|
||||
<button id="apply_resolution"
|
||||
<div width="75%" height="40" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
<button id="apply_resolution"
|
||||
I18N="In the video settings menu" text="Apply new resolution" />
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="4"/>
|
||||
|
||||
|
||||
@@ -345,6 +345,8 @@ supertuxkart_SOURCES = \
|
||||
states_screens/options_screen_input2.hpp \
|
||||
states_screens/options_screen_players.cpp \
|
||||
states_screens/options_screen_players.hpp \
|
||||
states_screens/options_screen_ui.cpp \
|
||||
states_screens/options_screen_u.hpp \
|
||||
states_screens/options_screen_video.cpp \
|
||||
states_screens/options_screen_video.hpp \
|
||||
states_screens/addons_screen.cpp \
|
||||
|
||||
@@ -76,6 +76,10 @@ void RibbonWidget::add()
|
||||
|
||||
const int subbuttons_amount = m_children.size();
|
||||
|
||||
// For some ribbon types, we can have unequal sizes depending on whether items have labels or not
|
||||
int with_label = 0;
|
||||
int without_label = 0;
|
||||
|
||||
// ---- check how much space each child button will take and fit them within available space
|
||||
int total_needed_space = 0;
|
||||
for (int i=0; i<subbuttons_amount; i++)
|
||||
@@ -96,6 +100,10 @@ void RibbonWidget::add()
|
||||
icon->m_tab_stop = false;
|
||||
}
|
||||
|
||||
|
||||
if (m_children[i].m_text.size() > 0) with_label++;
|
||||
else without_label++;
|
||||
|
||||
total_needed_space += m_children[i].m_w;
|
||||
}
|
||||
|
||||
@@ -111,21 +119,41 @@ void RibbonWidget::add()
|
||||
|
||||
const int one_button_space = (int)round((float)m_w / (float)subbuttons_amount);
|
||||
|
||||
int widget_x = -1;
|
||||
|
||||
// ---- add children
|
||||
for (int i=0; i<subbuttons_amount; i++)
|
||||
{
|
||||
|
||||
const int widget_x = one_button_space*(i+1) - one_button_space/2;
|
||||
|
||||
{
|
||||
// ---- tab ribbons
|
||||
if (getRibbonType() == RIBBON_TABS)
|
||||
{
|
||||
IGUIButton * subbtn = NULL;
|
||||
rect<s32> subsize = rect<s32>(widget_x - one_button_space/2+2, 0,
|
||||
widget_x + one_button_space/2-2, m_h);
|
||||
const int large_tab = (with_label + without_label)*one_button_space / (with_label + without_label/2.0f);
|
||||
const int small_tab = large_tab/2;
|
||||
|
||||
stringw& message = m_children[i].m_text;
|
||||
|
||||
|
||||
if (message.size() == 0)
|
||||
{
|
||||
if (widget_x == -1) widget_x = small_tab/2;
|
||||
else widget_x += small_tab/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (widget_x == -1) widget_x = large_tab/2;
|
||||
else widget_x += large_tab/2;
|
||||
}
|
||||
|
||||
IGUIButton * subbtn = NULL;
|
||||
rect<s32> subsize = rect<s32>(widget_x - large_tab/2+2, 0,
|
||||
widget_x + large_tab/2-2, m_h);
|
||||
|
||||
if (message.size() == 0)
|
||||
{
|
||||
subsize = rect<s32>(widget_x - small_tab/2+2, 0,
|
||||
widget_x + small_tab/2-2, m_h);
|
||||
}
|
||||
|
||||
if (m_children[i].m_type == WTYPE_BUTTON)
|
||||
{
|
||||
subbtn = GUIEngine::getGUIEnv()->addButton(subsize, btn, getNewNoFocusID(), message.c_str(), L"");
|
||||
@@ -138,6 +166,17 @@ void RibbonWidget::add()
|
||||
0,
|
||||
subsize.getHeight()+15,
|
||||
subsize.getHeight());
|
||||
|
||||
if (message.size() == 0)
|
||||
{
|
||||
const int x = subsize.getWidth()/2 - subsize.getHeight()/2;
|
||||
// no label, only icon, so center the icon
|
||||
icon_part = rect<s32>(x,
|
||||
0,
|
||||
x + subsize.getHeight(),
|
||||
subsize.getHeight());
|
||||
}
|
||||
|
||||
// label at the *right* of the icon (for tabs)
|
||||
rect<s32> label_part = rect<s32>(subsize.getHeight()+15,
|
||||
0,
|
||||
@@ -156,7 +195,7 @@ void RibbonWidget::add()
|
||||
icon->setUseAlphaChannel(true);
|
||||
icon->setDrawBorder(false);
|
||||
icon->setTabStop(false);
|
||||
|
||||
|
||||
IGUIStaticText* label = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), label_part,
|
||||
false /* border */,
|
||||
true /* word wrap */,
|
||||
@@ -168,7 +207,6 @@ void RibbonWidget::add()
|
||||
|
||||
subbtn->setTabStop(false);
|
||||
subbtn->setTabGroup(false);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -176,10 +214,15 @@ void RibbonWidget::add()
|
||||
}
|
||||
|
||||
m_children[i].m_element = subbtn;
|
||||
|
||||
if (message.size() == 0) widget_x += small_tab/2;
|
||||
else widget_x += large_tab/2;
|
||||
}
|
||||
// ---- icon ribbons
|
||||
else if (m_children[i].m_type == WTYPE_ICON_BUTTON)
|
||||
{
|
||||
if (widget_x == -1) widget_x = one_button_space/2;
|
||||
|
||||
// find how much space to keep for the label under the button.
|
||||
// consider font size, whether the label is multiline, etc...
|
||||
const bool has_label = m_children[i].m_text.size() > 0;
|
||||
@@ -233,6 +276,8 @@ void RibbonWidget::add()
|
||||
|
||||
// the label itself will be added by the icon widget. since it adds the label outside of the
|
||||
// widget area it is assigned to, the label will appear in the area we want at the bottom
|
||||
|
||||
widget_x += one_button_space;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
9538E2BA12C25D6800172896 /* network_http.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9538E2B712C25D6800172896 /* network_http.cpp */; };
|
||||
9538E2E912C2682B00172896 /* IrrFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9538E2E812C2682B00172896 /* IrrFramework.framework */; };
|
||||
95395A77129DFE130079BCE7 /* message_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95395A75129DFE130079BCE7 /* message_dialog.cpp */; };
|
||||
953A959D13367D6E00D86B4D /* options_screen_ui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 953A959B13367D6E00D86B4D /* options_screen_ui.cpp */; };
|
||||
953C304E12BEF384005BB4CD /* tutorial_data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 953C304C12BEF384005BB4CD /* tutorial_data.cpp */; };
|
||||
953F8B2111F7C13C00205E66 /* scalable_font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 953F8B1F11F7C13C00205E66 /* scalable_font.cpp */; };
|
||||
9542FC7712D3BDB000C00366 /* particle_emitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9542FC7512D3BDB000C00366 /* particle_emitter.cpp */; };
|
||||
@@ -466,6 +467,8 @@
|
||||
9538E2E812C2682B00172896 /* IrrFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IrrFramework.framework; path = /Library/Frameworks/IrrFramework.framework; sourceTree = "<absolute>"; };
|
||||
95395A75129DFE130079BCE7 /* message_dialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = message_dialog.cpp; path = ../../states_screens/dialogs/message_dialog.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95395A76129DFE130079BCE7 /* message_dialog.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = message_dialog.hpp; path = ../../states_screens/dialogs/message_dialog.hpp; sourceTree = SOURCE_ROOT; };
|
||||
953A959B13367D6E00D86B4D /* options_screen_ui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = options_screen_ui.cpp; path = ../../states_screens/options_screen_ui.cpp; sourceTree = SOURCE_ROOT; };
|
||||
953A959C13367D6E00D86B4D /* options_screen_ui.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = options_screen_ui.hpp; path = ../../states_screens/options_screen_ui.hpp; sourceTree = SOURCE_ROOT; };
|
||||
953C304C12BEF384005BB4CD /* tutorial_data.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tutorial_data.cpp; path = ../../tutorial/tutorial_data.cpp; sourceTree = SOURCE_ROOT; };
|
||||
953C304D12BEF384005BB4CD /* tutorial_data.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = tutorial_data.hpp; path = ../../tutorial/tutorial_data.hpp; sourceTree = SOURCE_ROOT; };
|
||||
953EAAAD0F30A4220000D57D /* terrain_info.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = terrain_info.hpp; path = ../../tracks/terrain_info.hpp; sourceTree = SOURCE_ROOT; };
|
||||
@@ -2171,6 +2174,8 @@
|
||||
9522F1EC107961560067ECF5 /* options_screen_players.hpp */,
|
||||
9556A87E119EF976009C558F /* options_screen_video.cpp */,
|
||||
9556A87F119EF976009C558F /* options_screen_video.hpp */,
|
||||
953A959B13367D6E00D86B4D /* options_screen_ui.cpp */,
|
||||
953A959C13367D6E00D86B4D /* options_screen_ui.hpp */,
|
||||
957BF97811EA96720018118A /* race_gui_base.hpp */,
|
||||
958330C810122B4A00C5137E /* race_gui.cpp */,
|
||||
958330C910122B4A00C5137E /* race_gui.hpp */,
|
||||
@@ -3053,6 +3058,7 @@
|
||||
958444A41330F89100CEA60A /* po_parser.cpp in Sources */,
|
||||
958444A51330F89100CEA60A /* stk_file_system.cpp in Sources */,
|
||||
958444A61330F89100CEA60A /* tinygettext.cpp in Sources */,
|
||||
953A959D13367D6E00D86B4D /* options_screen_ui.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "io/file_manager.hpp"
|
||||
#include "states_screens/options_screen_input.hpp"
|
||||
#include "states_screens/options_screen_players.hpp"
|
||||
#include "states_screens/options_screen_ui.hpp"
|
||||
#include "states_screens/options_screen_video.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
|
||||
@@ -102,6 +103,7 @@ void OptionsScreenAudio::eventCallback(Widget* widget, const std::string& name,
|
||||
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
|
||||
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
|
||||
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
|
||||
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
|
||||
}
|
||||
else if(name == "back")
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "states_screens/options_screen_audio.hpp"
|
||||
#include "states_screens/options_screen_players.hpp"
|
||||
#include "states_screens/options_screen_video.hpp"
|
||||
#include "states_screens/options_screen_ui.hpp"
|
||||
#include "states_screens/dialogs/add_device_dialog.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
@@ -176,6 +177,7 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
|
||||
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
|
||||
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
|
||||
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
|
||||
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
|
||||
}
|
||||
else if (name == "add_device")
|
||||
{
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "states_screens/options_screen_input.hpp"
|
||||
#include "states_screens/options_screen_players.hpp"
|
||||
#include "states_screens/options_screen_video.hpp"
|
||||
#include "states_screens/options_screen_ui.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
@@ -374,6 +375,7 @@ void OptionsScreenInput2::eventCallback(Widget* widget, const std::string& name,
|
||||
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
|
||||
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
|
||||
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
|
||||
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
|
||||
else if (selection == "tab_controls") {}
|
||||
}
|
||||
else if (name == "back_to_device_list")
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "states_screens/options_screen_audio.hpp"
|
||||
#include "states_screens/options_screen_input.hpp"
|
||||
#include "states_screens/options_screen_video.hpp"
|
||||
#include "states_screens/options_screen_ui.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
|
||||
|
||||
@@ -155,6 +156,7 @@ void OptionsScreenPlayers::eventCallback(Widget* widget, const std::string& name
|
||||
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
|
||||
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
|
||||
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
|
||||
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
|
||||
}
|
||||
else if (name == "back")
|
||||
{
|
||||
|
||||
192
src/states_screens/options_screen_ui.cpp
Normal file
192
src/states_screens/options_screen_ui.cpp
Normal file
@@ -0,0 +1,192 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2009 Marianne Gagnon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "states_screens/options_screen_ui.hpp"
|
||||
|
||||
#include "audio/music_manager.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "audio/sfx_base.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "guiengine/widgets/button_widget.hpp"
|
||||
#include "guiengine/widgets/check_box_widget.hpp"
|
||||
#include "guiengine/widgets/dynamic_ribbon_widget.hpp"
|
||||
#include "guiengine/widgets/spinner_widget.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "states_screens/options_screen_audio.hpp"
|
||||
#include "states_screens/options_screen_input.hpp"
|
||||
#include "states_screens/options_screen_players.hpp"
|
||||
#include "states_screens/options_screen_video.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
using namespace GUIEngine;
|
||||
|
||||
DEFINE_SCREEN_SINGLETON( OptionsScreenUI );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
OptionsScreenUI::OptionsScreenUI() : Screen("options_ui.stkgui")
|
||||
{
|
||||
m_inited = false;
|
||||
} // OptionsScreenVideo
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenUI::loadedFromFile()
|
||||
{
|
||||
m_inited = false;
|
||||
|
||||
GUIEngine::SpinnerWidget* skinSelector = this->getWidget<GUIEngine::SpinnerWidget>("skinchoice");
|
||||
assert( skinSelector != NULL );
|
||||
|
||||
skinSelector->m_properties[PROP_WARP_AROUND] = "true";
|
||||
|
||||
m_skins.clear();
|
||||
skinSelector->clearLabels();
|
||||
|
||||
std::set<std::string> skinFiles;
|
||||
file_manager->listFiles(skinFiles /* out */, file_manager->getGUIDir() + "/skins",
|
||||
true /* is full path */, true /* make full path */ );
|
||||
|
||||
for (std::set<std::string>::iterator it = skinFiles.begin(); it != skinFiles.end(); it++)
|
||||
{
|
||||
if ( (*it).find(".stkskin") != std::string::npos )
|
||||
{
|
||||
m_skins.push_back( *it );
|
||||
}
|
||||
}
|
||||
|
||||
if (m_skins.size() == 0)
|
||||
{
|
||||
std::cerr << "WARNING: could not find a single skin, make sure that "
|
||||
"the data files are correctly installed\n";
|
||||
skinSelector->setDeactivated();
|
||||
return;
|
||||
}
|
||||
|
||||
const int skinCount = m_skins.size();
|
||||
for (int n=0; n<skinCount; n++)
|
||||
{
|
||||
const std::string skinFileName = StringUtils::getBasename(m_skins[n]);
|
||||
const std::string skinName = StringUtils::removeExtension( skinFileName );
|
||||
skinSelector->addLabel( core::stringw(skinName.c_str()) );
|
||||
}
|
||||
skinSelector->m_properties[GUIEngine::PROP_MIN_VALUE] = "0";
|
||||
skinSelector->m_properties[GUIEngine::PROP_MAX_VALUE] = StringUtils::toString(skinCount-1);
|
||||
|
||||
|
||||
} // loadedFromFile
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenUI::init()
|
||||
{
|
||||
Screen::init();
|
||||
RibbonWidget* ribbon = this->getWidget<RibbonWidget>("options_choice");
|
||||
if (ribbon != NULL) ribbon->select( "tab_ui", PLAYER_ID_GAME_MASTER );
|
||||
|
||||
GUIEngine::SpinnerWidget* skinSelector = this->getWidget<GUIEngine::SpinnerWidget>("skinchoice");
|
||||
assert( skinSelector != NULL );
|
||||
|
||||
// ---- video modes
|
||||
|
||||
CheckBoxWidget* fps = this->getWidget<CheckBoxWidget>("showfps");
|
||||
assert( fps != NULL );
|
||||
fps->setState( UserConfigParams::m_display_fps );
|
||||
|
||||
// --- select the right skin in the spinner
|
||||
bool currSkinFound = false;
|
||||
const int skinCount = m_skins.size();
|
||||
for (int n=0; n<skinCount; n++)
|
||||
{
|
||||
const std::string skinFileName = StringUtils::getBasename(m_skins[n]);
|
||||
|
||||
if (UserConfigParams::m_skin_file.c_str() == skinFileName)
|
||||
{
|
||||
skinSelector->setValue(n);
|
||||
currSkinFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!currSkinFound)
|
||||
{
|
||||
std::cerr << "WARNING: couldn't find current skin in the list of skins!!\n";
|
||||
skinSelector->setValue(0);
|
||||
GUIEngine::reloadSkin();
|
||||
}
|
||||
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, const int playerID)
|
||||
{
|
||||
if (name == "options_choice")
|
||||
{
|
||||
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
|
||||
|
||||
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
|
||||
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
|
||||
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
|
||||
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
|
||||
}
|
||||
else if(name == "back")
|
||||
{
|
||||
StateManager::get()->escapePressed();
|
||||
}
|
||||
else if (name == "skinchoice")
|
||||
{
|
||||
GUIEngine::SpinnerWidget* skinSelector = this->getWidget<GUIEngine::SpinnerWidget>("skinchoice");
|
||||
assert( skinSelector != NULL );
|
||||
|
||||
const core::stringw selectedSkin = skinSelector->getStringValue();
|
||||
UserConfigParams::m_skin_file = core::stringc(selectedSkin.c_str()).c_str() + std::string(".stkskin");
|
||||
GUIEngine::reloadSkin();
|
||||
}
|
||||
else if (name == "showfps")
|
||||
{
|
||||
CheckBoxWidget* fps = this->getWidget<CheckBoxWidget>("showfps");
|
||||
assert( fps != NULL );
|
||||
UserConfigParams::m_display_fps = fps->getState();
|
||||
}
|
||||
|
||||
} // eventCallback
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenUI::tearDown()
|
||||
{
|
||||
Screen::tearDown();
|
||||
// save changes when leaving screen
|
||||
user_config->saveConfig();
|
||||
} // tearDown
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenUI::unloaded()
|
||||
{
|
||||
m_inited = false;
|
||||
} // unloaded
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
61
src/states_screens/options_screen_ui.hpp
Normal file
61
src/states_screens/options_screen_ui.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2009 Marianne Gagnon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#ifndef __HEADER_OPTIONS_SCREEN_UI_HPP__
|
||||
#define __HEADER_OPTIONS_SCREEN_UI_HPP__
|
||||
|
||||
#include <string>
|
||||
#include "irrlicht.h"
|
||||
|
||||
#include "guiengine/screen.hpp"
|
||||
|
||||
namespace GUIEngine { class Widget; }
|
||||
|
||||
struct Input;
|
||||
|
||||
/**
|
||||
* \brief Graphics options screen
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class OptionsScreenUI : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OptionsScreenUI>
|
||||
{
|
||||
OptionsScreenUI();
|
||||
bool m_inited;
|
||||
|
||||
std::vector<std::string> m_skins;
|
||||
|
||||
public:
|
||||
friend class GUIEngine::ScreenSingleton<OptionsScreenUI>;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile();
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID);
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void init();
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void tearDown();
|
||||
|
||||
/** \brief implement optional callback from parent class GUIEngine::Screen */
|
||||
virtual void unloaded();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "states_screens/options_screen_audio.hpp"
|
||||
#include "states_screens/options_screen_input.hpp"
|
||||
#include "states_screens/options_screen_players.hpp"
|
||||
#include "states_screens/options_screen_ui.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
@@ -62,43 +63,6 @@ void OptionsScreenVideo::loadedFromFile()
|
||||
{
|
||||
m_inited = false;
|
||||
|
||||
GUIEngine::SpinnerWidget* skinSelector = this->getWidget<GUIEngine::SpinnerWidget>("skinchoice");
|
||||
assert( skinSelector != NULL );
|
||||
|
||||
skinSelector->m_properties[PROP_WARP_AROUND] = "true";
|
||||
|
||||
m_skins.clear();
|
||||
skinSelector->clearLabels();
|
||||
|
||||
std::set<std::string> skinFiles;
|
||||
file_manager->listFiles(skinFiles /* out */, file_manager->getGUIDir() + "/skins",
|
||||
true /* is full path */, true /* make full path */ );
|
||||
|
||||
for (std::set<std::string>::iterator it = skinFiles.begin(); it != skinFiles.end(); it++)
|
||||
{
|
||||
if ( (*it).find(".stkskin") != std::string::npos )
|
||||
{
|
||||
m_skins.push_back( *it );
|
||||
}
|
||||
}
|
||||
|
||||
if (m_skins.size() == 0)
|
||||
{
|
||||
std::cerr << "WARNING: could not find a single skin, make sure that "
|
||||
"the data files are correctly installed\n";
|
||||
skinSelector->setDeactivated();
|
||||
return;
|
||||
}
|
||||
|
||||
const int skinCount = m_skins.size();
|
||||
for (int n=0; n<skinCount; n++)
|
||||
{
|
||||
const std::string skinFileName = StringUtils::getBasename(m_skins[n]);
|
||||
const std::string skinName = StringUtils::removeExtension( skinFileName );
|
||||
skinSelector->addLabel( core::stringw(skinName.c_str()) );
|
||||
}
|
||||
skinSelector->m_properties[GUIEngine::PROP_MIN_VALUE] = "0";
|
||||
skinSelector->m_properties[GUIEngine::PROP_MAX_VALUE] = StringUtils::toString(skinCount-1);
|
||||
|
||||
GUIEngine::SpinnerWidget* gfx = this->getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
gfx->m_properties[GUIEngine::PROP_MAX_VALUE] = StringUtils::toString(GFX_LEVEL_AMOUNT);
|
||||
@@ -113,15 +77,16 @@ void OptionsScreenVideo::init()
|
||||
RibbonWidget* ribbon = this->getWidget<RibbonWidget>("options_choice");
|
||||
if (ribbon != NULL) ribbon->select( "tab_video", PLAYER_ID_GAME_MASTER );
|
||||
|
||||
GUIEngine::SpinnerWidget* skinSelector = this->getWidget<GUIEngine::SpinnerWidget>("skinchoice");
|
||||
assert( skinSelector != NULL );
|
||||
|
||||
GUIEngine::ButtonWidget* applyBtn = this->getWidget<GUIEngine::ButtonWidget>("apply_resolution");
|
||||
assert( applyBtn != NULL );
|
||||
|
||||
GUIEngine::SpinnerWidget* gfx = this->getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
assert( gfx != NULL );
|
||||
|
||||
|
||||
GUIEngine::CheckBoxWidget* vsync = this->getWidget<GUIEngine::CheckBoxWidget>("vsync");
|
||||
assert( vsync != NULL );
|
||||
vsync->setState( UserConfigParams::m_vsync );
|
||||
|
||||
// ---- video modes
|
||||
DynamicRibbonWidget* res = this->getWidget<DynamicRibbonWidget>("resolutions");
|
||||
assert( res != NULL );
|
||||
@@ -271,27 +236,6 @@ void OptionsScreenVideo::init()
|
||||
}
|
||||
} // end for
|
||||
|
||||
// --- select the right skin in the spinner
|
||||
bool currSkinFound = false;
|
||||
const int skinCount = m_skins.size();
|
||||
for (int n=0; n<skinCount; n++)
|
||||
{
|
||||
const std::string skinFileName = StringUtils::getBasename(m_skins[n]);
|
||||
|
||||
if (UserConfigParams::m_skin_file.c_str() == skinFileName)
|
||||
{
|
||||
skinSelector->setValue(n);
|
||||
currSkinFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!currSkinFound)
|
||||
{
|
||||
std::cerr << "WARNING: couldn't find current skin in the list of skins!!\n";
|
||||
skinSelector->setValue(0);
|
||||
GUIEngine::reloadSkin();
|
||||
}
|
||||
|
||||
// --- set gfx settings values
|
||||
for (int l=0; l<GFX_LEVEL_AMOUNT; l++)
|
||||
{
|
||||
@@ -352,6 +296,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
|
||||
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
|
||||
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
|
||||
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
|
||||
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
|
||||
}
|
||||
else if(name == "back")
|
||||
{
|
||||
@@ -379,15 +324,6 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
|
||||
|
||||
irr_driver->changeResolution(w, h, w2->getState());
|
||||
}
|
||||
else if (name == "skinchoice")
|
||||
{
|
||||
GUIEngine::SpinnerWidget* skinSelector = this->getWidget<GUIEngine::SpinnerWidget>("skinchoice");
|
||||
assert( skinSelector != NULL );
|
||||
|
||||
const core::stringw selectedSkin = skinSelector->getStringValue();
|
||||
UserConfigParams::m_skin_file = core::stringc(selectedSkin.c_str()).c_str() + std::string(".stkskin");
|
||||
GUIEngine::reloadSkin();
|
||||
}
|
||||
else if (name == "gfx_level")
|
||||
{
|
||||
GUIEngine::SpinnerWidget* gfx_level = this->getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
|
||||
Reference in New Issue
Block a user