mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-20 22:35:41 +00:00
Simplified SDL random function names and added thread-safe versions
This commit is contained in:
@@ -74,8 +74,8 @@ static void DrawPoints(SDL_Renderer *renderer)
|
||||
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
|
||||
(Uint8)current_color, (Uint8)current_alpha);
|
||||
|
||||
x = (float)SDL_rand_n(viewport.w);
|
||||
y = (float)SDL_rand_n(viewport.h);
|
||||
x = (float)SDL_rand(viewport.w);
|
||||
y = (float)SDL_rand(viewport.h);
|
||||
SDL_RenderPoint(renderer, x, y);
|
||||
}
|
||||
}
|
||||
@@ -231,20 +231,20 @@ static void loop(void *arg)
|
||||
break;
|
||||
case SDLK_l:
|
||||
add_line(
|
||||
(float)SDL_rand_n(640),
|
||||
(float)SDL_rand_n(480),
|
||||
(float)SDL_rand_n(640),
|
||||
(float)SDL_rand_n(480));
|
||||
(float)SDL_rand(640),
|
||||
(float)SDL_rand(480),
|
||||
(float)SDL_rand(640),
|
||||
(float)SDL_rand(480));
|
||||
break;
|
||||
case SDLK_R:
|
||||
num_rects = 0;
|
||||
break;
|
||||
case SDLK_r:
|
||||
add_rect(
|
||||
(float)SDL_rand_n(640),
|
||||
(float)SDL_rand_n(480),
|
||||
(float)SDL_rand_n(640),
|
||||
(float)SDL_rand_n(480));
|
||||
(float)SDL_rand(640),
|
||||
(float)SDL_rand(480),
|
||||
(float)SDL_rand(640),
|
||||
(float)SDL_rand(480));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user