Add resizing code for networking lobby
This commit is contained in:
parent
f6949972b3
commit
18094c505a
@ -117,7 +117,8 @@ namespace GUIEngine
|
||||
void setScrollSpeed(float speed);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
float getScrollSpeed() const { return m_scroll_speed; }
|
||||
// --------------------------------------------------------------------
|
||||
/**
|
||||
* \brief Check if the current has been fully scrolled
|
||||
* \return true if the text has completely scrolled off
|
||||
|
@ -422,6 +422,34 @@ break_glyph_layouts:
|
||||
#endif
|
||||
} // addMoreServerInfo
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void NetworkingLobby::onResize()
|
||||
{
|
||||
Screen::onResize();
|
||||
const unsigned box_width = m_text_bubble->getDimension().Width;
|
||||
const float box_height = m_text_bubble->getDimension().Height;
|
||||
gui::IGUIFont* font = GUIEngine::getFont();
|
||||
gui::breakGlyphLayouts(m_server_info, box_width,
|
||||
font->getInverseShaping(), font->getScale());
|
||||
gui::eraseTopLargerThan(m_server_info, font->getHeightPerLine(),
|
||||
box_height);
|
||||
updateServerInfos();
|
||||
|
||||
int header_text_width =
|
||||
GUIEngine::getTitleFont()->getDimension(m_header_text.c_str()).Width;
|
||||
if ((m_header->m_w < header_text_width && m_header->getScrollSpeed() == 0.0f) ||
|
||||
(m_header->m_w >= header_text_width && m_header->getScrollSpeed() != 0.0f))
|
||||
{
|
||||
m_header->getIrrlichtElement()->remove();
|
||||
GUIEngine::getGUIEnv()->setChildEnd(m_back_widget->getIrrlichtElement());
|
||||
m_header->setScrollSpeed(m_header->m_w < header_text_width ? 0.5f: 0.0f);
|
||||
m_header->add();
|
||||
m_header->setText(m_header_text, true);
|
||||
GUIEngine::getGUIEnv()->setChildEnd(NULL);
|
||||
}
|
||||
m_header_text_width = header_text_width;
|
||||
} // onResize
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void NetworkingLobby::updateServerInfos()
|
||||
{
|
||||
|
@ -149,6 +149,7 @@ public:
|
||||
void reloadServerInfos() { m_reload_server_info = true; }
|
||||
void setHeader(const core::stringw& header) { m_header_text = header; }
|
||||
void setAssignedPlayers(bool val) { m_assigned_players = val; }
|
||||
virtual void onResize() OVERRIDE;
|
||||
}; // class NetworkingLobby
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user