Visual Studio2010下HGE平台的搭建

搭建平台:HGE 1.81+Visual Studio2010

HGE下载http://hge.relishgames.com/

不知道为什么金山毒霸和金山卫士都提示下载包有毒?不管,先下下来。本地扫描后发现只有hgehelp.a文件有毒。这个就不管了吧,反正也不用这个文件,直接删掉。其他部分还是可以用的。

 

 

下载完后解压到某一目录,我把它放在G:/C++/HGE。其中目录doc是他的开发文档,写得很详细。但是没有说明在Visual Studio2010中怎么用。经过我慢慢摸索,发现Visual Studio2010跟它前面的版本的设置还有有些差别的。(开始都找不到包含目录设置⊙﹏⊙b汗)

具体方法如下:

1.下载HGE的SDK包,解压在某个目录下,比如G:/C++/HGE。
2.打开VS2010新建一个空项目,如HGE。
3.选中“解决方案资源编辑器”中的项目名---“HGE”。
4.点击工具栏的“项目”---“属性”---“配置属性”---“VC++目录”。
5.选中“包含目录”右边的小箭头---“编辑”,在其中添加“G:/C++/HGE/include”。
6.同样的方法在“库目录”中添加“G:/C++/HGE/lib/vc”,并单击“应用”。
7.点击“HGE属性页”左边的“配置属性”---“链接器”---“输入”。
8.在“附加依赖项”中添加“hge.lib;hgehelp.lib;”
9.将HGE的SDK包根目录下的两个文件bass.dll和hge.dll复制到项目目录下。
至此HGE的环境搭建完成。

 

弄完后我用开发文档中的例一做了测试:

 /* ** Haaf's Game Engine 1.8 ** Copyright (C) 2003-2007, Relish Games ** hge.relishgames.com ** ** hge_tut01 - Minimal HGE application */ #include "hge.h" HGE *hge = 0; // This function will be called by HGE once per frame. // Put your game loop code here. In this example we // just check whether ESC key has been pressed. bool FrameFunc() { // By returning "true" we tell HGE // to stop running the application. if (hge->Input_GetKeyState(HGEK_ESCAPE)) return true; // Continue execution return false; } int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { // Here we use global pointer to HGE interface. // Instead you may use hgeCreate() every // time you need access to HGE. Just be sure to // have a corresponding hge->Release() // for each call to hgeCreate() hge = hgeCreate(HGE_VERSION); // Set our frame function hge->System_SetState(HGE_FRAMEFUNC, FrameFunc); // Set the window title hge->System_SetState(HGE_TITLE, "HGE Tutorial 01 - Minimal HGE application"); // Run in windowed mode // Default window size is 800x600 hge->System_SetState(HGE_WINDOWED, true); // Don't use BASS for sound hge->System_SetState(HGE_USESOUND, false); // Tries to initiate HGE with the states set. // If something goes wrong, "false" is returned // and more specific description of what have // happened can be read with System_GetErrorMessage(). if(hge->System_Initiate()) { // Starts running FrameFunc(). // Note that the execution "stops" here // until "true" is returned from FrameFunc(). hge->System_Start(); } else { // If HGE initialization failed show error message MessageBox(NULL, hge->System_GetErrorMessage(), "Error", MB_OK | MB_ICONERROR | MB_APPLMODAL); } // Now ESC has been pressed or the user // has closed the window by other means. // Restore video mode and free // all allocated resources hge->System_Shutdown(); // Release the HGE interface. // If there are no more references, // the HGE object will be deleted. hge->Release(); return 0; }

你可能感兴趣的:(Visual Studio2010下HGE平台的搭建)