2004-06-03 20:38:14 +02:00
|
|
|
#include "precompiled.h"
|
2004-12-15 22:24:46 +01:00
|
|
|
#include "CGUISprite.h"
|
|
|
|
|
2004-12-18 14:32:00 +01:00
|
|
|
void CGUISpriteInstance::Draw(CRect Size, int CellID, std::map<CStr, CGUISprite> &Sprites)
|
2004-12-15 22:24:46 +01:00
|
|
|
{
|
2004-12-18 14:32:00 +01:00
|
|
|
if (m_CachedSize != Size || m_CachedCellID != CellID)
|
2004-12-15 22:24:46 +01:00
|
|
|
{
|
2004-12-18 14:32:00 +01:00
|
|
|
GUIRenderer::UpdateDrawCallCache(m_DrawCallCache, m_SpriteName, Size, CellID, Sprites);
|
2004-12-15 22:24:46 +01:00
|
|
|
m_CachedSize = Size;
|
2004-12-18 14:32:00 +01:00
|
|
|
m_CachedCellID = CellID;
|
2004-12-15 22:24:46 +01:00
|
|
|
}
|
|
|
|
GUIRenderer::Draw(m_DrawCallCache);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGUISpriteInstance::Invalidate()
|
|
|
|
{
|
|
|
|
m_CachedSize = CRect();
|
2005-10-30 00:50:54 +02:00
|
|
|
m_CachedCellID = -1;
|
2004-12-15 22:24:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CGUISpriteInstance::IsEmpty() const
|
|
|
|
{
|
|
|
|
return m_SpriteName=="";
|
2004-12-19 00:30:28 +01:00
|
|
|
}
|
2004-12-19 13:20:04 +01:00
|
|
|
|
|
|
|
// Plus a load of constructors / assignment operators, which don't copy the
|
|
|
|
// DrawCall cache (to avoid losing track of who has allocated various bits
|
|
|
|
// of data):
|
|
|
|
|
|
|
|
CGUISpriteInstance::CGUISpriteInstance()
|
2005-10-30 00:50:54 +02:00
|
|
|
: m_CachedCellID(-1)
|
2004-12-19 13:20:04 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CGUISpriteInstance::CGUISpriteInstance(CStr SpriteName)
|
|
|
|
: m_SpriteName(SpriteName)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CGUISpriteInstance::CGUISpriteInstance(const CGUISpriteInstance &Sprite)
|
|
|
|
: m_SpriteName(Sprite.m_SpriteName)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CGUISpriteInstance &CGUISpriteInstance::operator=(CStr SpriteName)
|
|
|
|
{
|
|
|
|
m_SpriteName = SpriteName;
|
|
|
|
m_DrawCallCache.clear();
|
|
|
|
Invalidate();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|