45 lines
978 B
C++
45 lines
978 B
C++
#ifndef IGUIRenderer_h__
|
|||
|
|
#define IGUIRenderer_h__
|
||
|
|
|
||
|
|
#include "IImage.h"
|
||
|
|
#include "GUIVertex.h"
|
||
|
|
#include <LString.h>
|
||
|
|
#include <IMemoryStream.h>
|
||
|
|
#define MAX_DIP_COUNT 128
|
||
|
|
#define MAX_GUI_VERTEX_COUNT (6 * 4096)
|
||
|
|
|
||
|
|
namespace LifeGUI
|
||
|
|
{
|
||
|
|
struct GUIBatch
|
||
|
|
{
|
||
|
|
IImage* tex;
|
||
|
|
IImage* font;
|
||
|
|
bool lines;
|
||
|
|
int tex_id;
|
||
|
|
size_t vertex_count;
|
||
|
|
GUIBatch()
|
||
|
|
:tex(nullptr), font(nullptr), vertex_count(0)
|
||
|
|
{
|
||
|
|
lines = false;
|
||
|
|
tex_id = 0;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
class IGUIRenderer
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
IGUIRenderer();
|
||
|
|
void Reset();
|
||
|
|
void SetTexture(IImage* tex, IImage* font, bool line_geom);
|
||
|
|
void Write(const GUIVertex& data);
|
||
|
|
void Write(const GUIVertex* data, size_t count);
|
||
|
|
virtual void SetScissor(const LifeMath::Rect2i& rect) = 0;
|
||
|
|
virtual void Render() = 0;
|
||
|
|
virtual void SetScreenSize(int w, int h) = 0;
|
||
|
|
protected:
|
||
|
|
LifeCore::IMemoryStream* buffer;
|
||
|
|
LifeGUI::GUIBatch batch[MAX_DIP_COUNT];
|
||
|
|
size_t batch_id;
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif // IGUIRenderer_h__
|