Commit graph

14 commits

Author SHA1 Message Date
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
Sam Lantinga 0a48abc860 Switch header convention from #include "SDL.h" to #include <SDL3/SDLh>
I ran this script in the include directory:
```sh
sed -i '' -e 's,#include "\(SDL.*\)",#include <SDL3/\1>,' *.h
```

I ran this script in the src directory:
```sh
for i in ../include/SDL3/SDL*.h
do hdr=$(basename $i)
   if [ x"$(echo $hdr | egrep 'SDL_main|SDL_name|SDL_test|SDL_syswm|SDL_opengl|SDL_egl|SDL_vulkan')" != x ]; then
        find . -type f -exec sed -i '' -e 's,#include "\('$hdr'\)",#include <SDL3/\1>,' {} \;
    else
        find . -type f -exec sed -i '' -e '/#include "'$hdr'"/d' {} \;
    fi
done
```

Fixes https://github.com/libsdl-org/SDL/issues/6575
2022-11-26 22:15:18 -08:00
Pierre Wendling 655275378d N3DS port (squashed)
A dedicated renderer using Citro3D would likely allow for better
much better graphical performances.
2022-10-10 08:50:59 -07:00
Francisco Javier Trujillo Mata f0a05ed476 Add some PS2 flags 2022-06-15 15:15:26 -07:00
Cameron Cawley b398a847be Add SDL_FLOATWORDORDER for older ARM toolchains 2022-05-04 09:52:11 -07:00
Wouter Wijsman a79b642638 Make SDL2 able to build or PSP with cmake 2021-12-07 14:03:00 +03:00
Sylvain Becker d4a67e2541 Readability: change some pointer parameter to be pointer to const 2019-10-30 16:06:51 +01:00
Ryan C. Gordon 550437edbe libm: Fixed all static analysis warnings. 2018-08-08 12:13:56 -04:00
Ethan Lee b4fe7412f9 SDL_exp 2018-08-04 11:52:46 -04:00
Ryan C. Gordon 1089944bee libm: Fixed signature mismatches for __ieee754_rem_pio2 and __kernel_rem_pio2.
Fixes Bugzilla #4201.
2018-07-22 19:40:42 -04:00
Ethan Lee 11c348b4d7 SDL_log10 2018-01-17 11:53:09 -05:00
Sam Lantinga 5f38b5d705 Fixed bug 3979 - Failed to link with "multiple definition of `scalbln'" error on both MinGW and MinGW-w64 by CMake
Vitaly Novichkov

Once I ran build of my codecs collection on AppVeyor where my CMake script downloads latest SDL2 from HG repo, failed to link because of math functions conflict:

https://ci.appveyor.com/project/Wohlstand/audiocodecs/build/1.0.44
The revision is b9ff5f8b2303

There are both vanilla MinGW and MinGW-w64 are failed to build.


```
[100%] Linking C shared library libSDL2.dll
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libmingwex.a(scalbn.o):(.text+0x0): multiple definition of `scalbln'
CMakeFiles\SDL2.dir/objects.a(s_scalbn.c.obj):C:/projects/audiocodecs/build-MinGW-Release-Win32/external/SDL2/src/SDL2HG/src/libm/s_scalbn.c:30: first defined here
2017-11-24 03:01:07 -08:00
Sam Lantinga 6cf065753c Updated math code from the uClibc 0.9.33 release 2017-11-04 15:53:19 -07:00
Philipp Wiesemann 0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00