Commit Graph

638 Commits

Author SHA1 Message Date
Sam Lantinga 5bf6bc4d7d Renamed SDL_Get/SetProperty() to SDL_Get/SetPointerProperty()
This is consistent with the naming for the functions that affect other data types

Fixes https://github.com/libsdl-org/SDL/issues/10241
2024-07-12 10:41:02 -07:00
Sam Lantinga 875c4f0a4c Support indexed surfaces without palettes (thanks @sulix!)
Currently, all SDL_Surfaces with an indexed pixel format have an
associated SDL_Palette. This palette either consists of entirely the
colour black, or -- in the special case of 1-bit surfaces, black and
white.

When an indexed surface is blitted to another indexed surface, a 'map'
is generated from the source surface's palette to the destination
surfaces palette, in order to preserve the look of the image if the
palettes differ.

However, in most cases, applications will want to blit the raw index
values, rather than translate to make the colours as similar as
possible. For instance, the destination surface's palette may have been
modified to fade the screen out.

This change allows an indexed surface to have no associated palette. If
either the source or destination surface of a blit do not have a
palette, then the raw indices are copied (assuming both have an indexed
format).

This mimics better what happens with most other APIs (such as
DirectDraw), where most users do not set a palette on any surface but
the screen, whose palette is implicitly used for the whole application.
2024-07-11 08:31:32 -07:00
Sam Lantinga 60ed914c66 Added notes for migrating SDL_GetRGBA()/SDL_MapRGBA() code 2024-07-10 13:19:46 -07:00
Ryan C. Gordon af2dbf3ff3 video: Rename SDL_GL_DeleteContext to SDL_GL_DestroyContext.
Turns out that there isn't a strong OpenGL naming convention for "Delete" ...
WGL offers "wglDeleteContext" but the GLX equivalent is "glxDestroyContext"
and then EGL sealed the deal by going with Destroy as well! Since it matches
SDL3 naming conventions (Create/Destroy), we're renaming it.

Fixes #10197.
2024-07-10 15:54:08 -04:00
Sam Lantinga 2ba76dbe80 Simplified SDL_Surface
SDL_Surface has been simplified and internal details are no longer in the public structure.

The `format` member of SDL_Surface is now an enumerated pixel format value. You can get the full details of the pixel format by calling `SDL_GetPixelFormatDetails(surface->format)`. You can get the palette associated with the surface by calling SDL_GetSurfacePalette(). You can get the clip rectangle by calling SDL_GetSurfaceClipRect().

SDL_PixelFormat has been renamed SDL_PixelFormatDetails and just describes the pixel format, it does not include a palette for indexed pixel types.

SDL_PixelFormatEnum has been renamed SDL_PixelFormat and is used instead of Uint32 for API functions that refer to pixel format by enumerated value.

SDL_MapRGB(), SDL_MapRGBA(), SDL_GetRGB(), and SDL_GetRGBA() take an optional palette parameter for indexed color lookups.
2024-07-10 00:48:18 -07:00
Anonymous Maarten 50ae47af5e android: create android project in create-android-project.py python script
This script supersedes androidbuild.sh, and also supports using a SDL3 prefab archive
2024-07-05 21:12:26 +02:00
Frank Praznik 74cc06db1b Remove the SDL_EVENT_WINDOW_TAKE_FOCUS event
This was added by the Unreal Engine to handle the input focus for popups and dialogs, window types for which SDL3 has built-in, cross-platform support.

This was only ever implemented in X11, and the only purpose was to hint that a client application may want to call the SDL_SetWindowInputFocus() function, which has since been removed, rendering it pointless now.
2024-07-03 15:08:21 -04:00
Frank Praznik be13328cb1 Remove SDL_SetWindowInputFocus
This was added to SDL2 for the Unreal Engine's implementation of menus and dialogs on X11, window types for which SDL3 has added built-in, cross-platform support.

