Works. Generates random grid
This commit is contained in:
@@ -30,22 +30,26 @@ int main()
|
||||
Vect2i pos = {0, 0};
|
||||
Vect2i vel = {1, 1};
|
||||
|
||||
const int DELAY = 33*pow(10,3);
|
||||
//hz
|
||||
const int FRAME_RATE = 30;
|
||||
|
||||
const int DELAY = (float)pow(10,6)/(float)FRAME_RATE;
|
||||
|
||||
Grid grid;
|
||||
initGrid(&grid, width, height);
|
||||
randomizeGrid(&grid);
|
||||
putPixel(&grid, pos.x, pos.y);
|
||||
|
||||
while (running) {
|
||||
clearGrid(&grid);
|
||||
putPixel(&grid, pos.x, pos.y);
|
||||
drawGrid(&grid);
|
||||
|
||||
refresh();
|
||||
|
||||
moveVect2i(&pos, vel.x, vel.y);
|
||||
contain(&pos.x, &vel.x, 0, width-1);
|
||||
contain(&pos.y, &vel.y, 0, height-1);
|
||||
//moveVect2i(&pos, vel.x, vel.y);
|
||||
//contain(&pos.x, &vel.x, 0, width-1);
|
||||
//contain(&pos.y, &vel.y, 0, height-1);
|
||||
|
||||
updateGrid(&grid);
|
||||
|
||||
usleep(DELAY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user