游戏.主框架代码模型
来源:互联网 发布:adobe muse mac 网盘 编辑:程序博客网 时间:2024/05/16 02:28
/**************************************************
WinMain.cpp
游戏程序框架模型
blog:
http://blog.csdn.net/chinayaosir
**************************************************/
// Include files
#include <windows.h>
#include <stdio.h>
// Window handles, class and caption text
HWND g_hWnd;
HINSTANCE g_hInst;
static char g_szClass[] = "ShellClass";
static char g_szCaption[] = "Shell Application";
// Function prototypes
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, /
LPSTR szCmdLine, int nCmdShow);
long FAR PASCAL WindowProc(HWND hWnd, UINT uMsg, /
WPARAM wParam, LPARAM lParam);
BOOL DoInit();
BOOL DoFrame();
BOOL DoShutdown();
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, /
LPSTR szCmdLine, int nCmdShow)
{
WNDCLASSEX wcex;
MSG Msg;
g_hInst = hInst;
// Create the window class here and register it
wcex.cbSize = sizeof(wcex);
wcex.style = CS_CLASSDC;
wcex.lpfnWndProc = WindowProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInst;
wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = NULL;
wcex.lpszMenuName = NULL;
wcex.lpszClassName = g_szClass;
wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wcex))
return FALSE;
// Create the Main Window
g_hWnd = CreateWindow(g_szClass, g_szCaption,
WS_CAPTION | WS_SYSMENU,
0, 0, 400, 400,
NULL, NULL,
hInst, NULL );
if(!g_hWnd)
return FALSE;
ShowWindow(g_hWnd, SW_NORMAL);
UpdateWindow(g_hWnd);
// Run init function and return on error
if(DoInit() == FALSE)
return FALSE;
// Start message pump, waiting for signal to quit
ZeroMemory(&Msg, sizeof(MSG));
while(Msg.message != WM_QUIT) {
if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
if(DoFrame() == FALSE)
break;
}
// Run shutdown function
DoShutdown();
UnregisterClass(g_szClass, hInst);
return Msg.wParam;
}
long FAR PASCAL WindowProc(HWND hWnd, UINT uMsg, /
WPARAM wParam, LPARAM lParam)
{
switch(uMsg) {
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
BOOL DoInit()
{
return TRUE;
}
BOOL DoShutdown()
{
return TRUE;
}
BOOL DoFrame()
{
return TRUE;
}
- 游戏.主框架代码模型
- starUML建立模型及生成代码框架
- Orz游戏开发框架代码研究
- 代码笔记 | 一个简单的游戏框架
- odoo中根据模型生成viwe视图的框架代码
- unity,跟着大佬做第一个游戏(二,模型导入和游戏基本代码编写)
- unity3D 游戏开发之工程代码框架设计思路MVC
- DirectX游戏开发之代码的框架简析
- 我得第三篇博客(游戏框架代码)
- 游戏框架
- 游戏框架
- 游戏框架
- 在使用actor模型的游戏后端框架中添加单元测试
- J2ME 拼图游戏 快速开发 全过程 之代码祥解(2 )——游戏数据库与游戏模型开发
- 游戏中的消息模型
- 游戏小模型
- 简单游戏模型制作
- 游戏服务器模型
- 初探C# 异常处理
- java异常
- JDK 版本及命名
- ASP.NET正则表达式集合
- 浅谈Delphi开发经验
- 游戏.主框架代码模型
- ACPI 体系中的重要名词
- 健康提示:
- 40 个轻量级 JavaScript 库 (上)
- 关于未对齐指针释放问题(Non-aligned pointer being freed)
- 小草站长眼中的WEB2.0时代
- 事实证明,反应是无效的,石沉大海!
- 简单的文本复制
- 什么是"云计算",未来网络世界先锋