先来看看HGE是怎么使用的吧。
先上代码
/*
** Haaf's Game Engine 1.8
** Copyright (C) 2003-2007, Relish Games
** hge.relishgames.com
**
** hge_tut07 - Thousand of Hares
*/
// Copy the files "font2.fnt", "font2.png", "bg2.png"
// and "zazaka.png" from the folder "precompiled" to
// the folder with executable file. Also copy hge.dll
// to the same folder.
#include "hge.h"
#include "hgefont.h"
#pragma comment(lib,"hge.lib")
#pragma comment(lib,"hgehelp.lib")
#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 600
#define MIN_OBJECTS 100
#define MAX_OBJECTS 2000
struct sprObject
{
float x,y;
float dx,dy;
float scale,rot;
float dscale,drot;
DWORD color;
};
sprObject* pObjects;
int nObjects;
int nBlend;
// Pointer to the HGE interface (helper classes require this to work)
HGE *hge=0;
// Resource handles
HTEXTURE tex, bgtex;
hgeSprite *spr, *bgspr;
hgeFont *fnt;
// Set up blending mode for the scene
void SetBlend(int blend)
{
static int sprBlend[5]=
{
BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_NOZWRITE,
BLEND_COLORADD | BLEND_ALPHABLEND | BLEND_NOZWRITE,
BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_NOZWRITE,
BLEND_COLORMUL | BLEND_ALPHAADD | BLEND_NOZWRITE,
BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_NOZWRITE
};
static DWORD fntColor[5]=
{
0xFFFFFFFF, 0xFF000000, 0xFFFFFFFF, 0xFF000000, 0xFFFFFFFF
};
static DWORD sprCo