delete old codes.

This commit is contained in:
hyzboy 2020-08-07 16:43:05 +08:00
parent 74cf457bba
commit 1964e5da04
4 changed files with 0 additions and 301 deletions

View File

@ -1,25 +0,0 @@
static FontInfo *DefaultFont;
private:
UTF16String name;
int width,height;
bool bold,italic;
protected:
UTF16String &GetName(){return name;}
void SetName(UTF16String &);
int GetWidth(){return width;}
int GetHeight(){return height;}
bool GetBold(){return bold;}
bool GetItalic(){return italic;}
void SetWidth(int);
void SetHeight(int);
void SetBold(bool);
void SetItalic(bool);
void InitPrivate();

View File

@ -1,51 +0,0 @@
#ifndef HGL_FONT_INFO_INCLUDE
#define HGL_FONT_INFO_INCLUDE
#include<hgl/type/DataType.h>
#include<hgl/type/Color4f.h>
#include<hgl/type/BaseString.h>
namespace hgl
{
/**
* <br>
* 线
*/
class FontInfo ///字体数据结构
{
#include<hgl/graph/FontInfo.Attrib.h>
public: //属性
Property<UTF16String> Name; ///<字体名称
Property<int> Width; ///<平均字体宽度
Property<int> Height; ///<字体高度
Property<bool> Bold; ///<是否粗体
Property<bool> Italic; ///<是否斜体
public: //事件
DefEvent(void,OnChange,(FontInfo *)); ///<字体改变事件
public: //方法
FontInfo();
FontInfo(const FontInfo &);
FontInfo(const UTF16String &,int,int,bool=false,bool=false);
static void SetDefaultFont(const UTF16String &,int,int,bool,bool); ///<设置缺省字体
static void SetDefaultFont(const FontInfo &); ///<设置缺省字体
static void ClearDefaultFont(); ///<清除缺省字体
void Set(const UTF16String &,int,int,bool=false,bool=false); ///<设置字体
public: //操作符重载
bool operator == (const FontInfo &);
bool operator != (const FontInfo &);
void operator = (const FontInfo &);
};//class FontInfo
}//namespace hgl
#endif//HGL_FONT_INFO_INCLUDE

View File

@ -1,50 +0,0 @@
#ifndef HGL_GRAPH_FONT_SOURCE_INCLUDE
#define HGL_GRAPH_FONT_SOURCE_INCLUDE
#include<hgl/graph/FontInfo.h>
namespace hgl
{
namespace graph
{
/**
* <br>
*
*/
class FontSource
{
public:
/**
*
*/
struct Bitmap
{
int x,y; //图像显示偏移
int w,h; //图像尺寸
int adv_x,adv_y;//字符尺寸
unsigned char *data;
};//struct Bitmap
protected:
FontInfo fnt;
FontSource::Bitmap char_bitmap[0xFFFF]; ///<字符位图数据
protected:
virtual bool MakeCharBitmap(u16char)=0; ///<产生字体数据
virtual int GetLineHeight()const=0; ///<取得行高
public:
FontSource(const FontInfo &);
virtual ~FontSource();
FontSource::Bitmap *GetCharBitmap(u16char); ///<取得字体数据
};//class FontSource
}//namespace graph
}//namespace hgl
#endif//HGL_GRAPH_FONT_SOURCE_INCLUDE

View File

