Add resizing code for kart selection
This commit is contained in:
parent
0266b03809
commit
3a0a2eaf97
@ -542,6 +542,19 @@ void PlayerKartWidget::onUpdate(float delta)
|
||||
if (m_h < target_h) m_h = target_h;
|
||||
}
|
||||
|
||||
updateSize();
|
||||
// When coming from the overworld, we must rebuild the preview scene at
|
||||
// least once, since the scene is being cleared by leaving the overworld
|
||||
if (m_not_updated_yet)
|
||||
{
|
||||
m_model_view->clearRttProvider();
|
||||
m_not_updated_yet = false;
|
||||
}
|
||||
} // onUpdate
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
void PlayerKartWidget::updateSize()
|
||||
{
|
||||
setSize(m_x, m_y, m_w, m_h);
|
||||
|
||||
if (m_player_ident_spinner != NULL)
|
||||
@ -580,15 +593,7 @@ void PlayerKartWidget::onUpdate(float delta)
|
||||
kart_name_y,
|
||||
kart_name_w,
|
||||
kart_name_h);
|
||||
|
||||
// When coming from the overworld, we must rebuild the preview scene at
|
||||
// least once, since the scene is being cleared by leaving the overworld
|
||||
if (m_not_updated_yet)
|
||||
{
|
||||
m_model_view->clearRttProvider();
|
||||
m_not_updated_yet = false;
|
||||
}
|
||||
} // onUpdate
|
||||
} // updateSize
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
/** Event callback */
|
||||
|
@ -72,6 +72,8 @@ namespace GUIEngine
|
||||
long m_magic_number;
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
void updateSize();
|
||||
public:
|
||||
|
||||
LEAK_CHECK()
|
||||
@ -166,6 +168,15 @@ namespace GUIEngine
|
||||
virtual GUIEngine::EventPropagation onSpinnerConfirmed();
|
||||
// -------------------------------------------------------------------------
|
||||
void enableHandicapForNetwork();
|
||||
// -------------------------------------------------------------------------
|
||||
void updateSizeNow(int x, int y, int w, int h)
|
||||
{
|
||||
target_x = m_x = x;
|
||||
target_y = m_y = y;
|
||||
target_w = m_w = w;
|
||||
target_h = m_h = h;
|
||||
updateSize();
|
||||
}
|
||||
}; // PlayerKartWidget
|
||||
}
|
||||
|
||||
|
@ -1639,3 +1639,34 @@ bool KartSelectionScreen::useContinueButton() const
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void KartSelectionScreen::onResize()
|
||||
{
|
||||
// Remove dispatcher from m_widgets before calculateLayout otherwise a
|
||||
// dummy button is shown in kart screen
|
||||
bool removed_dispatcher = false;
|
||||
if (m_widgets.contains(m_dispatcher))
|
||||
{
|
||||
m_widgets.remove(m_dispatcher);
|
||||
removed_dispatcher = true;
|
||||
}
|
||||
Screen::onResize();
|
||||
if (removed_dispatcher)
|
||||
m_widgets.push_back(m_dispatcher);
|
||||
if (m_multiplayer)
|
||||
{
|
||||
if (m_kart_widgets.size() < 2)
|
||||
addMultiplayerMessage();
|
||||
if (m_kart_widgets.empty())
|
||||
return;
|
||||
}
|
||||
Widget* fullarea = getWidget("playerskarts");
|
||||
int split_width = fullarea->m_w / m_kart_widgets.size();
|
||||
if (m_multiplayer && m_kart_widgets.size() == 1)
|
||||
split_width /= 2;
|
||||
for (unsigned i = 0; i < m_kart_widgets.size(); i++)
|
||||
{
|
||||
m_kart_widgets[i].updateSizeNow(fullarea->m_x + split_width * i,
|
||||
fullarea->m_y, split_width, fullarea->m_h);
|
||||
}
|
||||
} // onResize
|
||||
|
@ -180,6 +180,8 @@ public:
|
||||
* class GUIEngine::Screen */
|
||||
virtual bool onEscapePressed() OVERRIDE;
|
||||
|
||||
virtual void onResize() OVERRIDE;
|
||||
|
||||
}; // KartSelectionScreen
|
||||
|
||||
//!----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user