Merge branch 'master' of github.com:supertuxkart/stk-code

This commit is contained in:
hiker 2018-11-16 23:48:47 +11:00
commit 0221e2f6d1
43 changed files with 520 additions and 189 deletions

View File

@ -102,7 +102,10 @@ SDK_PATH - Path to SDK directory
NDK_PATH - Path to NDK directory
PROJECT_VERSION - Set Supertuxkart version number, for example "0.9.3" or
"git20170409" or whatever.
"git20170409" or whatever. The version must match with file
assets/data/supertuxkart.$PROJECT_VERSION
and that file must exist, because it is used for extracting
and loading game data.
Default is: git.
PROJECT_CODE - Set Supertuxkart version code that is used in the manifest

View File

@ -7,7 +7,7 @@
<best>
<karts number="9"/>
<requirements position="1" time="120"/>
<requirements position="1" time="112"/>
</best>
<hard>
<karts number="8"/>

View File

@ -7,7 +7,7 @@
<best>
<karts number="9"/>
<requirements position="1" time="145"/>
<requirements position="1" time="138"/>
</best>
<hard>
<karts number="8"/>

View File

@ -7,7 +7,7 @@
<best>
<karts number="10"/>
<requirements position="1" time="135"/>
<requirements position="1" time="128"/>
</best>
<hard>
<karts number="9"/>

View File

@ -7,15 +7,15 @@
<best>
<karts number="1"/>
<requirements energy="20" time="135"/>
<requirements energy="20" time="128"/>
</best>
<hard>
<karts number="1"/>
<requirements energy="18" time="165"/>
<requirements energy="18" time="155"/>
</hard>
<medium>
<karts number="1"/>
<requirements energy="15" time="195"/>
<requirements energy="15" time="190"/>
</medium>
<easy>
<karts number="1"/>

View File

@ -7,11 +7,11 @@
<best>
<karts number="8"/>
<requirements position="1" time="115"/>
<requirements position="1" time="110"/>
</best>
<hard>
<karts number="7"/>
<requirements position="1" time="140"/>
<requirements position="1"/>
</hard>
<medium>
<karts number="6"/>

View File

@ -7,7 +7,7 @@
<best>
<karts number="9"/>
<requirements position="1" time="145"/>
<requirements position="1" time="140"/>
</best>
<hard>
<karts number="8"/>

View File

@ -6,15 +6,15 @@
<requirements trophies="35"/>
<best>
<karts number="3"/>
<requirements position="1"/>
<karts number="5"/>
<requirements position="1" time="102"/>
</best>
<hard>
<karts number="2"/>
<karts number="4"/>
<requirements position="1"/>
</hard>
<medium>
<karts number="2"/>
<karts number="3"/>
<requirements position="1"/>
</medium>
<easy>

View File

@ -2,7 +2,13 @@
<stkgui>
<div x="5%" y="5%" width="90%" height="90%" layout="vertical-row" >
<header id="title" width="100%" text="Race Setup" align="center" text_align="center" />
<div width="100%" layout="horizontal-row" height="12%">
<icon-button id="back" width="12%" align="left" icon="gui/icons/back.png"/>
<header id="title" width="80%" text="Race Setup" align="center" text_align="center" />
<spacer height="1" width="12%"/>
</div>
<spacer height="2%" width="1"/>

View File

@ -2,7 +2,13 @@
<stkgui>
<div x="5%" y="5%" width="90%" height="90%" layout="vertical-row" >
<header id="title" width="100%" text="Race Setup" align="center" text_align="center" />
<div width="100%" layout="horizontal-row" height="12%">
<icon-button id="back" width="12%" align="left" icon="gui/icons/back.png"/>
<header id="title" width="80%" text="Race Setup" align="center" text_align="center" />
<spacer height="1" width="12%"/>
</div>
<spacer height="2%" width="1"/>

View File

