void Button::SetPosition(const sf::Vector2f& pos){ mButtonArea->left = pos.x; mButtonArea->top = pos.y; mUnselectedSprite->setPosition(pos); mSelectedSprite->setPosition(pos); CalculateTextPosition(); };
void CButton::SetupText() { if (!GetGUI()) return; ENSURE(m_GeneratedTexts.size()==1); CStrW font; if (GUI<CStrW>::GetSetting(this, "font", font) != PSRETURN_OK || font.empty()) // Use the default if none is specified // TODO Gee: (2004-08-14) Default should not be hard-coded, but be in styles! font = L"default"; CGUIString caption; GUI<CGUIString>::GetSetting(this, "caption", caption); float buffer_zone=0.f; GUI<float>::GetSetting(this, "buffer_zone", buffer_zone); *m_GeneratedTexts[0] = GetGUI()->GenerateText(caption, font, m_CachedActualSize.GetWidth(), buffer_zone, this); CalculateTextPosition(m_CachedActualSize, m_TextPos, *m_GeneratedTexts[0]); }
void Button::SetTextParameters(){ CalculateTextSize(); CalculateTextPosition(); };