mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-01 15:52:41 -06:00
Rainbow: WinGL..
git-svn-id: svn://ultimatepp.org/upp/trunk@3658 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
8163e72248
commit
3eddc87704
5 changed files with 79 additions and 67 deletions
|
|
@ -147,7 +147,7 @@ void SystemDraw::SetClip(const Rect& r, int mode)
|
|||
void SystemDraw::BeginOp()
|
||||
{
|
||||
Cloff& w = cloff[ci++];
|
||||
w.clipping = true;
|
||||
w.clipping = false;
|
||||
w.org = drawing_offset;
|
||||
w.drawing_clip = drawing_clip;
|
||||
}
|
||||
|
|
@ -171,13 +171,13 @@ void SystemDraw::EndOp()
|
|||
void SystemDraw::OffsetOp(Point p)
|
||||
{
|
||||
BeginOp();
|
||||
cloff[ci - 1].clipping = false;
|
||||
drawing_offset += p;
|
||||
}
|
||||
|
||||
bool SystemDraw::ClipOp(const Rect& r)
|
||||
{
|
||||
BeginOp();
|
||||
cloff[ci - 1].clipping = true;
|
||||
drawing_clip = r + drawing_offset;
|
||||
SetClip(drawing_clip);
|
||||
return true;
|
||||
|
|
@ -186,6 +186,7 @@ bool SystemDraw::ClipOp(const Rect& r)
|
|||
bool SystemDraw::ClipoffOp(const Rect& r)
|
||||
{
|
||||
BeginOp();
|
||||
cloff[ci - 1].clipping = true;
|
||||
drawing_clip = r + drawing_offset;
|
||||
drawing_offset += r.TopLeft();
|
||||
SetClip(drawing_clip);
|
||||
|
|
|
|||
48
rainbow/WinGl/FontGl.h
Normal file
48
rainbow/WinGl/FontGl.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef _WinGl_FontGl_h_
|
||||
#define _WinGl_FontGl_h_
|
||||
|
||||
struct OpenGLFont : Moveable<OpenGLFont>
|
||||
{
|
||||
float scaleW;
|
||||
float scaleH;
|
||||
float lineHeight;
|
||||
float base;
|
||||
|
||||
bool texturesUpdated;
|
||||
|
||||
float vtx[1024 * 4 * 2];
|
||||
float crd[1024 * 4 * 2];
|
||||
|
||||
struct CharInfo : Moveable<CharInfo>
|
||||
{
|
||||
int id;
|
||||
float x;
|
||||
float y;
|
||||
float width;
|
||||
float height;
|
||||
float xoffset;
|
||||
float yoffset;
|
||||
float xadvance;
|
||||
int page;
|
||||
};
|
||||
|
||||
Vector<CharInfo> chars;
|
||||
VectorMap<int, VectorMap<int, float> > kerns;
|
||||
Vector<String> files;
|
||||
Array<const byte> compiledFiles;
|
||||
Vector<int64> pages;
|
||||
|
||||
OpenGLFont() : texturesUpdated(false)
|
||||
{}
|
||||
|
||||
~OpenGLFont()
|
||||
{}
|
||||
|
||||
void LoadBrc(const byte* xml, const byte* image);
|
||||
void Load(const String& fileName);
|
||||
void Parse(const char* xml, bool parsePages);
|
||||
void UpdateTextures();
|
||||
void BuildVertices();
|
||||
};
|
||||
|
||||
#endif
|
||||
24
rainbow/WinGl/ResGl.h
Normal file
24
rainbow/WinGl/ResGl.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef _WinGl_ResGl_h_
|
||||
#define _WinGl_ResGl_h_
|
||||
|
||||
struct Texture : Moveable<Texture>
|
||||
{
|
||||
Size sz;
|
||||
Point curpos;
|
||||
VectorMap<int64, Rect> parts;
|
||||
void AddPart(int64 serialId, const Image& img);
|
||||
};
|
||||
|
||||
struct Resources
|
||||
{
|
||||
static int64 currentSerialId;
|
||||
static ArrayMap<int64, Texture> textures;
|
||||
static VectorMap<String, OpenGLFont> fonts;
|
||||
static int64 Bind(const Image& img, bool linear = false);
|
||||
static bool Bind(int64 serialId, bool force = false);
|
||||
static OpenGLFont& GetFont(const char* fontName);
|
||||
static OpenGLFont& GetFontBrc(const char* fontName, const byte* fontDef, const byte* fontImage);
|
||||
static OpenGLFont& StdFont(bool bold = false);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include <Painter/Painter.h>
|
||||
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
#define IMAGECLASS WinGlImg
|
||||
|
|
@ -45,70 +44,8 @@ float GetFps();
|
|||
3 - Manual clip
|
||||
*/
|
||||
|
||||
struct OpenGLFont : Moveable<OpenGLFont>
|
||||
{
|
||||
float scaleW;
|
||||
float scaleH;
|
||||
float lineHeight;
|
||||
float base;
|
||||
|
||||
bool texturesUpdated;
|
||||
|
||||
float vtx[1024 * 4 * 2];
|
||||
float crd[1024 * 4 * 2];
|
||||
|
||||
struct CharInfo : Moveable<CharInfo>
|
||||
{
|
||||
int id;
|
||||
float x;
|
||||
float y;
|
||||
float width;
|
||||
float height;
|
||||
float xoffset;
|
||||
float yoffset;
|
||||
float xadvance;
|
||||
int page;
|
||||
};
|
||||
|
||||
Vector<CharInfo> chars;
|
||||
VectorMap<int, VectorMap<int, float> > kerns;
|
||||
Vector<String> files;
|
||||
Array<const byte> compiledFiles;
|
||||
Vector<int64> pages;
|
||||
|
||||
OpenGLFont() : texturesUpdated(false)
|
||||
{}
|
||||
|
||||
~OpenGLFont()
|
||||
{}
|
||||
|
||||
void LoadBrc(const byte* xml, const byte* image);
|
||||
void Load(const String& fileName);
|
||||
void Parse(const char* xml, bool parsePages);
|
||||
void UpdateTextures();
|
||||
void BuildVertices();
|
||||
|
||||
};
|
||||
|
||||
struct Texture : Moveable<Texture>
|
||||
{
|
||||
Size sz;
|
||||
Point curpos;
|
||||
VectorMap<int64, Rect> parts;
|
||||
void AddPart(int64 serialId, const Image& img);
|
||||
};
|
||||
|
||||
struct Resources
|
||||
{
|
||||
static int64 currentSerialId;
|
||||
static ArrayMap<int64, Texture> textures;
|
||||
static VectorMap<String, OpenGLFont> fonts;
|
||||
static int64 Bind(const Image& img, bool linear = false);
|
||||
static bool Bind(int64 serialId, bool force = false);
|
||||
static OpenGLFont& GetFont(const char* fontName);
|
||||
static OpenGLFont& GetFontBrc(const char* fontName, const byte* fontDef, const byte* fontImage);
|
||||
static OpenGLFont& StdFont(bool bold = false);
|
||||
};
|
||||
#include <WinGl/FontGl.h>
|
||||
#include <WinGl/ResGl.h>
|
||||
|
||||
class SystemDraw : public Draw {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ options
|
|||
|
||||
file
|
||||
WinGl.h,
|
||||
ResGl.h,
|
||||
FontGl.h,
|
||||
Keys.h,
|
||||
Draw.cpp,
|
||||
DrawOp.cpp,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue