Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GUIRenderer.h
Go to the documentation of this file.
1 /* Copyright (C) 2013 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 #ifndef GUIRenderer_h
19 #define GUIRenderer_h
20 
22 #include "graphics/Texture.h"
23 #include "lib/res/handle.h"
24 #include "ps/Overlay.h"
25 #include "ps/CStr.h"
26 #include <vector>
27 
28 struct SGUIImageEffects;
29 struct SGUIImage;
30 
31 namespace GUIRenderer
32 {
33  class IGLState
34  {
35  public:
36  virtual ~IGLState() {};
37  virtual void Set(const CTexturePtr& tex)=0;
38  virtual void Unset()=0;
39  };
40 
41  struct SDrawCall
42  {
43  SDrawCall(const SGUIImage* image) : m_Image(image) {}
44  CRect ComputeTexCoords() const;
45 
47 
50 
52  int m_CellID;
53 
55 
58 
60  float m_DeltaZ;
61 
62  CColor m_BorderColor; // == CColor() for no border
64  };
65 
66  class DrawCalls : public std::vector<SDrawCall>
67  {
68  public:
69  DrawCalls();
70  // Copy/assignment results in an empty list, not an actual copy
71  DrawCalls(const DrawCalls&);
72  DrawCalls& operator=(const DrawCalls&);
73  };
74 }
75 
76 #include "gui/CGUISprite.h"
77 
78 namespace GUIRenderer
79 {
80  void UpdateDrawCallCache(DrawCalls &Calls, const CStr& SpriteName, const CRect& Size, int CellID, std::map<CStr, CGUISprite> &Sprites);
81 
82  void Draw(DrawCalls &Calls, float Z);
83 }
84 
85 #endif // GUIRenderer_h
CRect ComputeTexCoords() const
CTexturePtr m_Texture
Definition: GUIRenderer.h:49
Definition: Overlay.h:34
virtual void Set(const CTexturePtr &tex)=0
shared_ptr< CShaderTechnique > CShaderTechniquePtr
virtual void Unset()=0
DrawCalls & operator=(const DrawCalls &)
Definition: GUIRenderer.cpp:53
void UpdateDrawCallCache(DrawCalls &Calls, const CStr &SpriteName, const CRect &Size, int CellID, std::map< CStr, CGUISprite > &Sprites)
Definition: GUIRenderer.cpp:59
A CGUISprite is actually a collage of several real sprites, this struct represents is such real sprit...
Definition: CGUISprite.h:77
Definition: Decompose.h:22
SDrawCall(const SGUIImage *image)
Definition: GUIRenderer.h:43
void Draw(DrawCalls &Calls, float Z)
const SGUIImage * m_Image
Definition: GUIRenderer.h:46
CShaderTechniquePtr m_Shader
Definition: GUIRenderer.h:56
Rectangle class used for screen rectangles.
Definition: Overlay.h:71
shared_ptr< CTexture > CTexturePtr
Definition: Texture.h:22