Several UI fixes (#4484)
* Open the confirm dialog if exiting the grand prix editor with changes by escape key * When launching the tutorial, use the last used device instead of the first keyboard * When launching story mode, use the last used device instead of the first keyboard * Make the kart color selection dialog more consistent with other dialogs Includes: * Add an icon button bar with containing actions to apply changes or to cancel them * The kart only shows its straight frame, without animation; it is slightly smaller * Adjust the vertical space between widgets, to try keeping the kart size larger * Use a button bar for the video settings and custom camera settings dialog
This commit is contained in:
parent
b43b5c6201
commit
a3b34e6823
@ -86,15 +86,14 @@
|
||||
|
||||
<spacer height="4%" width="100%" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" proportion="1">
|
||||
<spacer width="25%" height="100%" />
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<button id="close" text="Apply" align="center"/>
|
||||
</div>
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<button id="reset" text="Reset" align="center"/>
|
||||
</div>
|
||||
</div>
|
||||
<buttonbar id="buttons" height="20%" width="40%" align="center">
|
||||
<icon-button id="apply" width="128" height="128" icon="gui/icons/green_check.png"
|
||||
I18N="In the ui/camera screen" text="Apply" align="center"/>
|
||||
<icon-button id="reset" width="128" height="128" icon="gui/icons/restart.png"
|
||||
I18N="In the ui/camera screen" text="Reset" align="center"/>
|
||||
<icon-button id="cancel" width="128" height="128" icon="gui/icons/main_quit.png"
|
||||
I18N="In the ui/camera screen" text="Cancel" align="center"/>
|
||||
</buttonbar>
|
||||
</div>
|
||||
</div>
|
||||
</stkgui>
|
||||
|
@ -171,8 +171,13 @@
|
||||
|
||||
<label text="* Restart STK to apply new settings" width="100%" text_align="center" I18N="Video settings"/>
|
||||
|
||||
<spacer proportion="1"/>
|
||||
<spacer height="4" width="10"/>
|
||||
|
||||
<button id="close" text="Apply" align="center"/>
|
||||
<buttonbar id="buttons" height="15%" width="30%" align="center">
|
||||
<icon-button id="apply" width="128" height="128" icon="gui/icons/green_check.png"
|
||||
I18N="Video settings" text="Apply" align="center"/>
|
||||
<icon-button id="cancel" width="128" height="128" icon="gui/icons/main_quit.png"
|
||||
I18N="Video settings" text="Cancel" align="center"/>
|
||||
</buttonbar>
|
||||
</div>
|
||||
</stkgui>
|
||||
|
@ -1,20 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<stkgui>
|
||||
<div x="2%" y="0%" width="96%" height="95%" layout="vertical-row">
|
||||
<spacer height="20" width="10"/>
|
||||
<div id="kart-screen" layout="horizontal-row" width="100%" proportion="1" align="center">
|
||||
<model id="model" width="100%" layout="horizontal-row" height="100%">
|
||||
</model>
|
||||
</div>
|
||||
<div width="100%" height="fit" text-align="left" layout="horizontal-row" >
|
||||
<spacer height="30" width="15%"/>
|
||||
<spacer height="10" width="15%"/>
|
||||
<spinner id="toggle-slider" width="70%" min_value="0" max_value="1" wrap_around="true"/>
|
||||
<spacer height="30" width="15%"/>
|
||||
<spacer height="20" width="15%"/>
|
||||
</div>
|
||||
<spacer height="30" width="10"/>
|
||||
<spacer height="20" width="10"/>
|
||||
<div height="fit" width="100%" layout="horizontal-row">
|
||||
<gauge id="color-slider" min_value="1" max_value="100" proportion="1" wrap_around="true"/>
|
||||
</div>
|
||||
<spacer height="30" width="10"/>
|
||||
<button id="close" text="Apply" align="center"/>
|
||||
<spacer height="10" width="10"/>
|
||||
<buttonbar id="buttons" height="20%" width="30%" align="center">
|
||||
<icon-button id="apply" width="128" height="128" icon="gui/icons/green_check.png"
|
||||
I18N="In the kart color slider dialog" text="Apply" align="center"/>
|
||||
<icon-button id="cancel" width="128" height="128" icon="gui/icons/main_quit.png"
|
||||
I18N="In the kart color slider dialog" text="Cancel" align="center"/>
|
||||
</buttonbar>
|
||||
</div>
|
||||
</stkgui>
|
||||
|
@ -75,8 +75,8 @@ void OverWorld::enterOverWorld()
|
||||
RaceManager::get()->setDifficulty(RaceManager::DIFFICULTY_BEST);
|
||||
}
|
||||
|
||||
// Use keyboard 0 by default (FIXME: let player choose?)
|
||||
InputDevice* device = input_manager->getDeviceManager()->getKeyboard(0);
|
||||
// Use the last used device
|
||||
InputDevice* device = input_manager->getDeviceManager()->getLatestUsedDevice();
|
||||
|
||||
// Create player and associate player with keyboard
|
||||
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
|
||||
|
@ -20,8 +20,10 @@
|
||||
#include "config/user_config.hpp"
|
||||
#include "guiengine/widgets/check_box_widget.hpp"
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||
#include "guiengine/widgets/spinner_widget.hpp"
|
||||
#include "states_screens/options/options_screen_ui.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
@ -115,7 +117,12 @@ void CustomCameraSettingsDialog::beforeAddingWidgets()
|
||||
GUIEngine::EventPropagation CustomCameraSettingsDialog::processEvent(const std::string& eventSource)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
if (eventSource == "close")
|
||||
if (eventSource == "buttons")
|
||||
{
|
||||
const std::string& selection = getWidget<RibbonWidget>("buttons")->
|
||||
getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
if (selection == "apply")
|
||||
{
|
||||
UserConfigParams::m_camera_forward_smoothing = getWidget<CheckBoxWidget>("camera_smoothing")->getState();
|
||||
UserConfigParams::m_reverse_look_use_soccer_cam = getWidget<CheckBoxWidget>("use_soccer_camera")->getState();
|
||||
@ -149,7 +156,7 @@ GUIEngine::EventPropagation CustomCameraSettingsDialog::processEvent(const std::
|
||||
m_self_destroy = true;
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
else if (eventSource == "reset") // discard all the changes
|
||||
else if (selection == "reset") // discard all the changes
|
||||
{
|
||||
if (UserConfigParams::m_camera_present == 1) // Standard camera
|
||||
{
|
||||
@ -172,6 +179,12 @@ GUIEngine::EventPropagation CustomCameraSettingsDialog::processEvent(const std::
|
||||
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_saved_reverse_look_use_soccer_cam);
|
||||
}
|
||||
}
|
||||
else if (selection == "cancel")
|
||||
{
|
||||
ModalDialog::dismiss();
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return GUIEngine::EVENT_LET;
|
||||
} // processEvent
|
||||
|
@ -19,8 +19,10 @@
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "guiengine/widgets/check_box_widget.hpp"
|
||||
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||
#include "guiengine/widgets/spinner_widget.hpp"
|
||||
#include "states_screens/options/options_screen_video.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
@ -116,7 +118,12 @@ void CustomVideoSettingsDialog::beforeAddingWidgets()
|
||||
GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::string& eventSource)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
if (eventSource == "close")
|
||||
if (eventSource == "buttons")
|
||||
{
|
||||
const std::string& selection = getWidget<RibbonWidget>("buttons")->
|
||||
getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
if (selection == "apply")
|
||||
{
|
||||
bool advanced_pipeline = getWidget<CheckBoxWidget>("dynamiclight")->getState();
|
||||
UserConfigParams::m_dynamic_lights = advanced_pipeline;
|
||||
@ -181,6 +188,12 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
|
||||
OptionsScreenVideo::getInstance()->updateBlurSlider();
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
else if (selection == "cancel")
|
||||
{
|
||||
ModalDialog::dismiss();
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
}
|
||||
else if (eventSource == "dynamiclight")
|
||||
{
|
||||
updateActivation();
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "guiengine/widgets/model_view_widget.hpp"
|
||||
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||
#include "guiengine/widgets/spinner_widget.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
@ -51,6 +52,8 @@ KartColorSliderDialog::KartColorSliderDialog(PlayerProfile* pp)
|
||||
m_toggle_slider->addLabel(original_color);
|
||||
m_toggle_slider->addLabel(choose_color);
|
||||
|
||||
m_buttons_widget = getWidget<RibbonWidget>("buttons");
|
||||
|
||||
if (m_player_profile->getDefaultKartColor() != 0.0f)
|
||||
{
|
||||
m_toggle_slider->setValue(1);
|
||||
@ -111,26 +114,8 @@ void KartColorSliderDialog::beforeAddingWidgets()
|
||||
model_location.setScale(core::vector3df(scale, scale, scale));
|
||||
|
||||
// Add the kart model (including wheels and speed weight objects)
|
||||
const bool has_win_anime =
|
||||
(((kart_model.getFrame(KartModel::AF_WIN_LOOP_START) > -1 ||
|
||||
kart_model.getFrame(KartModel::AF_WIN_START) > -1) &&
|
||||
kart_model.getFrame(KartModel::AF_WIN_END) > -1) ||
|
||||
(kart_model.getFrame(KartModel::AF_SELECTION_START) > -1 &&
|
||||
kart_model.getFrame(KartModel::AF_SELECTION_END) > -1));
|
||||
m_model_view->addModel(kart_model.getModel(), model_location,
|
||||
has_win_anime ?
|
||||
kart_model.getFrame(KartModel::AF_SELECTION_START) > -1 ?
|
||||
kart_model.getFrame(KartModel::AF_SELECTION_START) :
|
||||
kart_model.getFrame(KartModel::AF_WIN_LOOP_START) > -1 ?
|
||||
kart_model.getFrame(KartModel::AF_WIN_LOOP_START) :
|
||||
kart_model.getFrame(KartModel::AF_WIN_START) :
|
||||
kart_model.getBaseFrame(),
|
||||
has_win_anime ?
|
||||
kart_model.getFrame(KartModel::AF_SELECTION_END) > -1 ?
|
||||
kart_model.getFrame(KartModel::AF_SELECTION_END) :
|
||||
kart_model.getFrame(KartModel::AF_WIN_END) :
|
||||
kart_model.getBaseFrame(),
|
||||
kart_model.getAnimationSpeed());
|
||||
kart_model.getBaseFrame(), kart_model.getBaseFrame());
|
||||
|
||||
model_location.setScale(core::vector3df(1.0f, 1.0f, 1.0f));
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
@ -191,7 +176,12 @@ GUIEngine::EventPropagation
|
||||
m_model_view->getModelViewRenderInfo()->setHue(float(
|
||||
m_color_slider->getValue()) / 100.0f);
|
||||
}
|
||||
else if (eventSource == "close")
|
||||
else if (eventSource == "buttons")
|
||||
{
|
||||
const std::string& selection = m_buttons_widget->
|
||||
getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
if (selection == "apply")
|
||||
{
|
||||
float color = 0.0f;
|
||||
if (m_toggle_slider->getValue() == 1)
|
||||
@ -200,5 +190,11 @@ GUIEngine::EventPropagation
|
||||
ModalDialog::dismiss();
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
else if (selection == "cancel")
|
||||
{
|
||||
ModalDialog::dismiss();
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
}
|
||||
return GUIEngine::EVENT_LET;
|
||||
} // processEvent
|
||||
|
@ -27,6 +27,7 @@ namespace GUIEngine
|
||||
{
|
||||
class CheckBoxWidget;
|
||||
class ModelViewWidget;
|
||||
class RibbonWidget;
|
||||
class SpinnerWidget;
|
||||
}
|
||||
|
||||
@ -44,6 +45,8 @@ private:
|
||||
|
||||
GUIEngine::SpinnerWidget* m_color_slider;
|
||||
|
||||
GUIEngine::RibbonWidget* m_buttons_widget;
|
||||
|
||||
void toggleSlider();
|
||||
public:
|
||||
KartColorSliderDialog(PlayerProfile* pp);
|
||||
|
@ -372,3 +372,20 @@ void EditGPScreen::enableButtons()
|
||||
edit_button->setActive(m_selected >= 0);
|
||||
remove_button->setActive(m_selected >= 0);
|
||||
} // enableButtons
|
||||
|
||||
bool EditGPScreen::onEscapePressed()
|
||||
{
|
||||
if (m_modified)
|
||||
{
|
||||
m_action = "back";
|
||||
new MessageDialog(
|
||||
_("Do you want to save your changes?"),
|
||||
MessageDialog::MESSAGE_DIALOG_CONFIRM,
|
||||
this, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
back();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -80,6 +80,9 @@ public:
|
||||
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
|
||||
const int playerID) OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual bool onEscapePressed() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void beforeAddingWidget() OVERRIDE;
|
||||
|
||||
|
@ -277,12 +277,11 @@ void MainMenuScreen::startTutorial()
|
||||
RaceManager::get()->setDifficulty(RaceManager::DIFFICULTY_EASY);
|
||||
RaceManager::get()->setReverseTrack(false);
|
||||
|
||||
// Use keyboard 0 by default (FIXME: let player choose?)
|
||||
InputDevice* device = input_manager->getDeviceManager()->getKeyboard(0);
|
||||
// Use the last used device
|
||||
InputDevice* device = input_manager->getDeviceManager()->getLatestUsedDevice();
|
||||
|
||||
// Create player and associate player with keyboard
|
||||
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
|
||||
device);
|
||||
// Create player and associate player with device
|
||||
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(), device);
|
||||
|
||||
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
|
||||
{
|
||||
@ -292,8 +291,7 @@ void MainMenuScreen::startTutorial()
|
||||
}
|
||||
RaceManager::get()->setPlayerKart(0, UserConfigParams::m_default_kart);
|
||||
|
||||
// ASSIGN should make sure that only input from assigned devices
|
||||
// is read.
|
||||
// ASSIGN should make sure that only input from assigned devices is read
|
||||
input_manager->getDeviceManager()->setAssignMode(ASSIGN);
|
||||
input_manager->getDeviceManager()
|
||||
->setSinglePlayer( StateManager::get()->getActivePlayer(0) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user