_
O.K. ...
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HBITMAP hBitmap;
static HINSTANCE hInstance;
static HDC hdc,hdcmem;
static PAINTSTRUCT ps;
static cBall ball1(12);
static int cy=10;
static int ce=1;
switch (message) /* handle the messages */
{
case WM_CREATE:
hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
hBitmap = LoadBitmap (hInstance, "BALLBMP");
break;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps);
hdcmem = CreateCompatibleDC (hdc);
SelectObject (hdcmem, hBitmap);
BitBlt (hdc, ball1.GetXpos(),ball1.GetYpos(),32,32,hdcmem,0,0,SRCCOPY);
DeleteDC (hdcmem);
EndPaint (hwnd, &ps);
return 0;
case WM_TIMER:
//ball1.SetYpos(100);
ce=ball1.GetEnergie();
cy=ball1.GetYpos();
cy=cy+ce;
ball1.SetYpos(cy);
ce=ce+0.1;
ball1.SetEnergie(ce);
RECT test;
test.left = 0;
test.top = 0;
test.right =500;
test.bottom =500;
InvalidateRect(hwnd,&test,false);
break;
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
DeleteObject (hBitmap);
break;
default: /* for messages that we don't deal with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
so Funktionierts auch.
Gibts da noch was zu verbessern?? bzw. is jetzt noch was da was grundsätzlich
schlechter C++ stil ist???