mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-30 01:38:45 +00:00
Fixed bug 5404 - stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf
Cameron Cawley stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf The default implementation is based on the one used in the Windows RT video driver.
This commit is contained in:
parent
d0b8295c0d
commit
93ccdee8c1
19 changed files with 105 additions and 19 deletions
|
|
@ -116,16 +116,6 @@ WINRT_TransformCursorPosition(SDL_Window * window,
|
|||
return outputPosition;
|
||||
}
|
||||
|
||||
static inline int
|
||||
_lround(float arg)
|
||||
{
|
||||
if (arg >= 0.0f) {
|
||||
return (int)floor(arg + 0.5f);
|
||||
} else {
|
||||
return (int)ceil(arg - 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
Uint8
|
||||
WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint ^pt)
|
||||
{
|
||||
|
|
@ -389,8 +379,8 @@ WINRT_ProcessMouseMovedEvent(SDL_Window * window, Windows::Devices::Input::Mouse
|
|||
window,
|
||||
0,
|
||||
1,
|
||||
_lround(mouseDeltaInSDLWindowCoords.X),
|
||||
_lround(mouseDeltaInSDLWindowCoords.Y));
|
||||
SDL_lroundf(mouseDeltaInSDLWindowCoords.X),
|
||||
SDL_lroundf(mouseDeltaInSDLWindowCoords.Y));
|
||||
}
|
||||
|
||||
#endif // SDL_VIDEO_DRIVER_WINRT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue