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
|
/* main.c */
#include <windows.h>
#include "Pong.h"
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE unused, LPSTR cmd, int show){
WNDCLASS wc = {0};
MSG msg;
wc.lpszClassName = TEXT( "Windows" );
wc.hInstance = hInst ;
wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
wc.lpfnWndProc = WndProc ;
wc.hCursor = LoadCursor(0,IDC_ARROW);
RegisterClass(&wc);
CreateWindow( wc.lpszClassName, TEXT(" :D"),
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 1000, 500, 0, 0, hInst, 0);
while( GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
switch(msg)
{
case WM_CREATE:
cpcInitialize(hwnd);
SetTimer (hwnd, 1, 50, 0);
break;
case WM_TIMER:
cpcBeginLoop(hwnd);
break;
case WM_PAINT:
cpcDraw(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
|