zl程序教程

您现在的位置是:首页 >  其它

当前栏目

HGE:OO FrameFunc/RenderFunc

2023-09-27 14:27:56 时间
#pragma once 
None.gif
None.gif#include    hge.h    
None.gif
None.gif class  CGlobal 
ExpandedBlockStart.gif { 
InBlock.gif public : 
InBlock.gif   CGlobal( void ); 
InBlock.gif    ~ CGlobal( void ); 
InBlock.gif    static   bool  FrameFunction( void ); 
InBlock.gif    static  CGlobal *  g_pGlobal;
InBlock.gif   HGE *  hge; 
InBlock.gif // private:  
InBlock.gif     bool  InitHGE( void ); 
InBlock.gif    void  DestroyHGE( void ); 
ExpandedBlockEnd.gif} ; Global.h 


Global.cpp 
None.gif#include ".\global.h" 
None.gif
None.gifCGlobal::CGlobal(void) 
ExpandedBlockStart.gif{
InBlock.gif   g_pGlobal = this; 
InBlock.gif   hge = hgeCreate(HGE_VERSION); 
ExpandedBlockEnd.gif
None.gif
None.gifCGlobal::~CGlobal(void) 
ExpandedBlockStart.gif
ExpandedBlockEnd.gif
None.gif
None.gifbool CGlobal::InitHGE(void) 
ExpandedBlockStart.gif
InBlock.gif   hge- System_SetState(HGE_LOGFILE, "global.log"); 
InBlock.gif   hge- System_SetState(HGE_FRAMEFUNC, this- FrameFunction); 
InBlock.gif   hge- System_SetState(HGE_TITLE, "Global Test"); 
InBlock.gif   hge- System_SetState(HGE_WINDOWED, true); 
InBlock.gif   hge- System_SetState(HGE_SCREENWIDTH, 1024); 
InBlock.gif   hge- System_SetState(HGE_SCREENHEIGHT, 768); 
InBlock.gif   hge- System_SetState(HGE_SCREENBPP, 32); 
InBlock.gif
InBlock.gif   try 
ExpandedSubBlockStart.gif   { 
InBlock.gif      hge- System_Initiate(); 
InBlock.gif      return true; 
ExpandedSubBlockEnd.gif   } 
InBlock.gif   catch(dot.gif
ExpandedSubBlockStart.gif   { 
InBlock.gif      return false; 
ExpandedSubBlockEnd.gif   } 
ExpandedBlockEnd.gif
None.gif
None.gifvoid CGlobal::DestroyHGE(void) 
ExpandedBlockStart.gif
InBlock.gif   hge- System_Shutdown(); 
InBlock.gif   hge- Release(); 
ExpandedBlockEnd.gif
None.gif
None.gifbool CGlobal::FrameFunction(void) 
ExpandedBlockStart.gif
InBlock.gif   if (hge- Input_GetKeyState(HGEK_ESCAPE)) 
InBlock.gif      return true; 
InBlock.gif   return false; 
ExpandedBlockEnd.gif}

Main.cpp 
None.gif#include "Global.h" 
None.gif
None.gifCGlobal* Main; 
None.gif
None.gifint WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) 
ExpandedBlockStart.gif
InBlock.gif   Main = new CGlobal(); 
InBlock.gif   if(!Main- InitHGE()) PostQuitMessage(1); 
InBlock.gif   Main- DestroyHGE(); 
InBlock.gif   delete Main; 
InBlock.gif   return 0; 
ExpandedBlockEnd.gif}
WPFのDecorator 、Adorner和AdornerDecorator 原文:WPFのDecorator 、Adorner和AdornerDecorator Decorator 和 Adorner 它们都有“装饰品”的意思。 Decorator类负责包装某个UI元素,以提供额外的行为。