#include<windows.h>
#include<windowsx.h>
#include<stdio.h>
#include<math.h>
#define WINDOW_CLASS_NAME "WINCLASS1"
LRESULT CALLBACK WindowProc(HWND hwnd,UINT msg,WPARARM wparam,LPARAM lparam)
{
PAINTSTRUCT ps;
HDC hdc;
switch(msg)
{
case WM_CREATE:
{
//INIT CODE
return(0);
} break;
case WM_PATIN:
{
hdc=BeginPaint(hwnd,&ps);
EndPaint(hwnd,&ps);
return(0);
} break;
case WM_DESTROY:
{
PostQuitMessage(0);
return(0);
}break;
default:break;
} //end WinProc
}
int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hprevinstance,LPSTR lpcmdline,int ncmdshow)
{
//首先是进行游戏初始化在开始
Game_Init();
WNDCLASSEX winclass;
HWND hwnd;
MSG msg;
winclass.cbsize=sizeof();
winclass.stylee=..;
//register window class
if(!(hwnd=CreateWindowEx(NULL,WINDOW_CLASS_NAME,"","",....);
return(0);
//进入主循环
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
//在此处进行游戏逻辑循环
Game_Main();
}
return (msg.wParam);
Game_ShutDown();
游戏关闭
}