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"?>
<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">
<placeholder width="100%" layout="horizontal-row" height="100%">
<!-- Content is added programmatically -->
</placeholder>
<model id="model" width="100%" layout="horizontal-row" height="100%">
</model>
</div>
<label text="0 to use the original color, otherwise pick one from slider."
width="100%" text_align="center" word_wrap="true"

View File

@ -32,7 +32,7 @@ using namespace GUIEngine;
// ----------------------------------------------------------------------------
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");
m_player_profile = pp;
@ -45,19 +45,13 @@ KartColorSliderDialog::KartColorSliderDialog(PlayerProfile* pp)
// ----------------------------------------------------------------------------
KartColorSliderDialog::~KartColorSliderDialog()
{
if (m_model_view->getIrrlichtElement() != NULL)
{
m_model_view->getIrrlichtElement()->remove();
}
} // ~KartColorSliderDialog
// ----------------------------------------------------------------------------
void KartColorSliderDialog::beforeAddingWidgets()
{
Widget* kart_screen = getWidget<Widget>("kart-screen");
m_model_view = new ModelViewWidget(
irr_driver->getActualScreenSize().Height > 1280 ||
irr_driver->getActualScreenSize().Width > 1280 ? 1024 : 512);
m_model_view = getWidget<ModelViewWidget>("model");
const KartProperties* props =
kart_properties_manager->getKart(UserConfigParams::m_default_kart);
@ -128,9 +122,6 @@ void KartColorSliderDialog::beforeAddingWidgets()
m_model_view->setRotateContinuously(35.0f);
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
// ----------------------------------------------------------------------------