游戏开发论坛

 找回密码
 立即注册
搜索
查看: 4042|回复: 0

??HGPTest????(2004.10.3)

[复制链接]

2万

主题

2万

帖子

6万

积分

论坛元老

Rank: 8Rank: 8

积分
66489
QQ
发表于 2004-10-3 13:42:00 | 显示全部楼层 |阅读模式
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&quotlease 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();                                 //????
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-11-9 11:17

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表