Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CGUISprite.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2009 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "precompiled.h"
19 #include "CGUISprite.h"
20 
21 void CGUISpriteInstance::Draw(CRect Size, int CellID, std::map<CStr, CGUISprite> &Sprites, float Z) const
22 {
23  if (m_CachedSize != Size || m_CachedCellID != CellID)
24  {
26  m_CachedSize = Size;
27  m_CachedCellID = CellID;
28  }
30 }
31 
33 {
34  m_CachedSize = CRect();
35  m_CachedCellID = -1;
36 }
37 
39 {
40  return m_SpriteName=="";
41 }
42 
43 // Plus a load of constructors / assignment operators, which don't copy the
44 // DrawCall cache (to avoid losing track of who has allocated various bits
45 // of data):
46 
48  : m_CachedCellID(-1)
49 {
50 }
51 
53  : m_SpriteName(SpriteName), m_CachedCellID(-1)
54 {
55 }
56 
58  : m_SpriteName(Sprite.m_SpriteName), m_CachedCellID(-1)
59 {
60 }
61 
63 {
64  m_SpriteName = SpriteName;
65  m_DrawCallCache.clear();
66  Invalidate();
67  return *this;
68 }
69 
void UpdateDrawCallCache(DrawCalls &Calls, const CStr &SpriteName, const CRect &Size, int CellID, std::map< CStr, CGUISprite > &Sprites)
Definition: GUIRenderer.cpp:59
bool IsEmpty() const
Definition: CGUISprite.cpp:38
Definition: Decompose.h:22
void Draw(DrawCalls &Calls, float Z)
CGUISpriteInstance & operator=(const CStr &SpriteName)
Definition: CGUISprite.cpp:62
void Draw(CRect Size, int CellID, std::map< CStr, CGUISprite > &Sprites, float Z) const
Definition: CGUISprite.cpp:21
Rectangle class used for screen rectangles.
Definition: Overlay.h:71
GUIRenderer::DrawCalls m_DrawCallCache
Definition: CGUISprite.h:188