Anonymous Maarten
31d133db40
Define SDL_PLATFORM_* macros instead of underscored ones ( #8875 )
2024-01-24 01:40:51 +00:00
Sam Lantinga
e2f35a16c2
Added <string.h> for declaration of memset() and memcpy()
2024-01-21 06:55:29 -08:00
Sam Lantinga
7a069cc4b0
Allow optimizing memcpy and memset where possible
...
Modern C runtimes have well optimized memset and memcpy, so use those instead of dispatching into SDL's versions. In addition, some compilers can analyze memset and memcpy calls and directly turn them into optimized assembly.
2024-01-21 06:55:29 -08:00
Sam Lantinga
5b3ee51c6c
Updated copyright for 2024
2024-01-01 13:15:26 -08:00
Sam Lantinga
2faae8457d
The C standard defines a boolean expression as a signed integer value.
...
Microsoft came to the same conclusion:
https://devblogs.microsoft.com/oldnewthing/20110328-00/?p=11113
Fixes https://github.com/libsdl-org/SDL/issues/8761
2023-12-30 11:44:40 -08:00
Sam Lantinga
7681695875
Revert "Fixed signed/unsigned warnings with Visual Studio when comparing SDL_bool with boolean expressions"
...
This reverts commit 61db102da9
.
This causes the build to fail:
SDL_waylandwindow.c:1876:45: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
wind->fullscreen_was_positioned = SDL_TRUE;
2023-12-29 17:14:05 -08:00
Sam Lantinga
61db102da9
Fixed signed/unsigned warnings with Visual Studio when comparing SDL_bool with boolean expressions
2023-12-29 09:23:47 -08:00
Sam Lantinga
ac0751a652
Added SDL_strnstr()
2023-12-03 15:06:46 -08:00
Anonymous Maarten
d6291d4d42
alloca: use alloca from <stdlib.h> on NetBSD
...
The only generally portable way to do this is to use -std=gnu99,
"#include <stdlib.h>", and write "alloca".
__builtin_alloca does not seem to be available on NetBSD
2023-11-22 06:33:50 +03:00
Ozkan Sezer
39870031d1
use format string attributes for functions accepting va_list params, too
2023-11-17 15:56:10 +03:00
Ryan C. Gordon
c53843a961
docs: Remove Doxygen `\brief` tags.
...
Doxygen and the wiki bridge don't need them; they'll both just use the first
line/sentence instead.
Fixes #8446 .
2023-11-06 10:26:06 -05:00
Sam Lantinga
d07a264a9b
Use the default UCS2/UCS4 conversion rather than non-portable INTERNAL encoding
...
Fxies https://github.com/libsdl-org/SDL/issues/1497
2023-11-04 12:01:30 -07:00
Sam Lantinga
a76d8e39aa
Changed SDL_bool from an enum to unsigned int
...
Fixes https://github.com/libsdl-org/SDL/issues/7957
2023-11-03 09:54:04 -07:00
Anonymous Maarten
6127ac0871
Use SDL_DISABLE_ALLOCA instead of HAVE_ALLOCA in SDL_stdinc.h
2023-10-28 18:54:12 +02:00
Sam Lantinga
080b1dfbdb
Revert "Improved fallback for SDL_COMPILE_TIME_ASSERT() (thanks @icculus!)"
...
This reverts commit 9d453daa23
.
Oops, it totally doesn't work:
error: unused variable 'SDL_compile_time_assert_SDL_copyp' [-Werror=unused-variable]
2023-08-05 19:23:30 -07:00
Sam Lantinga
9d453daa23
Improved fallback for SDL_COMPILE_TIME_ASSERT() (thanks @icculus!)
2023-08-05 19:18:31 -07:00
Sam Lantinga
0a4e6f6d29
Added SDL_strnlen() and SDL_wcsnlen()
2023-07-17 19:37:51 -07:00
Sam Lantinga
f3d6320bac
Added SDL_strndup()
2023-07-16 04:32:12 -07:00
Sam Lantinga
f010411492
Rename SDL_strtokr() to SDL_strtok_r()
...
Fixes https://github.com/libsdl-org/SDL/issues/7914
2023-07-03 06:20:06 -07:00
Sam Lantinga
2e465ae31b
Revert "Added SDL_nextafter() and SDL_nextafterf()"
...
This reverts commit bc5d074818
.
It's not clear that we need these yet, so I'm going to remove them for now.
2023-06-14 11:05:10 -07:00
Sam Lantinga
bc5d074818
Added SDL_nextafter() and SDL_nextafterf()
2023-06-13 10:32:21 -07:00
Ozkan Sezer
a8a72de6fb
fix mingw build failures in CI with clang-tidy.
2023-05-26 23:55:04 +03:00
Sam Lantinga
c9d8a04945
Added SDL_swprintf() and SDL_vswprintf()
2023-05-26 08:19:04 -07:00
Sam Lantinga
6c28546828
Added SDL_wcstol()
2023-05-26 08:19:04 -07:00
Anonymous Maarten
b6ae281e97
Use #ifdef/#ifndef instead of #if defined/#if \!defined
2023-03-30 21:35:01 +00:00
Pierre Wendling
ea093378a2
Fix clang-tidy error on LLVM 16.
...
Starting LLVM 16, clang-diagnostic-implicit-function-declaration is
treated as an error.
2023-03-27 12:50:00 +03:00
SDL Wiki Bot
260dcb856e
Sync SDL3 wiki -> header
2023-02-28 17:27:14 +00:00
Eddy Jansson
5f5abb6805
Always allocate zt in output of SDL_iconv_string()
...
Before this, the function could not be used on buffers,
as it would not account for the zero-termination unless
it was included in the input.
2023-02-28 09:26:01 -08:00
Anonymous Maarten
549cedfa88
include: add \brief to includes
2023-02-19 10:01:33 -08:00
Sylvain
81c94a165c
Add \since docs where missing and resets some to 3.0.0
...
- remove a \returns
2023-02-12 20:43:11 +01:00
Sylvain
e9af964cf4
More `\param` added for SDL function in stdinc.h
2023-02-12 09:50:38 +01:00
Sylvain
ce366facaa
Add missing \returns, change "return" to "returns" to have same naming
2023-02-12 09:22:25 +01:00
Ryan C. Gordon
197340ea1c
Sync wiki -> headers.
2023-01-25 13:01:40 -05:00
Sam Lantinga
2aa9569b3e
Replaced SDL_SIMDAlloc(), SDL_SIMDRealloc(), and SDL_SIMDFree() with SDL_aligned_alloc() and SDL_aligned_free()
...
Fixes https://github.com/libsdl-org/SDL/issues/5641
2023-01-09 18:01:59 -08:00
Sam Lantinga
e9b86eebf3
Functions which return function pointers now return SDL_FunctionPointer instead of void*
...
This fixes the clang warning "Cast between pointer-to-function and pointer-to-object is an extension"
You can define SDL_FUNCTION_POINTER_IS_VOID_POINTER in your project to restore the previous behavior.
Fixes https://github.com/libsdl-org/SDL/issues/2866
2023-01-09 15:46:21 -08:00
Sam Lantinga
fde78d12f2
Updated copyright for 2023
2023-01-09 09:41:41 -08:00
Anonymous Maarten
f91a747549
include: SDL_dynapi.h depends on platform defines
2023-01-08 21:37:54 +01:00
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
Sylvain Becker
d7d3c22dbf
Remove more reserved identifiers ( #6925 )
2022-12-29 13:58:16 -08:00
Sylvain
25336d053a
Remove underscore for _SDL_iconv_t
...
And change the name, not to have the same for pointer and data
2022-12-27 12:41:09 -08:00
Sylvain
04f2820e07
Remove underscore for some SDL_ builtin function/macros
2022-12-27 11:34:58 -08:00
Sam Lantinga
63724c113b
Removed the vi format comments from the source
...
Vim users can use the [editorconfig plugin](https://github.com/editorconfig/editorconfig-vim ) to automatically set tab spacing for the SDL coding style.
Fixes https://github.com/libsdl-org/SDL/issues/6903
2022-12-26 11:17:23 -08:00
Ryan C. Gordon
3197632347
include: Renamed begin_code.h and close_code.h to have SDL_ prefixes.
...
Fixes #6864 .
2022-12-22 11:39:26 -05: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