mirror of https://github.com/libsdl-org/SDL.git
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) {
...
}
|
||
|---|---|---|
| .. | ||
| SDL_build_config.h | ||
| SDL_build_config.h.cmake | ||
| SDL_build_config_android.h | ||
| SDL_build_config_emscripten.h | ||
| SDL_build_config_ios.h | ||
| SDL_build_config_macos.h | ||
| SDL_build_config_minimal.h | ||
| SDL_build_config_ngage.h | ||
| SDL_build_config_windows.h | ||
| SDL_build_config_wingdk.h | ||
| SDL_build_config_winrt.h | ||
| SDL_build_config_xbox.h | ||
| SDL_revision.h.cmake | ||