|
|
HGP?????2D???????????PSD?????PSD????????????ALPHA???2????????????????????????????1-8?????????
????????2?????????????????????
???????2?????????????????
??HGPTest???MainUnit.CPP????????????
??1.???windows/fons/??impact.ttf???hgptest.exe?5.hgp????
??2.??PSD??????Adobe Photoshop 6 ???????????Photoshop 7/8?????????
----------------------------------------------------------------------------------------------------
#include<hgl/hgl.h>
#include<hgl/hgp.h>
#include<hgl/OpenGL.H>
#include<hgl/Font.H>
using namespace hgl;
class Test:public FlowObject
{
HGP *hgp; //????HGP?????
Font *fnt; //??????????
wchar_t str[32];
wchar_t name[32];
private:
void OnCharProc(wchar_t ch)
{
if(ch>='1'&&ch<='8')
{
hgp->SetShow(false); //?????????
hgp->Layer[ch-'1'].Visible=true; //???????
wcscpy(str,L"Only show ? layer");
str[10]=ch-1;
wcscpy(name,L"Layer Name: ");
wcscat(name,hgp->Layer[ch-'1'].Name.wc_str());
}
}
public:
Test()
{
fnt=LoadFont("impact.ttf",32,32); //???????????????32x32
hgp=new HGP(L"5.hgp"); //??HGP?????????????
To2DMode(640,480); //???????2D??????????640x480
OnChar=OnCharProc; //????????????OnCharProc
wcscpy(str,L" lease press 1 - 8");
wcscpy(name,L"<All Layer>");
}
~Test()
{
delete hgp; //??HGP??????
delete fnt; //????????
}
void Update() //?????????
{
ClearScreen(); //??
hgp->Draw((640-hgp->Width)/2,(480-hgp->Height)/2); //????
fnt->DrawString(0,0,str); //??????
fnt->DrawString(0,32,name); //??????
}
};
void GameMain(char *)
{
Application->GameName =L"HGP??";
Application->GameCode =L"HGPTest";
Application->ProjectFile=L"HGPTest.cmproj";
if(!Application->Init())return; //???????
Application->flow.SetStart(new Test); //??????
Application->Run(); //????
} |
|