Commit Graph

360 Commits (b6c5ad0075435fcd6ca7a67328dd484f0fcde3a9)

Author SHA1 Message Date
Sam Lantinga b903ccf945 SDL_rwops read/write functions return size_t again
The current status is stored in the SDL_rwops 'status' field to be able to determine whether a 0 return value is caused by end of file, an error, or a non-blocking source not being ready.

The functions to read sized datatypes now return SDL_bool so you can detect read errors.

Fixes https://github.com/libsdl-org/SDL/issues/6729
2023-08-07 20:36:21 -07:00
Ryan C. Gordon e7d56dd0b2
audio: Renamed new API SDL_UnpauseAudioDevice to SDL_ResumeAudioDevice. 2023-08-05 19:20:14 -04:00
Ryan C. Gordon 6567285eae
SDL_migration.cocci: Fix up SDL_(Pause|Unpause)Audio. 2023-07-30 11:56:37 -04:00
luzpaz 65e1d568ef Fix various typos (docs/build scripts/tests) 2023-07-03 08:35:37 -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 e264bb5178 Rename SDL_PIXELFORMAT_RGB888 and SDL_PIXELFORMAT_BGR888 to SDL_PIXELFORMAT_XRGB8888 and SDL_PIXELFORMAT_XBGR8888 for clarity
Fixes https://github.com/libsdl-org/SDL/issues/7903
2023-07-01 17:58:34 -07:00
Sam Lantinga 8da9b22c17 The SDL_WINDOW_SKIP_TASKBAR flag has been replaced by the SDL_WINDOW_UTILITY flag
The SDL_WINDOW_UTILITY flag has the same functionality, and is now implemented on Windows.
2023-06-29 21:43:17 -07:00
Sam Lantinga c065a9b128 Fix some issues caught by check_stdlib_usage.py 2023-06-27 06:19:06 -07:00
Sylvain 70ccf34587 Script to detect use of stdlib function 2023-06-27 04:47:08 -07:00
Sam Lantinga 808d83dd67 Allow specifying APP_PLATFORM and APP_ABI on the command line 2023-06-21 13:49:09 -07:00
Sam Lantinga 8cf5dc9963 Build on Android targeting the arm64-v8a architecture by default
This speeds up iteration time and covers most customer devices
2023-06-20 09:18:19 -07:00
Sam Lantinga e6d1ba2a17 Added the concept of display natural orientation
Also renamed SDL_GetDisplayOrientation() SDL_GetDisplayCurrentOrientation()

The natural orientation of the primary display is the frame of reference for accelerometer and gyro sensor readings.
2023-06-17 07:42:16 -07:00
Sam Lantinga cb73bed6eb SDL API renaming: SDL TLS functions
Fixes https://github.com/libsdl-org/SDL/issues/7743
2023-05-26 08:33:15 -07:00
Sam Lantinga e61b5ceefe The SDL_WINDOW_ALLOW_HIGHDPI flag has been renamed SDL_WINDOW_HIGH_PIXEL_DENSITY 2023-05-18 07:34:45 -07:00
Sam Lantinga c699f3d1d8 Updated SDL high DPI support
We have gotten feedback that abstracting the coordinate system based on the display scale is unexpected and it is difficult to adapt existing applications to the proposed API.

The new approach is to provide the coordinate systems that people expect, but provide additional information that will help applications properly handle high DPI situations.

The concepts needed for high DPI support are documented in README-highdpi.md. An example of automatically adapting the content to display scale changes can be found in SDL_test_common.c, where auto_scale_content is checked.

Also, the SDL_WINDOW_ALLOW_HIGHDPI window flag has been replaced by the SDL_HINT_VIDEO_ENABLE_HIGH_PIXEL_DENSITY hint.

