Commit graph

226 commits

Author SHA1 Message Date
Sam Lantinga
f2074d7af3 Updated copyright for 2025 2025-01-01 07:45:52 -08:00
Sam Lantinga
a8d585aac3 Don't try to enumerate possible texture failure reasons.
This can cause misunderstanding about how texture creation works, as seen in https://github.com/libsdl-org/SDL/issues/9504. Instead let people check the error for more information on why creation may have failed.
2024-12-26 17:17:08 -08:00
SDL Wiki Bot
4d301b88d6 Sync SDL3 wiki -> header
[ci skip]
2024-12-24 00:54:10 +00:00
Sam Lantinga
969f03d9f0 Added SDL_PROP_RENDERER_GPU_DEVICE_POINTER
Fixes https://github.com/libsdl-org/SDL/issues/11600
2024-12-23 16:51:43 -08:00
SDL Wiki Bot
48a0adb2ac Sync SDL3 wiki -> header
[ci skip]
2024-12-18 15:41:13 +00:00
Ryan C. Gordon
4d4a2786bb render: Updates to format-string versions of SDL_RenderDebugText.
- Removes SDL_RenderDebugTextV
- Changes SDL_RenderDebugTextF to SDL_RenderDebugTextFormat and tweaks it to
  work in a world without SDL_RenderDebugTextV.
- Tweaked rendering position of formatted text in the example program.
2024-12-18 10:40:31 -05:00
williamistGitHub
1d0e28a5b3 Add SDL_RenderDebugTextF & SDL_RenderDebugTextV
This should make it easier to quickly put important numbers and such on
the screen without having to format them into a string manually.
2024-12-18 10:40:31 -05:00
SDL Wiki Bot
2ac62d8c67 Sync SDL3 wiki -> header
[ci skip]
2024-12-06 22:17:01 +00:00
SDL Wiki Bot
7278399366 Sync SDL3 wiki -> header
[ci skip]
2024-12-06 22:15:20 +00:00
expikr
d0f1910918 add SDL_RenderTextureAffine 2024-12-06 14:14:47 -08:00
Sam Lantinga
bc4185c685 Document that video and input functions should be called on the main thread.
This is a hard requirement on Apple platforms and while most other platforms don't have a concept of main thread, all video and input functions should be called on the same thread.
2024-12-05 13:53:51 -08:00
SDL Wiki Bot
c0f1fe8e7f Sync SDL3 wiki -> header
[ci skip]
2024-11-28 04:36:33 +00:00
Maia
97ddc9adf2 Fix outdated references to SDL symbols in docs. Fixes #11503 2024-11-22 15:52:31 -05:00
SDL Wiki Bot
0508f100e2 Sync SDL3 wiki -> header
[ci skip]
2024-11-01 22:50:16 +00:00
Petar Popovic
5e855d82e3 Manually bump versions of non-function identifiers introduced after 3.1.3 to 3.2.0 2024-10-23 11:17:46 -07:00
SDL Wiki Bot
24b376ef18 Sync SDL3 wiki -> header
[ci skip]
2024-10-23 16:30:58 +00:00
Ryan C. Gordon
1c1706a00b
fnsince: update \since policy for documentation.
Everything in SDL3 up to the ABI lock is reported as available since 3.1.3.
Everything else will be reported as since 3.2.0 (what will be the first
official release).

Also ran a Perl script over the headers to change everything to 3.1.3 that
wasn't an API function, since fnsince.pl can't manage those. If there's a
macro or datatype that has snuck in that needs to be 3.2.0 instead, we'll
have to manually fix it up, but it shouldn't be a big deal in any case.

