2010-09-10 23:02:10 +02:00
|
|
|
/* Copyright (C) 2010 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/>.
|
|
|
|
*/
|
|
|
|
|
2006-04-24 01:14:18 +02:00
|
|
|
#ifndef GUIRenderer_h
|
|
|
|
#define GUIRenderer_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"
|
|
|
|
#include "ps/Overlay.h"
|
|
|
|
#include "ps/CStr.h"
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
struct SGUIImageEffects;
|
2010-09-10 23:02:10 +02:00
|
|
|
struct SGUIImage;
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
namespace GUIRenderer
|
|
|
|
{
|
|
|
|
class IGLState
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~IGLState() {};
|
2010-09-10 23:02:10 +02:00
|
|
|
virtual void Set(const CTexturePtr& tex)=0;
|
2006-04-24 01:14:18 +02:00
|
|
|
virtual void Unset()=0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SDrawCall
|
|
|
|
{
|
2010-09-10 23:02:10 +02:00
|
|
|
SDrawCall(const SGUIImage* image) : m_Image(image), m_Effects(NULL) {}
|
|
|
|
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;
|
|
|
|
int m_CellID;
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
bool m_EnableBlending;
|
|
|
|
|
|
|
|
IGLState* m_Effects;
|
|
|
|
|
|
|
|
CRect m_Vertices;
|
|
|
|
float m_DeltaZ;
|
|
|
|
|
|
|
|
CColor m_BorderColor; // == CColor() for no border
|
|
|
|
CColor m_BackColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DrawCalls : public std::vector<SDrawCall>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void clear();
|
|
|
|
DrawCalls();
|
2009-07-28 11:27:56 +02:00
|
|
|
~DrawCalls();
|
|
|
|
// Copy/assignment results in an empty list, not an actual copy
|
2006-04-24 01:14:18 +02:00
|
|
|
DrawCalls(const DrawCalls&);
|
2006-09-30 17:46:40 +02:00
|
|
|
const DrawCalls& operator=(const DrawCalls&);
|
2006-04-24 01:14:18 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "gui/CGUISprite.h"
|
|
|
|
|
|
|
|
namespace GUIRenderer
|
|
|
|
{
|
2009-07-28 18:59:19 +02:00
|
|
|
void UpdateDrawCallCache(DrawCalls &Calls, const CStr& SpriteName, const CRect& Size, int CellID, std::map<CStr, CGUISprite> &Sprites);
|
2006-04-24 01:14:18 +02:00
|
|
|
|
|
|
|
void Draw(DrawCalls &Calls);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // GUIRenderer_h
|