I am working on a directx9 tutorial, I am able to count down from 255 to 0 which turns the background from bright blue to black however I want to count back up from 0 to 255 which turns the background form black to bright blue. Basically I want to count down and then back up and down again. I know this is a very simple question but I am very new to directx9
int x = 255;
// this is the function used to render a single frame
void render_frame(void)
{
// clear the window to a deep blue
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, x), 1.0f, 0);
x--;
d3ddev->BeginScene(); // begins the 3D scene
// do 3D rendering on the back buffer here
d3ddev->EndScene(); // ends the 3D scene
d3ddev->Present(NULL, NULL, NULL, NULL); // displays the created frame on the screen
}