reorganize files and add btgui
This commit is contained in:
74
btgui/Gwen/Renderers/DirectX9.h
Normal file
74
btgui/Gwen/Renderers/DirectX9.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
GWEN
|
||||
Copyright (c) 2010 Facepunch Studios
|
||||
See license in Gwen.h
|
||||
*/
|
||||
|
||||
#ifndef GWEN_RENDERERS_DIRECTX9_H
|
||||
#define GWEN_RENDERERS_DIRECTX9_H
|
||||
#include "Gwen/Gwen.h"
|
||||
#include "Gwen/BaseRender.h"
|
||||
|
||||
struct VERTEXFORMAT2D
|
||||
{
|
||||
FLOAT x, y, z, rhw;
|
||||
DWORD color;
|
||||
float u, v;
|
||||
};
|
||||
|
||||
#define D3DFVF_VERTEXFORMAT2D ( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1 )
|
||||
|
||||
namespace Gwen
|
||||
{
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
class GWEN_EXPORT DirectX9 : public Gwen::Renderer::Base
|
||||
{
|
||||
public:
|
||||
|
||||
DirectX9( IDirect3DDevice9* pDevice );
|
||||
~DirectX9();
|
||||
|
||||
virtual void Begin();
|
||||
virtual void End();
|
||||
virtual void Release();
|
||||
|
||||
virtual void SetDrawColor(Gwen::Color color);
|
||||
|
||||
virtual void DrawLine( int x, int y, int a, int b );
|
||||
virtual void DrawFilledRect( Gwen::Rect rect );
|
||||
|
||||
virtual void LoadFont( Gwen::Font* pFont );
|
||||
virtual void FreeFont( Gwen::Font* pFont );
|
||||
virtual void RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text );
|
||||
virtual Gwen::Point MeasureText( Gwen::Font* pFont, const Gwen::UnicodeString& text );
|
||||
|
||||
void StartClip();
|
||||
void EndClip();
|
||||
|
||||
void DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect pTargetRect, float u1=0.0f, float v1=0.0f, float u2=1.0f, float v2=1.0f );
|
||||
void LoadTexture( Gwen::Texture* pTexture );
|
||||
void FreeTexture( Gwen::Texture* pTexture );
|
||||
|
||||
protected:
|
||||
|
||||
void* m_pCurrentTexture;
|
||||
IDirect3DDevice9* m_pDevice;
|
||||
DWORD m_Color;
|
||||
|
||||
void Flush();
|
||||
void AddVert( int x, int y );
|
||||
void AddVert( int x, int y, float u, float v );
|
||||
|
||||
static const int MaxVerts = 1024;
|
||||
VERTEXFORMAT2D m_pVerts[MaxVerts];
|
||||
int m_iVertNum;
|
||||
|
||||
Gwen::Font::List m_FontList;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
265
btgui/Gwen/Renderers/FontData.h
Normal file
265
btgui/Gwen/Renderers/FontData.h
Normal file
File diff suppressed because one or more lines are too long
95
btgui/Gwen/Renderers/GDIPlus.h
Normal file
95
btgui/Gwen/Renderers/GDIPlus.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
GWEN
|
||||
Copyright (c) 2011 Facepunch Studios
|
||||
See license in Gwen.h
|
||||
*/
|
||||
|
||||
#ifndef GWEN_RENDERERS_GDIPLUS_H
|
||||
#define GWEN_RENDERERS_GDIPLUS_H
|
||||
|
||||
#include "Gwen/Gwen.h"
|
||||
#include "Gwen/BaseRender.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
GDI(plus) is pretty slow for rendering GWEN, because we're
|
||||
re-rendering everything on redraw.
|
||||
|
||||
Therefore its usage should be as a test - rather than production.
|
||||
|
||||
// Note: For this to work you should be including
|
||||
|
||||
#include <gdiplus.h>
|
||||
|
||||
// Which we don't do in the header, for the sake of usability
|
||||
|
||||
*/
|
||||
|
||||
namespace Gwen
|
||||
{
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
class GDIPlus : public Gwen::Renderer::Base
|
||||
{
|
||||
public:
|
||||
|
||||
GDIPlus( HWND pHWND );
|
||||
~GDIPlus();
|
||||
|
||||
virtual void Begin();
|
||||
virtual void End();
|
||||
|
||||
virtual void SetDrawColor(Gwen::Color color);
|
||||
|
||||
virtual void DrawLine( int x, int y, int a, int b );
|
||||
virtual void DrawFilledRect( Gwen::Rect rect );
|
||||
|
||||
virtual void LoadFont( Gwen::Font* pFont );
|
||||
virtual void FreeFont( Gwen::Font* pFont );
|
||||
virtual void RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text );
|
||||
virtual Gwen::Point MeasureText( Gwen::Font* pFont, const Gwen::UnicodeString& text );
|
||||
|
||||
void StartClip();
|
||||
void EndClip();
|
||||
|
||||
void DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect pTargetRect, float u1=0.0f, float v1=0.0f, float u2=1.0f, float v2=1.0f );
|
||||
void LoadTexture( Gwen::Texture* pTexture );
|
||||
void FreeTexture( Gwen::Texture* pTexture );
|
||||
|
||||
protected:
|
||||
|
||||
int m_iWidth;
|
||||
int m_iHeight;
|
||||
|
||||
Gdiplus::Color m_Colour;
|
||||
|
||||
HWND m_HWND;
|
||||
HDC m_hDC;
|
||||
ULONG_PTR m_gdiplusToken;
|
||||
|
||||
Gdiplus::Graphics* graphics;
|
||||
};
|
||||
|
||||
class GDIPlusBuffered : public GDIPlus
|
||||
{
|
||||
public:
|
||||
|
||||
GDIPlusBuffered( HWND pHWND );
|
||||
~GDIPlusBuffered();
|
||||
|
||||
virtual void Begin();
|
||||
virtual void End();
|
||||
|
||||
private:
|
||||
|
||||
void CreateBackbuffer();
|
||||
void DestroyBackbuffer();
|
||||
|
||||
Gdiplus::Bitmap* m_Bitmap;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
60
btgui/Gwen/Renderers/OpenGL.h
Normal file
60
btgui/Gwen/Renderers/OpenGL.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
GWEN
|
||||
Copyright (c) 2011 Facepunch Studios
|
||||
See license in Gwen.h
|
||||
*/
|
||||
|
||||
#ifndef GWEN_RENDERERS_OPENGL_H
|
||||
#define GWEN_RENDERERS_OPENGL_H
|
||||
|
||||
#include "Gwen/Gwen.h"
|
||||
#include "Gwen/BaseRender.h"
|
||||
|
||||
namespace Gwen
|
||||
{
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
class OpenGL : public Gwen::Renderer::Base
|
||||
{
|
||||
public:
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
float x, y, z;
|
||||
float u, v;
|
||||
unsigned char r, g, b, a;
|
||||
};
|
||||
|
||||
OpenGL();
|
||||
~OpenGL();
|
||||
|
||||
virtual void Begin();
|
||||
virtual void End();
|
||||
|
||||
virtual void SetDrawColor( Gwen::Color color );
|
||||
virtual void DrawFilledRect( Gwen::Rect rect );
|
||||
|
||||
void StartClip();
|
||||
void EndClip();
|
||||
|
||||
void DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect pTargetRect, float u1=0.0f, float v1=0.0f, float u2=1.0f, float v2=1.0f );
|
||||
void LoadTexture( Gwen::Texture* pTexture );
|
||||
void FreeTexture( Gwen::Texture* pTexture );
|
||||
|
||||
protected:
|
||||
|
||||
static const int MaxVerts = 1024;
|
||||
|
||||
|
||||
void Flush();
|
||||
void AddVert( int x, int y, float u = 0.0f , float v = 0.0f );
|
||||
|
||||
Gwen::Color m_Color;
|
||||
int m_iVertNum;
|
||||
Vertex m_Vertices[ MaxVerts ];
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
72
btgui/Gwen/Renderers/OpenGL_DebugFont.h
Normal file
72
btgui/Gwen/Renderers/OpenGL_DebugFont.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
GWEN
|
||||
Copyright (c) 2011 Facepunch Studios
|
||||
See license in Gwen.h
|
||||
*/
|
||||
|
||||
#ifndef GWEN_RENDERERS_OPENGL_DEBUGFONT_H
|
||||
#define GWEN_RENDERERS_OPENGL_DEBUGFONT_H
|
||||
|
||||
#include "Gwen/Gwen.h"
|
||||
#include "Gwen/Renderers/OpenGL.h"
|
||||
|
||||
void restoreOpenGLState();
|
||||
void saveOpenGLState(int screenWidth, int screenHeight);
|
||||
|
||||
|
||||
namespace Gwen
|
||||
{
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
class OpenGL_DebugFont : public Gwen::Renderer::Base
|
||||
{
|
||||
public:
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
float x, y, z;
|
||||
float u, v;
|
||||
unsigned char r, g, b, a;
|
||||
};
|
||||
|
||||
|
||||
static const int MaxVerts = 1024;
|
||||
|
||||
OpenGL_DebugFont();
|
||||
~OpenGL_DebugFont();
|
||||
|
||||
void RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text );
|
||||
Gwen::Point MeasureText( Gwen::Font* pFont, const Gwen::UnicodeString& text );
|
||||
|
||||
virtual void Begin();
|
||||
virtual void End();
|
||||
|
||||
virtual void SetDrawColor( Gwen::Color color );
|
||||
virtual void DrawFilledRect( Gwen::Rect rect );
|
||||
void DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect rect, float u1, float v1, float u2, float v2 );
|
||||
|
||||
|
||||
void StartClip();
|
||||
void EndClip();
|
||||
|
||||
void Flush();
|
||||
void AddVert( int x, int y, float u = 0.0f , float v = 0.0f );
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Gwen::Texture* m_pFontTexture;
|
||||
float m_fFontScale[2];
|
||||
float m_fLetterSpacing;
|
||||
|
||||
|
||||
Gwen::Color m_Color;
|
||||
int m_iVertNum;
|
||||
Vertex m_Vertices[ MaxVerts ];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
51
btgui/Gwen/Renderers/SFML.h
Normal file
51
btgui/Gwen/Renderers/SFML.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
GWEN
|
||||
Copyright (c) 2011 Facepunch Studios
|
||||
See license in Gwen.h
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef GWEN_RENDERERS_SFML_H
|
||||
#define GWEN_RENDERERS_SFML_H
|
||||
#include "Gwen/Gwen.h"
|
||||
#include "Gwen/BaseRender.h"
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
namespace Gwen
|
||||
{
|
||||
namespace Renderer
|
||||
{
|
||||
|
||||
class SFML : public Gwen::Renderer::Base
|
||||
{
|
||||
public:
|
||||
|
||||
SFML( sf::RenderTarget& target );
|
||||
~SFML();
|
||||
|
||||
virtual void SetDrawColor(Gwen::Color color);
|
||||
|
||||
virtual void DrawLine( int x, int y, int a, int b );
|
||||
virtual void DrawFilledRect( Gwen::Rect rect );
|
||||
|
||||
virtual void LoadFont( Gwen::Font* pFont );
|
||||
virtual void FreeFont( Gwen::Font* pFont );
|
||||
virtual void RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text );
|
||||
virtual Gwen::Point MeasureText( Gwen::Font* pFont, const Gwen::UnicodeString& text );
|
||||
|
||||
void StartClip();
|
||||
void EndClip();
|
||||
|
||||
void DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect pTargetRect, float u1=0.0f, float v1=0.0f, float u2=1.0f, float v2=1.0f );
|
||||
void LoadTexture( Gwen::Texture* pTexture );
|
||||
void FreeTexture( Gwen::Texture* pTexture );
|
||||
|
||||
protected:
|
||||
|
||||
sf::RenderTarget& m_Target;
|
||||
sf::Color m_Color;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user