Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
GUIRenderer.h
Go to the documentation of this file.
1/* Copyright (C) 2022 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 INCLUDED_GUIRENDERER
19#define INCLUDED_GUIRENDERER
20
21#include "graphics/Color.h"
23#include "graphics/Texture.h"
24#include "maths/Rect.h"
25#include "ps/CStrForward.h"
26#include "ps/CStrIntern.h"
27
28#include <map>
29#include <vector>
30
31class CCanvas2D;
32class CGUI;
33class CGUISprite;
34struct CGUIColor;
35struct SGUIImage;
36
37namespace GUIRenderer
38{
39 struct SDrawCall
40 {
41 SDrawCall(const SGUIImage* image) : m_Image(image) {}
42 CRect ComputeTexCoords() const;
43
45
47
50
52
56 };
57
58 class DrawCalls : public std::vector<SDrawCall>
59 {
60 public:
61 DrawCalls();
62 // Copy/assignment results in an empty list, not an actual copy
63 DrawCalls(const DrawCalls&);
65 };
66
67 void UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const CStr8& SpriteName, const CRect& Size, std::map<CStr8, std::unique_ptr<const CGUISprite>>& Sprites);
68
69 void Draw(DrawCalls& Calls, CCanvas2D& canvas);
70}
71
72#endif // INCLUDED_GUIRENDERER
Definition: Canvas2D.h:36
The GUI sprite, is actually several real sprites (images) like a collage.
Definition: CGUISprite.h:113
The main object that represents a whole GUI page.
Definition: CGUI.h:61
Rectangle class used for screen rectangles.
Definition: Rect.h:31
Definition: GUIRenderer.h:59
DrawCalls()
Definition: GUIRenderer.cpp:37
DrawCalls & operator=(const DrawCalls &)
Definition: GUIRenderer.cpp:53
std::shared_ptr< CTexture > CTexturePtr
Definition: Texture.h:23
Definition: GUIRenderer.h:38
void Draw(DrawCalls &Calls, CCanvas2D &canvas)
Definition: GUIRenderer.cpp:314
void UpdateDrawCallCache(const CGUI &pGUI, DrawCalls &Calls, const CStr8 &SpriteName, const CRect &Size, std::map< CStr8, std::unique_ptr< const CGUISprite > > &Sprites)
Definition: Color.h:43
Same as the CColor class, but this one can also parse colors predefined in the GUI page (such as "yel...
Definition: CGUIColor.h:30
Definition: GUIRenderer.h:40
SDrawCall(const SGUIImage *image)
Definition: GUIRenderer.h:41
CRect m_Vertices
Definition: GUIRenderer.h:49
CTexturePtr m_Texture
Definition: GUIRenderer.h:46
CRect m_ObjectSize
Definition: GUIRenderer.h:48
float m_GrayscaleFactor
Definition: GUIRenderer.h:55
const SGUIImage * m_Image
Definition: GUIRenderer.h:44
CColor m_ColorAdd
Definition: GUIRenderer.h:53
CColor m_ColorMultiply
Definition: GUIRenderer.h:54
CGUIColor * m_BackColor
Definition: GUIRenderer.h:51
CRect ComputeTexCoords() const
Definition: GUIRenderer.cpp:257
A CGUISprite is actually a collage of several real sprites, this struct represents is such real sprit...
Definition: CGUISprite.h:52