SDL2/src/stdlib
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
..
SDL_crc16.c Removed the vi format comments from the source 2022-12-26 11:17:23 -08:00
SDL_crc32.c Removed the vi format comments from the source 2022-12-26 11:17:23 -08:00
SDL_getenv.c Removed the vi format comments from the source 2022-12-26 11:17:23 -08:00
SDL_iconv.c Remove underscore for _SDL_iconv_t 2022-12-27 12:41:09 -08:00
SDL_malloc.c Removed the vi format comments from the source 2022-12-26 11:17:23 -08:00
SDL_mslibc.c Removed the vi format comments from the source 2022-12-26 11:17:23 -08:00
SDL_qsort.c Removed the vi format comments from the source 2022-12-26 11:17:23 -08:00
SDL_stdlib.c Added SDL_modf() and SDL_modff() 2022-12-29 23:12:19 -08:00
SDL_string.c Added basic support for %g snprintf format specifier 2022-12-29 23:12:19 -08:00
SDL_strtokr.c Added precompiled header support for Visual Studio and Xcode (#6710) 2022-11-29 18:34:15 -08:00
SDL_vacopy.h Removed the vi format comments from the source 2022-12-26 11:17:23 -08:00