mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 06:34:35 +00:00
Simplified SDL random function names and added thread-safe versions
This commit is contained in:
parent
d013ac80ef
commit
96f2f23240
12 changed files with 167 additions and 90 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue