diff --git a/data/gui/options_audio.png b/data/gui/options_audio.png
new file mode 100644
index 000000000..b056bc563
Binary files /dev/null and b/data/gui/options_audio.png differ
diff --git a/data/gui/options_audio.stkgui b/data/gui/options_audio.stkgui
new file mode 100644
index 000000000..61041df6e
--- /dev/null
+++ b/data/gui/options_audio.stkgui
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/data/gui/options_audio_video.png b/data/gui/options_audio_video.png
deleted file mode 100644
index 1da5c1032..000000000
Binary files a/data/gui/options_audio_video.png and /dev/null differ
diff --git a/data/gui/options_av.stkgui b/data/gui/options_av.stkgui
deleted file mode 100644
index 8294aec09..000000000
--- a/data/gui/options_av.stkgui
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/data/gui/options_device.stkgui b/data/gui/options_device.stkgui
index e48b86f15..0a54e9faa 100644
--- a/data/gui/options_device.stkgui
+++ b/data/gui/options_device.stkgui
@@ -6,8 +6,10 @@
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 06a480078..6f93884ee 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -292,14 +292,16 @@ supertuxkart_SOURCES = \
states_screens/kart_selection.hpp \
states_screens/main_menu_screen.cpp \
states_screens/main_menu_screen.hpp \
- states_screens/options_screen_av.cpp \
- states_screens/options_screen_av.hpp \
+ states_screens/options_screen_audio.cpp \
+ states_screens/options_screen_audio.hpp \
states_screens/options_screen_input.cpp \
states_screens/options_screen_input.hpp \
states_screens/options_screen_input2.cpp \
states_screens/options_screen_input2.hpp \
states_screens/options_screen_players.cpp \
states_screens/options_screen_players.hpp \
+ states_screens/options_screen_video.cpp \
+ states_screens/options_screen_video.hpp \
states_screens/race_gui.cpp \
states_screens/race_gui.hpp \
states_screens/race_setup_screen.cpp \
diff --git a/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj b/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj
index f2f00e0ba..f2427f05b 100644
--- a/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj
+++ b/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj
@@ -21,7 +21,6 @@
9522F1E010795E8A0067ECF5 /* help_screen_1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9522F1DE10795E8A0067ECF5 /* help_screen_1.cpp */; };
9522F1E510795EFF0067ECF5 /* help_screen_2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9522F1E210795EFF0067ECF5 /* help_screen_2.cpp */; };
9522F1E610795EFF0067ECF5 /* help_screen_3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9522F1E410795EFF0067ECF5 /* help_screen_3.cpp */; };
- 9522F1EF107961560067ECF5 /* options_screen_av.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9522F1E9107961560067ECF5 /* options_screen_av.cpp */; };
9522F1F0107961560067ECF5 /* options_screen_input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9522F1EB107961560067ECF5 /* options_screen_input.cpp */; };
9522F1F1107961560067ECF5 /* options_screen_players.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9522F1ED107961560067ECF5 /* options_screen_players.cpp */; };
9524739610497C75000C197E /* dynamic_ribbon_widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9524739510497C75000C197E /* dynamic_ribbon_widget.cpp */; };
@@ -227,6 +226,8 @@
9551CBDA0FC1BB9200DB481B /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9551CBD90FC1BB9200DB481B /* AGL.framework */; };
9551DB34104CABFC001C53E5 /* race_over_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9551DB33104CABFC001C53E5 /* race_over_dialog.cpp */; };
9553823A10FD4FEC00737979 /* constants.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9553823910FD4FEC00737979 /* constants.cpp */; };
+ 9556A880119EF976009C558F /* options_screen_audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9556A87C119EF976009C558F /* options_screen_audio.cpp */; };
+ 9556A881119EF976009C558F /* options_screen_video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9556A87E119EF976009C558F /* options_screen_video.cpp */; };
955DE88310042701006A4F3C /* check_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 955DE88110042701006A4F3C /* check_manager.cpp */; };
955DE88C1004273B006A4F3C /* check_structure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 955DE8871004273B006A4F3C /* check_structure.cpp */; };
95634EF21126272C009C145D /* gp_info_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95634EF01126272C009C145D /* gp_info_dialog.cpp */; };
@@ -332,8 +333,6 @@
9522F1E210795EFF0067ECF5 /* help_screen_2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = help_screen_2.cpp; path = ../../states_screens/help_screen_2.cpp; sourceTree = SOURCE_ROOT; };
9522F1E310795EFF0067ECF5 /* help_screen_3.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = help_screen_3.hpp; path = ../../states_screens/help_screen_3.hpp; sourceTree = SOURCE_ROOT; };
9522F1E410795EFF0067ECF5 /* help_screen_3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = help_screen_3.cpp; path = ../../states_screens/help_screen_3.cpp; sourceTree = SOURCE_ROOT; };
- 9522F1E9107961560067ECF5 /* options_screen_av.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = options_screen_av.cpp; path = ../../states_screens/options_screen_av.cpp; sourceTree = SOURCE_ROOT; };
- 9522F1EA107961560067ECF5 /* options_screen_av.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = options_screen_av.hpp; path = ../../states_screens/options_screen_av.hpp; sourceTree = SOURCE_ROOT; };
9522F1EB107961560067ECF5 /* options_screen_input.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = options_screen_input.cpp; path = ../../states_screens/options_screen_input.cpp; sourceTree = SOURCE_ROOT; };
9522F1EC107961560067ECF5 /* options_screen_players.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = options_screen_players.hpp; path = ../../states_screens/options_screen_players.hpp; sourceTree = SOURCE_ROOT; };
9522F1ED107961560067ECF5 /* options_screen_players.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = options_screen_players.cpp; path = ../../states_screens/options_screen_players.cpp; sourceTree = SOURCE_ROOT; };
@@ -412,6 +411,10 @@
9551DB32104CABFC001C53E5 /* race_over_dialog.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = race_over_dialog.hpp; path = ../../states_screens/dialogs/race_over_dialog.hpp; sourceTree = SOURCE_ROOT; };
9551DB33104CABFC001C53E5 /* race_over_dialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = race_over_dialog.cpp; path = ../../states_screens/dialogs/race_over_dialog.cpp; sourceTree = SOURCE_ROOT; };
9553823910FD4FEC00737979 /* constants.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = constants.cpp; path = ../../utils/constants.cpp; sourceTree = SOURCE_ROOT; };
+ 9556A87C119EF976009C558F /* options_screen_audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = options_screen_audio.cpp; path = ../../states_screens/options_screen_audio.cpp; sourceTree = SOURCE_ROOT; };
+ 9556A87D119EF976009C558F /* options_screen_audio.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = options_screen_audio.hpp; path = ../../states_screens/options_screen_audio.hpp; sourceTree = SOURCE_ROOT; };
+ 9556A87E119EF976009C558F /* options_screen_video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = options_screen_video.cpp; path = ../../states_screens/options_screen_video.cpp; sourceTree = SOURCE_ROOT; };
+ 9556A87F119EF976009C558F /* options_screen_video.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = options_screen_video.hpp; path = ../../states_screens/options_screen_video.hpp; sourceTree = SOURCE_ROOT; };
955DE88110042701006A4F3C /* check_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = check_manager.cpp; path = ../../tracks/check_manager.cpp; sourceTree = SOURCE_ROOT; };
955DE88210042701006A4F3C /* check_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = check_manager.hpp; path = ../../tracks/check_manager.hpp; sourceTree = SOURCE_ROOT; };
955DE8871004273B006A4F3C /* check_structure.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = check_structure.cpp; path = ../../tracks/check_structure.cpp; sourceTree = SOURCE_ROOT; };
@@ -1274,14 +1277,16 @@
958330C510122B4A00C5137E /* kart_selection.hpp */,
9522F124107948AD0067ECF5 /* main_menu_screen.cpp */,
9522F123107948AD0067ECF5 /* main_menu_screen.hpp */,
- 9522F1E9107961560067ECF5 /* options_screen_av.cpp */,
- 9522F1EA107961560067ECF5 /* options_screen_av.hpp */,
+ 9556A87C119EF976009C558F /* options_screen_audio.cpp */,
+ 9556A87D119EF976009C558F /* options_screen_audio.hpp */,
9522F1EB107961560067ECF5 /* options_screen_input.cpp */,
9522F1EE107961560067ECF5 /* options_screen_input.hpp */,
950D45CF118E040E006CFC41 /* options_screen_input2.cpp */,
950D45D0118E040E006CFC41 /* options_screen_input2.hpp */,
9522F1ED107961560067ECF5 /* options_screen_players.cpp */,
9522F1EC107961560067ECF5 /* options_screen_players.hpp */,
+ 9556A87E119EF976009C558F /* options_screen_video.cpp */,
+ 9556A87F119EF976009C558F /* options_screen_video.hpp */,
958330C810122B4A00C5137E /* race_gui.cpp */,
958330C910122B4A00C5137E /* race_gui.hpp */,
9522F15A107949780067ECF5 /* race_setup_screen.cpp */,
@@ -2516,7 +2521,6 @@
9522F1E010795E8A0067ECF5 /* help_screen_1.cpp in Sources */,
9522F1E510795EFF0067ECF5 /* help_screen_2.cpp in Sources */,
9522F1E610795EFF0067ECF5 /* help_screen_3.cpp in Sources */,
- 9522F1EF107961560067ECF5 /* options_screen_av.cpp in Sources */,
9522F1F0107961560067ECF5 /* options_screen_input.cpp in Sources */,
9522F1F1107961560067ECF5 /* options_screen_players.cpp in Sources */,
951B7D19108E52C900BC03AE /* challenges.cpp in Sources */,
@@ -2543,6 +2547,8 @@
95453ACA11808B8700A155B9 /* emergency_animation.cpp in Sources */,
950D448C118DEE3C006CFC41 /* CGUISpriteBank.cpp in Sources */,
950D45D1118E040E006CFC41 /* options_screen_input2.cpp in Sources */,
+ 9556A880119EF976009C558F /* options_screen_audio.cpp in Sources */,
+ 9556A881119EF976009C558F /* options_screen_video.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/src/states_screens/dialogs/race_paused_dialog.cpp b/src/states_screens/dialogs/race_paused_dialog.cpp
index 3c43b29ed..e4eaaebe4 100644
--- a/src/states_screens/dialogs/race_paused_dialog.cpp
+++ b/src/states_screens/dialogs/race_paused_dialog.cpp
@@ -27,7 +27,7 @@
#include "states_screens/help_screen_1.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/race_setup_screen.hpp"
-#include "states_screens/options_screen_av.hpp"
+#include "states_screens/options_screen_video.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
@@ -156,7 +156,7 @@ GUIEngine::EventPropagation RacePausedDialog::processEvent(const std::string& ev
else if (selection == "options")
{
dismiss();
- StateManager::get()->pushScreen(OptionsScreenAV::getInstance());
+ StateManager::get()->pushScreen(OptionsScreenVideo::getInstance());
return GUIEngine::EVENT_BLOCK;
}
else if (selection == "restart")
diff --git a/src/states_screens/main_menu_screen.cpp b/src/states_screens/main_menu_screen.cpp
index 40fb14577..fff0ba81f 100644
--- a/src/states_screens/main_menu_screen.cpp
+++ b/src/states_screens/main_menu_screen.cpp
@@ -26,7 +26,7 @@
#include "states_screens/credits.hpp"
#include "states_screens/kart_selection.hpp"
#include "states_screens/help_screen_1.hpp"
-#include "states_screens/options_screen_av.hpp"
+#include "states_screens/options_screen_video.hpp"
#include "states_screens/state_manager.hpp"
// FIXME : remove, temporary test
@@ -124,7 +124,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, cons
}
else if (selection == "options")
{
- StateManager::get()->pushScreen( OptionsScreenAV::getInstance() );
+ StateManager::get()->pushScreen( OptionsScreenVideo::getInstance() );
}
else if (selection == "quit")
{
diff --git a/src/states_screens/options_screen_av.cpp b/src/states_screens/options_screen_audio.cpp
similarity index 54%
rename from src/states_screens/options_screen_av.cpp
rename to src/states_screens/options_screen_audio.cpp
index afab96c62..2b5bde9b9 100644
--- a/src/states_screens/options_screen_av.cpp
+++ b/src/states_screens/options_screen_audio.cpp
@@ -15,9 +15,10 @@
// 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_audio.hpp"
#include "states_screens/options_screen_input.hpp"
-#include "states_screens/options_screen_av.hpp"
#include "states_screens/options_screen_players.hpp"
+#include "states_screens/options_screen_video.hpp"
#include "audio/music_manager.hpp"
#include "audio/sfx_manager.hpp"
@@ -37,28 +38,26 @@
using namespace GUIEngine;
-DEFINE_SCREEN_SINGLETON( OptionsScreenAV );
+DEFINE_SCREEN_SINGLETON( OptionsScreenAudio );
// -----------------------------------------------------------------------------
-OptionsScreenAV::OptionsScreenAV() : Screen("options_av.stkgui")
+OptionsScreenAudio::OptionsScreenAudio() : Screen("options_audio.stkgui")
{
- m_inited = false;
}
// -----------------------------------------------------------------------------
-void OptionsScreenAV::loadedFromFile()
+void OptionsScreenAudio::loadedFromFile()
{
- m_inited = false;
}
// -----------------------------------------------------------------------------
-void OptionsScreenAV::init()
+void OptionsScreenAudio::init()
{
RibbonWidget* ribbon = this->getWidget("options_choice");
- if (ribbon != NULL) ribbon->select( "tab_audio_video", PLAYER_ID_GAME_MASTER );
+ if (ribbon != NULL) ribbon->select( "tab_audio", PLAYER_ID_GAME_MASTER );
// ---- sfx volume
SpinnerWidget* gauge = this->getWidget("sfx_volume");
@@ -80,83 +79,18 @@ void OptionsScreenAV::init()
sfx->setState( UserConfigParams::m_sfx );
music->setState( UserConfigParams::m_music );
- // ---- video modes
- {
- DynamicRibbonWidget* res = this->getWidget("resolutions");
- assert( res != NULL );
-
-
- CheckBoxWidget* full = this->getWidget("fullscreen");
- assert( full != NULL );
- full->setState( UserConfigParams::m_fullscreen );
-
-
- // --- get resolution list from irrlicht the first time
- if (!m_inited)
- {
- const std::vector& modes = irr_driver->getVideoModes();
- const int amount = modes.size();
- for(int n=0; naddItem(name, name, "/gui/screen54.png");
- else if (ABOUT_EQUAL( ratio, (4.0f/3.0f) )) res->addItem(name, name, "/gui/screen43.png");
- else if (ABOUT_EQUAL( ratio, (16.0f/10.0f))) res->addItem(name, name, "/gui/screen1610.png");
- else if (ABOUT_EQUAL( ratio, (5.0f/3.0f) )) res->addItem(name, name, "/gui/screen53.png");
- else if (ABOUT_EQUAL( ratio, (3.0f/2.0f) )) res->addItem(name, name, "/gui/screen32.png");
- else
- {
- std::cout << "Unknown screen size ratio : " << ratio << std::endl;
- // FIXME - do something better than showing a random icon
- res->addItem(name,name, file_manager->getDataDir() + "/gui/screen1610.png");
- }
-#undef ABOUT_EQUAL
- } // next resolution
-
- } // end if not inited
-
- res->updateItemDisplay();
-
- // ---- select current resolution every time
- const std::vector& modes = irr_driver->getVideoModes();
- const int amount = modes.size();
- for(int n=0; nsetSelection(n, PLAYER_ID_GAME_MASTER, false);
- break;
- }
- } // end for
-
- }
}
// -----------------------------------------------------------------------------
-void OptionsScreenAV::eventCallback(Widget* widget, const std::string& name, const int playerID)
+void OptionsScreenAudio::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_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
+ 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());
}
@@ -211,42 +145,19 @@ void OptionsScreenAV::eventCallback(Widget* widget, const std::string& name, con
UserConfigParams::m_sfx = w->getState();
}
- else if(name == "apply_resolution")
- {
- using namespace GUIEngine;
- DynamicRibbonWidget* w1 = this->getWidget("resolutions");
- assert(w1 != NULL);
-
- const std::string& res = w1->getSelectionIDString(PLAYER_ID_GAME_MASTER);
-
- int w = -1, h = -1;
- if (sscanf(res.c_str(), "%ix%i", &w, &h) != 2 || w == -1 || h == -1)
- {
- std::cerr << "Failed to decode resolution : " << res.c_str() << std::endl;
- return;
- }
-
- CheckBoxWidget* w2 = this->getWidget("fullscreen");
- assert(w2 != NULL);
-
-
- irr_driver->changeResolution(w, h, w2->getState());
- }
-
}
// -----------------------------------------------------------------------------
-void OptionsScreenAV::tearDown()
+void OptionsScreenAudio::tearDown()
{
}
// -----------------------------------------------------------------------------
-void OptionsScreenAV::unloaded()
+void OptionsScreenAudio::unloaded()
{
- m_inited = false;
}
// -----------------------------------------------------------------------------
diff --git a/src/states_screens/options_screen_audio.hpp b/src/states_screens/options_screen_audio.hpp
new file mode 100644
index 000000000..8cf8507cc
--- /dev/null
+++ b/src/states_screens/options_screen_audio.hpp
@@ -0,0 +1,58 @@
+// 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_AUDIO_HPP__
+#define __HEADER_OPTIONS_SCREEN_AUDIO_HPP__
+
+#include
+#include "irrlicht.h"
+
+#include "guiengine/screen.hpp"
+
+namespace GUIEngine { class Widget; }
+
+struct Input;
+
+/**
+ * \brief Audio options screen
+ * \ingroup states_screens
+ */
+class OptionsScreenAudio : public GUIEngine::Screen, public GUIEngine::ScreenSingleton
+{
+ OptionsScreenAudio();
+
+public:
+ friend class GUIEngine::ScreenSingleton;
+
+ /** \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
diff --git a/src/states_screens/options_screen_input.cpp b/src/states_screens/options_screen_input.cpp
index e8084ad73..b56d3e886 100644
--- a/src/states_screens/options_screen_input.cpp
+++ b/src/states_screens/options_screen_input.cpp
@@ -17,8 +17,9 @@
#include "states_screens/options_screen_input.hpp"
#include "states_screens/options_screen_input2.hpp"
-#include "states_screens/options_screen_av.hpp"
+#include "states_screens/options_screen_audio.hpp"
#include "states_screens/options_screen_players.hpp"
+#include "states_screens/options_screen_video.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/CGUISpriteBank.h"
@@ -173,7 +174,8 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
- if (selection == "tab_audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
+ 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());
}
diff --git a/src/states_screens/options_screen_input2.cpp b/src/states_screens/options_screen_input2.cpp
index 59e137244..39f66d52e 100644
--- a/src/states_screens/options_screen_input2.cpp
+++ b/src/states_screens/options_screen_input2.cpp
@@ -17,8 +17,9 @@
#include "states_screens/options_screen_input.hpp"
#include "states_screens/options_screen_input2.hpp"
-#include "states_screens/options_screen_av.hpp"
+#include "states_screens/options_screen_audio.hpp"
#include "states_screens/options_screen_players.hpp"
+#include "states_screens/options_screen_video.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/CGUISpriteBank.h"
@@ -325,17 +326,10 @@ void OptionsScreenInput2::eventCallback(Widget* widget, const std::string& name,
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
- if (selection == "tab_audio_video")
- {
- StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
- }
- else if (selection == "tab_players")
- {
- StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
- }
- else if (selection == "tab_controls")
- {
- }
+ 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") {}
}
else if (name == "back_to_device_list")
{
diff --git a/src/states_screens/options_screen_players.cpp b/src/states_screens/options_screen_players.cpp
index 2e0d43afb..657363cac 100644
--- a/src/states_screens/options_screen_players.cpp
+++ b/src/states_screens/options_screen_players.cpp
@@ -15,9 +15,10 @@
// 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_audio.hpp"
#include "states_screens/options_screen_input.hpp"
-#include "states_screens/options_screen_av.hpp"
#include "states_screens/options_screen_players.hpp"
+#include "states_screens/options_screen_video.hpp"
#include "config/player.hpp"
#include "config/device_config.hpp"
@@ -146,7 +147,8 @@ void OptionsScreenPlayers::eventCallback(Widget* widget, const std::string& name
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
- if (selection == "tab_audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
+ 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());
}
diff --git a/src/states_screens/options_screen_video.cpp b/src/states_screens/options_screen_video.cpp
new file mode 100644
index 000000000..23466de28
--- /dev/null
+++ b/src/states_screens/options_screen_video.cpp
@@ -0,0 +1,186 @@
+// 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_audio.hpp"
+#include "states_screens/options_screen_input.hpp"
+#include "states_screens/options_screen_players.hpp"
+#include "states_screens/options_screen_video.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/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/state_manager.hpp"
+
+
+#include
+#include
+
+using namespace GUIEngine;
+
+DEFINE_SCREEN_SINGLETON( OptionsScreenVideo );
+
+// -----------------------------------------------------------------------------
+
+OptionsScreenVideo::OptionsScreenVideo() : Screen("options_video.stkgui")
+{
+ m_inited = false;
+}
+
+// -----------------------------------------------------------------------------
+
+void OptionsScreenVideo::loadedFromFile()
+{
+ m_inited = false;
+}
+
+// -----------------------------------------------------------------------------
+
+void OptionsScreenVideo::init()
+{
+ RibbonWidget* ribbon = this->getWidget("options_choice");
+ if (ribbon != NULL) ribbon->select( "tab_video", PLAYER_ID_GAME_MASTER );
+
+ // ---- video modes
+ DynamicRibbonWidget* res = this->getWidget("resolutions");
+ assert( res != NULL );
+
+
+ CheckBoxWidget* full = this->getWidget("fullscreen");
+ assert( full != NULL );
+ full->setState( UserConfigParams::m_fullscreen );
+
+
+ // --- get resolution list from irrlicht the first time
+ if (!m_inited)
+ {
+ const std::vector& modes = irr_driver->getVideoModes();
+ const int amount = modes.size();
+ for(int n=0; naddItem(name, name, "/gui/screen54.png");
+ else if (ABOUT_EQUAL( ratio, (4.0f/3.0f) )) res->addItem(name, name, "/gui/screen43.png");
+ else if (ABOUT_EQUAL( ratio, (16.0f/10.0f))) res->addItem(name, name, "/gui/screen1610.png");
+ else if (ABOUT_EQUAL( ratio, (5.0f/3.0f) )) res->addItem(name, name, "/gui/screen53.png");
+ else if (ABOUT_EQUAL( ratio, (3.0f/2.0f) )) res->addItem(name, name, "/gui/screen32.png");
+ else
+ {
+ std::cout << "Unknown screen size ratio : " << ratio << std::endl;
+ // FIXME - do something better than showing a random icon
+ res->addItem(name,name, file_manager->getDataDir() + "/gui/screen1610.png");
+ }
+#undef ABOUT_EQUAL
+ } // next resolution
+
+ } // end if not inited
+
+ res->updateItemDisplay();
+
+ // ---- select current resolution every time
+ const std::vector& modes = irr_driver->getVideoModes();
+ const int amount = modes.size();
+ for(int n=0; nsetSelection(n, PLAYER_ID_GAME_MASTER, false);
+ break;
+ }
+ } // end for
+
+}
+
+// -----------------------------------------------------------------------------
+
+void OptionsScreenVideo::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 == "apply_resolution")
+ {
+ using namespace GUIEngine;
+
+ DynamicRibbonWidget* w1 = this->getWidget("resolutions");
+ assert(w1 != NULL);
+
+ const std::string& res = w1->getSelectionIDString(PLAYER_ID_GAME_MASTER);
+
+ int w = -1, h = -1;
+ if (sscanf(res.c_str(), "%ix%i", &w, &h) != 2 || w == -1 || h == -1)
+ {
+ std::cerr << "Failed to decode resolution : " << res.c_str() << std::endl;
+ return;
+ }
+
+ CheckBoxWidget* w2 = this->getWidget("fullscreen");
+ assert(w2 != NULL);
+
+
+ irr_driver->changeResolution(w, h, w2->getState());
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+
+void OptionsScreenVideo::tearDown()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void OptionsScreenVideo::unloaded()
+{
+ m_inited = false;
+}
+
+// -----------------------------------------------------------------------------
+
diff --git a/src/states_screens/options_screen_av.hpp b/src/states_screens/options_screen_video.hpp
similarity index 83%
rename from src/states_screens/options_screen_av.hpp
rename to src/states_screens/options_screen_video.hpp
index dc810db9b..c06267d17 100644
--- a/src/states_screens/options_screen_av.hpp
+++ b/src/states_screens/options_screen_video.hpp
@@ -16,8 +16,8 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef __HEADER_OPTIONS_SCREEN_AV_HPP__
-#define __HEADER_OPTIONS_SCREEN_AV_HPP__
+#ifndef __HEADER_OPTIONS_SCREEN_VIDEO_HPP__
+#define __HEADER_OPTIONS_SCREEN_VIDEO_HPP__
#include
#include "irrlicht.h"
@@ -29,16 +29,16 @@ namespace GUIEngine { class Widget; }
struct Input;
/**
- * \brief Audio/video options screen
+ * \brief Graphics options screen
* \ingroup states_screens
*/
-class OptionsScreenAV : public GUIEngine::Screen, public GUIEngine::ScreenSingleton
+class OptionsScreenVideo : public GUIEngine::Screen, public GUIEngine::ScreenSingleton
{
- OptionsScreenAV();
+ OptionsScreenVideo();
bool m_inited;
public:
- friend class GUIEngine::ScreenSingleton;
+ friend class GUIEngine::ScreenSingleton;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile();