|
楼主 |
发表于 2005-6-11 23:24:00
|
显示全部楼层
Re:为何文字显示有些不清晰?
为了能看清楚一些,我将文字的颜色设置为蓝色,背景为黑色。
#include <hgl/hgl.h>
#include <hgl/opengl.h>
#include <hgl/hgp.h>
#include <hgl/font.h>
#include <hgl/flowobject.h>
#include <hgl/inputstate.h>
#include <hgl/TextureAnim2D.h>
using namespace hgl;
class CTest : public FlowObject
{
Font* fnt;
HGP* hgp;
TextureAnim2D* tex;
TextureAnim2D* tex2;
uint8 count;
uint64 tt; // 控制延迟时间
protected:
void OnKeyProc(uint32 key)
{
if(key==kbEsc) { fos = fosExitGame; return; }
}
public:
CTest()
{
fnt = LoadFont(L"c:\\windows\\fonts\\STSONG.TTF",32,32);
fnt->Color.Set(0,0,1,1);
hgp=new HGP(L"5.hgp");
count=0;
tt=Application->Time;
//GIF部分
tex=CreateTextureAnim2D(L"anim5.tex");
tex->Loop=true;
tex2 = new TextureAnim2D;
*tex2 = *tex;
tex2->Speed=0.5;
To2DMode(800,600);
glEnable(GL_TEXTURE_2D);
//glClearColor(0.2,0.5,0.2,1);
OnKeyDown = OnKeyProc;
}
~CTest()
{
delete fnt;
delete hgp;
delete tex;
delete tex2;
}
void Draw()
{
ClearScreen();
fnt->DrawFormat(0,0,L"ESC退出 (%d/%d)",count+1,hgp->LayerNumber);
fnt->DrawFormat(0,50,L"已流逝的时间 %ld 秒",Application->Time/1000);
hgp->SetShow(false);
if(Application->Time - tt > 125)
{
if(++count >= hgp->LayerNumber) count=0;
tt = Application->Time;
}
hgp->Layer[count].Visible = true;
hgp->Draw((800-hgp->Width)/2,(600-hgp->Height)/2);
tex->Draw(0,0);
tex2->Draw(300,0);
}
};
void GameMain(char *)
{
SystemInitInfo iis;
iis.info.ProjectName=L"SD转化到HGP";
iis.info.ProjectCode=L"Application";
iis.graphics.Width=800;
iis.graphics.Height=600;
iis.graphics.fs.Width=800;
iis.graphics.fs.Height=600;
if(!Application->Init(&iis)) return;
Application->flow.SetStart(new CTest);
Application->Run();
}
|
|