B
black(flashing vampire)
Hi all,
i'm trying to make my first windows tetris game but found a severe
problem. that is, everytime i update(redraw) the window it may be
filled with shaking lines. i checked some articles and also i have a
nice book "tricks of windows programming guru", but they both didnt
help.
here're parts of my code:
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// Do something...
while (1)
{
if (PeekMessage(&msg, hwndRoot, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
updateGame();
}
return FALSE;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
switch (message)
{
case WM_PAINT:
drawGame();
break;
case WM_KEYDOWN:
keyPressedGame(wParam);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
void updateGame()
{
// Do something...
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
and also i use UpdateWindow and
is there anything wrong ? btw i use GDI to draw objects in my game,
does it matter anyway ?
btw, how to mail to this group directly ? i have to post my message
via browser.
i'm trying to make my first windows tetris game but found a severe
problem. that is, everytime i update(redraw) the window it may be
filled with shaking lines. i checked some articles and also i have a
nice book "tricks of windows programming guru", but they both didnt
help.
here're parts of my code:
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// Do something...
while (1)
{
if (PeekMessage(&msg, hwndRoot, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
updateGame();
}
return FALSE;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
switch (message)
{
case WM_PAINT:
drawGame();
break;
case WM_KEYDOWN:
keyPressedGame(wParam);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
void updateGame()
{
// Do something...
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
and also i use UpdateWindow and
is there anything wrong ? btw i use GDI to draw objects in my game,
does it matter anyway ?
btw, how to mail to this group directly ? i have to post my message
via browser.