Improve kart color selection screen, fixes #3122

This commit is contained in:
auria.mg 2018-02-12 20:08:51 -05:00
parent 4cc57dd754
commit 2830dabfc1
2 changed files with 5 additions and 15 deletions

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<stkgui> <stkgui>
<div x="2%" y="10%" width="96%" height="70%" layout="vertical-row"> <div x="2%" y="5%" width="96%" height="90%" layout="vertical-row">
<div id="kart-screen" layout="horizontal-row" width="100%" height="60%" proportion="10" align="center"> <div id="kart-screen" layout="horizontal-row" width="100%" height="60%" proportion="10" align="center">
<placeholder width="100%" layout="horizontal-row" height="100%"> <model id="model" width="100%" layout="horizontal-row" height="100%">
<!-- Content is added programmatically --> </model>
</placeholder>
</div> </div>
<label text="0 to use the original color, otherwise pick one from slider." <label text="0 to use the original color, otherwise pick one from slider."
width="100%" text_align="center" word_wrap="true" width="100%" text_align="center" word_wrap="true"

View File

@ -32,7 +32,7 @@ using namespace GUIEngine;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
KartColorSliderDialog::KartColorSliderDialog(PlayerProfile* pp) KartColorSliderDialog::KartColorSliderDialog(PlayerProfile* pp)
: ModalDialog(0.75f, 0.75f, MODAL_DIALOG_LOCATION_BOTTOM) : ModalDialog(0.75f, 0.75f, MODAL_DIALOG_LOCATION_CENTER)
{ {
loadFromFile("kart_color_slider.stkgui"); loadFromFile("kart_color_slider.stkgui");
m_player_profile = pp; m_player_profile = pp;
@ -45,19 +45,13 @@ KartColorSliderDialog::KartColorSliderDialog(PlayerProfile* pp)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
KartColorSliderDialog::~KartColorSliderDialog() KartColorSliderDialog::~KartColorSliderDialog()
{ {
if (m_model_view->getIrrlichtElement() != NULL)
{
m_model_view->getIrrlichtElement()->remove();
}
} // ~KartColorSliderDialog } // ~KartColorSliderDialog
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void KartColorSliderDialog::beforeAddingWidgets() void KartColorSliderDialog::beforeAddingWidgets()
{ {
Widget* kart_screen = getWidget<Widget>("kart-screen"); Widget* kart_screen = getWidget<Widget>("kart-screen");
m_model_view = new ModelViewWidget( m_model_view = getWidget<ModelViewWidget>("model");
irr_driver->getActualScreenSize().Height > 1280 ||
irr_driver->getActualScreenSize().Width > 1280 ? 1024 : 512);
const KartProperties* props = const KartProperties* props =
kart_properties_manager->getKart(UserConfigParams::m_default_kart); kart_properties_manager->getKart(UserConfigParams::m_default_kart);
@ -128,9 +122,6 @@ void KartColorSliderDialog::beforeAddingWidgets()
m_model_view->setRotateContinuously(35.0f); m_model_view->setRotateContinuously(35.0f);
m_model_view->update(0); m_model_view->update(0);
kart_screen->getChildren().push_back(m_model_view);
m_model_view->move(kart_screen->m_w / 2, kart_screen->m_h / 2,
kart_screen->m_w / 2, kart_screen->m_w / 2);
} // beforeAddingWidgets } // beforeAddingWidgets
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------