C++源代码游戏编程--WinMain()函数集.doc
《C++源代码游戏编程--WinMain()函数集.doc》由会员分享,可在线阅读,更多相关《C++源代码游戏编程--WinMain()函数集.doc(7页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、C+源代码游戏编程-WinMain()函数集 C+源代码游戏编程-WinMain()函数交流/*/函数:WinMain()/功能:应用程序入口/*int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow) MSG msg; hInst=hInstance; /初始化主窗口 if (!InitWindow( hInstance, nCmdShow) return FALSE; /初始化DirectDraw环境 if (!InitDDraw() MessageBox(
2、hWndMain, 初始化DirectDraw过程中出错!, Error, MB_OK); FreeObjects(); DestroyWindow(hWndMain); return FALSE; /进入消息循环 while(1) if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) if(!GetMessage(&msg, NULL, 0, 0 ) return msg.wParam; TranslateMessage(&msg); DispatchMessage(&msg); else if(bActive) UpdateFrame(); else
3、WaitMessage(); return msg.wParam;/-/ Name: WinMain()/ Desc: Initialization, message loop/-int PASCALWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) MSG msg; if (InitApp(hInstance, nCmdShow) != DD_OK) return FALSE; while (GetMessage(&msg, NULL, 0, 0) TranslateMessage
4、(&msg); DispatchMessage(&msg); return msg.wParam;/ 主循环/int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) MSG msg; if(!InitApp(hInst, nCmdShow) return FALSE; while(1) if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) if(!GetMessage(&msg, NULL, 0, 0 ) return msg.wPara
5、m; TranslateMessage(&msg); DispatchMessage(&msg); else if(bActive) Update(); / 翻转上一层缓冲区内容到屏幕。 Screen-Flip(); else WaitMessage(); /int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow) / any windows programmer should be familiar with this MSG msg; lpCmdLine =
6、lpCmdLine; hPrevInstance = hPrevInstance; if(!doInit(hInstance, nCmdShow) return FALSE; while (1) if(PeekMessage(&msg, NULL, 0,0,PM_NOREMOVE) if(!GetMessage(&msg, NULL,0,0) return msg.wParam; TranslateMessage(&msg); DispatchMessage(&msg); else if(bActive) fire(480, 0, 600, 50); / draw fire on bottom
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C+ 源代码 游戏 编程 WinMain 函数
限制150内