Reference PR #11304.
2024-10-23 12:22:43 -04:00
SDL Wiki Bot
7b6416add0 Sync SDL3 wiki -> header
[ci skip]
2024-10-23 05:41:03 +00:00
Petar Popovic
af1c165352 Set version of new identifiers after 3.1.3 release to 3.1.6 2024-10-22 22:40:07 -07:00
SDL Wiki Bot
d9e6fe0b7a Sync SDL3 wiki -> header
[ci skip]
2024-10-22 20:03:14 +00:00
Ryan C. Gordon
f5c27a3a2c
render: Corrected docs for SDL_SetRenderVSync(). 2024-10-22 16:01:58 -04:00
SDL Wiki Bot
eb1451536e Sync SDL3 wiki -> header
[ci skip]
2024-10-20 14:12:45 +00:00
Petar Popovic
5819d4b360 SDL_CreateRenderer() comment: Remove mention of flags 2024-10-20 10:12:14 -04:00
SDL Wiki Bot
3733b1d5d8 Sync SDL3 wiki -> header
[ci skip]
2024-10-14 06:46:10 +00:00
Ryan C. Gordon
c20918b0fb render: Add SDL_RenderDebugText().
Fixes #11201.
2024-10-14 02:45:33 -04:00
Ryan C. Gordon
191f3ecbbc render: Restore previous policy for converting window/render coordinates.
Before this commit, it would adjust for the logical presentation settings.
Now, it works as it did before the logical presentation render target was
removed: it takes current viewport and scale into account, as well.

Fixes #10978.
2024-10-03 16:31:56 -04:00
Ryan C. Gordon
d287feaddf
render: Remove non-pointer args' const qualifiers on SDL_RenderTextureRotated.
Reference Issue #11032.
2024-10-02 15:31:20 -04:00
SDL Wiki Bot
f351395c46 Sync SDL3 wiki -> header 2024-10-01 15:10:40 +00:00
Sam Lantinga
1f3a0d12e6 Made texture size and format public in the API
Also added refcount to textures so they can be retained by application code.
2024-10-01 08:10:04 -07:00
Anonymous Maarten
345cae361d Document mode parameter of SDL_GetRenderLogicalPresentation 2024-09-26 16:12:13 +02:00
SDL Wiki Bot
81644d260f Sync SDL3 wiki -> header 2024-09-25 20:31:24 +00:00
Ryan C. Gordon
122cd4db2b
include: Added \threadsafety notes to all SDL_render.h functions. 2024-09-25 16:30:04 -04:00
SDL Wiki Bot
276969cd58 Sync SDL3 wiki -> header 2024-09-25 20:27:11 +00:00
Ryan C. Gordon
4c48ff51f8 render: SDL_RenderPresent now behaves when a render target is currently set.
It'll temporarily unbind it, draw letterboxing if necessary, present, and
then rebind the previous render target.
2024-09-25 16:26:36 -04:00
Ryan C. Gordon
7a6a0becb8 render: Fixed a FIXME for SDL_SetRenderViewport with a negative size. 2024-09-25 16:26:36 -04:00
Ryan C. Gordon
54459def69 render: Remove the logical presentation render target.
Now we render directly to the window, scaling as appropriate. This fixes some
concerns the render target introduced, like the quality of the final scaled
output, how to step outside of the logical size temporarily to draw some
things sharply at the native resolution, and loss of sub-pixel precision.

Fixes #8736.
2024-09-25 16:26:36 -04:00
SDL Wiki Bot
026d3c2306 Sync SDL3 wiki -> header 2024-09-18 15:33:11 +00:00
Sam Lantinga
a90ad3b0e2 Removed SDL_bool in favor of plain bool
We require stdbool.h in the build environment, so we might as well use the plain bool type.

If your environment doesn't have stdbool.h, this simple replacement will suffice:
typedef signed char bool;
2024-09-18 08:32:30 -07:00
Sam Lantinga
1bbc897e48 Updated documentation for bool return type
Also updated the test CRC functions to return bool.
2024-09-16 13:12:15 -07:00
Sam Lantinga
7df1caba7c Clarified that the contents of new textures aren't defined. 2024-09-08 07:23:17 -07:00
Maia
fa892d15b7 include files with required types directly 2024-09-07 08:37:46 -07:00
SDL Wiki Bot
85bbc6028a Sync SDL3 wiki -> header 2024-08-27 17:33:28 +00:00
Sam Lantinga
9ff3446f03 Use SDL_bool instead an int return code in the SDL API
Most SDL functions used to indicate success or failure using an int return code. These functions have been changed to return SDL_bool.

