Commit Graph

353 Commits

Author SHA1 Message Date
Sam Lantinga cc94f600fd Officially added the concept of window pixel density
The SDL_WINDOW_ALLOW_HIGHDPI flag has been renamed SDL_WINDOW_HIGH_PIXEL_DENSITY, and added the function SDL_GetWindowPixelDensity()
2023-05-17 17:54:03 -07:00
SDL Wiki Bot 5836e057de Sync SDL3 wiki -> header 2023-05-17 19:59:14 +00: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 4de7433a9e Use the term "points" instead of "screen coordinates"
It turns out that screen coordinates were confusing people, thinking that meant pixels, when instead they are virtual coordinates; device independent units defined as pixels scaled by the display scale. We'll use the term "points" for this going forward, to reduce confusion.
2023-05-15 11:20:38 -07:00
SDL Wiki Bot 78251f973d Sync SDL3 wiki -> header 2023-05-13 16:55:14 +00:00
Frank Praznik 12e1b2546a docs: Add README-wayland
Add a README file for Wayland that lists common issues and limitations.
2023-05-13 12:54:14 -04:00
Sylvain dfd80f3d76 Android: control activity re-creation 2023-05-12 07:48:33 -07:00
Brick 079ae065f1 Added SDL prefix AUDIO_* constants 2023-05-02 08:09:06 -07:00
Eric f7df966b41 SDL_JOYBALLMOTION 2023-04-28 23:35:33 -04:00
Eric e8c16ce483 Update migration guide with info on trackballs 2023-04-28 23:35:33 -04: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 4b17cc3a46 Add CMake toolchain files 2023-03-27 15:33:08 -07:00
SDL Wiki Bot 8c852f4dcf Sync SDL3 wiki -> header 2023-03-25 22:11:16 +00:00
Karl Hedberg 11142ec256
Made the Android documentation more clear and understandable (#7535) 2023-03-25 15:10:04 -07:00
SDL Wiki Bot 6760d54737 Sync SDL3 wiki -> header 2023-03-21 20:04:18 +00:00
Anonymous Maarten 6a9e2495f0 docs: add general information on how to build optimized binaries 2023-03-21 23:03:02 +03:00
Frank Praznik 5a0f50e1c3 docs: Update the migration document with changes to the tooltips and popup menu flags. 2023-03-10 15:51:13 -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
Ryan C. Gordon f48d0cc164
audio: Remove AUDIO_U16* support.
It wasn't heavily used, and you can't use memset to silence a U16 buffer.

Fixes #7380.
2023-03-01 10:26:01 -05:00
Sam Lantinga 941a603665 Document that SDL_IsScreenSaverEnabled() was renamed SDL_ScreenSaverEnabled() 2023-02-28 15:56:49 -08:00
Ryan C. Gordon 5d3234d8ae
docs: Removed bogus file from wiki bridge.
That was fixed to not do that again by 7e429a13d3
2023-02-28 13:39:43 -05:00
SDL Wiki Bot c3d2f5368b Sync SDL3 wiki -> header 2023-02-28 17:50:11 +00:00
SDL Wiki Bot 3f49e370c8 Sync SDL3 wiki -> header 2023-02-28 17:39:22 +00:00
Ryan C. Gordon 5585a4ac72
Renamed CONTRIBUTING.md to README-contributing.md
This lets the wiki bridge pick it up.
2023-02-28 12:38:31 -05:00
Ryan C. Gordon 7b9b20e684
docs: Deleting a bogus file to see if wiki bridge rebuilds it. 2023-02-28 12:31:11 -05:00
SDL Wiki Bot 60127460b0 Sync SDL3 wiki -> header 2023-02-28 17:30:22 +00:00
SDL Wiki Bot 5fb5586233 Sync SDL3 wiki -> header 2023-02-28 17:18:06 +00:00
Ryan C. Gordon 6d1e14b792
wikiheaders: ignore wiki's README/FrontPage.md 2023-02-28 11:55:19 -05:00
SDL Wiki Bot 90a911b31f Sync SDL3 wiki -> header 2023-02-28 16:52:06 +00:00
SDL Wiki Bot af9a2237e3 Sync SDL3 wiki -> header 2023-02-28 16:48:26 +00:00
Anonymous Maarten 0625695898 docs: Fix doxyfile 2023-02-19 10:01:33 -08:00
Sam Lantinga 24d419c09f Updated documentation for SDL3_DYNAMIC_API
Fixes https://github.com/libsdl-org/SDL/issues/7347
2023-02-19 09:54:47 -08:00
Anonymous Maarten dc138ee3d4 cmake: SDL3-shared target will always be a shared target 2023-02-17 23:42:03 +01:00
Sam Lantinga 96722a5809 Ubuntu 18.04 doesn't have a new enough version of Wayland for SDL, so update documentation appropriately
Reference https://github.com/libsdl-org/SDL/issues/7271
2023-02-16 08:57:53 -08:00
Sylvain 26f27a9e5a Update README-migration 2023-02-10 09:30:31 +01:00
Sam Lantinga 5b77ad54c4 Fixed order and constness of parameters to SDL_ConvertAudioSamples() 2023-02-09 17:49:35 -08:00
Sam Lantinga 824b9b0a58 Removed SDL_GetDisplayDPI()
This function wasn't consistently correct across platforms and devices.

If you want the UI scale factor, you can use display_scale in the structure returned by SDL_GetDesktopDisplayMode(). If you need an approximate DPI, you can multiply this value times 160 on iPhone and Android, and 96 on other platforms.
2023-02-08 17:35:54 -08:00
Sam Lantinga d563f38a0d Note that the renderer will by default scale from window coordinates to pixels 2023-02-05 08:41:35 -08: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 ac75fe9324 Folded SDL_WINDOW_FULLSCREEN_EXCLUSIVE and SDL_WINDOW_FULLSCREEN_DESKTOP into a single SDL_WINDOW_FULLSCREEN flag
The fullscreen video mode used by the window can be used to determine whether it's in exclusive fullscreen or fullscreen desktop mode.
2023-02-01 12:05:25 -08: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
Bruno Sanches 7c085862e1 SDL_Video.h - audio driver
I believe you intend to say "video driver", not audio driver
2023-01-30 08:13:16 -08:00