Commit Graph

298 Commits

Author SHA1 Message Date
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