SDL/src/libm
Sam Lantinga 7f23d71b6a Added SDL_modf() and SDL_modff()
This function is useful for accumulating relative mouse motion if you want to only handle whole pixel movement.
e.g.
static float dx_frac, dy_frac;
float dx, dy;

/* Accumulate new motion with previous sub-pixel motion */
dx = event.motion.xrel + dx_frac;
dy = event.motion.yrel + dy_frac;

/* Split the integral and fractional motion, dx and dy will contain whole pixel deltas */
dx_frac = SDL_modff(dx, &dx);
dy_frac = SDL_modff(dy, &dy);
if (dx != 0.0f || dy != 0.0f) {
    ...
}
2022-12-29 23:12:19 -08:00
..
e_atan2.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
e_exp.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
e_fmod.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
e_log.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
e_log10.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
e_pow.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
e_rem_pio2.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
e_sqrt.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
k_cos.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
k_rem_pio2.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
k_sin.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
k_tan.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
math_libm.h Added SDL_modf() and SDL_modff() 2022-12-29 23:12:19 -08:00
math_private.h Added SDL_modf() and SDL_modff() 2022-12-29 23:12:19 -08:00
s_atan.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
s_copysign.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
s_cos.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
s_fabs.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
s_floor.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
s_modf.c Added SDL_modf() and SDL_modff() 2022-12-29 23:12:19 -08:00
s_scalbn.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
s_sin.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
s_tan.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00