@ -1,175 +0,0 @@
#ifndef HGL_GRAPH_TILE_FONT_INCLUDE
#define HGL_GRAPH_TILE_FONT_INCLUDE
#include<hgl/algorithm/VectorMath.h>
#include<hgl/type/Color4f.h>
#include<hgl/type/ActiveChain.h>
#include<hgl/graph/TileData.h>
#include<hgl/graph/FontSource.h>
#include<hgl/graph/Makeup.h>
#include<hgl/graph/VertexBuffer.h>
namespace hgl
{
namespace graph
{
struct FontInfo;
class Renderable;
class Material;
/**
* 使Tile代表一个字符的管理模块<br>
* 使使
*/
class TileFont ///Tile字体
{
protected:
TileData *tile_data; ///<Tile管理器
FontSource *chs_source,*eng_source; ///<字体数据源
ActiveChain<u16char,TileData::Object *> fud; ///<字体缓冲管理
uint8 *char_bitmap_buffer; ///<字符位图缓冲区
uint char_bitmap_bytes; ///<字符位图字节数
VB2f *vertex2d; ///<绘制用顶点坐标
VB2f *tex_coord; ///<绘制用顶点坐标
// VB1ui *vertex_color; ///<绘制用顶点色
Material *fnt_mtl; ///<绘制用材质
Renderable *fnt_draw; ///<绘制用对象
int tile_width,tile_height; ///<所使用的Tile宽高
int font_height;
int line_distance;
protected:
void Clear(const u16char &,TileData::Object *&); ///<清除某个字
FontSource::Bitmap *GetCharBitmap(const u16char &ch) ///<取得字符位图数据
{return ((ch<=0xFF?eng_source:chs_source)->GetCharBitmap(ch));}
FontSource::Bitmap *MakeCharBitmap(const u16char &ch); ///<生成字符位图数据
TileData::Object *GetCharData(const u16char &); ///<取得字符数据
bool MakeupText(Makeup &,int,int,const u16char *,int); ///<排版字符串
public:
int GetHeight ()const {return font_height;} ///<取得字符高度
int GetLineDistance ()const {return line_distance;} ///<取得行间距
void SetLineDistance(int n) {line_distance=n;}
public: //属性
Color4f Color; ///<颜色
public:
TileFont(int,TileData *,FontSource *,FontSource *);
virtual ~TileFont();
float CharWidth(u16char); ///<指定字符宽度
float GetStringWidth(const u16char *,int=-1); ///<求字符串宽度
public:
bool MakeupText(Makeup &,const u16char *,int=-1); ///<排版字符串
bool MakeupText(Makeup &,const u16char *,int,TextAlignment); ///<排版字符串
void Draw(const Matrix4f *,const Makeup &,int=-1); ///<根据排版进行绘制
void Draw(float l,float t,const Makeup &makeup,int limit_char=-1) ///<根据排版进行绘制
{
const Matrix4f mat=translate(l,t,0);
Draw(&mat,makeup,limit_char);
}
/**
* ,,\n
* @param mat modelview变换矩阵
* @param str
* @param limit_char ,-1
* @return
* @return <0
*/
float DrawString(const Matrix4f *mat,const u16char *str,int limit_char=-1) ///<绘制一个字符串,可限制字数,并且处理\n
{
Makeup m;
if(!MakeupText(m,str,limit_char))
return(-1);
Draw(mat,m,limit_char);
return m.Width;
}
/**
* ,,\n
* @param x X坐标
* @param y Y坐标
* @param str
* @param limit_char ,-1
* @return
* @return <0
*/
float DrawString(float x,float y,const u16char *str,int limit_char=-1) ///<绘制一个字符串,可限制字数,并且处理\n
{
const Matrix4f mat=translate(x,y,0);
return DrawString(&mat,str,limit_char);
}
float DrawFormat(const Matrix4f *mat,const u16char *,...); ///<绘制一个格式化的字符串
float DrawFormat(float,float,const u16char *,...); ///<绘制一个格式化的字符串
};//class TileFont
TileFont *CreateTileFont(const FontInfo &,const FontInfo &,int=-1); ///<创建一个字体,使用系统字体
/**
* Tile字体
* @param chs_fontname
* @param eng_fontname
* @param width ,0,
* @param height
* @param bold ,false
* @param italic ,false
* @param anti 齿,true
* @param count
*/
TileFont *CreateTileFont(const u16char *chs_fontname,const u16char *eng_fontname,int width,int height,bool bold=false,bool italic=false,bool anti=true,int count=-1);
/**
* Tile字体,
* @param fontname
* @param width ,0,
* @param height
* @param bold ,false
* @param italic ,false
* @param anti 齿,true
* @param count
*/
__inline TileFont *CreateTileFont(const u16char *fontname,int width,int height,bool bold=false,bool italic=false,bool anti=true,int count=-1)
{
return CreateTileFont(fontname,fontname,width,height,bold,italic,anti,count);
}
/**
* Tile字体,
* @param chs_fontname
* @param eng_fontname
* @param width ,0,
* @param height
* @param count
*/
__inline TileFont *CreateTileFont(const u16char *chs_fontname,const u16char *eng_fontname,int width,int height,int count=-1)
{
return CreateTileFont(chs_fontname,eng_fontname,width,height,false,false,true,count);
}
}//namespace graph
}//namespace hgl
#endif//HGL_GRAPH_TILE_FONT_INCLUDE