I havent had any classes in this except intro to C, so I am completly lost as to what to do.
I have FINALLY gotten the shapes on the screen, that was hard enough. Now Im focusing on making the pentagon move up/down/left/right with the arrow keys. I know I need to have WM_KEYDOWN, and there will be if statements, for if up is pressed, down, etc. but I dont know how to increment the array and have it repaint it with the updated array of points.(which is what needs to be done right?)
Please help me, Im totally lost and my teacher doesnt respond to emails
This is my callback function that i have so far:
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HDC hDC;
PAINTSTRUCT Ps;
HPEN hPen;
HPEN hPen2;
HPEN hPen3;
HFONT hFont;
int i;
static POINT PointArray[]={{375,450},{275,270},{175,450}};
static POINT PointArray2[]={{900,339},{805,270},{710,339},{746,451},{864,451}};
switch(msg)
{
case WM_PAINT:
hDC=BeginPaint(hwnd,&Ps);
hPen=CreatePen(PS_SOLID,10,RGB(20,20,200));
SelectObject(hDC,hPen);
Rectangle(hDC,455,270,635,450);
DeleteObject(hPen);
hPen2=CreatePen(PS_SOLID,10,RGB(200,20,20));
SelectObject(hDC,hPen2);
Polygon(hDC, PointArray, 3);
DeleteObject(hPen2);
hPen3=CreatePen(PS_SOLID,10,RGB(20,200,20));
SelectObject(hDC,hPen3);
Polygon(hDC, PointArray2, 5);
DeleteObject(hPen3);
case WM_KEYDOWN:
if(wParam==VK_UP)
{
}
InvalidateRect(hwnd,NULL,true);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}

New Topic/Question
Reply




MultiQuote





|