Fixes https://github.com/libsdl-org/SDL/issues/7709
2023-05-17 12:58:00 -07:00
Sam Lantinga 9b87de258f Fixed crash in new audio channel conversion code
Each loop needs to be run num_frames times, and the source and destination pointers are incremented by the number of channels during the conversion.
2023-05-04 15:50:38 -07:00
Brick 079ae065f1 Added SDL prefix AUDIO_* constants 2023-05-02 08:09:06 -07:00
Sam Lantinga 87ad71f9b2 Rename SDL mutex, semaphore and condition variable types to match SDL 3.0 naming convention 2023-04-28 12:08:33 -07:00
Sam Lantinga 61c0c009ab Rename SDL semaphore and condition variable functions to match SDL 3.0 naming convention
Fixes https://github.com/libsdl-org/SDL/issues/7642
2023-04-28 12:08:33 -07:00
Ryan C. Gordon e5a6c24c82 audio: Redesigned audio conversion code for SDL3.
- SDL_AudioCVT is gone, even internally.
- libsamplerate is gone (I suspect our resampler is finally Good Enough).
- Cleanups and improvements to audio conversion interfaces.
- SDL_AudioStream can change its input/output format/rate/channels on the fly!
2023-04-27 18:35:15 -04:00
Sam Lantinga 2aa2fa5449 Added SDL_CreateWindowWithPosition()
It turns out there's a race condition on X11 where the window could be placed by the window manager while being placed by the application, so we need to have the initial position available at window creation.
2023-03-31 17:21:44 -07:00
Elad Lahav eca7b8e4a1 Do not look at local headers when determining features
Avoids the detection of X11 on the build machine
2023-03-27 15:33:08 -07:00
Elad Lahav 4b17cc3a46 Add CMake toolchain files 2023-03-27 15:33:08 -07:00
Sam Lantinga 1f095b9ce6 Fixed wikiheaders.pl with perl-5.10.1 (thanks @sezero!) 2023-03-24 13:57:24 -07:00
Ryan C. Gordon 586004e52a
wikiheaders.pl: Manpages shouldn't use .BI sections, it looks bad.
Reference Issue #7514.
2023-03-21 22:23:06 -07:00
Ryan C. Gordon 1b81ececd3
wikiheaders.pl: Fixed uninitialized value warning when run without arguments. 2023-03-21 21:57:12 -07:00
Anonymous Maarten 77b8edb5ad wikiheaders.pl: add --manpath argument 2023-03-21 02:19:19 +01:00
Stephen Kitt bbfd5b3fb2 Specify bash for androidbuildlibs.sh
This script relies on string indexes in parameter expansions, which
aren't suppored by /bin/sh (e.g. dash).

Based on a patch by Roflcopter4:
https://github.com/joncampbell123/dosbox-x/pull/3850

