|
|
请求,用MFC做游戏,怎么开始,怎么结束,哪里开始,哪里结束?
就这个问题我搜了一下,有两个答案:
第一个、BOOL CMy123App::InitInstance()
{
。。。。。。
MSG msg;
//开始
g.Game_Init();
while(1)
{
if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
{
if(!GetMessage(&msg,NULL,0,0))
{ //结束
g.Game_Shutdown();
return msg.wParam;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{ //运行
g.Game_Main();
}
}
。。。。。。。。
}
第二个、
BOOL CMy123App::InitInstance()
{
。。。。。。。
//开始
g.Game_Init();
。。。。。。
}
int CMy123App::ExitInstance()
{
//结束
g.Game_Shutdown();
return CWinApp::ExitInstance();
}
但我这两个办法都不行,程序不能正常结束。
有劳各位告诉以下,谢谢! |
|