mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-31 14:29:14 +08:00
Update hardcoded value of pi to use SDL constant SDL_PI_F for improved consistency and readability.
This commit is contained in:
+6
-5
@@ -12,9 +12,10 @@
|
|||||||
|
|
||||||
/* Simple program: draw a RGB triangle, with texture */
|
/* Simple program: draw a RGB triangle, with texture */
|
||||||
|
|
||||||
#include <SDL3/SDL_test_common.h>
|
|
||||||
#include <SDL3/SDL_main.h>
|
|
||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test_common.h>
|
||||||
|
|
||||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||||
#include <emscripten/emscripten.h>
|
#include <emscripten/emscripten.h>
|
||||||
@@ -136,7 +137,7 @@ static void loop(void)
|
|||||||
cx += translate_cx;
|
cx += translate_cx;
|
||||||
cy += translate_cy;
|
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.x = cx + d * SDL_cosf(a);
|
||||||
verts[0].position.y = cy + d * SDL_sinf(a);
|
verts[0].position.y = cy + d * SDL_sinf(a);
|
||||||
verts[0].color.r = 1.0f;
|
verts[0].color.r = 1.0f;
|
||||||
@@ -144,7 +145,7 @@ static void loop(void)
|
|||||||
verts[0].color.b = 0;
|
verts[0].color.b = 0;
|
||||||
verts[0].color.a = 1.0f;
|
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.x = cx + d * SDL_cosf(a);
|
||||||
verts[1].position.y = cy + d * SDL_sinf(a);
|
verts[1].position.y = cy + d * SDL_sinf(a);
|
||||||
verts[1].color.r = 0;
|
verts[1].color.r = 0;
|
||||||
@@ -152,7 +153,7 @@ static void loop(void)
|
|||||||
verts[1].color.b = 0;
|
verts[1].color.b = 0;
|
||||||
verts[1].color.a = 1.0f;
|
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.x = cx + d * SDL_cosf(a);
|
||||||
verts[2].position.y = cy + d * SDL_sinf(a);
|
verts[2].position.y = cy + d * SDL_sinf(a);
|
||||||
verts[2].color.r = 0;
|
verts[2].color.r = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user