I'm working on an assignment that I need to move a sphere around the screen with the keyboard arrows. I got the movements working and all that. But I'm drawing a blank on an "if" statement to prevent the image from going off the screen when the edges are reached.
if (KEY_DOWN(VK_DOWN))
{
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0);
rect2.top = rect2.top + 1;
rect2.bottom = rect2.bottom + 1;
if (rect2.bottom > SCREEN_HEIGHT)
{
rect2.bottom = - 1;
}
}