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) {
...
}
This commit is contained in:
@@ -27,16 +27,17 @@
|
||||
/* Math routines from uClibc: http://www.uclibc.org */
|
||||
|
||||
double SDL_uclibc_atan(double x);
|
||||
double SDL_uclibc_atan2(double y, double x);
|
||||
double SDL_uclibc_copysign(double x, double y);
|
||||
double SDL_uclibc_cos(double x);
|
||||
double SDL_uclibc_atan2(double y, double x);
|
||||
double SDL_uclibc_copysign(double x, double y);
|
||||
double SDL_uclibc_cos(double x);
|
||||
double SDL_uclibc_exp(double x);
|
||||
double SDL_uclibc_fabs(double x);
|
||||
double SDL_uclibc_fabs(double x);
|
||||
double SDL_uclibc_floor(double x);
|
||||
double SDL_uclibc_fmod(double x, double y);
|
||||
double SDL_uclibc_log(double x);
|
||||
double SDL_uclibc_log10(double x);
|
||||
double SDL_uclibc_pow(double x, double y);
|
||||
double SDL_uclibc_modf(double x, double *y);
|
||||
double SDL_uclibc_pow(double x, double y);
|
||||
double SDL_uclibc_scalbn(double x, int n);
|
||||
double SDL_uclibc_sin(double x);
|
||||
double SDL_uclibc_sqrt(double x);
|
||||
|
||||
Reference in New Issue
Block a user