Signed-off-by: Stephen Kitt <steve@sk2.org>
2023-03-10 07:26:37 -08:00
David Demelier d0c4849d0b Rename SDL_atomic_t to SDL_AtomicInt 2023-03-09 09:00:09 -08:00
Sam Lantinga 698dbd8464 SDL_CreateWindow() has been simplified and no longer takes a window position. 2023-03-06 09:50:12 -08:00
Sam Lantinga d5775f6708 The gamepad event structures caxis, cbutton, cdevice, ctouchpad, and csensor have been renamed gaxis, gbutton, gdevice, gtouchpad, and gsensor.
Fixes https://github.com/libsdl-org/SDL/issues/7375
2023-03-01 09:48:28 -08:00
Sam Lantinga 941a603665 Document that SDL_IsScreenSaverEnabled() was renamed SDL_ScreenSaverEnabled() 2023-02-28 15:56:49 -08:00
Ryan C. Gordon 99c38268cd
wikiheaders: Sort pages before listing them in README/FrontPage.md. 2023-02-28 12:28:10 -05:00
Ryan C. Gordon 7745c9b3ae
wikiheaders: Use Windows endlines in the source, Unix in the wiki. 2023-02-28 12:28:10 -05:00
Ryan C. Gordon 6d1e14b792
wikiheaders: ignore wiki's README/FrontPage.md 2023-02-28 11:55:19 -05:00
Ryan C. Gordon 2506676f34
wikiheaders: Bridge README files in the docs directory to wiki.
Fixes #6026.
2023-02-28 11:45:47 -05:00
Ryan C. Gordon a479633455
wikiheaders: fixed wikilinks in Markdown code sections. 2023-02-27 23:08:19 -05:00
Ryan C. Gordon 5b0351a672
wikiheaders: Fix wikilinks inside code sections a little. Not perfect yet. 2023-02-24 14:29:36 -05:00
Ryan C. Gordon d748a454a8
wikiheaders: fixed see-also conversion 2023-02-24 11:45:43 -05:00
Ryan C. Gordon 5ff49955ab
wikibridge: Fixes for manpage generation from Markdown format. 2023-02-24 10:21:54 -05:00
Ryan C. Gordon 936a51d5cc
wikiheaders: Work to make the wiki exist primarily in Markdown format.
This adds a means to mass-convert the whole wiki to Markdown as a one-time
operation, and then some fixes to make --copy-to-headers correctly deal with
Markdown-formatted wiki pages.
2023-02-24 09:07:09 -05:00
Sam Lantinga 0fe1e9f3a7 Cleaned up SDL_migration.cocci, removing old SDL3 names 2023-02-22 16:44:06 -08:00
Sam Lantinga b39b7025fd SDL_GL_GetDrawableSize, SDL_Metal_GetDrawableSize, and SDL_Vulkan_GetDrawableSize can be replaced with SDL_GetWindowSizeInPixels 2023-02-13 13:11:43 -08:00
Sam Lantinga 13d9e41c3f SDL_WINDOWEVENT_SIZE_CHANGED was renamed SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED 2023-02-10 06:38:14 -08:00
Sam Lantinga 449b2289c8 Remove renaming for SDL_GetDisplayDPI() 2023-02-10 06:31:09 -08:00
Sylvain 7c4ec1867b Remove some vim config lines 2023-02-10 11:00:48 +01:00
Sam Lantinga fa599c7548 Fixed SDL_GetRendererOutputSize renaming 2023-02-09 17:31:44 -08:00
Sam Lantinga 9ff15e5382 Don't change M_PI in application code, that's not an SDL symbol 2023-02-09 17:26:15 -08:00
Sam Lantinga a357021800 Use GNU sed if available
Fixes update-copyright.sh on macOS, which doesn't support the -b option.
2023-02-06 15:47:16 -08:00
Sylvain 5d1006657a SDL_migration.cocci: remove metavariable warning 2023-02-05 17:48:18 +01:00
Sylvain 85143c28b5 SDL_migration.cocci: fix syntax 2023-02-05 09:37:37 +01:00
Sam Lantinga a34a84ba98
Rename int versions of the SDL2 render functions (#7235)
This makes it clear what the new versions are, and in the case of SDL_RenderDrawPoint() and SDL_RenderDrawLine(), the coccinelle script actually does the (float) casts for you.
2023-02-03 14:55:32 -08:00
Sam Lantinga 14a4ce8b59 Fixed SDL_ScaleMode values for consistency 2023-02-03 14:20:51 -08:00
Sam Lantinga dcd17f5473 Renderer logical size is now implemented as a render target
This fixes rounding errors with coordinate scaling and gives more flexibility in the presentation, as well as making it easy to maintain device independent resolution as windows move between different pixel density displays.

By default when a renderer is created, it will match the window size so window coordinates and render coordinates are 1-1.

Mouse and touch events are no longer filtered to change their coordinates, instead you can call SDL_ConvertEventToRenderCoordinates() to explicitly map event coordinates into the rendering viewport.

SDL_RenderWindowToLogical() and SDL_RenderLogicalToWindow() have been renamed SDL_RenderCoordinatesFromWindow() and SDL_RenderCoordinatesToWindow() and take floating point coordinates in both directions.

The viewport, clipping state, and scale for render targets are now persistent and will remain set whenever they are active.
2023-02-03 12:57:37 -08:00
Anonymous Maarten 69aede6c9e Add missing _ in SDL_EVENT_LOCALECHANGED and SSDL_EVENT_TEXTEDITING_EXT 2023-02-02 00:49:09 +01:00
Sam Lantinga 6b137579ea Windows default to fullscreen desktop mode if they don't pick an explicit video mode
Rather than iterating over display modes using an index, there is a new function SDL_GetFullscreenDisplayModes() to get the list of available fullscreen modes on a display.
{
    SDL_DisplayID display = SDL_GetPrimaryDisplay();
    int num_modes = 0;
    SDL_DisplayMode **modes = SDL_GetFullscreenDisplayModes(display, &num_modes);
    if (modes) {
        for (i = 0; i < num_modes; ++i) {
            SDL_DisplayMode *mode = modes[i];
            SDL_Log("Display %" SDL_PRIu32 " mode %d:  %dx%d@%gHz, %d%% scale\n",
                    display, i, mode->pixel_w, mode->pixel_h, mode->refresh_rate, (int)(mode->display_scale * 100.0f));
        }
        SDL_free(modes);
    }
}

SDL_GetDesktopDisplayMode() and SDL_GetCurrentDisplayMode() return pointers to display modes rather than filling in application memory.

Windows now have an explicit fullscreen mode that is set, using SDL_SetWindowFullscreenMode(). The fullscreen mode for a window can be queried with SDL_GetWindowFullscreenMode(), which returns a pointer to the mode, or NULL if the window will be fullscreen desktop. SDL_SetWindowFullscreen() just takes a boolean value, setting the correct fullscreen state based on the selected mode.
2023-02-01 12:05:25 -08:00
Anonymous Maarten 09e2f83e17 cmake: no more SDL3_* cache variables 2023-01-31 01:59:21 +01:00
Anonymous Maarten 9cf34908a1 cmake: pass VERSION to project() + don't use SDL_VERSION 2023-01-31 01:59:21 +01:00
Sam Lantinga 22c69bccdf Displays are now referenced by instance ID instead of index 2023-01-29 19:25:15 -08:00
Anonymous Maarten 758c0dd6d8 Rename mouse BUTTON(DOWN|UP) event to BUTTON_(DOWN|UP) 2023-01-29 19:24:48 -08:00
Sylvain 413376cdb3 migration: replace SDL_DisplayMode w and h by screen_w and screen_h 2023-01-29 12:19:09 -08:00
Sam Lantinga 31f464153d SDL_WINDOW_INPUT_GRABBED has been renamed SDL_WINDOW_MOUSE_GRABBED 2023-01-28 10:56:38 -08:00
Sam Lantinga e83c54f271 SDL_WINDOW_FULLSCREEN and SDL_WINDOW_FULLSCREEN_DESKTOP are now distinct flags 2023-01-28 10:56:38 -08:00
Ryan C. Gordon 726d6f9422
wikiheaders: Allow markdown in the wikipreamble string.
Reference Issue #6568.
2023-01-26 14:45:57 -05:00
Anonymous Maarten 330ad80014 cocci: fix game pad event types 2023-01-25 22:02:31 +01:00
Ryan C. Gordon 01cba48d18
wikiheaders: Add a `\threadsafety` tag to document threading details.
Reference Issue #7140.
2023-01-25 12:59:25 -05:00
Sylvain 724d92fd65 Rename SDL_GetDisplayDPI to SDL_GetDisplayPhysicalDPI
to avoid confusion with logical DPI
2023-01-25 00:04:00 -08:00
Sam Lantinga 7b50bae524 Renamed SDL events for clarity
Fixes https://github.com/libsdl-org/SDL/issues/6877
2023-01-24 07:26:48 -08:00
Anonymous Maarten 0770c55e8d cocci: remove SDL_INIT_NOPARACHUTE 2023-01-22 20:14:35 +01:00
Anonymous Maarten 967ebd78e6 cocci: also fix up SDL_CreateRenderer calls with non-default render indices 2023-01-22 20:04:40 +01:00
Sylvain 1a47cf5448
Revert "gen_audio_resampler_filter: Use SDL_PI_F"
This reverts commit 41221777ba.
2023-01-16 10:04:22 +01:00
Sylvain 41221777ba gen_audio_resampler_filter: Use SDL_PI_F 2023-01-16 09:24:27 +01:00
Sylvain 9eaea7d661 SDL_migration.cocci: simplify multiplicaction / division by 1 2023-01-12 20:52:37 +01:00
Sylvain 3b2e9d98df SDL_migration.cocci: migrate audio api 1.2 2023-01-12 15:01:31 +01:00
Sylvain 8bdc25f4e4 SDL_migration.cocci: set events 2023-01-12 11:56:49 +01:00
Sylvain ed1bdf32ee SDL_migration.cocci: more gamepad migration 2023-01-12 11:39:48 +01:00
Sylvain 9b0c660a03 SDL_migration: various name changes, and function removed 2023-01-12 11:08:15 +01:00
Sylvain 21e4be5a27 SDL_migration: add RW read/write 2023-01-12 10:43:08 +01:00
Sylvain efa2945502 SDL_migration.cocci: add SIMD Alloc / Free 2023-01-12 09:58:37 +01:00
Sylvain 439c0b0236 Add vulkan migration 2023-01-12 09:45:14 +01:00
Sam Lantinga 0ad22cfe37 Fixed version validation 2023-01-11 15:11:41 -08:00
Sylvain 84cd7214bd SDL_migration.cocci / rename_api.py: handle migration of enum/structure
and fix previous one in SDL_migration.cocci.
2023-01-11 23:33:14 +01:00
Sam Lantinga 9f721d492a Catch SDL_opengles2.h in rename_headers.py 2023-01-10 15:25:48 -08:00
Sam Lantinga 69b94145d3 Updated documentation for SDL_migration.cocci
Especially note that this can be installed and run in WSL on Windows
2023-01-10 07:54:18 -08:00
Anonymous Maarten c4b471bd13 Ensure training new line in cocci files 2023-01-10 16:43:15 +01:00
Anonymous Maarten ecc48b882d migration: change 2nd arg of SDL_CreateRenderer to NULL if it was -1 2023-01-10 16:11:22 +01:00
Sylvain Becker 5066fcde69
Add SDL_migration.cocci for SDL2 to 3 migration (#7042)
* Add SDL_migration.cocci for SDL2 to 3 migration
2023-01-10 15:25:00 +01:00
Sam Lantinga fde78d12f2 Updated copyright for 2023 2023-01-09 09:41:41 -08:00
Sam Lantinga 78ccadd5a2 Speed up processing of update-copyright.sh 2023-01-09 09:38:36 -08:00
Sam Lantinga 228d9ae791 rename_headers.py covers begin_code.h/close_code.h 2023-01-04 23:50:08 -08:00
Sam Lantinga 566a559beb Fixed parsing symbols from SDL_oldnames.h 2023-01-04 13:51:00 -08:00
Sam Lantinga e76c1d74bc Added a python script to rename SDL2 headers to SDL3 headers 2023-01-04 11:20:38 -08:00
Sam Lantinga 406c8b79fe rename_symbols: only write new file if contents have changed
Also don't stop for other exceptions, just print them and keep going
2023-01-04 10:40:30 -08:00
Sam Lantinga ce412c2c71 Consistency cleanup for README-migration.md 2022-12-29 10:44:54 -08:00
Sam Lantinga 9b8208c195 Updated add_symbol_to_oldnames 2022-12-28 17:49:34 -08:00
Sam Lantinga 1d80082e8e Removed old iOS demos 2022-12-27 16:48:55 -08:00
Sam Lantinga 5baed331f1 Don't add symbol renaming to WhatsNew.txt 2022-12-27 10:00:10 -08:00
Sam Lantinga 84725c00d8 Make sure we update the cmake test programs as well 2022-12-27 09:56:16 -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
Sam Lantinga 59467ff063 Make it easier to mass rename symbols in the SDL API 2022-12-27 07:31:27 -08:00