API reference / Math
SDL_sinf
Function, SDL3
Gives the sine of an angle in radians.
Declaration
#include <SDL3/SDL.h>
float SDL_sinf(float x);Parameters
x | The angle in radians. |
Return value
The sine, from -1 to 1.
Example
samples[i] = volume * SDL_sinf(phase * 2.0f * SDL_PI_F);See this code run in Make a tone. Download the full program (.zip)
In Draw shapes
points[i].y = y + radius * SDL_sinf(angle);See this code run in Draw shapes. Download the full program (.zip)
In SDL2
The name is the same.