-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (49 loc) · 1.17 KB
/
main.cpp
File metadata and controls
59 lines (49 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <Windows.h>
#include "config.h"
//响应函数原型
LRESULT CALLBACK WindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
//入口
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wnc = {};
wnc.style = cstyle;
wnc.lpfnWndProc = WindowProc;
wnc.cbClsExtra = ccbClsExtra;
wnc.cbWndExtra = ccbWndExtra;
wnc.hInstance = hInstance;
wnc.hIcon = chIcon;
wnc.hCursor = chCursor;
wnc.hbrBackground = chbrBackground;
wnc.lpszMenuName = clpszMenuName;
wnc.lpszClassName = className;
if (!RegisterClass(&wnc))
{
MessageBox(NULL, TEXT("无法注册窗口类"), TEXT("错误"), MB_ICONERROR);
return 0;
}
G_hwnd = CreateWindow(className,wndTittle,wndStyle,wndx,wndy,wndWidth,wndHeight,wndParent,wndMenu,hInstance,wndParam);
if (G_hwnd == NULL)
{
MessageBox(NULL, TEXT("窗口创建失败"), TEXT("错误"), MB_ICONERROR);
return 0;
}
ShowWindow(G_hwnd, SW_SHOW);
UpdateWindow(G_hwnd);
myGame.InitializeGame(G_hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}