@ -41,6 +41,7 @@ crown.png by glitch, from https://openclipart.org/detail/210257/misc-game-crown,
ghost_plus.png by Alayan, based on https://openclipart.org/detail/17847/cartoon-ghost by lemmling, released under CC-O
options_language.png by Alayan, based on http://www.languageicon.org/, released under CC-BY-SA 3+
options_general.png by Alayan, released under CC-BY-SA 4
blue_flag.png, heart.png and red_flag.png by Benau, released under CC-BY-SA 4

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/icons/back.png"/>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header width="80%" height="7%" align="center" text="SuperTuxKart Options" text_align="center"/>
<spacer width="100%" height="1%"/>
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/icons/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/icons/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/icons/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/icons/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<spacer width="2%" height="100%"/>
<div width="100%" height="100%" layout="vertical-row" >
<box width="80%" height="49%" layout="vertical-row">
<spacer width="5" height="2%"/>
<label width="80%" height="fit" align="center" I18N="In the general settings" text="Internet options" text_align="center"/>
<spacer width="5" height="4%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-internet"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the general settings" text="Connect to the Internet" word_wrap="true"/>
</div>
<spacer width="5" height="4%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-hw-report"/>
<spacer width="1%" height="100%" />
<label height="100%" id="label-hw-report" I18N="In the general settings"
text="Send anonymous hardware statistics" word_wrap="true"/>
</div>
<spacer width="5" height="4%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="show-login"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the general settings" text="Always show login screen" word_wrap="true"/>
</div>
<spacer width="5" height="4%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-lobby-chat"/>
<spacer width="1%" height="100%" />
<label height="100%" id="label-lobby-chat" I18N="In the general settings" text="Enable chatting in networking lobby" word_wrap="true"/>
</div>
<spacer width="5" height="4%"/>
</box>
<spacer width="5" height="2%"/>
<box width="80%" height="49%" layout="vertical-row">
<spacer width="5" height="2%"/>
<label width="80%" height="fit" align="center" I18N="In the general settings" text="Miscellaneous options" text_align="center"/>
<spacer width="5" height="4%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="perPlayerDifficulty"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the general settings" text="Enable per-player handicaps" word_wrap="true"/>
</div>
<spacer width="5" height="4%"/>
</box>
</div>
</div>
</div>
</stkgui>

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -1,18 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/icons/back.png"/>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header width="80%" height="7%" align="center" text="SuperTuxKart Options" text_align="center"/>
<spacer width="100%" height="1%"/>
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<div width="100%" height="92%" layout="horizontal-row" >
<tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/icons/options_ui.png"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/icons/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/icons/options_input.png"/>
</tabs>
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/icons/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/icons/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/icons/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/icons/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<box proportion="1" width="100%" layout="vertical-row">
@ -46,6 +56,4 @@
<spacer width="20" height="15"/>
</box>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/icons/back.png"/>
</stkgui>

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"
@ -64,47 +66,6 @@
</div>
<spacer width="5" height="2%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="perPlayerDifficulty"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the ui settings" text="Enable per-player handicaps" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-internet"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the ui settings" text="Connect to the Internet" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-hw-report"/>
<spacer width="1%" height="100%" />
<label height="100%" id="label-hw-report" I18N="In the ui settings"
text="Send anonymous hardware statistics" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="show-login"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the ui settings" text="Always show login screen" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-lobby-chat"/>
<spacer width="1%" height="100%" />
<label height="100%" id="label-lobby-chat" I18N="In the ui settings" text="Enable chatting in networking lobby" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
</box>
</div>
</div>

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -11,11 +11,11 @@
<spacer height="1%" width="25"/>
<div layout="horizontal-row" width="40%" height="fit" align="left">
<div layout="horizontal-row" width="100%" height="fit" align="left">
<bright width="fit" height="100%"
I18N="In soccer setup screen" text="Soccer game type" text_align="left" />
<spacer width="2%" height="25"/>
<spinner id="time_enabled" proportion="1" wrap_around="true"/>
<spinner id="time_enabled" width="30%" wrap_around="true"/>
</div>
<div layout="horizontal-row" width="100%" height="fit" align="left">

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -170,7 +170,7 @@
<near-ground distance="2"/>
<!-- How long the end animation will be shown. -->
<delay-finish time="0.5"/>
<delay-finish time="1.0"/>
<!-- How long the music credits are shown. -->
<credits music="10"/>
@ -555,7 +555,7 @@
max-adjust-time: Maximum time spent in each smoothing stage.
adjust-length-threshold: The higher this value, the larger the correction curve.
-->
<network-smoothing min-adjust-length="0.1"
<network-smoothing min-adjust-length="0.05"
max-adjust-length="4.0"
min-adjust-speed="0.3"
max-adjust-time="2.0"

View File

