Commit Graph

32 Commits (9c9e6e3aa3757d4e8deb8b56843c86ce6bedfa68)

Author SHA1 Message Date
Daniel Gibson 22e22ba196 Add SDL_main.h includes to tests
.. including cmake/test/*.c, whatever that does

(this is needed now because SDL.h doesn't include SDL_main.h anymore)
2022-12-15 08:01:01 -08:00
Sam Lantinga 8121bbd083 Convert ticks to 64-bit, added nanosecond precision to the API
Fixes https://github.com/libsdl-org/SDL/issues/5512
Fixes https://github.com/libsdl-org/SDL/issues/6731
2022-12-02 12:37:41 -08:00
Pierre Wendling 3c501b963d
Clang-Tidy fixes (#6725) 2022-12-01 13:07:03 -08:00
Sam Lantinga 5750bcb174
Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594
2022-11-30 12:51:59 -08:00
Sylvain Becker 6a2200823c
Cleanup add brace (#6545)
* Add braces after if conditions

* More add braces after if conditions

* Add braces after while() conditions

* Fix compilation because of macro being modified

* Add braces to for loop

* Add braces after if/goto

* Move comments up

* Remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements after merge

* Fix inconsistent patterns are xxx == NULL vs !xxx

* More "{}" for "if() break;"  and "if() continue;"

* More "{}" after if() short statement

* More "{}" after "if () return;" statement

* More fix inconsistent patterns are xxx == NULL vs !xxx

* Revert some modificaion on SDL_RLEaccel.c

* SDL_RLEaccel: no short statement

* Cleanup 'if' where the bracket is in a new line

* Cleanup 'while' where the bracket is in a new line

* Cleanup 'for' where the bracket is in a new line

* Cleanup 'else' where the bracket is in a new line
2022-11-27 08:38:43 -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
Sam Lantinga 63f307fe1f Remove SDL_config.h from the public headers
The SDL headers are no longer dependent on the build configuration.

Fixes https://github.com/libsdl-org/SDL/issues/6643 and https://github.com/libsdl-org/SDL/issues/6641
2022-11-26 04:48:36 -08:00
Ozkan Sezer 0b8309da0c renamed SDL PI constants to SDL_PI_D and SDL_PI_F. 2022-11-25 22:35:24 +03:00
Sam Lantinga 199423612c Updated test programs with SDL_M_PI* 2022-11-25 10:57:12 -08:00
Pierre Wendling 6784d84c9d N3DS: Fix `-Wformat` warnings in tests.
All warnings were about invalid specifiers. Since U/Sint32 is a long,
using `%d` emits a -Wformat warning.
2022-10-10 08:50:59 -07:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Brick f30e2e438d Fix compiler warnings in testvulkan.c
MSVC gives the following warnings when compiling testvulkan.c:
```
testvulkan.c(656,1): warning C4018: '<': signed/unsigned mismatch
testvulkan.c(656,1): warning C4018: '>': signed/unsigned mismatch
testvulkan.c(660,1): warning C4018: '<': signed/unsigned mismatch
testvulkan.c(660,1): warning C4018: '>': signed/unsigned mismatch
```
2021-10-06 15:24:41 -07:00
Ryan C. Gordon 79c7a1713f
testvulkan: reformatted to more-closely match SDL coding conventions. 2021-08-24 12:41:41 -04:00
Lionel Landwerlin b073d2753d test/vulkan: fix/workaround validation errors 2021-08-24 12:21:30 -04:00
Ryan C. Gordon abba181118
testvulkan: support multiple windows.
Fixes #4363.
2021-08-23 20:20:49 -04:00
David Gow fbc364908a Use the new SDL_clamp() macro where sensible
There were a few places throughout the SDL code where values were
clamped using SDL_min() and SDL_max(). Now that we have an SDL_clamp()
macro, use this instead.
2021-08-14 09:01:14 -07:00
David Gow 773e1ba19f testvulkan: Clamp the drawable size to the allowed range
SDL_Vulkan_GetDrawableSize() doesn't always return a size which is
within the Vulkan swapchain's allowed image extent range.

(This happens on X11 a lot when resizing, which is bug #3287)

Clamp the value we get back from SDL_Vulkan_GetDrawableSize() to this
range. Given the range usually is just a single value, this is almost
always equivalent to just using the min or max image extent, but this
seems logically most correct.
2021-08-08 18:06:15 -07:00
Christian Rauch b972258d56 test: remove unused variables and typedefs 2021-03-29 09:01:26 -07:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Ozkan Sezer 239c8f1f4c testvulkan.c: fix -Wmissing-braces warnings. also fix whitespace. 2020-12-24 00:28:50 +03:00
Ryan C. Gordon c3a32605f8 testvulkan: Patched to compile with SDL's internal Vulkan headers. 2020-11-09 04:55:15 -05:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Ryan C. Gordon 00e5eeb40e test: added SDLTest_CommonDefaultArgs()
This is for test apps that don't need custom command line arguments; it lets
us reduce the boilerplate code a tiny bit.
2019-05-19 01:45:15 -04:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Jeremy Ong a794126d56 vulkan: SDL_Vulkan_GetInstanceExtensions should accept a NULL window.
Fixes Bugzilla #4235.
2018-08-24 09:49:48 -04:00
Sam Lantinga e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga 37ce9f2773 Fixed typedef redefinition errors when including both SDL_vulkan.h and vulkan.h
You should always include vulkan/vulkan.h first, then include SDL_vulkan.h
2017-08-27 23:13:15 -07:00
Sam Lantinga 1f2e151b44 Added Vulkan support to the Visual Studio 2010 solution 2017-08-27 22:20:17 -07:00
Sam Lantinga 071e101837 We use the SDL Vulkan headers 2017-08-27 20:41:48 -07:00
Ryan C. Gordon c722e58d1f vulkan: Include a copy of vulkan.h and vk_platform.h.
Now we can provide Vulkan support in the build even if the build box doesn't
have a Vulkan SDK, since we dynamically link to the library anyhow.
2017-08-27 23:25:12 -04:00
Sam Lantinga 803fd6d526 Use SDL_Vulkan_GetDrawableSize() instead of SDL_GL_GetDrawableSize() 2017-08-27 19:32:08 -07:00
Ryan C. Gordon 25e3a1ec90 vulkan: Initial Vulkan support!
This work was done by Jacob Lifshay and Mark Callow; I'm just merging it
into revision control.
2017-08-27 22:15:57 -04:00