Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/CGUISprite.h
Show First 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | |||||
#include "GUIRenderer.h" | #include "GUIRenderer.h" | ||||
// An instance of a sprite, usually stored in IGUIObjects - basically a string | // An instance of a sprite, usually stored in IGUIObjects - basically a string | ||||
// giving the sprite's name, but with some extra data to cache rendering | // giving the sprite's name, but with some extra data to cache rendering | ||||
// calculations between draw calls. | // calculations between draw calls. | ||||
class CGUISpriteInstance | class CGUISpriteInstance | ||||
{ | { | ||||
NONCOPYABLE(CGUISpriteInstance); | |||||
public: | public: | ||||
CGUISpriteInstance(); | CGUISpriteInstance(); | ||||
CGUISpriteInstance(const CStr& SpriteName); | CGUISpriteInstance(const CStr& SpriteName); | ||||
CGUISpriteInstance(const CGUISpriteInstance& Sprite); | |||||
CGUISpriteInstance& operator=(const CGUISpriteInstance&); | CGUISpriteInstance(CGUISpriteInstance&&) = default; | ||||
CGUISpriteInstance& operator=(const CStr& SpriteName); | CGUISpriteInstance& operator=(CGUISpriteInstance&&) = default; | ||||
void Draw(CRect Size, int CellID, std::map<CStr, CGUISprite*>& Sprites, float Z) const; | |||||
void Invalidate(); | void Draw(const CRect& Size, int CellID, std::map<CStr, CGUISprite*>& Sprites, float Z) const; | ||||
bool IsEmpty() const; | bool IsEmpty() const; | ||||
const CStr& GetName() { return m_SpriteName; } | const CStr& GetName() const { return m_SpriteName; } | ||||
void SetName(const CStr& SpriteName); | |||||
private: | private: | ||||
CStr m_SpriteName; | CStr m_SpriteName; | ||||
// Stored drawing calls, for more efficient rendering | // Stored drawing calls, for more efficient rendering | ||||
mutable GUIRenderer::DrawCalls m_DrawCallCache; | mutable GUIRenderer::DrawCalls m_DrawCallCache; | ||||
// Relevant details of previously rendered sprite; the cache is invalidated | // Relevant details of previously rendered sprite; the cache is invalidated | ||||
// whenever any of these values changes. | // whenever any of these values changes. | ||||
mutable CRect m_CachedSize; | mutable CRect m_CachedSize; | ||||
mutable int m_CachedCellID; | mutable int m_CachedCellID; | ||||
}; | }; | ||||
#endif // INCLUDED_CGUISPRITE | #endif // INCLUDED_CGUISPRITE |
Wildfire Games · Phabricator