@ -93,7 +93,7 @@
#if defined(__REGAL_H__)
#error Regal.h included before glew.h
#endif
#if defined(__glext_h_) || defined(__GLEXT_H_)
#if defined(__glext_h_) || defined(__GLEXT_H_) || defined(__gl_glext_h_)
#error glext.h included before glew.h
#endif
#if defined(__gl_ATI_h_)
@ -109,6 +109,7 @@
#define __X_GL_H
#define __glext_h_
#define __GLEXT_H_
#define __gl_glext_h_
#define __gl_ATI_h_
#if defined(_WIN32)

View File

@ -1,5 +1,5 @@
# Modify this file to change the last-modified date when you add/remove a file.
# This will then trigger a new cmake run automatically.
# This will then trigger a new cmake run automatically.
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")

View File

@ -441,7 +441,7 @@ void AchievementsStatus::updateAchievementsProgress(UpdateType type, unsigned in
{
std::string goal_string[2];
int max_across_tracks = -1;
int min_across_tracks = -1;
int min_across_tracks = INT_MAX;
int max_kart_hits = 0;
if (type == UP_ACHIEVEMENT_DATA)
{

View File

@ -394,11 +394,11 @@ namespace UserConfigParams
&m_audio_group,
"Whether musics are enabled or not (true or false)") );
PARAM_PREFIX FloatUserConfigParam m_sfx_volume
PARAM_DEFAULT( FloatUserConfigParam(1.0, "sfx_volume",
PARAM_DEFAULT( FloatUserConfigParam(0.6f, "sfx_volume",
&m_audio_group, "Volume for sound effects, see openal AL_GAIN "
"for interpretation") );
PARAM_PREFIX FloatUserConfigParam m_music_volume
PARAM_DEFAULT( FloatUserConfigParam(0.7f, "music_volume",
PARAM_DEFAULT( FloatUserConfigParam(0.5f, "music_volume",
&m_audio_group, "Music volume from 0.0 to 1.0") );
// ---- Race setup

View File

@ -81,15 +81,15 @@ void NetworkAIController::convertAIToPlayerActions()
if (m_ai_controls->getSteer() < 0.0f)
{
all_actions.emplace_back(PA_STEER_LEFT,
fabsf(m_ai_controls->getSteer()) * 32768);
int(fabsf(m_ai_controls->getSteer()) * 32768));
}
else
{
all_actions.emplace_back(PA_STEER_RIGHT,
fabsf(m_ai_controls->getSteer()) * 32768);
int(fabsf(m_ai_controls->getSteer()) * 32768));
}
all_actions.emplace_back(PA_ACCEL,
m_ai_controls->getAccel() * 32768);
int(m_ai_controls->getAccel() * 32768));
all_actions.emplace_back(PA_BRAKE,
m_ai_controls->getBrake() ? 32768 : 0);
all_actions.emplace_back(PA_FIRE,

View File

@ -993,17 +993,19 @@ void Kart::finishedRace(float time, bool from_server)
RaceGUIBase* m = World::getWorld()->getRaceGUI();
if (m)
{
if (race_manager->
getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER &&
getPosition() == 2)
m->addMessage(_("You won the race!"), this, 2.0f);
else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_NORMAL_RACE ||
race_manager->getMinorMode() == RaceManager::MINOR_MODE_TIME_TRIAL)
{
m->addMessage((getPosition() == 1 ?
_("You won the race!") : _("You finished the race!")) ,
this, 2.0f);
}
bool won_the_race = false;
unsigned int win_position = 1;
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER)
win_position = 2;
if (getPosition() == (int)win_position &&
World::getWorld()->getNumKarts() > win_position)
won_the_race = true;
m->addMessage((won_the_race ?
_("You won the race!") : _("You finished the race!")) ,
this, 2.0f, video::SColor(255, 255, 255, 255), true, true, true);
}
}

View File

@ -105,7 +105,7 @@ void android_main(struct android_app* app)
// its state is remembered when the window is restored. We will use exit
// call to make sure that all variables are cleared until a proper fix will
// be done.
exit(0);
_exit(0);
}
#endif

View File

@ -35,7 +35,7 @@
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/race_gui_base.hpp"
#include "states_screens/race_setup_screen.hpp"
#include "states_screens/options/options_screen_video.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
@ -174,7 +174,7 @@ GUIEngine::EventPropagation
else if (selection == "options")
{
dismiss();
OptionsScreenVideo::getInstance()->push();
OptionsScreenGeneral::getInstance()->push();
return GUIEngine::EVENT_BLOCK;
}
else if (selection == "restart")

