且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

HGE:OO FrameFunc/RenderFunc

更新时间:2022-08-22 12:18:02

#pragma once 
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFunc#include  < hge.h >  
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFunc class  CGlobal 
HGE:OO FrameFunc/RenderFunc 
HGE:OO FrameFunc/RenderFunc public : 
HGE:OO FrameFunc/RenderFunc   CGlobal( void ); 
HGE:OO FrameFunc/RenderFunc    ~ CGlobal( void ); 
HGE:OO FrameFunc/RenderFunc    static   bool  FrameFunction( void ); 
HGE:OO FrameFunc/RenderFunc    static  CGlobal *  g_pGlobal;
HGE:OO FrameFunc/RenderFunc   HGE *  hge; 
HGE:OO FrameFunc/RenderFunc // private:  
HGE:OO FrameFunc/RenderFunc 
    bool  InitHGE( void ); 
HGE:OO FrameFunc/RenderFunc    void  DestroyHGE( void ); 
HGE:OO FrameFunc/RenderFunc
;
Global.h 


Global.cpp 
HGE:OO FrameFunc/RenderFunc#include ".\global.h" 
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFuncCGlobal::CGlobal(void
HGE:OO FrameFunc/RenderFunc{
HGE:OO FrameFunc/RenderFunc   g_pGlobal = this
HGE:OO FrameFunc/RenderFunc   hge = hgeCreate(HGE_VERSION); 
HGE:OO FrameFunc/RenderFunc}
 
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFuncCGlobal::~CGlobal(void
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFunc}
 
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFuncbool CGlobal::InitHGE(void
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFunc   hge->System_SetState(HGE_LOGFILE, "global.log"); 
HGE:OO FrameFunc/RenderFunc   hge->System_SetState(HGE_FRAMEFUNC, this->FrameFunction); 
HGE:OO FrameFunc/RenderFunc   hge->System_SetState(HGE_TITLE, "Global Test"); 
HGE:OO FrameFunc/RenderFunc   hge->System_SetState(HGE_WINDOWED, true); 
HGE:OO FrameFunc/RenderFunc   hge->System_SetState(HGE_SCREENWIDTH, 1024); 
HGE:OO FrameFunc/RenderFunc   hge->System_SetState(HGE_SCREENHEIGHT, 768); 
HGE:OO FrameFunc/RenderFunc   hge->System_SetState(HGE_SCREENBPP, 32); 
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFunc   try 
HGE:OO FrameFunc/RenderFunc   
HGE:OO FrameFunc/RenderFunc      hge->System_Initiate(); 
HGE:OO FrameFunc/RenderFunc      return true
HGE:OO FrameFunc/RenderFunc   }
 
HGE:OO FrameFunc/RenderFunc   catch(HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFunc   
HGE:OO FrameFunc/RenderFunc      return false
HGE:OO FrameFunc/RenderFunc   }
 
HGE:OO FrameFunc/RenderFunc}
 
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFuncvoid CGlobal::DestroyHGE(void
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFunc   hge->System_Shutdown(); 
HGE:OO FrameFunc/RenderFunc   hge->Release(); 
HGE:OO FrameFunc/RenderFunc}
 
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFuncbool CGlobal::FrameFunction(void
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFunc   if (hge->Input_GetKeyState(HGEK_ESCAPE)) 
HGE:OO FrameFunc/RenderFunc      return true
HGE:OO FrameFunc/RenderFunc   return false
HGE:OO FrameFunc/RenderFunc}


Main.cpp 
HGE:OO FrameFunc/RenderFunc#include "Global.h" 
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFuncCGlobal* Main; 
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFuncint WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int
HGE:OO FrameFunc/RenderFunc
HGE:OO FrameFunc/RenderFunc   Main = new CGlobal(); 
HGE:OO FrameFunc/RenderFunc   if(!Main->InitHGE()) PostQuitMessage(1); 
HGE:OO FrameFunc/RenderFunc   Main->DestroyHGE(); 
HGE:OO FrameFunc/RenderFunc   delete Main; 
HGE:OO FrameFunc/RenderFunc   return 0; 
HGE:OO FrameFunc/RenderFunc}