Commit Graph

1300 Commits (b33420cac7e999ed06054dd769b38a3b9d869e3d)

Author SHA1 Message Date
Ravbug 2d640d0b59
ci: Add iOS and tvOS CMake GitHub Actions checks (#9465)
- Also add watchos support to CMake (SDL does not support this platform yet)

Co-authored-by: Ravbug <ravbug@users.noreply.github.com>
Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2024-04-08 19:18:28 +02:00
Petar Popovic 764fe72449 SDL_time.h: Renaming enums SDL_DATE_FORMAT and SDL_TIME_FORMAT to SDL_DateFormat and SDL_TimeFormat 2024-04-07 23:03:01 -04:00
Sam Lantinga 5fa87e29e7 Removed SDL_RENDERER_ACCELERATED and SDL_RENDERER_SOFTWARE
These flags are unnecessary and have always been a source of confusion.
2024-04-04 13:30:49 -07:00
Ryan C. Gordon bc94451bed
testfilesystem: Add a '?' to the glob test, for a little more completeness. 2024-04-04 10:44:19 -04:00
Sam Lantinga 0abdc1a343 Renamed GLOBDIR to GLOB 2024-04-04 07:40:48 -07:00
Ryan C. Gordon 764207d873 filesystem: Added SDL_GlobDirectory() and SDL_GlobStorageDirectory().
Fixes #9287.
2024-04-04 09:40:13 -04:00
Sam Lantinga a82ed82bc7 SDL_QueryTexture() fills in a pointer to SDL_PixelFormatEnum 2024-04-01 15:45:22 -07:00
Sam Lantinga 8847b35244 Separate joystick power state into battery status and percentage
This allows you to see battery percentage while the controller is charging
2024-04-01 13:59:00 -07:00
Anonymous Maarten 72cf9c0ef4 test: don't run testautomation in parallel 2024-03-29 21:11:35 +01:00
Ryan C. Gordon 38e3c6a4aa
main: Add an optional `appstate` param to main callback entry points.
This allows apps to maintain state data without using global variables.

Fixes #9377.
2024-03-27 17:22:08 -04:00
Frank Praznik a7df28201b Revert "testautomation: fix renderer leak in video tests"
This reverts commit 2f13f66c71.

Not needed if renderers are once again implicitly cleaned up when their associated windows are destroyed.
2024-03-26 13:10:14 -07:00
Sam Lantinga f1f24b173c Added support for multiple distinct keyboards 2024-03-25 20:41:05 -07:00
Anonymous Maarten a65982e15d testevdev: include SDL_internal.h first, and fixup SDL_main.h 2024-03-26 00:10:40 +01:00
Cameron Gutman f14fb979c1 Remove legacy SDL2 input grab API 2024-03-24 16:53:23 -07:00
Christoph Reichenbach 0df0462d0a Removed all tabs in testautomation_pen.c 2024-03-24 05:05:30 -07:00
Christoph Reichenbach 615c7efd98 Fix #9279: Memory leak in pen name handling
- Fixes a leak in pen name allocation that would trigger
  for both X11 and Wayland for some non-pen input devices
  when new devices are added/removed.
- SDL_PenQuit() now deallocates and resets the table of known pens
- testautomation_pen.c now uses PenInit and PenQuit as setup and
  teardown, respectively

testautomation_pen.c was already triggering the leak, and it is
visible with --trackmem, so no new tests are added.
2024-03-24 05:04:53 -07:00
Anonymous Maarten 89b135e570 cmake: add automation and platform test without simd 2024-03-23 16:36:44 -07:00
Sam Lantinga 208cd434b5 Show the names of mice and keyboards when they connect 2024-03-23 16:31:00 -07:00
Sam Lantinga 6604d423fd Added a test program for multiple mice 2024-03-23 16:31:00 -07:00
Sam Lantinga d1eb4adb16 Be explicit about the event mouse and keyboard ID 2024-03-23 16:31:00 -07:00
Sam Lantinga 2fe1a6a279 Initial support for hotplugging mice and keyboards 2024-03-23 16:31:00 -07:00
Anonymous Maarten 75a71bde4b cmake: build tests against installed SDL prefix 2024-03-23 21:41:20 +01:00
Anonymous Maarten 7f888f98f7 gles2: only build tests when building SDL3 or when the headers are available 2024-03-23 21:41:20 +01:00
Anonymous Maarten c493b40cc3 testffmpeg_vulkan: fix -Wincompatible-pointer-types warning
```
[1/1] Building C object test/CMakeFiles/testffmpeg.dir/testffmpeg_vulkan.c.o
/src/SDL/test/testffmpeg_vulkan.c: In function ‘BeginVulkanFrameRendering’:
/src/SDL/test/testffmpeg_vulkan.c:787:20: warning: passing argument 1 of ‘vk->lock_frame’ from incompatible pointer type [-Wincompatible-pointer-types]
  787 |     vk->lock_frame(frames, pVkFrame);
      |                    ^~~~~~
      |                    |
      |                    AVHWFramesContext *
/src/SDL/test/testffmpeg_vulkan.c:787:20: note: expected ‘struct AVHWFramesContext *’ but argument is of type ‘AVHWFramesContext *’
/src/SDL/test/testffmpeg_vulkan.c: In function ‘FinishVulkanFrameRendering’:
/src/SDL/test/testffmpeg_vulkan.c:885:22: warning: passing argument 1 of ‘vk->unlock_frame’ from incompatible pointer type [-Wincompatible-pointer-types]
  885 |     vk->unlock_frame(frames, pVkFrame);
      |                      ^~~~~~
      |                      |
      |                      AVHWFramesContext *
/src/SDL/test/testffmpeg_vulkan.c:885:22: note: expected ‘struct AVHWFramesContext *’ but argument is of type ‘AVHWFramesContext *’
```
2024-03-22 11:05:13 -07:00
Sam Lantinga 18feaa52dd Fixed comment at the top of testtime.c 2024-03-19 17:09:08 -07:00
Sam Lantinga e0ef4dac85 Fixed int to float conversion warnings 2024-03-19 17:07:52 -07:00
Sam Lantinga 3316587113 Fixed warning C4389: '==': signed/unsigned mismatch 2024-03-19 17:04:29 -07:00
Frank Praznik a6fbf0488c Add time and realtime clock functions
Adds functions to query the system's realtime clock, convert time intervals to/from a calendar date and time in either UTC or the local time, and perform time related calculations.

An SDL_Time type (a time interval represented in nanoseconds), and SDL_DateTime struct (broken down calendar date and time) were added to facilitate this functionality.

Querying the system time results in a value expressed in nanoseconds since the Unix epoch (Jan 1, 1970) in UTC +0000. Conversions to and from the various platform epochs and units are performed when required.

Any direct handling of timezones and DST were intentionally avoided. The offset from UTC is provided when converting from UTC to a local time by calculating the difference between the original UTC and the resulting local time, but no other timezone or DST information is used.

The preferred date formatting and 12/24 hour time for the system locale can be retrieved via global preferences.

Helper functions for obtaining the day of week or day or year for calendar date, and getting the number of days in a month in a given year are provided for convenience. These are simple, but useful for performing various time related calculations.

An automated test for time conversion is included, as is a simple standalone test to display the current system date and time onscreen along with a calendar, the rendering of which demonstrates the use of the utility functions (press up/down to increment or decrement the current month, and keys 1-5 to change the date and time formats).
2024-03-19 10:57:36 -07:00
Anonymous Maarten f59dbf6a12 cmake: add -Wimplicit-fallthrough warning 2024-03-18 20:34:50 +01:00
Sam Lantinga a1a0156756 Renamed SDL_SizeIO() SDL_GetIOSize() 2024-03-18 00:27:18 -04:00
Sam Lantinga df0f5deddf Added SDL_IOFromDynamicMem() 2024-03-18 00:27:18 -04:00
Sam Lantinga d65ae710a1 Renamed SDL_LogGetOutputFunction() and SDL_LogSetOutputFunction() to match SDL 3.0 naming convention 2024-03-17 12:28:11 -07:00
Petar Popovic 4ecea42fb0 testautomation_math.c: use isinf(V) instead of fpclassify(V) == FP_INFINITE
Using fpclassify can cause a linker error.
Using isinf instead fixes this.
2024-03-17 11:12:09 -07:00
Sam Lantinga 7a088527c1 Removed the reserved parameter from SDL_EnumerateDirectoryCallback
If someone needs to, say, include an SDL_Storage object, they can simply point userdata at a structure that includes the the storage and any other data needed in enumeration.
2024-03-17 08:39:43 -07:00
Sam Lantinga db0c1d7aeb Added portable file and directory operations (thanks @icculus!) 2024-03-17 08:39:43 -07:00
Anonymous Maarten e5812a9fd2 testpen: don't include math.h 2024-03-16 20:37:31 +01:00
Anonymous Maarten 2f13f66c71 testautomation: fix renderer leak in video tests 2024-03-16 11:59:04 -07:00
Anonymous Maarten db31367999 testffmpeg: use SDL_free instead of free 2024-03-15 21:26:40 +01:00
Anonymous Maarten f8c2ec5462 testffmpeg: use Uint64 instead of __u64 2024-03-15 21:26:40 +01:00
Ryan C. Gordon 5a21d87e69
rwops: Changed filenames that reference "rwops" to "iostream". 2024-03-14 23:30:59 -04:00
Ryan C. Gordon fc7afa9cbf
rwops: Renamed SDL_RWops to SDL_IOStream, and other related symbols. 2024-03-14 19:38:12 -04:00
Ryan C. Gordon 7d4d8ccde0
rwops: Rename everything from SDL_RWxxx to SDL_XxxRW. 2024-03-14 19:37:04 -04:00
Ryan C. Gordon 655ceb3b31
rwops: Renamed SDL_CreateRW and SDL_DestroyRW to SDL_OpenRW and SDL_CloseRW. 2024-03-14 19:37:01 -04:00
Ryan C. Gordon 525919b315
rwops: Reworked RWops for SDL3.
- SDL_RWops is now an opaque struct.
- SDL_AllocRW is gone. If an app is creating a custom RWops, they pass the
  function pointers to SDL_CreateRW(), which are stored internally.
- SDL_RWclose is gone, there is only SDL_DestroyRW(), which calls the
  implementation's `->close` method before freeing other things.
- There is only one path to create and use RWops now, so we don't have to
  worry about whether `->close` will call SDL_DestroyRW, or if this will
  risk any Properties not being released, etc.
- SDL_RWFrom* still works as expected, for getting a RWops without having
  to supply your own implementation. Objects from these functions are also
  destroyed with SDL_DestroyRW.
- Lots of other cleanup and SDL3ization of the library code.
2024-03-14 19:36:08 -04:00
Semphris 70c2e15615 Add file dialogs 2024-03-14 15:40:25 -07:00
Sam Lantinga 209a87bf24 Added missing default case (thanks @sezero!) 2024-03-14 08:52:59 -07:00
Sam Lantinga 41b7036f37 testffmpeg: added support for EGL OES frame formats 2024-03-12 16:13:04 -07:00
Sam Lantinga d78a24a5ce testffmpeg: added verbose logging of ffmpeg messages 2024-03-11 15:48:52 -07:00
Sam Lantinga 7c5f79e7ea testffmpeg: removed redundant enumeration of hardware device types 2024-03-11 15:31:47 -07:00
Anonymous Maarten bee8a95571 Fix SDL_LEAN_AND_MEAN build 2024-03-11 13:46:16 -07:00