33,311
社区成员
发帖
与我相关
我的任务
分享
int WINAPI WinMain( HINSTANCE hinstance,HINSTANCE hprevinstance,LPSTR lpcmdline,int ncmdshow)
{
WNDCLASSEX winclass; // this will hold the class we create
HWND hwnd; // generic window handle
MSG msg; // generic message
HDC hdc; // graphics device context
winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc = WindowProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hinstance;
winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
winclass.hCursor = LoadCursor(NULL, IDC_ARROW);
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME;
winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
hinstance_app = hinstance;
if (!RegisterClassEx(&winclass))
return(0);
if (!(hwnd = CreateWindowEx(NULL,WINDOW_CLASS_NAME,"FLYsh_game",WS_POPUP|WS_VISIBLE,0,0,SCREEN_WIDTH,SCREEN_HEIGHT,NULL,NULL,hinstance,NULL)))
return(0);////////////////////////////////////////// ^----FLYsh_game(′°?úname)
main_window_handle = hwnd;// save main window handle
FLYsh mygame1(main_window_handle);
mygame1.FLYsh_Init();// initialize game here (ó??·è??ú1)
while(TRUE)
{if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
if (msg.message == WM_QUIT)
{break;}
TranslateMessage(&msg);
DispatchMessage(&msg);
} // end if
mygame1.FLYsh_Main(); // main game processing goes here (ó??·è??ú2)
} // end while
mygame1.FLYsh_Shutdown();// closedown game here (ó??·è??ú3)
return(msg.wParam);
} // end WinMain
/////////////////////////////////////WindowProc///////////////////////////////////////////////////
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
省略~
} // end WinProc
/////////////////////////////////////////////A . I/////////////////////////////////////////////////
void FLYsh::FLYsh_onEnterFrame()
{
static bool is_firs_run=true;
//FLYsh_rectangle(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,255,255,255);
if(is_firs_run)
{
for (int j=0;j<100;j++)
{
FLYsh_plot(156,200,70,500+j,500+j);
}
FLYsh_load_bitmap();
is_firs_run=false;
}
if (KEYDOWN(VK_ESCAPE)){
should_close_all=true;
}
}