#include <windows.h>
#include "main.h"
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
LONG PRG_WIDTH = 500;
LONG PRG_HEIGHT = 400;
int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int iCmdShow)
{
MSG msg; static int trigger = 0;
int tickcount;
if ( init_game(hInstance,hPrevInstance,lpszArgument,iCmdShow) == TRUE )
{
while (TRUE)
{
if ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
if ( game->sleep == FALSE )
{
tickcount = GetTickCount();
if ( tickcount > trigger )
{
trigger = tickcount + game->framedelay;
handle_keys();
game_loop();
}
}
}
}
return (int)msg.wParam;
}
else
return FALSE;
game_end();
return TRUE;
}
LRESULT CALLBACK WindowProcedure (HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam)
{
return handle_event( hWindow, msg, wParam, lParam );
}