View File

@ -174,11 +174,28 @@ void SelectChallengeDialog::updateSolvedIcon(const ChallengeStatus* c, RaceManag
}
} //updateSolvedIcon
// -----------------------------------------------------------------------------
void SelectChallengeDialog::onUpdate(float dt)
{
if (m_self_destroy)
{
ModalDialog::clearWindow();
ModalDialog::dismiss();
return;
}
} // onUpdate
// ----------------------------------------------------------------------------
GUIEngine::EventPropagation SelectChallengeDialog::processEvent(const std::string& eventSourceParam)
{
std::string eventSource = eventSourceParam;
if (eventSource == "back")
{
m_self_destroy = true;
return GUIEngine::EVENT_BLOCK;
}
if (eventSource == "novice" || eventSource == "intermediate" ||
eventSource == "expert" || eventSource == "supertux")
{

View File

@ -30,6 +30,7 @@
class SelectChallengeDialog : public GUIEngine::ModalDialog
{
private:
bool m_self_destroy = false;
std::string m_challenge_id;
void updateSolvedIcon(const ChallengeStatus* c, RaceManager::Difficulty diff,
const char* widget_name, const char* path);
@ -40,6 +41,7 @@ public:
virtual ~SelectChallengeDialog();
virtual GUIEngine::EventPropagation processEvent(const std::string& eventSource);
virtual void onUpdate(float dt);
};
#endif

View File

@ -47,7 +47,7 @@
#include "states_screens/online/online_profile_achievements.hpp"
#include "states_screens/online/online_profile_servers.hpp"
#include "states_screens/online/online_screen.hpp"
#include "states_screens/options/options_screen_video.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/options/user_screen.hpp"
#if DEBUG_MENU_ITEM
@ -401,7 +401,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
}
else if (selection == "options")
{
OptionsScreenVideo::getInstance()->push();
OptionsScreenGeneral::getInstance()->push();
}
else if (selection == "quit")
{

View File

@ -27,6 +27,7 @@
#include "guiengine/widgets/spinner_widget.hpp"
#include "guiengine/widget.hpp"
#include "io/file_manager.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_ui.hpp"
@ -112,6 +113,8 @@ void OptionsScreenAudio::eventCallback(Widget* widget, const std::string& name,
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)

View File

@ -32,6 +32,7 @@
#include "io/file_manager.hpp"
#include "states_screens/dialogs/press_a_key_dialog.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_video.hpp"
@ -550,6 +551,8 @@ void OptionsScreenDevice::eventCallback(Widget* widget,
// screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)

View File

@ -0,0 +1,229 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2009-2015 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/options_screen_general.hpp"
#include "addons/news_manager.hpp"
#include "audio/sfx_manager.hpp"
#include "audio/sfx_base.hpp"
#include "config/hardware_stats.hpp"
#include "config/player_manager.hpp"
#include "config/user_config.hpp"
#include "font/bold_face.hpp"
#include "font/font_manager.hpp"
#include "font/regular_face.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/scalable_font.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/label_widget.hpp"
#include "guiengine/widgets/list_widget.hpp"
#include "guiengine/widgets/spinner_widget.hpp"
#include "guiengine/widget.hpp"
#include "io/file_manager.hpp"
#include "online/request_manager.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_ui.hpp"
#include "states_screens/options/options_screen_video.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/options/user_screen.hpp"
#include "utils/log.hpp"
#include "utils/string_utils.hpp"
#include "utils/translation.hpp"
#include <algorithm>
#include <iostream>
#include <sstream>
using namespace GUIEngine;
using namespace Online;
// -----------------------------------------------------------------------------
OptionsScreenGeneral::OptionsScreenGeneral() : Screen("options_general.stkgui")
{
m_inited = false;
} // OptionsScreenVideo
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::loadedFromFile()
{
m_inited = false;
} // loadedFromFile
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::init()
{
Screen::init();
RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
assert(ribbon != NULL);
ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
ribbon->select( "tab_general", PLAYER_ID_GAME_MASTER );
CheckBoxWidget* news = getWidget<CheckBoxWidget>("enable-internet");
assert( news != NULL );
news->setState( UserConfigParams::m_internet_status
==RequestManager::IPERM_ALLOWED );
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
assert( stats != NULL );
LabelWidget *stats_label = getWidget<LabelWidget>("label-hw-report");
assert( stats_label );
stats->setState(UserConfigParams::m_hw_report_enable);
getWidget<CheckBoxWidget>("enable-lobby-chat")
->setState(UserConfigParams::m_lobby_chat);
if(news->getState())
{
stats_label->setVisible(true);
stats->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
}
else
{
stats_label->setVisible(false);
stats->setVisible(false);
}
CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
assert( difficulty != NULL );
difficulty->setState( UserConfigParams::m_per_player_difficulty );
// I18N: Tooltip in the UI menu. Use enough linebreaks to make sure the text fits the screen in low resolutions.
difficulty->setTooltip(_("In multiplayer mode, players can select handicapped\n(more difficult) profiles on the kart selection screen"));
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
assert( show_login!= NULL );
show_login->setState( UserConfigParams::m_always_show_login_screen);
} // init
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
#ifndef SERVER_ONLY
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
Screen *screen = NULL;
if (selection == "tab_audio")
screen = OptionsScreenAudio::getInstance();
else if (selection == "tab_video")
screen = OptionsScreenVideo::getInstance();
else if (selection == "tab_players")
screen = TabbedUserScreen::getInstance();
else if (selection == "tab_controls")
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
//else if (selection == "tab_general")
// screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if(name == "back")
{
StateManager::get()->escapePressed();
}
else if (name=="enable-internet")
{
CheckBoxWidget* internet = getWidget<CheckBoxWidget>("enable-internet");
assert( internet != NULL );
UserConfigParams::m_internet_status =
internet->getState() ? RequestManager::IPERM_ALLOWED
: RequestManager::IPERM_NOT_ALLOWED;
// If internet gets enabled, re-initialise the addon manager (which
// happens in a separate thread) so that news.xml etc can be
// downloaded if necessary.
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
LabelWidget* stats_label = getWidget<LabelWidget>("label-hw-report");
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
LabelWidget* chat_label = getWidget<LabelWidget>("label-lobby-chat");
if(internet->getState())
{
NewsManager::get()->init(false);
stats->setVisible(true);
stats_label->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
chat->setVisible(true);
stats->setState(UserConfigParams::m_lobby_chat);
chat_label->setVisible(true);
}
else
{
chat->setVisible(false);
chat_label->setVisible(false);
stats->setVisible(false);
stats_label->setVisible(false);
PlayerProfile* profile = PlayerManager::getCurrentPlayer();
if (profile != NULL && profile->isLoggedIn())
profile->requestSignOut();
}
}
else if (name=="enable-hw-report")
{
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
UserConfigParams::m_hw_report_enable = stats->getState();
if(stats->getState())
HardwareStats::reportHardwareStats();
}
else if (name=="enable-lobby-chat")
{
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
UserConfigParams::m_lobby_chat = chat->getState();
}
else if (name=="show-login")
{
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
assert( show_login != NULL );
UserConfigParams::m_always_show_login_screen = show_login->getState();
}
else if (name=="perPlayerDifficulty")
{
CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
assert( difficulty != NULL );
UserConfigParams::m_per_player_difficulty = difficulty->getState();
}
#endif
} // eventCallback
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::tearDown()
{
Screen::tearDown();
// save changes when leaving screen
user_config->saveConfig();
} // tearDown
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::unloaded()
{
m_inited = false;
} // unloaded
// -----------------------------------------------------------------------------

View File

@ -0,0 +1,61 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2009-2015 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_GENERAL_HPP__
#define __HEADER_OPTIONS_SCREEN_GENERAL_HPP__
#include <string>
#include "guiengine/screen.hpp"
namespace GUIEngine { class Widget; }
struct Input;
/**
* \brief Graphics options screen
* \ingroup states_screens
*/
class OptionsScreenGeneral : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OptionsScreenGeneral>
{
OptionsScreenGeneral();
bool m_inited;
std::vector<std::string> m_skins;
public:
friend class GUIEngine::ScreenSingleton<OptionsScreenGeneral>;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
const int playerID) OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void init() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void tearDown() OVERRIDE;
/** \brief implement optional callback from parent class GUIEngine::Screen */
virtual void unloaded() OVERRIDE;
};
#endif

View File

@ -30,6 +30,7 @@
#include "io/file_manager.hpp"
#include "states_screens/options/options_screen_device.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_video.hpp"
#include "states_screens/options/options_screen_ui.hpp"
@ -222,6 +223,8 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
// screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)

View File

@ -40,6 +40,7 @@
#include "online/request_manager.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_ui.hpp"
#include "states_screens/options/options_screen_video.hpp"
@ -139,6 +140,8 @@ void OptionsScreenLanguage::eventCallback(Widget* widget, const std::string& nam
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
//else if (selection == "tab_language")
// screen = OptionsScreenLanguage::getInstance();
if(screen)

View File

@ -40,6 +40,7 @@
#include "online/request_manager.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_video.hpp"
@ -163,39 +164,6 @@ void OptionsScreenUI::init()
CheckBoxWidget* fps = getWidget<CheckBoxWidget>("showfps");
assert( fps != NULL );
fps->setState( UserConfigParams::m_display_fps );
CheckBoxWidget* news = getWidget<CheckBoxWidget>("enable-internet");
assert( news != NULL );
news->setState( UserConfigParams::m_internet_status
==RequestManager::IPERM_ALLOWED );
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
assert( stats != NULL );
LabelWidget *stats_label = getWidget<LabelWidget>("label-hw-report");
assert( stats_label );
stats->setState(UserConfigParams::m_hw_report_enable);
getWidget<CheckBoxWidget>("enable-lobby-chat")
->setState(UserConfigParams::m_lobby_chat);
if(news->getState())
{
stats_label->setVisible(true);
stats->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
}
else
{
stats_label->setVisible(false);
stats->setVisible(false);
}
CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
assert( difficulty != NULL );
difficulty->setState( UserConfigParams::m_per_player_difficulty );
// I18N: Tooltip in the UI menu. Use enough linebreaks to make sure the text fits the screen in low resolutions.
difficulty->setTooltip(_("In multiplayer mode, players can select handicapped\n(more difficult) profiles on the kart selection screen"));
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
assert( show_login!= NULL );
show_login->setState( UserConfigParams::m_always_show_login_screen);
// --- select the right skin in the spinner
bool currSkinFound = false;
@ -243,6 +211,8 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
screen = OptionsScreenInput::getInstance();
//else if (selection == "tab_ui")
// screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)
@ -282,65 +252,6 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
assert( fps != NULL );
UserConfigParams::m_display_fps = fps->getState();
}
else if (name=="enable-internet")
{
CheckBoxWidget* internet = getWidget<CheckBoxWidget>("enable-internet");
assert( internet != NULL );
UserConfigParams::m_internet_status =
internet->getState() ? RequestManager::IPERM_ALLOWED
: RequestManager::IPERM_NOT_ALLOWED;
// If internet gets enabled, re-initialise the addon manager (which
// happens in a separate thread) so that news.xml etc can be
// downloaded if necessary.
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
LabelWidget* stats_label = getWidget<LabelWidget>("label-hw-report");
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
LabelWidget* chat_label = getWidget<LabelWidget>("label-lobby-chat");
if(internet->getState())
{
NewsManager::get()->init(false);
stats->setVisible(true);
stats_label->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
chat->setVisible(true);
stats->setState(UserConfigParams::m_lobby_chat);
chat_label->setVisible(true);
}
else
{
chat->setVisible(false);
chat_label->setVisible(false);
stats->setVisible(false);
stats_label->setVisible(false);
PlayerProfile* profile = PlayerManager::getCurrentPlayer();
if (profile != NULL && profile->isLoggedIn())
profile->requestSignOut();
}
}
else if (name=="enable-hw-report")
{
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
UserConfigParams::m_hw_report_enable = stats->getState();
if(stats->getState())
HardwareStats::reportHardwareStats();
}
else if (name=="enable-lobby-chat")
{
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
UserConfigParams::m_lobby_chat = chat->getState();
}
else if (name=="show-login")
{
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
assert( show_login != NULL );
UserConfigParams::m_always_show_login_screen = show_login->getState();
}
else if (name=="perPlayerDifficulty")
{
CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
assert( difficulty != NULL );
UserConfigParams::m_per_player_difficulty = difficulty->getState();
}
#endif
} // eventCallback

View File

@ -31,6 +31,7 @@
#include "io/file_manager.hpp"
#include "states_screens/dialogs/custom_video_settings.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_ui.hpp"
@ -513,6 +514,8 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)

View File

@ -36,6 +36,7 @@
#include "states_screens/dialogs/recovery_dialog.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_ui.hpp"
@ -748,6 +749,8 @@ void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)