2021-03-27 12:38:34 +01:00
|
|
|
/* Copyright (C) 2021 Wildfire Games.
|
2009-04-18 19:00:33 +02:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
*
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-08-21 19:08:41 +02:00
|
|
|
#ifndef INCLUDED_GUIRENDERER
|
|
|
|
#define INCLUDED_GUIRENDERER
|
2006-04-24 01:14:18 +02:00
|
|
|
|
2020-11-21 12:20:29 +01:00
|
|
|
#include "graphics/Color.h"
|
|
|
|
#include "graphics/ShaderTechniquePtr.h"
|
2010-09-10 23:02:10 +02:00
|
|
|
#include "graphics/Texture.h"
|
2006-04-24 01:14:18 +02:00
|
|
|
#include "lib/res/handle.h"
|
2021-03-30 23:14:36 +02:00
|
|
|
#include "maths/Rect.h"
|
2015-08-21 19:08:41 +02:00
|
|
|
|
2019-09-20 15:11:18 +02:00
|
|
|
#include <map>
|
2006-04-24 01:14:18 +02:00
|
|
|
#include <vector>
|
|
|
|
|
2020-11-21 12:20:29 +01:00
|
|
|
class CGUI;
|
2019-08-20 12:51:29 +02:00
|
|
|
class CGUISprite;
|
2020-11-21 12:20:29 +01:00
|
|
|
class CStr8;
|
|
|
|
struct CGUIColor;
|
2010-09-10 23:02:10 +02:00
|
|
|
struct SGUIImage;
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
namespace GUIRenderer
|
|
|
|
{
|
|
|
|
struct SDrawCall
|
|
|
|
{
|
2012-02-08 21:43:38 +01:00
|
|
|
SDrawCall(const SGUIImage* image) : m_Image(image) {}
|
2010-09-10 23:02:10 +02:00
|
|
|
CRect ComputeTexCoords() const;
|
2006-04-24 01:14:18 +02:00
|
|
|
|
2010-09-10 23:02:10 +02:00
|
|
|
const SGUIImage* m_Image;
|
|
|
|
|
|
|
|
bool m_HasTexture;
|
|
|
|
CTexturePtr m_Texture;
|
|
|
|
|
|
|
|
CRect m_ObjectSize;
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
bool m_EnableBlending;
|
|
|
|
|
2012-02-08 21:43:38 +01:00
|
|
|
CShaderTechniquePtr m_Shader;
|
|
|
|
CColor m_ShaderColorParameter;
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
CRect m_Vertices;
|
|
|
|
|
Stop copying color every draw call for every GUI object using colors.
Avoid color copies for rendering Draw calls in
GUIRenderer::UpdateDrawCallCache, CButton::Draw, CChart::DrawAxes,
CDropDown::Draw, CList::DrawList, COList::DrawList, refs #1984,
8f4f8e240f, 3028551b91, a905fbbc98.
Avoid color copies during XML loading in CGUI::Xeromyces_ReadImage,
CGUI::Xeromyces_ReadEffects, COList::HandleAdditionalChildren.
Add CGUI::HasPreDefinedColor and mark m_PreDefinedColors,
CGUI::GetPreDefinedColor, IGUIButtonBehavior::ChooseColor() as const for
consistency with the other "databases", refs 3028551b91.
Mark CGUIColor as NONCOPYABLE to add compiler errors if there is an
unexplicit copy, refs 3028551b91.
Explicit ugly copy in CGUI::Xeromyces_ReadColor and
CGUIColor::ParseString.
Deregister copying <CGUIColor>GetSetting functions, refs 8f4f8e240f.
Uses the const ref GetSetting from 3dfa23cd25.
This was SVN commit r22694.
2019-08-19 14:53:58 +02:00
|
|
|
CGUIColor* m_BackColor;
|
2006-04-24 01:14:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawCalls : public std::vector<SDrawCall>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DrawCalls();
|
2009-07-28 11:27:56 +02:00
|
|
|
// Copy/assignment results in an empty list, not an actual copy
|
2006-04-24 01:14:18 +02:00
|
|
|
DrawCalls(const DrawCalls&);
|
2013-05-23 00:04:58 +02:00
|
|
|
DrawCalls& operator=(const DrawCalls&);
|
2006-04-24 01:14:18 +02:00
|
|
|
};
|
|
|
|
|
2021-03-27 12:38:34 +01:00
|
|
|
void UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const CStr8& SpriteName, const CRect& Size, std::map<CStr8, const CGUISprite*>& Sprites);
|
2006-04-24 01:14:18 +02:00
|
|
|
|
2021-05-22 20:06:18 +02:00
|
|
|
void Draw(DrawCalls& Calls);
|
2006-04-24 01:14:18 +02:00
|
|
|
}
|
|
|
|
|
2015-08-21 19:08:41 +02:00
|
|
|
#endif // INCLUDED_GUIRENDERER
|