Commit Graph

43 Commits (566d14293849e74910e0c793784fcc67cb355122)

Author SHA1 Message Date
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
Ryan C. Gordon 5a21d87e69
rwops: Changed filenames that reference "rwops" to "iostream". 2024-03-14 23:30:59 -04:00
Sam Lantinga 12bdb2b4d0 Added the environment variable SDL_LOGGING to control default log output 2024-01-27 19:30:22 -08:00
Sam Lantinga d6fb0d91d8 Added testpen to the Visual Studio solution 2023-12-26 09:55:09 -08:00
Christoph Reichenbach 7c80ac6df7 API for pressure-sensitive pens + XInput2/Wayland
This patch adds an API for querying pressure-
sensitive pens, cf. SDL_pen.h:
- Enumerate all pens
- Get pen capabilities, names, GUIDs
- Distinguishes pens and erasers
- Distinguish attached and detached pens
- Pressure and tilt support
- Rotation, distance, throttle wheel support
  (throttle wheel untested)
- Pen type and meta-information reporting
  (partially tested)

Pen event reporting:
- Three new event structures: PenTip, PenMotion, and
  PenButton
- Report location with sub-pixel precision
- Include axis and button status, is-eraser flag

Internal pen tracker, intended to be independent
of platform APIs, cf. SDL_pen_c.h:
- Track known pens
- Handle pen hotplugging

Automatic test:
- testautomation_pen.c

Other features:
- XInput2 implementation, incl. hotplugging
- Wayland implementation, incl. hotplugging
- Backward compatibility: pen events default to
  emulating pens with mouse ID SDL_PEN_MOUSEID
- Can be toggled via SDL_HINT_PEN_NOT_MOUSE
- Test/demo program (testpen)
- Wacom pen feature identification by pen ID

Acknowledgements:
- Ping Cheng (Wacom) provided extensive feedback
  on Wacom pen features and detection so that
  hopefully untested Wacom devices have a
  realistic chance of working out of the box.
2023-11-12 09:52:02 -08:00
Sam Lantinga fd4a2cce9e SDL_syswm.h has been removed and replaced with window properties 2023-11-08 12:01:48 -08:00
Ivan Mogilko c4bf05fd9d Added subsystem refcount tests to testautomation 2023-11-04 00:52:08 -07:00
Sam Lantinga 973c8b3273 Added SDL properties API
Fixes https://github.com/libsdl-org/SDL/issues/7799
2023-10-11 22:38:00 -07:00
Sam Lantinga 505a8dfb15 testcontroller replaces gamepadmap 2023-07-16 04:32:12 -07:00
Sam Lantinga ca492dff18 Renamed testgamepad to testcontroller
The program does more than just test gamepads, and will eventually map them as well.
2023-07-16 04:32:12 -07:00
Sam Lantinga d2d26c7b1e testgamepad replaces testjoystick 2023-07-16 04:32:12 -07:00
Sam Lantinga 8f5ec2f596 Added shared code between testgamepad and gamepadmap
The goal is to eventually create a single program that can do mapping and testing of game controllers.
2023-07-09 19:24:36 -07:00
Anonymous Maarten 5775d5e112 Add intrinsics test automation 2023-03-21 23:03:02 +03:00
Anonymous Maarten 4a6528e3f0 testprograms: parse arguments using SDLTest_CommonState 2023-03-17 17:54:16 +01:00
Sam Lantinga 364db52ca3 Moved testautomation data out of SDL_test library 2023-01-26 10:25:44 -08:00
Sam Lantinga 1d956c2817 Rename SDL2 tests for SDL3 2023-01-03 11:54:35 -08:00
Sam Lantinga 659abc721a SDL API renaming: SDL_gamecontroller.h
SDL_gamecontroller.h has been renamed SDL_gamepad.h, and all APIs have been renamed to match.

Fixes https://github.com/libsdl-org/SDL/issues/6885
2022-12-27 09:47:24 -08:00
Daniel Gibson 2aee3e654d Remove SDL_main from VS Solutions in VisualC/ and VisualC-GDK/
and update README-visualc.md and README-gdk.md accordingly

Also moved src/main/windows/version.rc to src/core/windows/
and adjusted VS solutions, CMakeLists.txt and versioning scripts
in build-scripts/ accordingly.

This will eventually allow us to remove all of src/main/

