mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 06:34:35 +00:00
examples/renderer/03-lines: Fix incorrect angle calculation rendering circle.
This fix was contributed by GitHub user hushangazar (thanks!). Closes #14599.
This commit is contained in:
parent
8e644111c2
commit
8be18741e1
1 changed files with 2 additions and 1 deletions
|
|
@ -77,8 +77,9 @@ SDL_AppResult SDL_AppIterate(void *appstate)
|
|||
const float size = 30.0f;
|
||||
const float x = 320.0f;
|
||||
const float y = 95.0f - (size / 2.0f);
|
||||
const float r = (float) ((double)i * (SDL_PI_F / 180.0));
|
||||
SDL_SetRenderDrawColor(renderer, SDL_rand(256), SDL_rand(256), SDL_rand(256), SDL_ALPHA_OPAQUE);
|
||||
SDL_RenderLine(renderer, x, y, x + SDL_sinf((float) i) * size, y + SDL_cosf((float) i) * size);
|
||||
SDL_RenderLine(renderer, x, y, x + SDL_cosf(r) * size, y + SDL_sinf(r) * size);
|
||||
}
|
||||
|
||||
SDL_RenderPresent(renderer); /* put it all on the screen! */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue