i need help with my array of colors. i have a simple program but i am trying to get the array to NOT display the same color twice. All input is welcome...
#include "DarkGDK.h"
void DarkGDK()
{
//set window title
dbSetWindowTitle("Array of Colors");
// Color constants
const DWORD RED = dbRGB(255, 0, 0);
const DWORD GREEN = dbRGB(0, 255, 0);
const DWORD BLUE = dbRGB(0, 0, 255);
const DWORD MAGENTA = dbRGB(255, 0, 255);
// Constant for time delay (half a second)
const int DELAY = 500;
// Constant for the array size
const int SIZE = 4;
// Array of colors
DWORD colors[SIZE] = { RED, GREEN, BLUE, MAGENTA };
// Variable to use as an array index
int index;
// Seed the random number generator.
dbRandomize( dbTimer() );
// Repeatedly clear the screen with random colors.
while ( LoopGDK() )
{
// Get a random number
index = dbRND( SIZE - 1 );
// Clear the screen to a random color.
dbCLS( colors[index] );
// Wait.
dbWait(DELAY);
}
}