# Conflicts:
#	VisualC/tests/testgesture/testgesture.vcxproj
2022-12-15 08:01:01 -08:00
Ryan C. Gordon a76053352c
gesture: Removed the gesture API from SDL3.
Fixes #6758.
2022-12-13 14:54:37 -05:00
Sylvain Becker 92cd2c0a74
Enable creation of yuv SDL_Surfaces (#6735) 2022-12-02 12:53:48 -08:00
Sam Lantinga c2432f8d0d Rename SDLmain to SDL_main and SDLtest to SDL_test for consistency with other SDL libraries 2022-11-28 10:57:59 -08:00
Sam Lantinga 7e2a996958 Added a virtual joystick automated test
Useful to verify 4fa2653394 on a big-endian system
2022-07-13 08:58:15 -07:00
Cameron Cawley 0a600b1df4
Merge testguid into testautomation (#5873) 2022-07-01 16:27:51 -07:00
Sam Lantinga e9d5060c4c checkkeys will now render text that is input
Also added test functions for multi-line debug text display

Currently this only supports ASCII, as the font doesn't have the correct Latin-1 characters
2022-07-01 12:56:47 -07:00
Pierre Wendling 6208ed8604 Test: Add math suite to Visual Studio solution. 2022-06-15 12:05:30 -07:00
Simon McVittie 76a7b629bf test: Add some common code to load test resources
As well as reducing duplication, this lets the tests load their resources
from the SDL_GetBasePath() on platforms that support it, which is useful
if the tests are compiled along with the rest of SDL and installed below
/usr as manual tests, similar to GNOME's installed-tests convention.

Thanks to Ozkan Sezer for the OS/2 build glue.

Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Cameron Gutman cd66c050fe testsurround: Add surround sound channel tester 2021-10-30 21:26:03 -07:00
Sam Lantinga b2d77e638c Added testwm2 to the Visual Studio test programs 2021-07-27 10:57:40 -07:00
Cameron Cawley 89bdc6ba1d Fix MSVC builds in paths with spaces 2021-07-24 16:06:54 -07:00
Cameron Cawley b0daa9f1db Automatically select the default platform toolset for MSVC builds 2021-07-24 16:06:54 -07:00
Sam Lantinga 009b62f1c2 Be explicit about mapping the new game controller paddle buttons 2020-11-07 02:22:15 -08:00
Sam Lantinga 3180ba81af First pass at Windows sensor implementation 2020-04-08 08:34:27 -07:00
Ryan C. Gordon 08dc8cc20a testgesture: Add dependency to SDLtest to Visual Studio project. 2019-03-15 23:54:42 -04:00
Ozkan Sezer 425149f47b remove testvulkan.vcproj (was a VS2008 left-over.) 2018-05-11 09:37:00 +03:00
Sam Lantinga 4764f7a45c Fixed building YUV test programs (thanks Ozkan!) 2017-11-17 10:54:46 -08:00
Sam Lantinga a6a4e27ae8 Updated SDL's YUV support, many thanks to Adrien Descamps
New functions get and set the YUV colorspace conversion mode:
	SDL_SetYUVConversionMode()
	SDL_GetYUVConversionMode()
	SDL_GetYUVConversionModeForResolution()

SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats.

Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
2017-11-12 22:51:12 -08:00
Sam Lantinga e763dac6dd Good bye, Visual Studio 2008 2017-09-22 17:02:18 -07:00
Sam Lantinga 09e43d450f Added missing Visual Studio 2010 project for testvulkan 2017-08-28 17:28:09 -07:00
Sam Lantinga 1f2e151b44 Added Vulkan support to the Visual Studio 2010 solution 2017-08-27 22:20:17 -07:00
Sam Lantinga 213356cd6f Don't need the Vulkan SDK for the Visual Studio 2008 project anymore 2017-08-27 21:55:31 -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
Sam Lantinga a52d48c5ab Fixed bugs 2570, 3145, improved OpenGL ES context support on Windows and X11
Mark Callow

The attached patch does the following for the X11 and Windows platforms, the only ones where SDL attempts to use context_create_es_profile:

- Adds SDL_HINT_OPENGL_ES_DRIVER by which the application can
  say to use the OpenGL ES driver & EGL rather than the Open GL
  driver. (For bug #2570)
- Adds code to {WIN,X11}_GL_InitExtensions to determine the maximum
  OpenGL ES version supported by the OpenGL driver (for bug #3145)
- Modifies the test that determines whether to use the OpenGL
  driver or the real OpenGL ES driver to take into account the
  hint, the requested and supported ES version and whether ES 1.X
  is being requested. (For bug #2570 & bug #3145)
- Enables the testgles2 test for __WINDOWS__ and __LINUX__ and adds
  the test to the VisualC projects.

With the fix in place I have run testdraw2, testgl and testgles2 without any issues and have run my own apps that use OpenGL, OpenGL ES 3 and OpenGL ES 1.1.
2017-01-10 08:54:33 -08: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