Commit Graph

132 Commits (9786d8ac402f05c44fdf9fa1d7984dcfed5c4ab4)

Author SHA1 Message Date
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
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
SDL Wiki Bot 60127460b0 Sync SDL3 wiki -> header 2023-02-28 17:30:22 +00: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
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
Sasha Szpakowski 90795291e4 Remove SDL_GL/Metal/Vulkan_GetDrawableSize().
SDL_GetWindowSizeInPixels supersedes those functions.
2023-01-29 11:20:33 -08:00
Sam Lantinga bf4095359c Removed duplicated window size events, and added SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED 2023-01-28 15:56:02 -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
Sam Lantinga 24fec13ac1 Add full high DPI information to SDL_DisplayMode
SDL_DisplayMode now includes the pixel size, the screen size and the relationship between the two. For example, a 4K display at 200% scale could have a pixel size of 3840x2160, a screen size of 1920x1080, and a display scale of 2.0.
2023-01-27 12:38:46 -08:00
Sam Lantinga 6240252736 Updated documentation with the SDL_WINDOW_ALLOW_HIGHDPI flag removal 2023-01-25 01:28:37 -08: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 a06a593aa6 Renamed SDL_GetGamepadNumTouchpads and SDL_GetGamepadNumTouchpadFingers to match the new convention 2023-01-24 13:47:30 -08:00
Ozkan Sezer 58e8cf599c README-migration.md: fix SDL_WINDOWEVENT_CLOSE renamed name.
SDL_EVENT_WINDOW_CLOSE_REQUESTED, not SDL_EVENT_WINDOW_CLOSE.
2023-01-24 20:05:50 +03:00
Sylvain 052b14eb65 Add SDL_ConvertAudioSamples() helper function 2023-01-24 08:26:09 -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
Sylvain b1f365374b Add code snipped to migrate from AudioCVT interface 2023-01-22 22:22:50 +01:00
Sam Lantinga 9c8642ded9 Removed SDL_INIT_NOPARACHUTE
Fixes https://github.com/libsdl-org/SDL/issues/7121
2023-01-22 09:14:12 -08:00
Sylvain e4fdf42097 Update README-migration.md 2023-01-22 11:31:30 -05:00
Sam Lantinga dc280c17a0 Moved SDL_intrin.h back into the public headers for application use 2023-01-10 15:50:35 -08: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 2aa9569b3e Replaced SDL_SIMDAlloc(), SDL_SIMDRealloc(), and SDL_SIMDFree() with SDL_aligned_alloc() and SDL_aligned_free()
Fixes https://github.com/libsdl-org/SDL/issues/5641
2023-01-09 18:01:59 -08:00
Sam Lantinga e9b86eebf3 Functions which return function pointers now return SDL_FunctionPointer instead of void*
This fixes the clang warning "Cast between pointer-to-function and pointer-to-object is an extension"

You can define SDL_FUNCTION_POINTER_IS_VOID_POINTER in your project to restore the previous behavior.

Fixes https://github.com/libsdl-org/SDL/issues/2866
2023-01-09 15:46:21 -08:00
Sam Lantinga 5feebcdce0 SDL_AddHintCallback() now returns a standard int result instead of void
Fixes https://github.com/libsdl-org/SDL/issues/7035
2023-01-09 12:09:30 -08:00
Sam Lantinga 9ffeae7b58 Added a migration note for SDL_Vulkan_GetInstanceExtensions() 2023-01-08 07:59:14 -08:00
Sylvain 93e2903ac5 Add SDL_PlayAudioDevice() to play audio. Remove pause_on param from SDL_PauseAudioDevice() 2023-01-06 09:15:39 -08:00
Sam Lantinga 26be384801 SDL_syswm.h provides the platform specific types by default again
You can enable and disable subsystems with SDL_ENABLE_SYSWM_*/SDL_DISABLE_SYSWM_* and you can disable the type forward declarations with SDL_DISABLE_SYSWM_*_TYPES
2023-01-05 23:50:37 -08:00
Sylvain 2d7f8d7d51 Remove legacy SDL_Audio functions that acts on device id == 1 2023-01-05 09:40:06 -05:00