Commit Graph

1836 Commits

Author SHA1 Message Date
Sam Lantinga
f62c982bcf Reverted Accelerometer and Gyro displays to throttled display (10hz)
Also made accelerometer threshold for drift calibration more lenient for very noisy accelerometers.

The testcontroller tool could eventually be used to come up with a better way to profile an IMU's "stationary" noise so that this threshold can be as tight as necessary for the sake of automatic drift calibration.

(thanks @HilariousCow!)
2025-06-16 11:14:22 -07:00
Aubrey Hesselgren
913b611ccd Added tools for evaluating gyroscope accuracy and IMU polling rates. (#13209)
* Added tools to Test Controller for evaluating gyroscope accuracy and IMU polling rates.

This adds a visual suite to the testcontroller tool to help validate IMU data from new gamepad drivers and HID implementations.

The 3D gizmo renders accumulated rotation using quaternion integration of gyroscope packets. If a controller is rotated 90° in real space, the gizmo should reflect a 90° change, allowing quick detection of incorrect sensitivity or misaligned axes.

Also includes:
- Euler angle readout (pitch, yaw, roll)
- Real-time drift calibration display with noise gating and progress
- Accelerometer vector overlay
- Live polling rate estimation to verify update frequency

Intended for developers working on controller firmware or SDL backend support to confirm correctness of IMU data processing.
2025-06-13 14:01:52 -07:00
Michael Fitzmayer
7ae64592c9 Restore support for the Nokia N-Gage (#12148) 2025-05-22 11:07:22 -07:00
Takase
f6c1e81394 [Process API] Quoting enhancements (#12946) 2025-05-12 09:17:21 -07:00
Ryan C. Gordon
795d1ae1fb testmessage: Don't push the event if "Retry" was chosen.
Otherwise, the message box thread goes back to blocking, but the app's main
thread progresses to SDL_WaitThread and won't pump the event queue anymore.

On iOS, this means the messagebox won't pop back up (because it uses
SDL_RunOnMainThread, which needs the event loop to pump), but it's just bad
practice on any platform to stop pumping the event queue for indefinite
lengths of time.
2025-05-02 21:42:47 -04:00
Ryan C. Gordon
691cc5bb5e dialog: Cocoa shouldn't crash if there's a '.' in the filters.
So something like "index.pb" will now accept any file with a ".pb" extension,
to make macOS happy. This seems like a reasonable tradeoff.

Other minor cleanups.

Fixes #12778.
2025-05-01 18:11:36 -04:00
Sam Lantinga
48dfc03a87 Added the gamepad hint SDL_GAMECONTROLLER_USE_GAMECUBE_LABELS
This is for internal use to signal that a mapping uses positional GameCube buttons. It's set so we know whether a mapping uses the older style labeled buttons or the newer style positional buttons. If a positional mapping is used with SDL2, then it will be ignored, since the hint is marked as defaulting true and the mapping conditional is that the hint is false.
2025-05-01 10:54:16 -07:00
Sam Lantinga
21a7bbbf14 Restore compatibility with older GameCube mappings
Restore the original button values for GameCube controllers, but swap labeled mappings to positional while loading mappings

Fixes https://github.com/libsdl-org/SDL/issues/12847
2025-05-01 10:54:16 -07:00
Frank Praznik
b871ac0d97 Add support for non-constrained and non-grabbing popups
By default, popups are automatically constrained to be completely within display bounds, so as not to cut off information and result in an unusable menu, or unreadable tooltip. In some cases, however, this is not wanted, so a property to toggle this behavior is added.

There are also cases where the client may not want a popup menu to implicitly grab the keyboard focus, as is the default behavior, so popup menus now respect the focusable flag/property, as well as being able to toggle focus grabbing via SDL_SetWindowFocusable().
2025-04-29 12:02:14 -04:00
Sam Lantinga
31650d566c Added SDL_GAMEPAD_TYPE_GAMECUBE
The GameCube controller has a different face button layout than the Xbox or Nintendo Switch style controllers. It has the B button on the left and the X button on the right, so we should map those to SDL_GAMEPAD_BUTTON_WEST with SDL_GAMEPAD_BUTTON_LABEL_B and SDL_GAMEPAD_BUTTON_EAST with SDL_GAMEPAD_BUTTON_LABEL_X respectively.

Fixes https://github.com/libsdl-org/SDL/issues/12847
2025-04-27 11:01:50 -07:00
Ozkan Sezer
360cc2791f test/msdf_font.bmp: mark as non-executable. 2025-04-26 02:39:20 +03:00
Sam Lantinga
c2ed58db7b windows: Fix stale zoom/iconic state in WM_WINDOWPOSCHANGED handler
- IsIconic/IsZoomed must be checked after sending SDL_EVENT_WINDOW_SHOWN as that may trigger window operations if any are pending from when
  the window was hidden. e.g. the window may be shown, which triggers SDL_MaximizeWindow and a new WM_WINDOWPOSCHANGED where
  SDL_EVENT_WINDOW_MAXIMIZED is sent, then control returns to the original WM_WINDOWPOSCHANGED which would not think the window is zoomed
  and send SDL_EVENT_WINDOW_RESTORED.
2025-04-25 16:21:44 -07:00
Ryan C. Gordon
18a86ea6bb testaudio: Use SDL_SetAppMetadata at startup.
This helps in finding its outputs in system lists of PipeWire streams, etc.
2025-04-25 13:03:09 -04:00
Maia
d50520462a Add and use SDL_HapticEffectID typedef 2025-04-24 08:51:55 -07:00
Sam Lantinga
89d7d406ab Added tests to cover invalid surface blits
Reproduction case for https://github.com/libsdl-org/SDL/issues/12844
2025-04-22 13:05:38 -07:00
Topi-Matti Ritala
f7b7188837 Add SDL_CreateGPURenderer 2025-04-07 09:26:03 -07:00
Temdog007
cc8ec6cf18 Handle global mouse state for Emscripten (#12669) 2025-04-02 07:21:21 -07:00
Anonymous Maarten
e87a00c07c tests: port failing SDL_Renderer test from pysdl2 to testautomation
(cherry picked from commit 8436ce98b4)
2025-04-01 21:31:10 +02:00
Anonymous Maarten
10819273bf tests: port failing SDL_Renderer test from pysdl2 to testautomation
(cherry picked from commit 7d8a6f1603)
2025-04-01 21:31:10 +02:00
Anonymous Maarten
ffbd434a11 tests: port failing window test from pysdl2 to testautomation
(cherry picked from commit 4f488b9be2)
2025-04-01 21:31:10 +02:00
Anonymous Maarten
2775e7a78f tests: port failing SDL_Rect tests from pysdl2 to testautomation
(cherry picked from commit 39bb71c442)
2025-04-01 21:31:10 +02:00
Anonymous Maarten
39eed1d233 tests: port failing SDL_Hint tests from pysdl2 to testautomation
(cherry picked from commit 177fb9cb6c)
2025-04-01 21:31:10 +02:00
Sam Lantinga
3fd61b0535 Updated for SDL style 2025-03-20 16:42:40 -07:00
Temdog007
581b614291 Emscripten: Support Custom Message Boxes (#12583)
* Allow custom message boxes with colors and multiple buttons to work if Asyncify is enabled
* Keep old functionality of using alert when Asyncify is not available
* Update testmessage to allow for setting random colors as the color scheme of the message box
2025-03-20 16:33:06 -07:00
Sam Lantinga
476e7e54cb Don't create surfaces with invalid pixel formats
Fixes https://github.com/libsdl-org/SDL/issues/12556
2025-03-20 09:42:52 -07:00
Anonymous Maarten
9820f655dd android: reduce visiblity as much as possible 2025-03-19 23:36:08 +01:00
Sam Lantinga
efe122be4d Removed width/height parameters from LoadTexture()
You can directly access the texture width and height now.
2025-03-14 11:38:13 -07:00
Sam Lantinga
dcb97a5f49 Set a default shader entry point
The default should be the entrypoint generated by SDL_shadercross. That way it doesn't need to be hand-specified in the common workflow.
2025-03-14 11:38:13 -07:00
Sam Lantinga
02faa8f75c Rename SDL_SetGPURenderStateFragmentUniformData() to SDL_SetGPURenderStateFragmentUniforms() 2025-03-14 09:26:30 -07:00
Sam Lantinga
96194347bc Added an example of fullscreen shader effects with the GPU renderer 2025-03-14 09:26:30 -07:00
Sam Lantinga
2aee105b43 Added support for custom shaders with the GPU renderer
Added an example of MSDF font rendering with the SDL 2D renderer
2025-03-14 09:26:30 -07:00
Sam Lantinga
3e9e22f17d Added SDL_SCALEMODE_PIXELART
This is based on the algorithm presented by t3ssel8r:
https://www.youtube.com/watch?v=d6tp43wZqps
2025-03-13 09:48:37 -07:00
Sam Lantinga
be6ed6e9c4 Fixed sscanf("026", "%1x%1x%1x", &r, &g, &b)
Fixes https://github.com/libsdl-org/SDL/issues/12510
2025-03-10 14:45:08 -07:00
Sam Lantinga
e20e27e1fb Added SIMD blitters for 8888 -> 8888 format conversion 2025-03-06 02:14:54 -08:00
Sam Lantinga
cb099ebd4f Make texture scale mode a part of the 2D renderer draw state
Also added texture addressing mode support to the PSP and Vita renderers (untested)

Fixes https://github.com/libsdl-org/SDL/issues/12461
2025-03-05 21:35:04 -08:00
Arkadiusz Lach
e25ee22469 Added tiled 9-grid texture rendering function
* New function SDL_RenderTexture9GridTiled, borders and center is tiled instead of stretched
2025-03-02 07:52:25 -08:00
Frank Praznik
edaf447678 tests: Add showing/setting the primary selection text to testclipboard 2025-02-27 12:35:37 -05:00
Sam Lantinga
049a7a04de Wake the main thread for main function dispatch
Also added a test case to catch the main thread waiting indefinitely when a function is pending.

Fixes https://github.com/libsdl-org/SDL/issues/12390
2025-02-25 12:50:41 -08:00
Sam Lantinga
6980325310 Added support for the "%n" sscanf format specifier 2025-02-24 20:02:59 -08:00
Sam Lantinga
bc85c55350 testcontroller: create window with high pixel density
This improves the picture quality when running on an iPhone.
2025-02-22 09:02:01 -08:00
Anonymous Maarten
5c214e5e9c testcamera: SDL_AppQuit destroys state and SDL
This fixes a double-free of SDLTest_CommonState
2025-02-21 23:04:13 -08:00
Petar Popovic
b5297de56f Add 'const' to pointer parameters 2025-02-21 15:59:40 -08:00
Petar Popovic
c70f54e28b Remove redundant casts 2025-02-21 10:09:10 -08:00
Sam Lantinga
f24f9d3bed Revert "testcamera: added support for Motion JPEG camera frames"
This reverts commit 5ccee77190.
2025-02-20 12:16:26 -08:00
Petar Popovic
045a4492f1 test/testaudio.c: Fix use-after-free warning 2025-02-16 19:35:54 -08:00
Petar Popovic
da2460f9e7 test/testautomation_audio.c: Free variables before returning 2025-02-16 16:57:56 -08:00
Petar Popovic
831fc70923 test/testautomation_intrinsics.c: Free variables before returning 2025-02-16 07:50:07 -08:00
Sam Lantinga
5ccee77190 testcamera: added support for Motion JPEG camera frames 2025-02-10 17:18:16 -08:00
Sam Lantinga
c4550d906a testcontroller: show the gamepad device type 2025-02-05 08:27:26 -08:00
Petar Popovic
8ccf85c59e Formatting spaces around pointer symbol. 2025-02-03 17:03:26 -08:00