Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/ObjectTypes/CSlider.cpp
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | void CSlider::HandleMessage(SGUIMessage& Message) | ||||
} | } | ||||
} | } | ||||
void CSlider::Draw() | void CSlider::Draw() | ||||
{ | { | ||||
CRect slider_line(m_CachedActualSize); | CRect slider_line(m_CachedActualSize); | ||||
slider_line.left += m_ButtonSide / 2.0f; | slider_line.left += m_ButtonSide / 2.0f; | ||||
slider_line.right -= m_ButtonSide / 2.0f; | slider_line.right -= m_ButtonSide / 2.0f; | ||||
float bz = GetBufferedZ(); | m_pGUI.DrawSprite(m_SpriteBar, slider_line); | ||||
m_pGUI.DrawSprite(m_SpriteBar, bz, slider_line); | m_pGUI.DrawSprite(m_Sprite, GetButtonRect()); | ||||
m_pGUI.DrawSprite(m_Sprite, bz, GetButtonRect()); | |||||
} | } | ||||
void CSlider::UpdateValue() | void CSlider::UpdateValue() | ||||
{ | { | ||||
ScriptEvent(EventNameValueChange); | ScriptEvent(EventNameValueChange); | ||||
} | } | ||||
CRect CSlider::GetButtonRect() const | CRect CSlider::GetButtonRect() const | ||||
{ | { | ||||
float ratio = m_MaxValue > m_MinValue ? (m_Value - m_MinValue) / (m_MaxValue - m_MinValue) : 0.0f; | float ratio = m_MaxValue > m_MinValue ? (m_Value - m_MinValue) / (m_MaxValue - m_MinValue) : 0.0f; | ||||
float x = m_CachedActualSize.left + ratio * (m_CachedActualSize.GetWidth() - m_ButtonSide); | float x = m_CachedActualSize.left + ratio * (m_CachedActualSize.GetWidth() - m_ButtonSide); | ||||
float y = m_CachedActualSize.top + (m_CachedActualSize.GetHeight() - m_ButtonSide) / 2.0; | float y = m_CachedActualSize.top + (m_CachedActualSize.GetHeight() - m_ButtonSide) / 2.0; | ||||
return CRect(x, y, x + m_ButtonSide, y + m_ButtonSide); | return CRect(x, y, x + m_ButtonSide, y + m_ButtonSide); | ||||
} | } |
Wildfire Games · Phabricator