Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/CProgressBar.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | case GUIM_SETTINGS_UPDATED: | ||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
void CProgressBar::Draw() | void CProgressBar::Draw() | ||||
{ | { | ||||
CGUISpriteInstance& sprite_bar = GUI<CGUISpriteInstance>::GetSetting(this, "sprite_bar"); | |||||
CGUISpriteInstance& sprite_background = GUI<CGUISpriteInstance>::GetSetting(this, "sprite_background"); | |||||
float bz = GetBufferedZ(); | float bz = GetBufferedZ(); | ||||
CGUISpriteInstance* sprite_background; | |||||
CGUISpriteInstance* sprite_bar; | |||||
int cell_id = 0; | int cell_id = 0; | ||||
float value = 0; | float value = 0; | ||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite_background", sprite_background); | |||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite_bar", sprite_bar); | |||||
GUI<float>::GetSetting(this, "caption", value); | GUI<float>::GetSetting(this, "caption", value); | ||||
GetGUI()->DrawSprite(*sprite_background, cell_id, bz, m_CachedActualSize); | m_pGUI->DrawSprite(sprite_background, cell_id, bz, m_CachedActualSize); | ||||
// Get size of bar (notice it is drawn slightly closer, to appear above the background) | // Get size of bar (notice it is drawn slightly closer, to appear above the background) | ||||
CRect bar_size(m_CachedActualSize.left, m_CachedActualSize.top, | CRect bar_size(m_CachedActualSize.left, m_CachedActualSize.top, | ||||
m_CachedActualSize.left+m_CachedActualSize.GetWidth()*(value/100.f), m_CachedActualSize.bottom); | m_CachedActualSize.left+m_CachedActualSize.GetWidth()*(value/100.f), m_CachedActualSize.bottom); | ||||
GetGUI()->DrawSprite(*sprite_bar, cell_id, bz+0.01f, bar_size); | m_pGUI->DrawSprite(sprite_bar, cell_id, bz+0.01f, bar_size); | ||||
} | } |
Wildfire Games · Phabricator