Remove this function, as it was only ever implemented for X11 and is now basically useless aside from allowing annoying or malicious client apps to discretely steal focus. As the documentation states: "You almost certainly want SDL_RaiseWindow() instead of this function."
2024-07-03 15:08:21 -04:00
Sam Lantinga e8dbbf8380 Renamed SDLK_a-z to SDLK_A-Z
Made the symbols uppercase for consistency with the other SDLK_* constants, but the values are still lowercase.
2024-07-01 13:56:49 -07:00
SDL Wiki Bot 5755bde3b8 Sync SDL3 wiki -> header 2024-07-01 20:36:18 +00:00
Sam Lantinga 212a491f7c Renamed SDL_HINT_IME_NATIVE_UI to SDL_HINT_IME_IMPLEMENTED_UI
This inverts the logic to make more sense from an application perspective.
2024-06-28 19:41:37 -07:00
Sam Lantinga 4c7db129df SDL_HINT_IME_INTERNAL_EDITING and SDL_HINT_IME_SHOW_UI are replaced with SDL_HINT_IME_NATIVE_UI 2024-06-28 17:09:22 -07:00
Sam Lantinga bdd531986b SDL_SetTextInputRect() has been renamed to SDL_SetTextInputArea()
The new function includes the cursor position so IME UI elements can be placed relative to the cursor, as well as having the whole text area available so on-screen keyboards can avoid it.
2024-06-28 17:09:22 -07:00
SDL Wiki Bot c983c1da97 Sync SDL3 wiki -> header 2024-06-28 22:35:57 +00:00
Ryan C. Gordon 982feb7a65 vulkan: SDL_Vulkan_CreateSurface now returns the usual int (0=ok, -1=error).
Fixes #10091.
2024-06-27 15:25:10 -04:00
SDL Wiki Bot 306cc6f91e Sync SDL3 wiki -> header 2024-06-26 17:52:24 +00:00
Sam Lantinga 76631a0978 The text input state has been changed to be window-specific.
SDL_StartTextInput(), SDL_StopTextInput(), SDL_TextInputActive(), SDL_ClearComposition(), and SDL_SetTextInputRect() all now take a window parameter.

This change also fixes IME candidate positioning when SDL_SetTextInputRect() is called before SDL_StartTextInput(), as is recommended in the documentation.
2024-06-24 11:20:08 -07:00
Sam Lantinga 90034b16dc The keycode in key events is affected by modifiers by default.
This behavior can be customized with SDL_HINT_KEYCODE_OPTIONS.
2024-06-22 00:19:06 -07:00
Sam Lantinga 0dd579d40d Removed SDL_Keysym 2024-06-21 22:06:08 -07:00
Sam Lantinga 679e4471ed Added the ability to query the keymap for keycodes based on modifier state 2024-06-21 22:06:08 -07:00
Sam Lantinga 9d816c72ef Updated SDL3 scancode list
This adds more app editing and audio control keys and removes keys that launch applications