Here is a coccinelle patch to change code that previously compared the return value to 0 and changes it to a boolean test:
@ bool_return_type  @
identifier func =~ "^(SDL_AddEventWatch|SDL_AddHintCallback|SDL_AddSurfaceAlternateImage|SDL_AddVulkanRenderSemaphores|SDL_BindAudioStream|SDL_BindAudioStreams|SDL_BlitSurface|SDL_BlitSurface9Grid|SDL_BlitSurfaceScaled|SDL_BlitSurfaceTiled|SDL_BlitSurfaceTiledWithScale|SDL_BlitSurfaceUnchecked|SDL_BlitSurfaceUncheckedScaled|SDL_CaptureMouse|SDL_ClearAudioStream|SDL_ClearClipboardData|SDL_ClearComposition|SDL_ClearError|SDL_ClearProperty|SDL_ClearSurface|SDL_CloseIO|SDL_CloseStorage|SDL_ConvertAudioSamples|SDL_ConvertEventToRenderCoordinates|SDL_ConvertPixels|SDL_ConvertPixelsAndColorspace|SDL_CopyFile|SDL_CopyProperties|SDL_CopyStorageFile|SDL_CreateDirectory|SDL_CreateStorageDirectory|SDL_CreateWindowAndRenderer|SDL_DateTimeToTime|SDL_DestroyWindowSurface|SDL_DetachVirtualJoystick|SDL_DisableScreenSaver|SDL_EnableScreenSaver|SDL_EnumerateDirectory|SDL_EnumerateProperties|SDL_EnumerateStorageDirectory|SDL_FillSurfaceRect|SDL_FillSurfaceRects|SDL_FlashWindow|SDL_FlipSurface|SDL_FlushAudioStream|SDL_FlushRenderer|SDL_GL_DestroyContext|SDL_GL_GetAttribute|SDL_GL_GetSwapInterval|SDL_GL_LoadLibrary|SDL_GL_MakeCurrent|SDL_GL_SetAttribute|SDL_GL_SetSwapInterval|SDL_GL_SwapWindow|SDL_GetAudioDeviceFormat|SDL_GetAudioStreamFormat|SDL_GetCameraFormat|SDL_GetClosestFullscreenDisplayMode|SDL_GetCurrentRenderOutputSize|SDL_GetCurrentTime|SDL_GetDXGIOutputInfo|SDL_GetDateTimeLocalePreferences|SDL_GetDisplayBounds|SDL_GetDisplayUsableBounds|SDL_GetGDKDefaultUser|SDL_GetGDKTaskQueue|SDL_GetGamepadSensorData|SDL_GetGamepadTouchpadFinger|SDL_GetHapticEffectStatus|SDL_GetJoystickBall|SDL_GetMasksForPixelFormat|SDL_GetPathInfo|SDL_GetRectUnion|SDL_GetRectUnionFloat|SDL_GetRenderClipRect|SDL_GetRenderColorScale|SDL_GetRenderDrawBlendMode|SDL_GetRenderDrawColor|SDL_GetRenderDrawColorFloat|SDL_GetRenderLogicalPresentation|SDL_GetRenderLogicalPresentationRect|SDL_GetRenderOutputSize|SDL_GetRenderSafeArea|SDL_GetRenderScale|SDL_GetRenderVSync|SDL_GetRenderViewport|SDL_GetSensorData|SDL_GetStorageFileSize|SDL_GetStoragePathInfo|SDL_GetSurfaceAlphaMod|SDL_GetSurfaceBlendMode|SDL_GetSurfaceClipRect|SDL_GetSurfaceColorKey|SDL_GetSurfaceColorMod|SDL_GetTextInputArea|SDL_GetTextureAlphaMod|SDL_GetTextureAlphaModFloat|SDL_GetTextureBlendMode|SDL_GetTextureColorMod|SDL_GetTextureColorModFloat|SDL_GetTextureScaleMode|SDL_GetTextureSize|SDL_GetWindowAspectRatio|SDL_GetWindowBordersSize|SDL_GetWindowMaximumSize|SDL_GetWindowMinimumSize|SDL_GetWindowPosition|SDL_GetWindowRelativeMouseMode|SDL_GetWindowSafeArea|SDL_GetWindowSize|SDL_GetWindowSizeInPixels|SDL_GetWindowSurfaceVSync|SDL_HideCursor|SDL_HideWindow|SDL_Init|SDL_InitHapticRumble|SDL_InitSubSystem|SDL_LoadWAV|SDL_LoadWAV_IO|SDL_LockAudioStream|SDL_LockProperties|SDL_LockSurface|SDL_LockTexture|SDL_LockTextureToSurface|SDL_MaximizeWindow|SDL_MinimizeWindow|SDL_MixAudio|SDL_OpenURL|SDL_OutOfMemory|SDL_PauseAudioDevice|SDL_PauseAudioStreamDevice|SDL_PauseHaptic|SDL_PlayHapticRumble|SDL_PremultiplyAlpha|SDL_PremultiplySurfaceAlpha|SDL_PushEvent|SDL_PutAudioStreamData|SDL_RaiseWindow|SDL_ReadStorageFile|SDL_ReadSurfacePixel|SDL_ReadSurfacePixelFloat|SDL_RegisterApp|SDL_ReloadGamepadMappings|SDL_RemovePath|SDL_RemoveStoragePath|SDL_RemoveTimer|SDL_RenamePath|SDL_RenameStoragePath|SDL_RenderClear|SDL_RenderCoordinatesFromWindow|SDL_RenderCoordinatesToWindow|SDL_RenderFillRect|SDL_RenderFillRects|SDL_RenderGeometry|SDL_RenderGeometryRaw|SDL_RenderLine|SDL_RenderLines|SDL_RenderPoint|SDL_RenderPoints|SDL_RenderPresent|SDL_RenderRect|SDL_RenderRects|SDL_RenderTexture|SDL_RenderTexture9Grid|SDL_RenderTextureRotated|SDL_RenderTextureTiled|SDL_RequestAndroidPermission|SDL_RestoreWindow|SDL_ResumeAudioDevice|SDL_ResumeAudioStreamDevice|SDL_ResumeHaptic|SDL_RumbleGamepad|SDL_RumbleGamepadTriggers|SDL_RumbleJoystick|SDL_RumbleJoystickTriggers|SDL_RunHapticEffect|SDL_SaveBMP|SDL_SaveBMP_IO|SDL_SendAndroidMessage|SDL_SendGamepadEffect|SDL_SendJoystickEffect|SDL_SendJoystickVirtualSensorData|SDL_SetAppMetadata|SDL_SetAppMetadataProperty|SDL_SetAudioDeviceGain|SDL_SetAudioPostmixCallback|SDL_SetAudioStreamFormat|SDL_SetAudioStreamFrequencyRatio|SDL_SetAudioStreamGain|SDL_SetAudioStreamGetCallback|SDL_SetAudioStreamInputChannelMap|SDL_SetAudioStreamOutputChannelMap|SDL_SetAudioStreamPutCallback|SDL_SetBooleanProperty|SDL_SetClipboardData|SDL_SetClipboardText|SDL_SetCursor|SDL_SetFloatProperty|SDL_SetGamepadLED|SDL_SetGamepadMapping|SDL_SetGamepadPlayerIndex|SDL_SetGamepadSensorEnabled|SDL_SetHapticAutocenter|SDL_SetHapticGain|SDL_SetJoystickLED|SDL_SetJoystickPlayerIndex|SDL_SetJoystickVirtualAxis|SDL_SetJoystickVirtualBall|SDL_SetJoystickVirtualButton|SDL_SetJoystickVirtualHat|SDL_SetJoystickVirtualTouchpad|SDL_SetLinuxThreadPriority|SDL_SetLinuxThreadPriorityAndPolicy|SDL_SetLogPriorityPrefix|SDL_SetMemoryFunctions|SDL_SetNumberProperty|SDL_SetPaletteColors|SDL_SetPointerProperty|SDL_SetPointerPropertyWithCleanup|SDL_SetPrimarySelectionText|SDL_SetRenderClipRect|SDL_SetRenderColorScale|SDL_SetRenderDrawBlendMode|SDL_SetRenderDrawColor|SDL_SetRenderDrawColorFloat|SDL_SetRenderLogicalPresentation|SDL_SetRenderScale|SDL_SetRenderTarget|SDL_SetRenderVSync|SDL_SetRenderViewport|SDL_SetScancodeName|SDL_SetStringProperty|SDL_SetSurfaceAlphaMod|SDL_SetSurfaceBlendMode|SDL_SetSurfaceColorKey|SDL_SetSurfaceColorMod|SDL_SetSurfaceColorspace|SDL_SetSurfacePalette|SDL_SetSurfaceRLE|SDL_SetTLS|SDL_SetTextInputArea|SDL_SetTextureAlphaMod|SDL_SetTextureAlphaModFloat|SDL_SetTextureBlendMode|SDL_SetTextureColorMod|SDL_SetTextureColorModFloat|SDL_SetTextureScaleMode|SDL_SetThreadPriority|SDL_SetWindowAlwaysOnTop|SDL_SetWindowAspectRatio|SDL_SetWindowBordered|SDL_SetWindowFocusable|SDL_SetWindowFullscreen|SDL_SetWindowFullscreenMode|SDL_SetWindowHitTest|SDL_SetWindowIcon|SDL_SetWindowKeyboardGrab|SDL_SetWindowMaximumSize|SDL_SetWindowMinimumSize|SDL_SetWindowModalFor|SDL_SetWindowMouseGrab|SDL_SetWindowMouseRect|SDL_SetWindowOpacity|SDL_SetWindowPosition|SDL_SetWindowRelativeMouseMode|SDL_SetWindowResizable|SDL_SetWindowShape|SDL_SetWindowSize|SDL_SetWindowSurfaceVSync|SDL_SetWindowTitle|SDL_SetiOSAnimationCallback|SDL_ShowAndroidToast|SDL_ShowCursor|SDL_ShowMessageBox|SDL_ShowSimpleMessageBox|SDL_ShowWindow|SDL_ShowWindowSystemMenu|SDL_StartTextInput|SDL_StartTextInputWithProperties|SDL_StopHapticEffect|SDL_StopHapticEffects|SDL_StopHapticRumble|SDL_StopTextInput|SDL_SyncWindow|SDL_TimeToDateTime|SDL_TryLockMutex|SDL_TryLockRWLockForReading|SDL_TryLockRWLockForWriting|SDL_TryWaitSemaphore|SDL_UnlockAudioStream|SDL_UpdateHapticEffect|SDL_UpdateNVTexture|SDL_UpdateTexture|SDL_UpdateWindowSurface|SDL_UpdateWindowSurfaceRects|SDL_UpdateYUVTexture|SDL_Vulkan_CreateSurface|SDL_Vulkan_LoadLibrary|SDL_WaitConditionTimeout|SDL_WaitSemaphoreTimeout|SDL_WarpMouseGlobal|SDL_WriteStorageFile|SDL_WriteSurfacePixel|SDL_WriteSurfacePixelFloat)$";
@@
(
  func(
  ...
  )
- == 0
|
- func(
+ !func(
  ...
  )
- < 0
|
- func(
+ !func(
  ...
  )
- != 0
|
- func(
+ !func(
  ...
  )
- == -1
)
2024-08-27 10:31:46 -07:00
Sam Lantinga
d7b027a241 Namespace the object creation properties
Fixes https://github.com/libsdl-org/SDL/issues/10543
2024-08-15 12:56:04 -07:00
Sam Lantinga
0a6bab3ac7 Added SDL_CreateRenderer to the "see also" for SDL_RenderPresent() 2024-08-05 07:56:29 -07:00
SDL Wiki Bot
2e058ba7a4 Sync SDL3 wiki -> header 2024-08-01 05:37:11 +00:00
Sam Lantinga
a5f18048b2 Extend the 9-grid functions to handle a non-uniform grid layout (thanks @zaun!)
Fixes https://github.com/libsdl-org/SDL/issues/10389
2024-07-31 22:36:39 -07:00
Sam Lantinga
4f55271571 Removed temporary memory from the API
It was intended to make the API easier to use, but various automatic garbage collection all had flaws, and making the application periodically clean up temporary memory added cognitive load to using the API, and in many cases was it was difficult to restructure threaded code to handle this.

So, we're largely going back to the original system, where the API returns allocated results and you free them.

In addition, to solve the problems we originally wanted temporary memory for:
* Short strings with a finite count, like device names, get stored in a per-thread string pool.
* Events continue to use temporary memory internally, which is cleaned up on the next event processing cycle.
2024-07-26 20:59:14 -07:00
Sam Lantinga
5e513ecc7f Don't automatically free temporary memory, let the application call SDL_FreeTemporaryMemory() when it's ready.
Also mark up all functions that return temporary memory with SDL_DECLSPEC_TEMP, to help people implementing language bindings.

Fixes https://github.com/libsdl-org/SDL/issues/10378
2024-07-26 10:05:03 -07:00
SDL Wiki Bot
ba8495c214 Sync SDL3 wiki -> header 2024-07-25 00:41:44 +00:00