Update hardcoded value of pi to use SDL constant SDL_PI_F for improved consistency and readability.

main
Nour Fouad 2024-03-09 04:46:35 +02:00 committed by Sam Lantinga
parent fcb132b8e8
commit b6c5ad0075
1 changed files with 6 additions and 5 deletions

View File

@ -12,9 +12,10 @@
/* Simple program: draw a RGB triangle, with texture */
#include <SDL3/SDL_test_common.h>
#include <SDL3/SDL_main.h>
#include "testutils.h"
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3/SDL_test_common.h>
#ifdef SDL_PLATFORM_EMSCRIPTEN
#include <emscripten/emscripten.h>
@ -136,7 +137,7 @@ static void loop(void)
cx += translate_cx;
cy += translate_cy;
a = (angle * 3.1415f) / 180.0f;
a = (angle * SDL_PI_F) / 180.0f;
verts[0].position.x = cx + d * SDL_cosf(a);
verts[0].position.y = cy + d * SDL_sinf(a);
verts[0].color.r = 1.0f;
@ -144,7 +145,7 @@ static void loop(void)
verts[0].color.b = 0;
verts[0].color.a = 1.0f;
a = ((angle + 120) * 3.1415f) / 180.0f;
a = ((angle + 120) * SDL_PI_F) / 180.0f;
verts[1].position.x = cx + d * SDL_cosf(a);
verts[1].position.y = cy + d * SDL_sinf(a);
verts[1].color.r = 0;
@ -152,7 +153,7 @@ static void loop(void)
verts[1].color.b = 0;
verts[1].color.a = 1.0f;
a = ((angle + 240) * 3.1415f) / 180.0f;
a = ((angle + 240) * SDL_PI_F) / 180.0f;
verts[2].position.x = cx + d * SDL_cosf(a);
verts[2].position.y = cy + d * SDL_sinf(a);
verts[2].color.r = 0;