I'm using the following loop to draw random pixels on the screen, but the loop makes the application freeze....anyone know how to avoid this...
Code:
Code:int index; for (index = 0;index<512; index++) { int randomcol= 0; randomcol = rand()%2; if (randomcol == 1) { SetPixel(hdc,rand()%WINDOW_WIDTH,rand()%WINDOW_HEIGHT, RGB(0,0,0)); } if (randomcol=2) { SetPixel(hdc,rand()%WINDOW_WIDTH,rand()%WINDOW_HEIGHT, RGB(255,255,255)); Sleep(2); if (index >510) { index = 0; } }




Reply With Quote