HGE引擎及实例,可以下载学习
HGE引挚 CRect rs; GetClientRect(pWnd->GetSafeHwnd(),&rs); hge = hgeCreate(HGE_VERSION); hge->System_SetState(HGE_LOGFILE, "hge_tut07.log"); //hge->System_SetState(HGE_FRAMEFUNC, FrameFunc); hge->System_SetState(HGE_RENDERFUNC, RenderFunc); hge->System_SetState(HGE_TITLE, "HGE Tutorial 07 - Thou sand of Hares"); hge->System_SetState(HGE_USESOUND, false); hge->System_SetState(HGE_WINDOWED, true); hge->System_SetState(HGE_SCREENWIDTH, SCREEN_WIDTH); hge->System_SetState(HGE_SCREENHEIGHT, SCREEN_HEIGHT); hge->System_SetState(HGE_SCREENBPP, 32); hge->System_SetState(HGE_HWNDPARENT, pWnd->GetSafeHwnd()); if(hge->System_Initiate()) { // Load textures bgtex=hge->Texture_Load("bg2.png"); tex=hge->Texture_Load("zazaka.png"); if(!bgtex || !tex) { // If one of the data files is not found, // display an error message and shutdown // MessageBox(NULL, "Can't load BG2.PNG or ZAZAKA.PNG", "Error", MB_OK | MB_ICONERROR | MB_APPLMODAL); hge->System_Shutdown(); hge->Release(); return ; } // Load font, create sprites fnt=new hgeFont("font2.fnt"); spr=new hgeSprite(tex,0,0,64,64); spr->SetHotSpot(32,32); bgspr=new hgeSprite(bgtex,0,0,800,600); bgspr->SetBlendMode(BLEND_COLORADD | BLEND_ALPHABLEND | BLEND_NOZWRITE); bgspr->SetColor(0xFF000000,0); bgspr->SetColor(0xFF000000,1); bgspr->SetColor(0xFF000040,2); bgspr->SetColor(0xFF000040,3); // Initialize objects list pObjects=new sprObject[MAX_OBJECTS]; nObjects=1000; for(int i=0;iRandom_Float(0,SCREEN_WIDTH); pObjects[i].y=hge->Random_Float(0,SCREEN_HEIGHT); pObjects[i].dx=hge->Random_Float(-200,200); pObjects[i].dy=hge->Random_Float(-200,200); pObjects[i].scale=hge->Random_Float(0.5f,2.0f); pObjects[i].dscale=hge->Random_Float(-1.0f,1.0f); pObjects[i].rot=hge->Random_Float(0,M_PI*2); pObjects[i].drot=hge->Random_Float(-1.0f,1.0f); } SetBlend(0); // Let's rock now! hge->System_Start(); // Delete created objects and free loaded resources delete[] pObjects; delete fnt; delete spr; delete bgspr; hge->Texture_Free(tex); hge->Texture_Free(bgtex); } // Clean up and shutdown hge->System_Shutdown(); hge->Release(); sand of Hares"); hge->System_SetState(HGE_USESOUND, false); hge->System_SetState(HGE_WINDOWED, true); hge->System_SetState(HGE_SCREENWIDTH, SCREEN_WIDTH); hge->System_SetState(HGE_SCREENHEIGHT, SCREEN_HEIGHT); hge->System_SetState(HGE_SCREENBPP, 32); hge->System_SetState(HGE_HWNDPARENT, pWnd->GetSafeHwnd()); if(hge->System_Initiate()) { // Load textures bgtex=hge->Texture_Load("bg2.png"); tex=hge->Texture_Load("zazaka.png"); if(!bgtex || !tex) { // If one of the data files is not found, // display an error message and shutdown // MessageBox(NULL, "Can't load BG2.PNG or ZAZAKA.PNG", "Error", MB_OK | MB_ICONERROR | MB_APPLMODAL); hge->System_Shutdown(); hge->Release(); return ; } // Load font, create sprites fnt=new hgeFont("font2.fnt"); spr=new hgeSprite(tex,0,0,64,64); spr->SetHotSpot(32,32); bgspr=new hgeSprite(bgtex,0,0,800,600); bgspr->SetBlendMode(BLEND_COLORADD | BLEND_ALPHABLEND | BLEND_NOZWRITE); bgspr->SetColor(0xFF000000,0); bgspr->SetColor(0xFF000000,1); bgspr->SetColor(0xFF000040,2); bgspr->SetColor(0xFF000040,3); // Initialize objects list pObjects=new sprObject[MAX_OBJECTS]; nObjects=1000; for(int i=0;iRandom_Float(0,SCREEN_WIDTH); pObjects[i].y=hge->Random_Float(0,SCREEN_HEIGHT); pObjects[i].dx=hge->Random_Float(-200,200); pObjects[i].dy=hge->Random_Float(-200,200); pObjects[i].scale=hge->Random_Float(0.5f,2.0f); pObjects[i].dscale=hge->Random_Float(-1.0f,1.0f); pObjects[i].rot=hge->Random_Float(0,M_PI*2); pObjects[i].drot=hge->Random_Float(-1.0f,1.0f); } SetBlend(0); // Let's rock now! hge->System_Start(); // Delete created objects and free loaded resources delete[] pObjects; delete fnt; delete spr; delete bgspr; hge->Texture_Free(tex); hge->Texture_Free(bgtex); } // Clean up and shutdown hge->System_Shutdown(); hge->Release();
用户评论
还不会用,先看看吧
这个真心不错,帮助很大
还可以吧,只是hge现在有点老了,作为学习还可以
项目需要,学习下。
同学推荐的游戏引擎,学习一下~感谢!
用来做纸牌游戏不错
学习一下,听说这个引擎不错
很好,hge的官网我访问不了,下了这个可以用。
初级引擎 应该很适合新手使用
还不会用呢啊