///////////////////////////////////////////////////
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
// any windows programmer should be familiar with this
//将地图全部置为可到达
int i,j;
reachable=1;
for (j=0;j<Map[0].Hight;j++)
for (i=0;i<Map[0].Width;i++)
{
*(Map[0].Data+i*Map[0].Hight+j)=reachable;
}
for (j=0;j<Map[0].Hight;j++)
for (i=0;i<Map[0].Width;i++)
{
*(Map[0].Pro+i*Map[0].Hight+j)=select_pro;
}
//消息循环
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: Entry point to the program. Initializes everything and calls
// UpdateFrame() when idle from the message pump.
//-----------------------------------------------------------------------------
int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR pCmdLine, int nCmdShow )
{
MSG msg;
HWND hWnd;
while( TRUE )
{
// Look for messages, if none are found then
// update the state and display it
if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if( 0 == GetMessage(&msg, NULL, 0, 0 ) )
{
// WM_QUIT was posted, so exit
return (int)msg.wParam;
}
// Translate and dispatch the message
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
if( g_bActive )
{
// Move the sprites, blt them to the back buffer, then
// flip or blt the back buffer to the primary buffer
if( FAILED( ProcessNextFrame() ) )
{
SAFE_DELETE( g_pDisplay );
MessageBox( hWnd, TEXT("Displaying the next frame failed. ")
TEXT("The sample will now exit. "), TEXT("DirectDraw Sample"),
MB_ICONERROR | MB_OK );
return FALSE;
}
}
else
{
// Make sure we go to sleep if we have nothing else to do
WaitMessage();