Work in progress on https://github.com/libsdl-org/SDL/issues/6390
2024-06-21 22:06:08 -07:00
Hubert Maier 81d8fcb5d8
JANITORIAL: Fix judgement typos (#10059) 2024-06-19 07:14:58 -07:00
Hubert Maier 3acdb8a90b
JANITORIAL: Fix typos in comments in various files (#10058) 2024-06-19 07:13:46 -07:00
Zack Middleton 02597cdc56 Remove cursors not in SDL2 from migration guide 2024-06-18 12:22:02 -04:00
Ryan C. Gordon 38f0214e8a audio: Refer to audio devices to "playback" and "recording".
Fixes #9619.
2024-06-15 01:08:12 -04:00
Sam Lantinga 80a907e0e6 Backed out the viewport and cliprect changes in 9fb5a9ccac
This ended up being lots of application code churn without any real benefit in practice.
2024-06-12 19:25:15 -07:00
Ryan C. Gordon 5416bd5fdc
ios: Move animation callback to its own typedef. 2024-06-12 15:10:16 -04:00
Sam Lantinga 9fb5a9ccac Use floating point values for viewport, clip rectangle, and texture sizes
These are integer values internally, but the API has been changed to make it easier to mix other render code with querying those values.

Fixes https://github.com/libsdl-org/SDL/issues/7519
2024-06-12 10:18:39 -07:00
Anonymous Maarten 32907a9606 Rename SDL_Swap(16|32|64)(LE|BE) to SDL_Swap(LE|BE)(16|32|64) 2024-06-12 02:29:39 +02:00
Anonymous Maarten 657c0135b1 android: android release binary should only contain a shared SDL3 library 2024-06-10 18:04:18 +02:00
Anonymous Maarten dd0bb25f66 cmake: remove SDL_STATIC_PIC cmake option.
Use CMAKE_POSITION_INDEPENDENT_CODE instead
2024-06-10 18:04:18 +02:00
Sam Lantinga 5701c4f4bc Added migration documentation for iOS window properties
Fixes https://github.com/libsdl-org/SDL/issues/9430
2024-06-06 10:59:15 -07:00
Sam Lantinga a0d1445ccb Replaced SDL_GetRendererInfo() with SDL_GetRendererName()
The texture formats are available via the SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER property

Fixes https://github.com/libsdl-org/SDL/issues/9851
2024-06-03 21:10:58 -07:00
Sam Lantinga 3e70964ae2 Updated docs to note that SDL_GetAudioDeviceName() now returns const char * 2024-06-03 17:42:53 -07:00
SDL Wiki Bot 17c459e384 Sync SDL3 wiki -> header 2024-06-03 18:48:59 +00:00
SDL Wiki Bot 9c4fb449e2 Sync SDL3 wiki -> header 2024-06-03 18:41:23 +00:00
SDL Wiki Bot de5a8b61d0 Sync SDL3 wiki -> header 2024-06-03 18:27:57 +00:00
Ryan C. Gordon e23257307e Introduce formal policy for APIs that return strings.
This declares that any `const char *` returned from SDL is owned by SDL, and
promises to be valid _at least_ until the next time the event queue runs, or
SDL_Quit() is called, even if the thing that owns the string gets destroyed
or changed before then.

This is noted in the headers as "the SDL_GetStringRule", so this will both be
greppable to find a detailed explaination in docs/README-strings.md and
wikiheaders will automatically turn it into a link we can point at the
appropriate documentation.

Fixes #9902.

(and several FIXMEs, both known and yet-undocumented.)
2024-06-03 14:20:49 -04:00
Ryan C. Gordon 9a9a3d1a33 SDL_SystemCursor: rename enum items to match CSS.
Fixes #9079.
2024-06-01 22:32:43 -04:00
Sam Lantinga b6360516e4 Added the timerID to the SDL timer callback
Fixes https://github.com/libsdl-org/SDL/issues/2593
2024-05-27 07:57:33 -07:00
Sam Lantinga df25e4022d Removed short aliases for 16-bit pixel formats
These were potentially misleading in the same way the RGB888/BGR888 aliases were

Fixes https://github.com/libsdl-org/SDL/issues/4994
2024-05-27 07:24:46 -07:00
d-musique 535be42b1c Correct name for SDL_CreateThreadWithStackSize() 2024-05-24 07:32:34 -07:00
Sam Lantinga 7a043d9958 Note that SDL_BlitSurface() was renamed SDL_BlitSurfaceScaled() 2024-05-24 05:33:51 -07:00
Ryan C. Gordon b83bb035e6 thread: SDL_CreateThreadWithStackSize is now SDL_CreateThreadWithProperties. 2024-05-22 11:39:43 -04:00
Ryan C. Gordon 0ec716819e thread: Reworked SDL_CreateThread to be consistent across platforms.
Also documented missing and weird bits, rename typedefs to fit SDL standards.
2024-05-22 11:39:43 -04:00
SDL Wiki Bot 95aa9a79a9 Sync SDL3 wiki -> header 2024-05-22 00:07:49 +00:00
SDL Wiki Bot 7164ca374e Sync SDL3 wiki -> header 2024-05-22 00:06:36 +00:00
SDL Wiki Bot 1f0884ffef Sync SDL3 wiki -> header 2024-05-21 23:59:08 +00:00
Anonymous Maarten 45081db9d4 Build Android prefab in releaser.py script
[ci skip]
2024-05-22 01:28:44 +02:00
Sam Lantinga 6f2621438a Renamed DECLSPEC to SDL_DECLSPEC 2024-05-17 17:09:09 -07:00