1
0
forked from 0ad/0ad
0ad/source/gui/CGUISprite.cpp
Ykkrosh ba0ebd6644 Renamed icon-size/icon-id to cell-size/cell-id, and allowed cell-id to be used in <icon>s.
Added <effect>s to sprites/images - currently multiply-color and
add-color, though they're far from perfect.

This was SVN commit r1525.
2004-12-18 13:32:00 +00:00

39 lines
787 B
C++
Executable File

#include "precompiled.h"
#include "CGUISprite.h"
CGUISpriteInstance::CGUISpriteInstance()
{
}
CGUISpriteInstance::CGUISpriteInstance(CStr SpriteName)
: m_SpriteName(SpriteName)
{
}
CGUISpriteInstance &CGUISpriteInstance::operator=(CStr SpriteName)
{
m_SpriteName = SpriteName;
Invalidate();
return *this;
}
void CGUISpriteInstance::Draw(CRect Size, int CellID, std::map<CStr, CGUISprite> &Sprites)
{
if (m_CachedSize != Size || m_CachedCellID != CellID)
{
GUIRenderer::UpdateDrawCallCache(m_DrawCallCache, m_SpriteName, Size, CellID, Sprites);
m_CachedSize = Size;
m_CachedCellID = CellID;
}
GUIRenderer::Draw(m_DrawCallCache);
}
void CGUISpriteInstance::Invalidate()
{
m_CachedSize = CRect();
}
bool CGUISpriteInstance::IsEmpty() const
{
return m_SpriteName=="";
}