|
@@ -25,7 +25,6 @@ int SDL_AppInit(void **appstate, int argc, char *argv[])
|
|
|
}
|
|
|
|
|
|
/* set up some random points */
|
|
|
- SDL_srand(0); /* seed the random number generator with current time */
|
|
|
for (i = 0; i < SDL_arraysize(points); i++) {
|
|
|
points[i].x = (SDL_randf() * 440.0f) + 100.0f;
|
|
|
points[i].y = (SDL_randf() * 280.0f) + 100.0f;
|
|
@@ -59,6 +58,10 @@ int SDL_AppIterate(void *appstate)
|
|
|
rect.h = 280;
|
|
|
SDL_RenderFillRect(renderer, &rect);
|
|
|
|
|
|
+ /* draw some points across the canvas. */
|
|
|
+ SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); /* red, full alpha */
|
|
|
+ SDL_RenderPoints(renderer, points, SDL_arraysize(points));
|
|
|
+
|
|
|
/* draw a unfilled rectangle in-set a little bit. */
|
|
|
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); /* green, full alpha */
|
|
|
rect.x += 30;
|
|
@@ -72,10 +75,6 @@ int SDL_AppIterate(void *appstate)
|
|
|
SDL_RenderLine(renderer, 0, 0, 640, 480);
|
|
|
SDL_RenderLine(renderer, 0, 480, 640, 0);
|
|
|
|
|
|
- /* draw some points across the canvas. */
|
|
|
- SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); /* red, full alpha */
|
|
|
- SDL_RenderPoints(renderer, points, SDL_arraysize(points));
|
|
|
-
|
|
|
SDL_RenderPresent(renderer); /* put it all on the screen! */
|
|
|
|
|
|
return SDL_APP_CONTINUE; /* carry on with the program! */
|