All Functions and Procedures

Name Unit Description
aacircleColor sdl2_gfx

AA Circle

aacircleRGBA sdl2_gfx

 

aaellipseColor sdl2_gfx

AA Ellipse

aaellipseRGBA sdl2_gfx

 

aalineColor sdl2_gfx

AA Line

aalineRGBA sdl2_gfx

 

aapolygonColor sdl2_gfx

AA-Polygon

aapolygonRGBA sdl2_gfx

 

aatrigonColor sdl2_gfx

AA-Trigon

aatrigonRGBA sdl2_gfx

 

arcColor sdl2_gfx

Arc

arcRGBA sdl2_gfx

 

bezierColor sdl2_gfx

Bezier

bezierRGBA sdl2_gfx

 

boxColor sdl2_gfx

Filled rectangle (Box)

boxRGBA sdl2_gfx

 

characterColor sdl2_gfx

 

characterRGBA sdl2_gfx

 

circleColor sdl2_gfx

Circle

circleRGBA sdl2_gfx

 

ellipseColor sdl2_gfx

Ellipse

ellipseRGBA sdl2_gfx

 

filledCircleColor sdl2_gfx

Filled Circle

filledCircleRGBA sdl2_gfx

 

filledEllipseColor sdl2_gfx

Filled Ellipse

filledEllipseRGBA sdl2_gfx

 

filledPieColor sdl2_gfx

Filled Pie

filledPieRGBA sdl2_gfx

 

filledPolygonColor sdl2_gfx

Filled Polygon

filledPolygonRGBA sdl2_gfx

 

filledTrigonColor sdl2_gfx

Filled Trigon

filledTrigonRGBA sdl2_gfx

 

gfxPrimitivesSetFont sdl2_gfx

Characters/Strings

gfxPrimitivesSetFontRotation sdl2_gfx

 

hlineColor sdl2_gfx

Horizontal line

hlineRGBA sdl2_gfx

 

IMG_GetError sdl2_image

 

IMG_Init sdl2_image

Loads dynamic libraries and prepares them for use. Flags should be one or more flags from IMG_InitFlags OR'd together. It returns the flags successfully initialized, or 0 on failure.

IMG_isBMP sdl2_image

 

IMG_isCUR sdl2_image

 

IMG_isGIF sdl2_image

 

IMG_isICO sdl2_image

Functions to detect a file type, given a seekable source *

IMG_isJPG sdl2_image

 

IMG_isLBM sdl2_image

 

IMG_isPCX sdl2_image

 

IMG_isPNG sdl2_image

 

IMG_isPNM sdl2_image

 

IMG_isSVG sdl2_image

 

IMG_isTIF sdl2_image

 

IMG_isWEBP sdl2_image

 

IMG_isXCF sdl2_image

 

IMG_isXPM sdl2_image

 

IMG_isXV sdl2_image

 

IMG_Linked_Version sdl2_image

This function gets the version of the dynamically linked SDL_image library.

Note that this function does NOT allocate a new TSDL_Version and fill it with info, but returns a pointer to a TSDL_Version residing inside dynlinked file.

As such, attempting to Dispose() of this memory will result in access violation.

IMG_Load sdl2_image

Convenience functions *

IMG_LoadBMP_RW sdl2_image

 

IMG_LoadCUR_RW sdl2_image

 

IMG_LoadGIF_RW sdl2_image

 

IMG_LoadICO_RW sdl2_image

Individual loading functions *

IMG_LoadJPG_RW sdl2_image

 

IMG_LoadLBM_RW sdl2_image

 

IMG_LoadPCX_RW sdl2_image

 

IMG_LoadPNG_RW sdl2_image

 

IMG_LoadPNM_RW sdl2_image

 

IMG_LoadSVG_RW sdl2_image

 

IMG_LoadTexture sdl2_image

Load an image directly into a render texture. *

IMG_LoadTextureTyped_RW sdl2_image

 

IMG_LoadTexture_RW sdl2_image

 

IMG_LoadTGA_RW sdl2_image

 

IMG_LoadTIF_RW sdl2_image

 

IMG_LoadTyped_RW sdl2_image

Load an image from an SDL data source. The 'type' may be one of: "BMP", "GIF", "PNG", etc.

If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);

IMG_LoadWEBP_RW sdl2_image

 

IMG_LoadXCF_RW sdl2_image

 

IMG_LoadXPM_RW sdl2_image

 

IMG_LoadXV_RW sdl2_image

 

IMG_Load_RW sdl2_image

 

IMG_Quit sdl2_image

Unloads libraries loaded with IMG_Init *

IMG_ReadXPMFromArray sdl2_image

 

IMG_SaveJPG sdl2_image

 

IMG_SaveJPG_RW sdl2_image

 

IMG_SavePNG sdl2_image

Individual saving functions *

IMG_SavePNG_RW sdl2_image

 

IMG_SetError sdl2_image

We'll use SDL for reporting errors *

lineColor sdl2_gfx

Line

lineRGBA sdl2_gfx

 

Mix_AllocateChannels sdl2_mixer

Dynamically change the number of channels managed by the mixer. If decreasing the number of channels, the upper channels are stopped. This function returns the new number of allocated channels.

Mix_ChannelFinished sdl2_mixer

 

Mix_ClearError sdl2_mixer

 

Mix_CloseAudiocdecl sdl2_mixer

Close the mixer, halting all playing audio *

Mix_EachSoundFont sdl2_mixer

 

Mix_ExpireChannel sdl2_mixer

Change the expiration delay for a particular channel. The sample will stop playing after the 'ticks' milliseconds have elapsed, or remove the expiration if 'ticks' is -1

Mix_FadeInChannel sdl2_mixer

 

Mix_FadeInChannelTimed sdl2_mixer

 

Mix_FadeInMusic sdl2_mixer

Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions *

Mix_FadeInMusicPos sdl2_mixer

 

Mix_FadeOutChannel sdl2_mixer

Halt a channel, fading it out progressively till it's silent The ms parameter indicates the number of milliseconds the fading will take.

Mix_FadeOutGroup sdl2_mixer

 

Mix_FadeOutMusic sdl2_mixer

 

Mix_FadingChannel sdl2_mixer

 

Mix_FadingMusic sdl2_mixer

Query the fading status of a channel *

Mix_FreeChunk sdl2_mixer

Free an audio chunk previously loaded *

Mix_FreeMusic sdl2_mixer

 

Mix_GetChunk sdl2_mixer

Get the Mix_Chunk currently associated with a mixer channel Returns NULL if it's an invalid channel, or there's no chunk associated.

Mix_GetChunkDecoder sdl2_mixer

 

Mix_GetError sdl2_mixer

 

Mix_GetMusicDecoder sdl2_mixer

 

Mix_GetMusicHookData sdl2_mixer

Get a pointer to the user data for the current music hook *

Mix_GetMusicType sdl2_mixer

Find out the music format of a mixer music, or the currently playing music, if 'music' is NULL.

Mix_GetNumChunkDecoders sdl2_mixer

Get a list of chunk/music decoders that this build of SDL_mixer provides. This list can change between builds AND runs of the program, if external libraries that add functionality become available. You must successfully call Mix_OpenAudio() before calling these functions. This API is only available in SDL_mixer 1.2.9 and later.

// usage... int i; const int total = Mix_GetNumChunkDecoders(); for (i = 0; i < total; i++) printf("Supported chunk decoder: [%s]\n", Mix_GetChunkDecoder(i));

Appearing in this list doesn't promise your specific audio file will decode...but it's handy to know if you have, say, a functioning Timidity install.

These return values are static, read-only data; do not modify or free it. The pointers remain valid until you call Mix_CloseAudio().

Mix_GetNumMusicDecoders sdl2_mixer

 

Mix_GetSoundFonts sdl2_mixer

 

Mix_GetSynchroValue sdl2_mixer

 

Mix_GroupAvailable sdl2_mixer

Finds the first available channel in a group of channels, returning -1 if none are available.

Mix_GroupChannel sdl2_mixer

Attach a tag to a channel. A tag can be assigned to several mixer channels, to form groups of channels. If 'tag' is -1, the tag is removed (actually -1 is the tag used to represent the group of all the channels). Returns true if everything was OK.

Mix_GroupChannels sdl2_mixer

Assign several consecutive channels to a group *

Mix_GroupCount sdl2_mixer

Returns the number of channels in a group. This is also a subtle way to get the total number of channels when 'tag' is -1

Mix_GroupNewer sdl2_mixer

Finds the "most recent" (i.e. last) sample playing in a group of channels *

Mix_GroupOldest sdl2_mixer

Finds the "oldest" sample playing in a group of channels *

Mix_HaltChannel sdl2_mixer

Halt playing of a particular channel *

Mix_HaltGroup sdl2_mixer

 

Mix_HaltMusic sdl2_mixer

 

Mix_HasChunkDecoder sdl2_mixer

 

Mix_HasMusicDecoder sdl2_mixer

 

Mix_HookMusic sdl2_mixer

Add your own music player or additional mixer function. If 'mix_func' is NULL, the default music player is re-enabled.

Mix_HookMusicFinished sdl2_mixer

 

Mix_Init sdl2_mixer

Loads dynamic libraries and prepares them for use. Flags should be one or more flags from MIX_InitFlags OR'd together. It returns the flags successfully initialized, or 0 on failure.

Mix_Linked_Version sdl2_mixer

This function gets the version of the dynamically linked SDL_mixer library. it should NOT be used to fill a version structure, instead you should use the SDL_MIXER_VERSION() macro.

Mix_LoadMUS sdl2_mixer

 

Mix_LoadMUSType_RW sdl2_mixer

Load a music file from an SDL_RWop object assuming a specific format *

Mix_LoadMUS_RW sdl2_mixer

Load a music file from an SDL_RWop object (Ogg and MikMod specific currently) Matt Campbell (matt@campbellhome.dhs.org) April 2000 *

Mix_LoadWAV sdl2_mixer

 

Mix_LoadWAV_RW sdl2_mixer

Load a wave file or a music (.mod .s3m .it .xm) file *

Mix_OpenAudio sdl2_mixer

Open the mixer with a certain audio format *

Mix_Pause sdl2_mixer

Pause/Resume a particular channel *

Mix_Paused sdl2_mixer

 

Mix_PausedMusic sdl2_mixer

 

Mix_PauseMusiccdecl sdl2_mixer

Pause/Resume the music stream *

Mix_PlayChannel sdl2_mixer

Play an audio chunk on a specific channel. If the specified channel is -1, play on the first free channel. If 'loops' is greater than zero, loop the sound that many times. If 'loops' is -1, loop inifinitely (˜65000 times). Returns which channel was used to play the sound.

Mix_PlayChannelTimed sdl2_mixer

The same as above, but the sound is played at most 'ticks' milliseconds *

Mix_Playing sdl2_mixer

Check the status of a specific channel. If the specified channel is -1, check all channels.

Mix_PlayingMusic sdl2_mixer

 

Mix_PlayMusic sdl2_mixer

 

Mix_QuerySpec sdl2_mixer

Find out what the actual audio device parameters are. This function returns 1 if the audio has been opened, 0 otherwise.

Mix_QuickLoad_RAW sdl2_mixer

Load raw audio data of the mixer format from a memory buffer *

Mix_QuickLoad_WAV sdl2_mixer

Load a wave file of the mixer format from a memory buffer *

Mix_Quit sdl2_mixer

Unloads libraries loaded with Mix_Init *

Mix_RegisterEffect sdl2_mixer

Register a special effect function. At mixing time, the channel data is copied into a buffer and passed through each registered effect function. After it passes through all the functions, it is mixed into the final output stream. The copy to buffer is performed once, then each effect function performs on the output of the previous effect. Understand that this extra copy to a buffer is not performed if there are no effects registered for a given chunk, which saves CPU cycles, and any given effect will be extra cycles, too, so it is crucial that your code run fast. Also note that the data that your function is given is in the format of the sound device, and not the format you gave to Mix_OpenAudio(), although they may in reality be the same. This is an unfortunate but necessary speed concern. Use Mix_QuerySpec() to determine if you can handle the data before you register your effect, and take appropriate actions. You may also specify a callback (Mix_EffectDone_t) that is called when the channel finishes playing. This gives you a more fine-grained control than Mix_ChannelFinished(), in case you need to free effect-specific resources, etc. If you don't need this, you can specify NULL. You may set the callbacks before or after calling Mix_PlayChannel(). Things like Mix_SetPanning() are just internal special effect functions, so if you are using that, you've already incurred the overhead of a copy to a separate buffer, and that these effects will be in the queue with any functions you've registered. The list of registered effects for a channel is reset when a chunk finishes playing, so you need to explicitly set them with each call to Mix_PlayChannel*(). You may also register a special effect function that is to be run after final mixing occurs. The rules for these callbacks are identical to those in Mix_RegisterEffect, but they are run after all the channels and the music have been mixed into a single stream, whereas channel-specific effects run on a given channel before any other mixing occurs. These global effect callbacks are call "posteffects". Posteffects only have their Mix_EffectDone_t function called when they are unregistered (since the main output stream is never "done" in the same sense as a channel). You must unregister them manually when you've had enough. Your callback will be told that the channel being mixed is (MIX_CHANNEL_POST) if the processing is considered a posteffect.

After all these effects have finished processing, the callback registered through Mix_SetPostMix() runs, and then the stream goes to the audio device.

DO NOT EVER call SDL_LockAudio() from your callback function!

returns zero if error (no such channel), nonzero if added. Error messages can be retrieved from Mix_GetError().

Mix_ReserveChannels sdl2_mixer

Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate them dynamically to the next sample if requested with a -1 value below. Returns the number of reserved channels.

Mix_Resume sdl2_mixer

 

Mix_ResumeMusiccdecl sdl2_mixer

 

Mix_RewindMusiccdecl sdl2_mixer

 

Mix_SetDistance sdl2_mixer

Set the "distance" of a channel. (distance) is an integer from 0 to 255 that specifies the location of the sound in relation to the listener. Distance 0 is overlapping the listener, and 255 is as far away as possible A distance of 255 does not guarantee silence; in such a case, you might want to try changing the chunk's volume, or just cull the sample from the mixing process with Mix_HaltChannel(). For efficiency, the precision of this effect may be limited (distances 1 through 7 might all produce the same effect, 8 through 15 are equal, etc). (distance) is an integer between 0 and 255 that specifies the space between the sound and the listener. The larger the number, the further away the sound is. Setting (distance) to 0 unregisters this effect, since the data would be unchanged. If you need more precise positional audio, consider using OpenAL for spatialized effects instead of SDL_mixer. This is only meant to be a basic effect for simple "3D" games.

Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and the distance attenuation will be done to the final mixed stream before passing it on to the audio device.

This uses the Mix_RegisterEffect() API internally.

returns zero if error (no such channel or Mix_RegisterEffect() fails), nonzero if position effect is enabled. Error messages can be retrieved from Mix_GetError().

Mix_SetError sdl2_mixer

We'll use SDL for reporting errors *

Mix_SetMusicCMD sdl2_mixer

Stop music and set external music playback command *

Mix_SetMusicPosition sdl2_mixer

Set the current position in the music stream. This returns 0 if successful, or -1 if it failed or isn't implemented. This function is only implemented for MOD music formats (set pattern order number) and for OGG, FLAC, MP3_MAD, MP3_MPG and MODPLUG music (set position in seconds), at the moment.

Mix_SetPanning sdl2_mixer

Set the panning of a channel. The left and right channels are specified as integers between 0 and 255, quietest to loudest, respectively.

Technically, this is just individual volume control for a sample with two (stereo) channels, so it can be used for more than just panning. If you want real panning, call it like this:

Mix_SetPanning(channel, left, 255 - left);

...which isn't so hard.

Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and the panning will be done to the final mixed stream before passing it on to the audio device.

This uses the Mix_RegisterEffect() API internally, and returns without registering the effect function if the audio device is not configured for stereo output. Setting both (left) and (right) to 255 causes this effect to be unregistered, since that is the data's normal state.

returns zero if error (no such channel or Mix_RegisterEffect() fails), nonzero if panning effect enabled. Note that an audio device in mono mode is a no-op, but this call will return successful in that case. Error messages can be retrieved from Mix_GetError().

Mix_SetPosition sdl2_mixer

Set the position of a channel. (angle) is an integer from 0 to 360, that specifies the location of the sound in relation to the listener. (angle) will be reduced as neccesary (540 becomes 180 degrees, -100 becomes 260). Angle 0 is due north, and rotates clockwise as the value increases. For efficiency, the precision of this effect may be limited (angles 1 through 7 might all produce the same effect, 8 through 15 are equal, etc). (distance) is an integer between 0 and 255 that specifies the space between the sound and the listener. The larger the number, the further away the sound is. Using 255 does not guarantee that the channel will be culled from the mixing process or be completely silent. For efficiency, the precision of this effect may be limited (distance 0 through 5 might all produce the same effect, 6 through 10 are equal, etc). Setting (angle) and (distance) to 0 unregisters this effect, since the data would be unchanged.

If you need more precise positional audio, consider using OpenAL for spatialized effects instead of SDL_mixer. This is only meant to be a basic effect for simple "3D" games.

If the audio device is configured for mono output, then you won't get any effectiveness from the angle; however, distance attenuation on the channel will still occur. While this effect will function with stereo voices, it makes more sense to use voices with only one channel of sound, so when they are mixed through this effect, the positioning will sound correct. You can convert them to mono through SDL before giving them to the mixer in the first place if you like.

Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and the positioning will be done to the final mixed stream before passing it on to the audio device.

This is a convenience wrapper over Mix_SetDistance() and Mix_SetPanning().

returns zero if error (no such channel or Mix_RegisterEffect() fails), nonzero if position effect is enabled. Error messages can be retrieved from Mix_GetError().

Mix_SetPostMix sdl2_mixer

 

Mix_SetReverseStereo sdl2_mixer

Causes a channel to reverse its stereo. This is handy if the user has his speakers hooked up backwards, or you would like to have a minor bit of psychedelia in your sound code. :) Calling this function with (flip) set to non-zero reverses the chunks's usual channels. If (flip) is zero, the effect is unregistered.

This uses the Mix_RegisterEffect() API internally, and thus is probably more CPU intensive than having the user just plug in his speakers correctly. Mix_SetReverseStereo() returns without registering the effect function if the audio device is not configured for stereo output.

If you specify MIX_CHANNEL_POST for (channel), then this the effect is used on the final mixed stream before sending it on to the audio device (a posteffect).

returns zero if error (no such channel or Mix_RegisterEffect() fails), nonzero if reversing effect is enabled. Note that an audio device in mono mode is a no-op, but this call will return successful in that case. Error messages can be retrieved from Mix_GetError().

Mix_SetSoundFonts sdl2_mixer

Set/Get/Iterate SoundFonts paths to use by supported MIDI backends *

Mix_SetSynchroValue sdl2_mixer

Synchro value is set by MikMod from modules while playing *

Mix_UnregisterAllEffects sdl2_mixer

You may not need to call this explicitly, unless you need to stop all effects from processing in the middle of a chunk's playback. Note that this will also shut off some internal effect processing, since Mix_SetPanning() and others may use this API under the hood. This is called internally when a channel completes playback. Posteffects are never implicitly unregistered as they are for channels, but they may be explicitly unregistered through this function by specifying MIX_CHANNEL_POST for a channel. returns zero if error (no such channel), nonzero if all effects removed. Error messages can be retrieved from Mix_GetError().

Mix_UnregisterEffect sdl2_mixer

You may not need to call this explicitly, unless you need to stop an effect from processing in the middle of a chunk's playback. Posteffects are never implicitly unregistered as they are for channels, but they may be explicitly unregistered through this function by specifying MIX_CHANNEL_POST for a channel. returns zero if error (no such channel or effect), nonzero if removed. Error messages can be retrieved from Mix_GetError().

MIX_VERSION sdl2_mixer

 

Mix_Volume sdl2_mixer

Set the volume in the range of 0-128 of a specific channel or chunk. If the specified channel is -1, set volume for all channels. Returns the original volume. If the specified volume is -1, just return the current volume.

Mix_VolumeChunk sdl2_mixer

 

Mix_VolumeMusic sdl2_mixer

 

pieColor sdl2_gfx

Pie

pieRGBA sdl2_gfx

 

pixelColor sdl2_gfx

Pixel *

pixelRGBA sdl2_gfx

 

polygonColor sdl2_gfx

Polygon

polygonRGBA sdl2_gfx

 

rectangleColor sdl2_gfx

Rectangle

rectangleRGBA sdl2_gfx

 

rotateSurface90Degrees sdl2_gfx

Specialized rotation functions

rotozoomSurface sdl2_gfx

Rotozoom functions

rotozoomSurfaceSize sdl2_gfx

 

rotozoomSurfaceSizeXY sdl2_gfx

 

rotozoomSurfaceXY sdl2_gfx

 

roundedBoxColor sdl2_gfx

Rounded-Corner Filled rectangle (Box)

roundedBoxRGBA sdl2_gfx

 

roundedRectangleColor sdl2_gfx

Rounded-Corner Rectangle

roundedRectangleRGBA sdl2_gfx

 

SDLNet_AddSocket sdl2_net

Add a socket to a set of sockets to be checked for available data *

SDLNet_AllocPacket sdl2_net

Allocate/resize/free a single UDP packet 'size' bytes long. The new packet is returned, or NULL if the function ran out of memory.

SDLNet_AllocPacketV sdl2_net

Allocate/Free a UDP packet vector (array of packets) of 'howmany' packets, each 'size' bytes long. A pointer to the first packet in the array is returned, or NULL if the function ran out of memory.

SDLNet_AllocSocketSet sdl2_net

Allocate a socket set for use with SDLNet_CheckSockets() This returns a socket set for up to 'maxsockets' sockets, or NULL if the function ran out of memory.

SDLNet_CheckSockets sdl2_net

This function checks to see if data is available for reading on the given set of sockets. If 'timeout' is 0, it performs a quick poll, otherwise the function returns when either data is available for reading, or the timeout in milliseconds has elapsed, which ever occurs first. This function returns the number of sockets ready for reading, or -1 if there was an error with the select() system call.

SDLNet_DelSocket sdl2_net

Remove a socket from a set of sockets to be checked for available data *

SDLNet_FreePacket sdl2_net

 

SDLNet_FreePacketV sdl2_net

 

SDLNet_FreeSocketSet sdl2_net

Free a set of sockets allocated by SDL_NetAllocSocketSet() *

SDLNet_GetError sdl2_net

 

SDLNet_GetLocalAddresses sdl2_net

Get the addresses of network interfaces on this system. This returns the number of addresses saved in 'addresses'

SDLNet_Init sdl2_net

Initialize/Cleanup the network API SDL must be initialized before calls to functions in this library, because this library uses utility functions from the SDL library.

SDLNet_Linked_Version sdl2_net

This function gets the version of the dynamically linked SDL_net library. it should NOT be used to fill a version structure, instead you should use the SDL_NET_VERSION() macro.

SDLNet_Quit sdl2_net

 

SDLNet_ResizePacket sdl2_net

 

SDLNet_ResolveHost sdl2_net

 

SDLNet_ResolveIP sdl2_net

Resolve an ip address to a host name in canonical form. If the ip couldn't be resolved, this function returns NULL, otherwise a pointer to a static buffer containing the hostname is returned. Note that this function is not thread-safe.

SDLNet_SetError sdl2_net

 

SDLNet_SocketReady sdl2_net

After calling SDLNet_CheckSockets(), you can use this function on a socket that was in the socket set, to find out if data is available for reading.

SDLNet_TCP_Accept sdl2_net

Accept an incoming connection on the given server socket. The newly created socket is returned, or NULL if there was an error.

SDLNet_TCP_Close sdl2_net

Close a TCP network socket *

SDLNet_TCP_GetPeerAddress sdl2_net

Get the IP address of the remote system associated with the socket. If the socket is a server socket, this function returns NULL.

SDLNet_TCP_Open sdl2_net

Open a TCP network socket If ip.host is INADDR_NONE or INADDR_ANY, this creates a local server socket on the given port, otherwise a TCP connection to the remote host and port is attempted. The address passed in should already be swapped to network byte order (addresses returned from SDLNet_ResolveHost() are already in the correct form). The newly created socket is returned, or NULL if there was an error.

SDLNet_TCP_Recv sdl2_net

Receive up to 'maxlen' bytes of data over the non-server socket 'sock', and store them in the buffer pointed to by 'data'. This function returns the actual amount of data received. If the return value is less than or equal to zero, then either the remote connection was closed, or an unknown socket error occurred.

SDLNet_TCP_Send sdl2_net

Send 'len' bytes of 'data' over the non-server socket 'sock' This function returns the actual amount of data sent. If the return value is less than the amount of data sent, then either the remote connection was closed, or an unknown socket error occurred.

SDLNet_UDP_Bind sdl2_net

Bind the address 'address' to the requested channel on the UDP socket. If the channel is -1, then the first unbound channel that has not yet been bound to the maximum number of addresses will be bound with the given address as it's primary address. If the channel is already bound, this new address will be added to the list of valid source addresses for packets arriving on the channel. If the channel is not already bound, then the address becomes the primary address, to which all outbound packets on the channel are sent. This function returns the channel which was bound, or -1 on error.

SDLNet_UDP_Close sdl2_net

Close a UDP network socket *

SDLNet_UDP_GetPeerAddress sdl2_net

Get the primary IP address of the remote system associated with the socket and channel. If the channel is -1, then the primary IP port of the UDP socket is returned – this is only meaningful for sockets opened with a specific port. If the channel is not bound and not -1, this function returns NULL.

SDLNet_UDP_Open sdl2_net

Open a UDP network socket If 'port' is non-zero, the UDP socket is bound to a local port. The 'port' should be given in native byte order, but is used internally in network (big endian) byte order, in addresses, etc. This allows other systems to send to this socket via a known port.

SDLNet_UDP_Recv sdl2_net

Receive a single packet from the UDP socket. The returned packet contains the source address and the channel it arrived on. If it did not arrive on a bound channel, the the channel will be set to -1. The channels are checked in highest to lowest order, so if an address is bound to multiple channels, the highest channel with the source address bound will be returned. This function returns the number of packets read from the network, or -1 on error. This function does not block, so can return 0 packets pending.

SDLNet_UDP_RecvV sdl2_net

Receive a vector of pending packets from the UDP socket. The returned packets contain the source address and the channel they arrived on. If they did not arrive on a bound channel, the the channel will be set to -1. The channels are checked in highest to lowest order, so if an address is bound to multiple channels, the highest channel with the source address bound will be returned. This function returns the number of packets read from the network, or -1 on error. This function does not block, so can return 0 packets pending.

SDLNet_UDP_Send sdl2_net

Send a single packet to the specified channel. If the channel specified in the packet is -1, the packet will be sent to the address in the 'src' member of the packet. The packet will be updated with the status of the packet after it has been sent. This function returns 1 if the packet was sent, or 0 on error.

NOTE: The maximum size of the packet is limited by the MTU (Maximum Transfer Unit) of the transport medium. It can be as low as 250 bytes for some PPP links, and as high as 1500 bytes for ethernet.

SDLNet_UDP_SendV sdl2_net

Send a vector of packets to the the channels specified within the packet. If the channel specified in the packet is -1, the packet will be sent to the address in the 'src' member of the packet. Each packet will be updated with the status of the packet after it has been sent, -1 if the packet send failed. This function returns the number of packets sent.

SDLNet_UDP_SetPacketLoss sdl2_net

Set the percentage of simulated packet loss for packets sent on the socket. *

SDLNet_UDP_Unbind sdl2_net

Unbind all addresses from the given channel *

SDL_acos sdl2

Calculate the arc cosine of x; that is, the value (in radians) whose cosine equals x.

\since This function is available since SDL 2.0.4.

SDL_acosf sdl2

Calculate the arc cosine of x; that is, the value (in radians) whose cosine equals x.

\since This function is available since SDL 2.0.8.

SDL_AddEventWatch sdl2

Add a function which is called when an event is added to the queue.

SDL_AddHintCallback sdl2

 

SDL_AddTimer sdl2

Add a new timer to the pool of timers already running.

A timer ID, or NULL when an error occurs.

SDL_AllocFormat sdl2

Create an SDL_PixelFormat structure corresponding to a pixel format.

Returned structure may come from a shared global cache (i.e. not newly allocated), and hence should not be modified, especially the palette. Weird errors such as `Blit combination not supported` may occur.

\param pixel_format one of the SDL_PixelFormatEnum values \returns the new SDL_PixelFormat structure or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_FreeFormat

SDL_AllocPalette sdl2

Create a palette structure with the specified number of color entries.

The palette entries are initialized to white.

\param ncolors represents the number of color entries in the color palette \returns a new SDL_Palette structure on success or NULL on failure (e.g. if there wasn't enough memory); call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_FreePalette

SDL_AllocRW sdl2

RWFrom functions*

SDL_asin sdl2

Calculate the arc sine of x; that is, the value (in radians) whose sine equals x.

\since This function is available since SDL 2.0.4.

SDL_asinf sdl2

Calculate the arc sine of x; that is, the value (in radians) whose sine equals x.

\since This function is available since SDL 2.0.8.

SDL_atan sdl2

Calculate the arc tangent of x; that is, the value (in radians) whose tangent equals x.

\since This function is available since SDL 2.0.4.

SDL_atan2 sdl2

Calculate the arc tangent of y/x, using the signs of the two arguments to determine the quadrant of the result.

\since This function is available since SDL 2.0.4.

SDL_atan2f sdl2

Calculate the arc tangent of y/x, using the signs of the two arguments to determine the quadrant of the result.

\since This function is available since SDL 2.0.8.

SDL_atanf sdl2

Calculate the arc tangent of x; that is, the value (in radians) whose tangent equals x.

\since This function is available since SDL 2.0.8.

SDL_AtomicAdd sdl2

Add to an atomic variable, and return the old value.

This function also acts as a full memory barrier.

SDL_AtomicCAS sdl2

Set an atomic variable to a new value if it is currently an old value.

SDL_AtomicCASPtr sdl2

Set a pointer to a new value if it is currently an old value.

SDL_AtomicDecRef sdl2

Decrement an atomic variable used as a reference count and check if it reached zero after decrementing.

SDL_AtomicGet sdl2

Get the value of an atomic variable.

SDL_AtomicGetPtr sdl2

Get the value of a pointer atomically.

SDL_AtomicIncRef sdl2

Increment an atomic variable used as a reference count.

SDL_AtomicLock sdl2

Lock a spin lock by setting it to a non-zero value.

SDL_AtomicSet sdl2

Set an atomic variable to a new value and return the old one.

This function also acts as a full memory barrier.

SDL_AtomicSetPtr sdl2

Set a pointer to a new value atomically, and return the old value.

SDL_AtomicTryLock sdl2

Try to lock a spin lock by setting it to a non-zero value.

SDL_AtomicUnlock sdl2

Unlock a spin lock by setting it to 0.

Always returns immediately.

SDL_AudioInit sdl2

Use this function to initialize a particular audio driver.

This function is used internally, and should not be used unless you have a specific need to designate the audio driver you want to use. You should normally use SDL_Init() or SDL_InitSubSystem().

\param driver_name the name of the desired audio driver \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_AudioQuit

SDL_AudioQuit sdl2

Use this function to shut down audio if you initialized it with SDL_AudioInit().

This function is used internally, and should not be used unless you have a specific need to specify the audio driver you want to use. You should normally use SDL_Quit() or SDL_QuitSubSystem().

\since This function is available since SDL 2.0.0.

\sa SDL_AudioInit

SDL_AudioStreamAvailable sdl2

Get the number of converted/resampled bytes available.

The stream may be buffering data behind the scenes until it has enough to resample correctly, so this number might be lower than what you expect, or even be zero. Add more data or flush the stream if you need the data now.

\since This function is available since SDL 2.0.7.

\sa SDL_NewAudioStream \sa SDL_AudioStreamPut \sa SDL_AudioStreamGet \sa SDL_AudioStreamFlush \sa SDL_AudioStreamClear \sa SDL_FreeAudioStream

SDL_AudioStreamClear sdl2

Clear any pending data in the stream without converting it

\since This function is available since SDL 2.0.7.

\sa SDL_NewAudioStream \sa SDL_AudioStreamPut \sa SDL_AudioStreamGet \sa SDL_AudioStreamAvailable \sa SDL_AudioStreamFlush \sa SDL_FreeAudioStream

SDL_AudioStreamFlush sdl2

Tell the stream that you're done sending data, and anything being buffered should be converted/resampled and made available immediately.

It is legal to add more data to a stream after flushing, but there will be audio gaps in the output. Generally this is intended to signal the end of input, so the complete output becomes available.

\since This function is available since SDL 2.0.7.

\sa SDL_NewAudioStream \sa SDL_AudioStreamPut \sa SDL_AudioStreamGet \sa SDL_AudioStreamAvailable \sa SDL_AudioStreamClear \sa SDL_FreeAudioStream

SDL_AudioStreamGet sdl2

Get converted/resampled data from the stream

\param stream The stream the audio is being requested from \param buf A buffer to fill with audio data \param len The maximum number of bytes to fill \returns the number of bytes read from the stream, or -1 on error

\since This function is available since SDL 2.0.7.

\sa SDL_NewAudioStream \sa SDL_AudioStreamPut \sa SDL_AudioStreamAvailable \sa SDL_AudioStreamFlush \sa SDL_AudioStreamClear \sa SDL_FreeAudioStream

SDL_AudioStreamPut sdl2

Add data to be converted/resampled to the stream.

\param stream The stream the audio data is being added to \param buf A pointer to the audio data to add \param len The number of bytes to write to the stream \returns 0 on success, or -1 on error.

\since This function is available since SDL 2.0.7.

\sa SDL_NewAudioStream \sa SDL_AudioStreamGet \sa SDL_AudioStreamAvailable \sa SDL_AudioStreamFlush \sa SDL_AudioStreamClear \sa SDL_FreeAudioStream

SDL_AUDIO_BITSIZE sdl2

 

SDL_AUDIO_ISBIGENDIAN sdl2

 

SDL_AUDIO_ISFLOAT sdl2

 

SDL_AUDIO_ISINT sdl2

 

SDL_AUDIO_ISLITTLEENDIAN sdl2

 

SDL_AUDIO_ISSIGNED sdl2

 

SDL_AUDIO_ISUNSIGNED sdl2

 

SDL_BITSPERPIXEL sdl2

 

SDL_BlitSurface sdl2

SDL_surface.h uses #define to change all SDL_BlitSurface() calls into SDL_UpperBlit() calls. * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurface() to SDL_UpperBlit().

SDL_BlitSurfaceScaled sdl2

SDL_surface.h uses #define to change all SDL_BlitSurfaceScaled() calls into SDL_UpperBlitScaled() calls. * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurfaceScaled() to SDL_UpperBlitScaled().

SDL_BuildAudioCVT sdl2

Initialize an SDL_AudioCVT structure for conversion.

Before an SDL_AudioCVT structure can be used to convert audio data it must be initialized with source and destination information.

This function will zero out every field of the SDL_AudioCVT, so it must be called before the application fills in the final buffer information.

Once this function has returned successfully, and reported that a conversion is necessary, the application fills in the rest of the fields in SDL_AudioCVT, now that it knows how large a buffer it needs to allocate, and then can call SDL_ConvertAudio() to complete the conversion.

\param cvt an SDL_AudioCVT structure filled in with audio conversion information \param src_format the source format of the audio data; for more info see SDL_AudioFormat \param src_channels the number of channels in the source \param src_rate the frequency (sample-frames-per-second) of the source \param dst_format the destination format of the audio data; for more info see SDL_AudioFormat \param dst_channels the number of channels in the destination \param dst_rate the frequency (sample-frames-per-second) of the destination \returns 1 if the audio filter is prepared, 0 if no conversion is needed, or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_ConvertAudio

SDL_Button sdl2

Used as a mask when testing buttons in buttonstate. - Button 1: Left mouse button - Button 2: Middle mouse button - Button 3: Right mouse button

SDL_CalculateGammaRamp sdl2

/** Calculate a 256 entry gamma ramp for a gamma value.

\param gamma a gamma value where 0.0 is black and 1.0 is identity \param ramp an array of 256 values filled in with the gamma ramp

\since This function is available since SDL 2.0.0.

\sa SDL_SetWindowGammaRamp

SDL_calloc sdl2

Allocate a block of memory that can fit an array of nmemb elements, each of given size. The memory is initialized by setting every byte to 0.

SDL_CaptureMouse sdl2

Capture the mouse and to track input outside an SDL window.

Capturing enables your app to obtain mouse events globally, instead of just within your window. Not all video targets support this function. When capturing is enabled, the current window will get all mouse events, but unlike relative mode, no change is made to the cursor and it is not restrained to your window.

This function may also deny mouse input to other windows–both those in your application and others on the system–so you should use this function sparingly, and in small bursts. For example, you might want to track the mouse while the user is dragging something, until the user releases a mouse button. It is not recommended that you capture the mouse for long periods of time, such as the entire time your app is running. For that, you should probably use SDL_SetRelativeMouseMode() or SDL_SetWindowGrab(), depending on your goals.

While captured, mouse events still report coordinates relative to the current (foreground) window, but those coordinates may be outside the bounds of the window (including negative values). Capturing is only allowed for the foreground window. If the window loses focus while capturing, the capture will be disabled automatically.

While capturing is enabled, the current window will have the `SDL_WINDOW_MOUSE_CAPTURE` flag set.

Please note that as of SDL 2.0.22, SDL will attempt to "auto capture" the mouse while the user is pressing a button; this is to try and make mouse behavior more consistent between platforms, and deal with the common case of a user dragging the mouse outside of the window. This means that if you are calling SDL_CaptureMouse() only to deal with this situation, you no longer have to (although it is safe to do so). If this causes problems for your app, you can disable auto capture by setting the `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero.

\param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable. \returns 0 on success or -1 if not supported; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.4.

\sa SDL_GetGlobalMouseState

SDL_ceil sdl2

Calculate the smallest integral value that is not less than x.

\since This function is available since SDL 2.0.4.

SDL_ceilf sdl2

Calculate the smallest integral value that is not less than x.

\since This function is available since SDL 2.0.8.

SDL_ClearComposition sdl2

Dismiss the composition window/IME without disabling the subsystem.

\since This function is available since SDL 2.0.22.

\sa SDL_StartTextInput \sa SDL_StopTextInput

SDL_ClearErrorcdecl sdl2

\brief Clear the error message for the current thread

SDL_ClearHints sdl2

Clear all hints.

This function is automatically called during SDL_Quit(), and deletes all callbacks without calling them and frees all memory associated with hints. If you're calling this from application code you probably want to call SDL_ResetHints() instead.

This function will be removed from the API the next time we rev the ABI.

\since This function is available since SDL 2.0.0.

\sa SDL_ResetHints

SDL_ClearQueuedAudio sdl2

Drop any queued audio data waiting to be sent to the hardware.

Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For output devices, the hardware will start playing silence if more audio isn't queued. For capture devices, the hardware will start filling the empty queue with new data if the capture device isn't paused.

This will not prevent playback of queued audio that's already been sent to the hardware, as we can not undo that, so expect there to be some fraction of a second of audio that might still be heard. This can be useful if you want to, say, drop any pending music or any unprocessed microphone input during a level change in your game.

You may not queue or dequeue audio on a device that is using an application-supplied callback; calling this function on such a device always returns 0. You have to use the audio callback or queue audio, but not both.

You should not call SDL_LockAudio() on the device before clearing the queue; SDL handles locking internally for this function.

This function always succeeds and thus returns void.

\param dev the device ID of which to clear the audio queue

\since This function is available since SDL 2.0.4.

\sa SDL_GetQueuedAudioSize \sa SDL_QueueAudio \sa SDL_DequeueAudio

SDL_CloseAudio sdl2

This function is a legacy means of closing the audio device.

This function is equivalent to calling...

```c SDL_CloseAudioDevice(1); ```

...and is only useful if you used the legacy SDL_OpenAudio() function.

\since This function is available since SDL 2.0.0.

\sa SDL_OpenAudio

SDL_CloseAudioDevice sdl2

Use this function to shut down audio processing and close the audio device.

The application should close open audio devices once they are no longer needed. Calling this function will wait until the device's audio callback is not running, release the audio hardware and then clean up internal state. No further audio will play from this device once this function returns.

This function may block briefly while pending audio data is played by the hardware, so that applications don't drop the last buffer of data they supplied.

The device ID is invalid as soon as the device is closed, and is eligible for reuse in a new SDL_OpenAudioDevice() call immediately.

\param dev an audio device previously opened with SDL_OpenAudioDevice()

\since This function is available since SDL 2.0.0.

\sa SDL_OpenAudioDevice

SDL_COMPILEDVERSION sdl2

This is the version number macro for the current SDL version.

SDL_CompilerBarrier sdl2

The compiler barrier prevents the compiler from reordering reads and writes to globally visible variables across the call.

SDL_ComposeCustomBlendMode sdl2

\brief Create a custom blend mode, which may or may not be supported by a given renderer

\param srcColorFactor source color factor \param dstColorFactor destination color factor \param colorOperation color operation \param srcAlphaFactor source alpha factor \param dstAlphaFactor destination alpha factor \param alphaOperation alpha operation

The result of the blend mode operation will be: dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor and dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor

SDL_CondBroadcast sdl2

Restart all threads that are waiting on the condition variable.

\param cond the condition variable to signal \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_CondSignal sdl2

Restart one of the threads that are waiting on the condition variable.

\param cond the condition variable to signal \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_CondWait sdl2

Wait until a condition variable is signaled.

This function unlocks the specified `mutex` and waits for another thread to call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable `cond`. Once the condition variable is signaled, the mutex is re-locked and the function returns.

The mutex must be locked before calling this function.

This function is the equivalent of calling SDL_CondWaitTimeout() with a time length of SDL_MUTEX_MAXWAIT.

\param cond the condition variable to wait on \param mutex the mutex used to coordinate thread access \returns 0 when it is signaled or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_CondWaitTimeout sdl2

Wait until a condition variable is signaled or a certain time has passed.

This function unlocks the specified `mutex` and waits for another thread to call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable `cond`, or for the specified time to elapse. Once the condition variable is signaled or the time elapsed, the mutex is re-locked and the function returns.

The mutex must be locked before calling this function.

\param cond the condition variable to wait on \param mutex the mutex used to coordinate thread access \param ms the maximum time to wait, in milliseconds, or SDL_MUTEX_MAXWAIT to wait indefinitely \returns 0 if the condition variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not signaled in the allotted time, or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_ConvertAudio sdl2

Convert audio data to a desired audio format.

This function does the actual audio data conversion, after the application has called SDL_BuildAudioCVT() to prepare the conversion information and then filled in the buffer details.

Once the application has initialized the `cvt` structure using SDL_BuildAudioCVT(), allocated an audio buffer and filled it with audio data in the source format, this function will convert the buffer, in-place, to the desired format.

The data conversion may go through several passes; any given pass may possibly temporarily increase the size of the data. For example, SDL might expand 16-bit data to 32 bits before resampling to a lower frequency, shrinking the data size after having grown it briefly. Since the supplied buffer will be both the source and destination, converting as necessary in-place, the application must allocate a buffer that will fully contain the data during its largest conversion pass. After SDL_BuildAudioCVT() returns, the application should set the `cvt->len` field to the size, in bytes, of the source data, and allocate a buffer that is `cvt->len * cvt->len_mult` bytes long for the `buf` field.

The source data should be copied into this buffer before the call to SDL_ConvertAudio(). Upon successful return, this buffer will contain the converted audio, and `cvt->len_cvt` will be the size of the converted data, in bytes. Any bytes in the buffer past `cvt->len_cvt` are undefined once this function returns.

\param cvt an SDL_AudioCVT structure that was previously set up by SDL_BuildAudioCVT(). \returns 0 if the conversion was completed successfully or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_BuildAudioCVT

SDL_ConvertPixels sdl2

Copy a block of pixels of one format to another format

0 on success, or -1 if there was an error

SDL_ConvertSurface sdl2

Creates a new surface of the specified format, and then copies and maps the given surface to it so the blit of the converted surface will be as fast as possible. If this function fails, it returns NULL.

The flags parameter is passed to SDL_CreateRGBSurface() and has those semantics. You can also pass SDL_RLEACCEL in the flags parameter and SDL will try to RLE accelerate colorkey and alpha blits in the resulting surface.

SDL_ConvertSurfaceFormat sdl2

 

SDL_copysign sdl2

Return a number whose absolute value matches that of x, but the sign matches that of y.

\since This function is available since SDL 2.0.4.

SDL_copysignf sdl2

Return a number whose absolute value matches that of x, but the sign matches that of y.

\since This function is available since SDL 2.0.8.

SDL_cos sdl2

Calculate the cosine of x, where x is given in radians.

\since This function is available since SDL 2.0.4.

SDL_cosf sdl2

Calculate the cosine of x, where x is given in radians.

\since This function is available since SDL 2.0.4.

SDL_CreateColorCursor sdl2

Create a color cursor.

\param surface an SDL_Surface structure representing the cursor image \param hot_x the x position of the cursor hot spot \param hot_y the y position of the cursor hot spot \returns the new cursor on success or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_CreateCursor \sa SDL_FreeCursor

SDL_CreateCond sdl2

Create a condition variable.

\returns a new condition variable or NIL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_CreateCursor sdl2

Create a cursor using the specified bitmap data and mask (in MSB format).

`mask` has to be in MSB (Most Significant Bit) format.

The cursor width (`w`) must be a multiple of 8 bits.

The cursor is created in black and white according to the following:

- data=0, mask=1: white - data=1, mask=1: black - data=0, mask=0: transparent - data=1, mask=0: inverted color if possible, black if not.

Cursors created with this function must be freed with SDL_FreeCursor().

If you want to have a color cursor, or create your cursor from an SDL_Surface, you should use SDL_CreateColorCursor(). Alternately, you can hide the cursor and draw your own as part of your game's rendering, but it will be bound to the framerate.

Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which provides twelve readily available system cursors to pick from.

\param data the color value for each pixel of the cursor \param mask the mask value for each pixel of the cursor \param w the width of the cursor \param h the height of the cursor \param hot_x the X-axis location of the upper left corner of the cursor relative to the actual mouse position \param hot_y the Y-axis location of the upper left corner of the cursor relative to the actual mouse position \returns a new cursor with the specified parameters on success or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_FreeCursor \sa SDL_SetCursor \sa SDL_ShowCursor

SDL_CreateMutex sdl2

Create a new mutex.

All newly-created mutexes begin in the _unlocked_ state.

Calls to SDL_LockMutex() will not return while the mutex is locked by another thread. See SDL_TryLockMutex() to attempt to lock without blocking.

SDL mutexes are reentrant.

\returns the initialized and unlocked mutex or NIL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_CreateRenderer sdl2

Create a 2D rendering context for a window.

window The window where rendering is displayed. index The index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags. flags ::SDL_RendererFlags.

A valid rendering context or NULL if there was an error.

SDL_CreateSoftwareRenderer() SDL_GetRendererInfo() SDL_DestroyRenderer()

SDL_CreateRGBSurface sdl2

Allocate and free an RGB surface.

If the depth is 4 or 8 bits, an empty palette is allocated for the surface. If the depth is greater than 8 bits, the pixel format is set using the flags '[RGB]mask'.

If the function runs out of memory, it will return NULL.

\param flags The \c flags are obsolete and should be set to 0. \param width The width in pixels of the surface to create. \param height The height in pixels of the surface to create. \param depth The depth in bits of the surface to create. \param Rmask The red mask of the surface to create. \param Gmask The green mask of the surface to create. \param Bmask The blue mask of the surface to create. \param Amask The alpha mask of the surface to create.

SDL_CreateRGBSurfaceFrom sdl2

 

SDL_CreateRGBSurfaceWithFormat sdl2

!!! FIXME for 2.1: why does this ask for depth? Format provides that. *

SDL_CreateRGBSurfaceWithFormatFrom sdl2

 

SDL_CreateSemaphore sdl2

Create a semaphore.

This function creates a new semaphore and initializes it with the provided initial value. Each wait operation on the semaphore will atomically decrement the semaphore value and potentially block if the semaphore value is 0. Each post operation will atomically increment the semaphore value and wake waiting threads and allow them to retry the wait operation.

\param initial_value the starting value of the semaphore \returns a new semaphore or NIL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_CreateShapedWindow sdl2

Create a window that can be shaped with the specified position, dimensions, and flags.

\param title The title of the window, in UTF-8 encoding. \param x The x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED. \param y The y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED. \param w The width of the window. \param h The height of the window. \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: SDL_WINDOW_OPENGL, SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_HIDDEN, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED. SDL_WINDOW_BORDERLESS is always set, and SDL_WINDOW_FULLSCREEN is always unset. \return the window created, or NIL if window creation failed.

\since This function is available since SDL 2.0.0.

\sa SDL_DestroyWindow

SDL_CreateSoftwareRenderer sdl2

Create a 2D software rendering context for a surface.

surface The surface where rendering is done.

A valid rendering context or NULL if there was an error.

SDL_CreateRenderer() SDL_DestroyRenderer()

SDL_CreateSystemCursor sdl2

Create a system cursor.

\param id an SDL_SystemCursor enum value \returns a cursor on success or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_FreeCursor

SDL_CreateTexture sdl2

Create a texture for a rendering context.

renderer The renderer. format The format of the texture. access One of the enumerated values in ::SDL_TextureAccess. w The width of the texture in pixels. h The height of the texture in pixels.

The created texture is returned, or 0 if no rendering context was active, the format was unsupported, or the width or height were out of range.

SDL_QueryTexture() SDL_UpdateTexture() SDL_DestroyTexture()

SDL_CreateTextureFromSurface sdl2

Create a texture from an existing surface.

renderer The renderer. surface The surface containing pixel data used to fill the texture.

The created texture is returned, or 0 on error.

The surface is not modified or freed by this function.

SDL_QueryTexture() SDL_DestroyTexture()

SDL_CreateThread sdl2

Create a thread.

Thread naming is a little complicated: Most systems have very small limits for the string length (BeOS has 32 bytes, Linux currently has 16, Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll have to see what happens with your system's debugger. The name should be UTF-8 (but using the naming limits of C identifiers is a better bet). There are no requirements for thread naming conventions, so long as the string is null-terminated UTF-8, but these guidelines are helpful in choosing a name:

http://stackoverflow.com/questions/149932/naming-conventions-for-threads

If a system imposes requirements, SDL will try to munge the string for it (truncate, etc), but the original string contents will be available from SDL_GetThreadName().

SDL_CreateWindow sdl2

\brief Create a window with the specified position, dimensions, and flags.

\param title The title of the window, in UTF-8 encoding. \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. \param w The width of the window, in screen coordinates. \param h The height of the window, in screen coordinates. \param flags The flags for the window, a mask of any of the following: ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.

\return The created window, or NULL if window creation failed.

If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size in pixels may differ from its size in screen coordinates on platforms with high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the drawable size in pixels.

If the window is created with any of the SDL_WINDOW_OPENGL or SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the corresponding UnloadLibrary function is called by SDL_DestroyWindow().

If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.

\note On non-Apple devices, SDL requires you to either not link to the Vulkan loader or link to a dynamic library version. This limitation may be removed in a future version of SDL.

\sa SDL_DestroyWindow() \sa SDL_GL_LoadLibrary() \sa SDL_Vulkan_LoadLibrary()

SDL_CreateWindowAndRenderer sdl2

Create a window and default renderer

width The width of the window height The height of the window window_flags The flags used to create the window window A pointer filled with the window, or NULL on error renderer A pointer filled with the renderer, or NULL on error

0 on success, or -1 on error

SDL_CreateWindowFrom sdl2

Create an SDL window from an existing native window.

data A pointer to driver-dependent window creation data

The id of the window created, or zero if window creation failed.

SDL_DestroyWindow()

SDL_Delay sdl2

Wait a specified number of milliseconds before returning.

SDL_DelEventWatch sdl2

Remove an event watch function added with SDL_AddEventWatch()

SDL_DelHintCallback sdl2

/** \brief Remove a function watching a particular hint

\param name The hint being watched \param callback The function being called when the hint value changes \param userdata A pointer being passed to the callback function /

SDL_DequeueAudio sdl2

Dequeue more audio on non-callback devices.

If you are looking to queue audio for output on a non-callback playback device, you want SDL_QueueAudio() instead. SDL_DequeueAudio() will always return 0 if you use it with playback devices.

SDL offers two ways to retrieve audio from a capture device: you can either supply a callback that SDL triggers with some frequency as the device records more audio data, (push method), or you can supply no callback, and then SDL will expect you to retrieve data at regular intervals (pull method) with this function.

There are no limits on the amount of data you can queue, short of exhaustion of address space. Data from the device will keep queuing as necessary without further intervention from you. This means you will eventually run out of memory if you aren't routinely dequeueing data.

Capture devices will not queue data when paused; if you are expecting to not need captured audio for some length of time, use SDL_PauseAudioDevice() to stop the capture device from queueing more data. This can be useful during, say, level loading times. When unpaused, capture devices will start queueing data from that point, having flushed any capturable data available while paused.

This function is thread-safe, but dequeueing from the same device from two threads at once does not promise which thread will dequeue data first.

You may not dequeue audio from a device that is using an application-supplied callback; doing so returns an error. You have to use the audio callback, or dequeue audio with this function, but not both.

You should not call SDL_LockAudio() on the device before dequeueing; SDL handles locking internally for this function.

\param dev the device ID from which we will dequeue audio \param data a pointer into where audio data should be copied \param len the number of bytes (not samples!) to which (data) points \returns the number of bytes dequeued, which could be less than requested; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.5.

\sa SDL_ClearQueuedAudio \sa SDL_GetQueuedAudioSize

SDL_DestroyCond sdl2

Destroy a condition variable.

\param cond the condition variable to destroy

\since This function is available since SDL 2.0.0.

SDL_DestroyMutex sdl2

Destroy a mutex created with SDL_CreateMutex().

This function must be called on any mutex that is no longer needed. Failure to destroy a mutex will result in a system memory or resource leak. While it is safe to destroy a mutex that is _unlocked_, it is not safe to attempt to destroy a locked mutex, and may result in undefined behavior depending on the platform.

\param mutex the mutex to destroy

\since This function is available since SDL 2.0.0.

SDL_DestroyRenderer sdl2

Destroy the rendering context for a window and free associated textures.

SDL_CreateRenderer()

SDL_DestroySemaphore sdl2

Destroy a semaphore.

It is not safe to destroy a semaphore if there are threads currently waiting on it.

\param sem the semaphore to destroy

\since This function is available since SDL 2.0.0.

SDL_DestroyTexture sdl2

Destroy the specified texture.

SDL_CreateTexture() SDL_CreateTextureFromSurface()

SDL_DestroyWindow sdl2

Destroy a window.

SDL_DetachThread sdl2

A thread may be "detached" to signify that it should not remain until another thread has called SDL_WaitThread() on it. Detaching a thread is useful for long-running threads that nothing needs to synchronize with or further manage. When a detached thread is done, it simply goes away.

There is no way to recover the return code of a detached thread. If you need this, don't detach the thread and instead use SDL_WaitThread().

Once a thread is detached, you should usually assume the SDL_Thread isn't safe to reference again, as it will become invalid immediately upon the detached thread's exit, instead of remaining until someone has called SDL_WaitThread() to finally clean it up. As such, don't detach the same thread more than once.

If a thread has already exited when passed to SDL_DetachThread(), it will stop waiting for a call to SDL_WaitThread() and clean up immediately. It is not safe to detach a thread that might be used with SDL_WaitThread().

You may not call SDL_WaitThread() on a thread that has been detached. Use either that function or this one, but not both, or behavior is undefined.

It is safe to pass NIL to this function; it is a no-op.

SDL_DisableScreenSaver sdl2

Prevent the screen from being blanked by a screensaver

SDL_IsScreenSaverEnabled() SDL_EnableScreenSaver()

SDL_DuplicateSurface sdl2

Creates a new surface identical to the existing surface

SDL_EnableScreenSaver sdl2

Allow the screen to be blanked by a screensaver

SDL_IsScreenSaverEnabled() SDL_DisableScreenSaver()

SDL_EncloseFPoints sdl2

Calculate a minimal rectangle enclosing a set of points with float precision.

If `clip` is not NIL then only points inside of the clipping rectangle are considered.

\param points an array of SDL_FPoint structures representing points to be enclosed \param count the number of structures in the `points` array \param clip an SDL_FRect used for clipping or NIL to enclose all points \param result an SDL_FRect structure filled in with the minimal enclosing rectangle \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the points were outside of the clipping rectangle.

\since This function is available since SDL 2.0.22.

SDL_EnclosePoints sdl2

Calculate a minimal rectangle enclosing a set of points

SDL_TRUE if any points were within the clipping rect

SDL_Error sdl2

SDL_Error() unconditionally returns -1. *

SDL_EventState sdl2

This function allows you to set the state of processing certain events. - If state is set to SDL_IGNORE, that event will be automatically dropped from the event queue and will not event be filtered. - If state is set to SDL_ENABLE, that event will be processed normally. - If state is set to SDL_QUERY, SDL_EventState() will return the current processing state of the specified event.

SDL_exp sdl2

Calculate the value of e (the base of natural logarithms) raised to the power of x.

\since This function is available since SDL 2.0.9.

SDL_expf sdl2

Calculate the value of e (the base of natural logarithms) raised to the power of x.

\since This function is available since SDL 2.0.9.

SDL_fabs sdl2

Calculate the absolute value of x.

\since This function is available since SDL 2.0.4.

SDL_fabsf sdl2

Calculate the absolute value of x.

\since This function is available since SDL 2.0.8.

SDL_FillRect sdl2

Performs a fast fill of the given rectangle with color.

If rect is NULL, the whole surface will be filled with color.

The color should be a pixel of the format used by the surface, and can be generated by the SDL_MapRGB() function.

0 on success, or -1 on error.

SDL_FillRects sdl2

 

SDL_FilterEvents sdl2

Run the filter function on the current event queue, removing any events for which the filter returns 0.

SDL_FlashWindow sdl2

Request a window to demand attention from the user.

\param window the window to be flashed \param operation the flash operation \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.16.

SDL_floor sdl2

Calculate the largest integral value that is not greater than x.

\since This function is available since SDL 2.0.4.

SDL_floorf sdl2

Calculate the largest integral value that is not greater than x.

\since This function is available since SDL 2.0.8.

SDL_FlushEvent sdl2

This function clears events from the event queue

SDL_FlushEvents sdl2

 

SDL_fmod sdl2

Calculate the floating-point remainder of dividing x by y.

\since This function is available since SDL 2.0.8.

SDL_fmodf sdl2

Calculate the floating-point remainder of dividing x by y.

\since This function is available since SDL 2.0.8.

SDL_framerateDelay sdl2_gfx

 

SDL_FRectEmpty sdl2

Returns true if the rectangle has no area.

SDL_FRectEquals sdl2

Returns true if the two rectangles are equal, using a default epsilon.

\since This function is available since SDL 2.0.22.

SDL_FRectEqualsEpsilon sdl2

Returns true if the two rectangles are equal, within some given epsilon.

\since This function is available since SDL 2.0.22.

SDL_free sdl2

Free memory returned by functions like SDL_GetBasePath(), SDL_GetPrefPath(), etc.

Calling SDL_free() on the same pointer twice is undefined behaviour and may cause your program to crash or behave in unexpected ways.

SDL_FreeAudioStream sdl2

Free an audio stream

\since This function is available since SDL 2.0.7.

\sa SDL_NewAudioStream \sa SDL_AudioStreamPut \sa SDL_AudioStreamGet \sa SDL_AudioStreamAvailable \sa SDL_AudioStreamFlush \sa SDL_AudioStreamClear

SDL_FreeCursor sdl2

Free a previously-created cursor.

Use this function to free cursor resources created with SDL_CreateCursor(), SDL_CreateColorCursor() or SDL_CreateSystemCursor().

\param cursor the cursor to free

\since This function is available since SDL 2.0.0.

\sa SDL_CreateColorCursor \sa SDL_CreateCursor \sa SDL_CreateSystemCursor

SDL_FreeFormat sdl2

Free an SDL_PixelFormat structure allocated by SDL_AllocFormat().

\param format the SDL_PixelFormat structure to free

\since This function is available since SDL 2.0.0.

\sa SDL_AllocFormat

SDL_FreePalette sdl2

Free a palette created with SDL_AllocPalette().

\param palette the SDL_Palette structure to be freed

\since This function is available since SDL 2.0.0.

\sa SDL_AllocPalette

SDL_FreeRW sdl2

 

SDL_FreeSurface sdl2

 

SDL_FreeWAV sdl2

Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW().

After a WAVE file has been opened with SDL_LoadWAV() or SDL_LoadWAV_RW() its data can eventually be freed with SDL_FreeWAV(). It is safe to call this function with a NULL pointer.

\param audio_buf a pointer to the buffer created by SDL_LoadWAV() or SDL_LoadWAV_RW()

\since This function is available since SDL 2.0.0.

\sa SDL_LoadWAV \sa SDL_LoadWAV_RW

SDL_GameControllerAddMapping sdl2

Add or update an existing mapping configuration

1 if mapping is added, 0 if updated, -1 on error

SDL_GameControllerAddMappingsFromFile sdl2

 

SDL_GameControllerAddMappingsFromRW sdl2

Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform() A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt

If freerw is non-zero, the stream will be closed after being read.

Returns number of mappings added, -1 on error

SDL_GameControllerClose sdl2

Close a controller previously opened with SDL_GameControllerOpen().

SDL_GameControllerEventState sdl2

Enable/disable controller event polling.

If controller events are disabled, you must call SDL_GameControllerUpdate() yourself and check the state of the controller when you want controller information.

The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.

SDL_GameControllerFromInstanceID sdl2

Return the SDL_GameController associated with an instance id.

SDL_GameControllerFromPlayerIndex sdl2

Get the SDL_GameController associated with a player index.

Please note that the player index is _not_ the device index, nor is it the instance id!

SDL_GameControllerGetAppleSFSymbolsNameForAxis sdl2

Return the sfSymbolsName for a given axis on a game controller on Apple platforms.

Returns the sfSymbolsName, or NIL if the name can't be found. Do _not_ pass this string to SDL_free().

SDL_GameControllerGetAppleSFSymbolsNameForButton sdl2

Return the sfSymbolsName for a given button on a game controller on Apple platforms.

Returns the sfSymbolsName, or NIL if the name can't be found. Do _not_ pass this string to SDL_free().

SDL_GameControllerGetAttached sdl2

Returns SDL_TRUE if the controller has been opened and currently connected, or SDL_FALSE if it has not.

SDL_GameControllerGetAxis sdl2

Get the current state of an axis control on a game controller.

The state is a value ranging from -32768 to 32767.

The axis indices start at index 0.

SDL_GameControllerGetAxisFromString sdl2

turn this string into a axis mapping

SDL_GameControllerGetBindForAxis sdl2

Get the SDL joystick layer binding for this controller button mapping

SDL_GameControllerGetBindForButton sdl2

Get the SDL joystick layer binding for this controller button mapping

SDL_GameControllerGetButton sdl2

Get the current state of a button on a game controller.

The button indices start at index 0.

SDL_GameControllerGetButtonFromString sdl2

turn this string into a button mapping

SDL_GameControllerGetFirmwareVersion sdl2

Get the firmware version of an opened controller, if available.

If the firmware version isn't available this function returns 0.

\param gamecontroller the game controller object to query. \return the controller firmware version, or zero if unavailable.

\since This function is available since SDL 2.24.0.

SDL_GameControllerGetJoystick sdl2

Get the underlying joystick object used by a controller

SDL_GameControllerGetNumTouchpadFingers sdl2

Get the number of supported simultaneous fingers on a touchpad on a game controller.

SDL_GameControllerGetNumTouchpads sdl2

Get the number of touchpads on a game controller.

SDL_GameControllerGetPlayerIndex sdl2

Get the player index of an opened game controller. For XInput controllers this returns the XInput user index.

Returns the player index for controller, or -1 if it's not available.

SDL_GameControllerGetProduct sdl2

Get the USB product ID of an opened controller, if available. If the product ID isn't available, this function returns 0.

SDL_GameControllerGetProductVersion sdl2

Get the product version of an opened controller, if available. If the product version isn't available, this function returns 0.

SDL_GameControllerGetSensorData sdl2

Get the current state of a game controller sensor.

The number of values and interpretation of the data is sensor dependent. See sdlsensor.inc for the details for each type of sensor.

SDL_GameControllerGetSensorDataRate sdl2

Get the data rate (number of events per second) of a game controller sensor.

Returns the data rate, or 0.0 if the data rate is not available.

SDL_GameControllerGetSerial sdl2

Get the serial number of an opened controller, if available.

Returns a string containing the serial number of the controller, or NIL if it is not available. Do _not_ free the string with SDL_free().

SDL_GameControllerGetStringForAxis sdl2

turn this axis enum into a string mapping

SDL_GameControllerGetStringForButton sdl2

turn this button enum into a string mapping

SDL_GameControllerGetTouchpadFinger sdl2

Get the current state of a finger on a touchpad on a game controller.

SDL_GameControllerGetType sdl2

Get the type of this currently opened controller

This is the same name as returned by SDL_GameControllerTypeForIndex(), but it takes a controller identifier instead of the (unstable) device index.

SDL_GameControllerGetVendor sdl2

Get the USB vendor ID of an opened controller, if available.

If the vendor ID isn't available this function returns 0.

\param gamecontroller the game controller object to query. \return the USB vendor ID, or zero if unavailable.

\since This function is available since SDL 2.0.6.

SDL_GameControllerHasAxis sdl2

Query whether a game controller has a given axis.

This merely reports whether the controller's mapping defined this axis, as that is all the information SDL has about the physical device.

SDL_GameControllerHasButton sdl2

Query whether a game controller has a given button.

This merely reports whether the controller's mapping defined this button, as that is all the information SDL has about the physical device.

SDL_GameControllerHasLED sdl2

Query whether a game controller has an LED.

SDL_GameControllerHasRumble sdl2

Query whether a game controller has rumble support.

SDL_GameControllerHasRumbleTriggers sdl2

Query whether a game controller has rumble support on triggers.

SDL_GameControllerHasSensor sdl2

Return whether a game controller has a particular sensor.

SDL_GameControllerIsSensorEnabled sdl2

Query whether sensor data reporting is enabled for a game controller.

SDL_GameControllerMapping sdl2

Get a mapping string for an open GameController

the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available

SDL_GameControllerMappingForDeviceIndex sdl2

Get the mapping of a game controller. This can be called before any controllers are opened.

Returns the mapping string. Must be freed with SDL_free(). Returns NIL if no mapping is available.

SDL_GameControllerMappingForGUID sdl2

Get a mapping string for a GUID

the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available

SDL_GameControllerMappingForIndex sdl2

Get the mapping at a particular index.

Returns the mapping string. Must be freed with SDL_free(). Returns NIL if the index is out of range.

SDL_GameControllerName sdl2

Return the name for this currently opened controller

SDL_GameControllerNameForIndex sdl2

Get the implementation dependent name of a game controller. This can be called before any controllers are opened. If no name can be found, this function returns NULL.

SDL_GameControllerNumMappings sdl2

Get the number of mappings installed.

SDL_GameControllerOpen sdl2

Open a game controller for use. The index passed as an argument refers to the N'th game controller on the system. This index is the value which will identify this controller in future controller events.

A controller identifier, or NULL if an error occurred.

SDL_GameControllerPath sdl2

Get the implementation-dependent path for an opened game controller.

This is the same path as returned by SDL_GameControllerNameForIndex(), but it takes a controller identifier instead of the (unstable) device index.

\param gamecontroller a game controller identifier previously returned by SDL_GameControllerOpen() \returns the implementation dependent path for the game controller, or NIL if there is no path or the identifier passed is invalid.

\since This function is available since SDL 2.24.0.

\sa SDL_GameControllerPathForIndex

SDL_GameControllerPathForIndex sdl2

Get the implementation dependent path for the game controller.

This function can be called before any controllers are opened.

`joystick_index` is the same as the `device_index` passed to SDL_JoystickOpen().

\param joystick_index the device_index of a device, from zero to SDL_NumJoysticks()-1 \returns the implementation-dependent path for the game controller, or NIL if there is no path or the index is invalid.

\since This function is available since SDL 2.24.0.

\sa SDL_GameControllerPath

SDL_GameControllerRumble sdl2

Start a rumble effect on a game controller.

Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.

Returns 0, or -1 if rumble isn't supported on this controller.

SDL_GameControllerRumbleTriggers sdl2

Start a rumble effect in the game controller's triggers.

Each call to this function cancels any previous trigger rumble effect, and calling it with 0 intensity stops any rumbling.

Note that this is rumbling of the _triggers_ and not the game controller as a whole. This is currently only supported on Xbox One controllers. If you want the (more common) whole-controller rumble, use SDL_GameControllerRumble() instead.

Returns 0, or -1 if trigger rumble isn't supported on this controller

SDL_GameControllerSendEffect sdl2

Send a controller-specific effect packet.

Returns 0, or -1 if this controller or driver does not support effect packets.

SDL_GameControllerSetLED sdl2

Update a game controller's LED color.

Returns 0, or -1 if this controller does not have a modifiable LED.

SDL_GameControllerSetPlayerIndex sdl2

Set the player index of an opened game controller.

SDL_GameControllerSetSensorEnabled sdl2

Set whether data reporting for a game controller sensor is enabled.

SDL_GameControllerTypeForIndex sdl2

Get the type of a game controller. This can be called before any controllers are opened.

SDL_GameControllerUpdate sdl2

Update the current state of the open game controllers.

This is called automatically by the event loop if any game controller events are enabled.

SDL_GetAudioDeviceName sdl2

Get the human-readable name of a specific audio device.

This function is only valid after successfully initializing the audio subsystem. The values returned by this function reflect the latest call to SDL_GetNumAudioDevices(); re-call that function to redetect available hardware.

The string returned by this function is UTF-8 encoded, read-only, and managed internally. You are not to free it. If you need to keep the string for any length of time, you should make your own copy of it, as it will be invalid next time any of several other SDL functions are called.

\param index the index of the audio device; valid values range from 0 to SDL_GetNumAudioDevices() - 1 \param iscapture non-zero to query the list of recording devices, zero to query the list of output devices. \returns the name of the audio device at the requested index, or NULL on error.

\since This function is available since SDL 2.0.0.

\sa SDL_GetNumAudioDevices \sa SDL_GetDefaultAudioInfo

SDL_GetAudioDeviceSpec sdl2

Get the preferred audio format of a specific audio device.

This function is only valid after a successfully initializing the audio subsystem. The values returned by this function reflect the latest call to SDL_GetNumAudioDevices(); re-call that function to redetect available hardware.

`spec` will be filled with the sample rate, sample format, and channel count.

\param index the index of the audio device; valid values range from 0 to SDL_GetNumAudioDevices() - 1 \param iscapture non-zero to query the list of recording devices, zero to query the list of output devices. \param spec The SDL_AudioSpec to be initialized by this function. \returns 0 on success, nonzero on error

\since This function is available since SDL 2.0.16.

\sa SDL_GetNumAudioDevices \sa SDL_GetDefaultAudioInfo

SDL_GetAudioDeviceStatus sdl2

Use this function to get the current audio state of an audio device.

\param dev the ID of an audio device previously opened with SDL_OpenAudioDevice() \returns the SDL_AudioStatus of the specified audio device.

\since This function is available since SDL 2.0.0.

\sa SDL_PauseAudioDevice

SDL_GetAudioDriver sdl2

Use this function to get the name of a built in audio driver.

The list of audio drivers is given in the order that they are normally initialized by default; the drivers that seem more reasonable to choose first (as far as the SDL developers believe) are earlier in the list.

The names of drivers are all simple, low-ASCII identifiers, like "alsa", "coreaudio" or "xaudio2". These never have Unicode characters, and are not meant to be proper names.

\param index the index of the audio driver; the value ranges from 0 to SDL_GetNumAudioDrivers() - 1 \returns the name of the audio driver at the requested index, or NULL if an invalid index was specified.

\since This function is available since SDL 2.0.0.

\sa SDL_GetNumAudioDrivers

SDL_GetAudioStatus sdl2

This function is a legacy means of querying the audio device.

New programs might want to use SDL_GetAudioDeviceStatus() instead. This function is equivalent to calling...

```c SDL_GetAudioDeviceStatus(1); ```

...and is only useful if you used the legacy SDL_OpenAudio() function.

\returns the SDL_AudioStatus of the audio device opened by SDL_OpenAudio().

\since This function is available since SDL 2.0.0.

\sa SDL_GetAudioDeviceStatus

SDL_GetBasePath sdl2

Get the directory where the application was run from.

This is not necessarily a fast call, so you should call this once near startup and save the string if you need it.

**Mac OS X and iOS Specific Functionality**: If the application is in a ".app" bundle, this function returns the Resource directory (e.g. MyApp.app/Contents/Resources/). This behaviour can be overridden by adding a property to the Info.plist file. Adding a string key with the name SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the behaviour.

Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an application in /Applications/SDLApp/MyApp.app):

- `resource`: bundle resource directory (the default). For example: `/Applications/SDLApp/MyApp.app/Contents/Resources` - `bundle`: the Bundle directory. For example: `/Applications/SDLApp/MyApp.app/` - `parent`: the containing directory of the bundle. For example: `/Applications/SDLApp/`

The returned path is guaranteed to end with a path separator ('\' on Windows, '/' on most other platforms).

The pointer returned is owned by the caller. Please call SDL_free() on the pointer when done with it.

\returns an absolute path in UTF-8 encoding to the application data directory. nil will be returned on error or when the platform doesn't implement this functionality, call SDL_GetError() for more information.

\since This function is available since SDL 2.0.1.

\sa SDL_GetPrefPath

SDL_GetClipboardText sdl2

Get UTF-8 text from the clipboard, which must be freed with SDL_free().

This functions returns empty string if there was not enough memory left for a copy of the clipboard's content.

\returns the clipboard text on success or an empty string on failure; call SDL_GetError() for more information. Caller must call SDL_free() on the returned pointer when done with it (even if there was an error).

\since This function is available since SDL 2.0.0.

\sa SDL_HasClipboardText \sa SDL_SetClipboardText

SDL_GetClipRect sdl2

Gets the clipping rectangle for the destination surface in a blit.

rect must be a pointer to a valid rectangle which will be filled with the correct values.

SDL_GetClosestDisplayMode sdl2

Get the closest match to the requested display mode.

mode The desired display mode closest A pointer to a display mode to be filled in with the closest match of the available display modes.

The passed in value closest, or nil if no matching video mode was available.

The available display modes are scanned, and closest is filled in with the closest mode matching the requested mode and returned. The mode format and refresh_rate default to the desktop mode if they are 0. The modes are scanned with size being first priority, format being second priority, and finally checking the refresh_rate. If all the available modes are too small, then nil is returned.

SDL_GetNumDisplayModes() SDL_GetDisplayMode()

SDL_GetColorKey sdl2

Gets the color key (transparent pixel) in a blittable surface.

surface The surface to update key A pointer filled in with the transparent pixel in the native surface format

0 on success, or -1 if the surface is not valid or colorkey is not enabled.

SDL_GetCPUCacheLineSize sdl2

This function returns the L1 cache line size of the CPU.

This is useful for determining multi-threaded structure padding or SIMD prefetch sizes.

SDL_GetCPUCount sdl2

This function returns the number of CPU cores available.

SDL_GetCurrentAudioDriver sdl2

Get the name of the current audio driver.

The returned string points to internal static memory and thus never becomes invalid, even if you quit the audio subsystem and initialize a new driver (although such a case would return a different static string from another call to this function, of course). As such, you should not modify or free the returned string.

\returns the name of the current audio driver or NULL if no driver has been initialized.

\since This function is available since SDL 2.0.0.

\sa SDL_AudioInit

SDL_GetCurrentDisplayMode sdl2

Fill in information about the current display mode.

SDL_GetCurrentVideoDriver sdl2

Returns the name of the currently initialized video driver.

The name of the current video driver or nil if no driver has been initialized

SDL_GetNumVideoDrivers() SDL_GetVideoDriver()

SDL_GetCursor sdl2

Get the active cursor.

This function returns a pointer to the current cursor which is owned by the library. It is not necessary to free the cursor with SDL_FreeCursor().

\returns the active cursor or NULL if there is no mouse.

\since This function is available since SDL 2.0.0.

\sa SDL_SetCursor

SDL_GetDefaultAudioInfo sdl2

Get the name and preferred format of the default audio device.

Some (but not all!) platforms have an isolated mechanism to get information about the "default" device. This can actually be a completely different device that's not in the list you get from SDL_GetAudioDeviceSpec(). It can even be a network address! (This is discussed in SDL_OpenAudioDevice().)

As a result, this call is not guaranteed to be performant, as it can query the sound server directly every time, unlike the other query functions. You should call this function sparingly!

`spec` will be filled with the sample rate, sample format, and channel count, if a default device exists on the system. If `name` is provided, will be filled with either a dynamically-allocated UTF-8 string or nil.

\param name A pointer to be filled with the name of the default device (can be nil). Please call SDL_free() when you are done with this pointer! \param spec The SDL_AudioSpec to be initialized by this function. \param iscapture non-zero to query the default recording device, zero to query the default output device. \returns 0 on success, nonzero on error

\since This function is available since SDL 2.24.0.

\sa SDL_GetAudioDeviceName \sa SDL_GetAudioDeviceSpec \sa SDL_OpenAudioDevice

SDL_GetDefaultCursor sdl2

Get the default cursor.

\returns the default cursor on success or NULL on failure.

\since This function is available since SDL 2.0.0.

\sa SDL_CreateSystemCursor

SDL_GetDesktopDisplayMode sdl2

Fill in information about the desktop display mode.

SDL_GetDisplayBounds sdl2

Get the desktop area represented by a display, with the primary display located at 0,0

0 on success, or -1 if the index is out of range.

SDL_GetNumVideoDisplays()

SDL_GetDisplayDPI sdl2

\brief Get the dots/pixels-per-inch for a display

\note Diagonal, horizontal and vertical DPI can all be optionally returned if the parameter is non-NULL.

\return 0 on success, or -1 if no DPI information is available or the index is out of range.

\sa SDL_GetNumVideoDisplays()

SDL_GetDisplayMode sdl2

Fill in information about a specific display mode.

The display modes are sorted in this priority: bits per pixel -> more colors to fewer colors width -> largest to smallest height -> largest to smallest refresh rate -> highest to lowest

SDL_GetNumDisplayModes()

SDL_GetDisplayName sdl2

Get the name of a display in UTF-8 encoding

The name of a display, or nil for an invalid display index.

SDL_GetNumVideoDisplays()

SDL_GetDisplayOrientation sdl2

\brief Get the orientation of a display

\return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available.

\sa SDL_GetNumVideoDisplays()

SDL_GetDisplayUsableBounds sdl2

\brief Get the usable desktop area represented by a display, with the primary display located at 0,0

This is the same area as SDL_GetDisplayBounds() reports, but with portions reserved by the system removed. For example, on Mac OS X, this subtracts the area occupied by the menu bar and dock.

Setting a window to be fullscreen generally bypasses these unusable areas, so these are good guidelines for the maximum space available to a non-fullscreen window.

\return 0 on success, or -1 if the index is out of range.

\sa SDL_GetDisplayBounds() \sa SDL_GetNumVideoDisplays()

SDL_GetError sdl2

\brief Get the last error message that was set

SDL API functions may set error messages and then succeed, so you should only use the error value if a function fails.

This returns a pointer to a static buffer for convenience and should not be called by multiple threads simultaneously.

\return a pointer to the last error message that was set

SDL_GetErrorMsg sdl2

\brief Get the last error message that was set for the current thread

SDL API functions may set error messages and then succeed, so you should only use the error value if a function fails.

\param errstr A buffer to fill with the last error message that was set for the current thread \param maxlen The size of the buffer pointed to by the errstr parameter

\return errstr

SDL_GetEventFilter sdl2

Return the current event filter - can be used to "chain" filters. If there is no event filter set, this function returns SDL_FALSE.

SDL_GetEventState sdl2

 

SDL_getFramecount sdl2_gfx

 

SDL_getFramerate sdl2_gfx

 

SDL_GetGlobalMouseState sdl2

Get the current state of the mouse in relation to the desktop.

This works similarly to SDL_GetMouseState(), but the coordinates will be reported relative to the top-left of the desktop. This can be useful if you need to track the mouse outside of a specific window and SDL_CaptureMouse() doesn't fit your needs. For example, it could be useful if you need to track the mouse while dragging a window, where coordinates relative to a window might not be in sync at all times.

Note: SDL_GetMouseState() returns the mouse position as SDL understands it from the last pump of the event queue. This function, however, queries the OS for the current mouse position, and as such, might be a slightly less efficient function. Unless you know what you're doing and have a good reason to use this function, you probably want SDL_GetMouseState() instead.

\param x filled in with the current X coord relative to the desktop; can be NULL \param y filled in with the current Y coord relative to the desktop; can be NULL \returns the current button state as a bitmask which can be tested using the SDL_BUTTON(X) macros.

\since This function is available since SDL 2.0.4.

\sa SDL_CaptureMouse

SDL_GetGrabbedWindow sdl2

\brief Get the window that currently has an input grab enabled.

\return This returns the window if input is grabbed, and NULL otherwise.

\sa SDL_SetWindowGrab()

SDL_GetHint sdl2

/** \brief Get a hint

\return The string value of a hint variable. /

SDL_GetHintBoolean sdl2

/** \brief Get a hint

\return The boolean value of a hint variable. /

SDL_GetJoystickGUIDInfo sdl2

Get the device information encoded in a SDL_JoystickGUID structure

\param guid the SDL_JoystickGUID you wish to get info about \param vendor A pointer filled in with the device VID, or 0 if not available \param product A pointer filled in with the device PID, or 0 if not available \param version A pointer filled in with the device version, or 0 if not available \param crc16 A pointer filled in with a CRC used to distinguish different products with the same VID/PID, or 0 if not available

\since This function is available since SDL 2.26.0.

\sa SDL_JoystickGetDeviceGUID

SDL_GetKeyboardFocus sdl2

Query the window which currently has keyboard focus.

\returns the window with keyboard focus.

\since This function is available since SDL 2.0.0.

SDL_GetKeyboardState sdl2

Get a snapshot of the current state of the keyboard.

The pointer returned is a pointer to an internal SDL array. It will be valid for the whole lifetime of the application and should not be freed by the caller.

A array element with a value of 1 means that the key is pressed and a value of 0 means that it is not. Indexes into this array are obtained by using SDL_Scancode values.

Use SDL_PumpEvents() to update the state array.

This function gives you the current state after all events have been processed, so if a key or button has been pressed and released before you process events, then the pressed state will never show up in the SDL_GetKeyboardState() calls.

Note: This function doesn't take into account whether shift has been pressed or not.

\param numkeys if non-nil, receives the length of the returned array \returns a pointer to an array of key states.

\since This function is available since SDL 2.0.0.

\sa SDL_PumpEvents \sa SDL_ResetKeyboard

SDL_GetKeyFromName sdl2

Get a key code from a human-readable name.

\param name the human-readable key name \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_GetKeyFromScancode \sa SDL_GetKeyName \sa SDL_GetScancodeFromName

SDL_GetKeyFromScancode sdl2

Get the key code corresponding to the given scancode according to the current keyboard layout.

See SDL_Keycode for details.

\param scancode the desired SDL_Scancode to query \returns the SDL_Keycode that corresponds to the given SDL_Scancode.

\since This function is available since SDL 2.0.0.

\sa SDL_GetKeyName \sa SDL_GetScancodeFromKey

SDL_GetKeyName sdl2

Get a human-readable name for a key.

See SDL_Scancode and SDL_Keycode for details.

\param key the desired SDL_Keycode to query \returns a pointer to a UTF-8 string that stays valid at least until the next call to this function. If you need it around any longer, you must copy it. If the key doesn't have a name, this function returns an empty string ("").

\since This function is available since SDL 2.0.0.

\sa SDL_GetKeyFromName \sa SDL_GetKeyFromScancode \sa SDL_GetScancodeFromKey

SDL_GetMemoryFunctions sdl2

Get the current set of SDL memory functions

\since This function is available since SDL 2.0.7.

SDL_GetModState sdl2

Get the current key modifier state for the keyboard.

\returns an OR'd combination of the modifier keys for the keyboard. See SDL_Keymod for details.

\since This function is available since SDL 2.0.0.

\sa SDL_GetKeyboardState \sa SDL_SetModState

SDL_GetMouseFocus sdl2

Get the window which currently has mouse focus.

\returns the window with mouse focus.

\since This function is available since SDL 2.0.0.

SDL_GetMouseState sdl2

Retrieve the current state of the mouse.

The current button state is returned as a button bitmask, which can be tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the left, 2 for middle, 3 for the right button), and `x` and `y` are set to the mouse cursor position relative to the focus window. You can pass NULL for either `x` or `y`.

\param x the x coordinate of the mouse cursor position relative to the focus window \param y the y coordinate of the mouse cursor position relative to the focus window \returns a 32-bit button bitmask of the current button state.

\since This function is available since SDL 2.0.0.

\sa SDL_GetGlobalMouseState \sa SDL_GetRelativeMouseState \sa SDL_PumpEvents

SDL_GetNumAllocations sdl2

Get the number of outstanding (unfreed) allocations

\since This function is available since SDL 2.0.7.

SDL_GetNumAudioDevices sdl2

Get the number of built-in audio devices.

This function is only valid after successfully initializing the audio subsystem.

Note that audio capture support is not implemented as of SDL 2.0.4, so the `iscapture` parameter is for future expansion and should always be zero for now.

This function will return -1 if an explicit list of devices can't be determined. Returning -1 is not an error. For example, if SDL is set up to talk to a remote audio server, it can't list every one available on the Internet, but it will still allow a specific host to be specified in SDL_OpenAudioDevice().

In many common cases, when this function returns a value <= 0, it can still successfully open the default device (NULL for first argument of SDL_OpenAudioDevice()).

This function may trigger a complete redetect of available hardware. It should not be called for each iteration of a loop, but rather once at the start of a loop:

```c // Don't do this: for (int i = 0; i < SDL_GetNumAudioDevices(0); i++)

// do this instead: const int count = SDL_GetNumAudioDevices(0); for (int i = 0; i < count; ++i) do_something_here(); ```

\param iscapture zero to request playback devices, non-zero to request recording devices \returns the number of available devices exposed by the current driver or -1 if an explicit list of devices can't be determined. A return value of -1 does not necessarily mean an error condition.

\since This function is available since SDL 2.0.0.

\sa SDL_GetAudioDeviceName \sa SDL_OpenAudioDevice

SDL_GetNumAudioDrivers sdl2

Use this function to get the number of built-in audio drivers.

This function returns a hardcoded number. This never returns a negative value; if there are no drivers compiled into this build of SDL, this function returns zero. The presence of a driver in this list does not mean it will function, it just means SDL is capable of interacting with that interface. For example, a build of SDL might have esound support, but if there's no esound server available, SDL's esound driver would fail if used.

By default, SDL tries all drivers, in its preferred order, until one is found to be usable.

\returns the number of built-in audio drivers.

\since This function is available since SDL 2.0.0.

\sa SDL_GetAudioDriver

SDL_GetNumDisplayModes sdl2

Returns the number of available display modes.

SDL_GetDisplayMode()

SDL_GetNumRenderDrivers sdl2

Get the number of 2D rendering drivers available for the current display.

A render driver is a set of code that handles rendering and texture management on a particular display. Normally there is only one, but some drivers may have several available with different capabilities.

SDL_GetRenderDriverInfo() SDL_CreateRenderer()

SDL_GetNumTouchDevices sdl2

Get the number of registered touch devices.

SDL_GetNumTouchFingers sdl2

Get the number of active fingers for a given touch device.

SDL_GetNumVideoDisplays sdl2

Returns the number of available video displays.

SDL_GetDisplayBounds()

SDL_GetNumVideoDrivers sdl2

Get the number of video drivers compiled into SDL

SDL_GetVideoDriver()

SDL_GetOriginalMemoryFunctions sdl2

Get the original set of SDL memory functions

\since This function is available since SDL 2.24.0.

SDL_GetPerformanceCounter sdl2

Get the current value of the high resolution counter

SDL_GetPerformanceFrequency sdl2

Get the count per second of the high resolution counter

SDL_GetPixelFormatName sdl2

Get the human readable name of a pixel format.

\param format the pixel format to query \returns the human readable name of the specified pixel format or `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized.

\since This function is available since SDL 2.0.0.

SDL_GetPlatform sdl2

Gets the name of the platform.

SDL_GetPointDisplayIndex sdl2

Get the index of the display containing a point

\param point the point to query \returns the index of the display containing the point or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.24.0.

\sa SDL_GetDisplayBounds \sa SDL_GetNumVideoDisplays

SDL_GetPowerInfo sdl2

\brief Get the current power supply details.

\param secs Seconds of battery life left. You can pass a NULL here if you don't care. Will return -1 if we can't determine a value, or we're not running on a battery.

\param pct Percentage of battery life left, between 0 and 100. You can pass a NULL here if you don't care. Will return -1 if we can't determine a value, or we're not running on a battery.

\return The state of the battery (if any).

SDL_GetPreferredLocales sdl2

\brief Report the user's preferred locale.

This returns an array of SDL_Locale structs, the final item zeroed out. When the caller is done with this array, it should call SDL_free() on the returned value; all the memory involved is allocated in a single block, so a single SDL_free() will suffice.

Returned language strings are in the format xx, where 'xx' is an ISO-639 language specifier (such as 'en' for English, 'de' for German, etc). Country strings are in the format YY, where 'YY' is an ISO-3166 country code (such as "US" for the United States, 'CA' for Canada, etc). Country might be NULL if there's no specific guidance on them (so you might get ( 'en', 'US' ) for American English, but ( 'en', NIL ) means "English language, generically"). Language strings are never NIL, except to terminate the array.

Please note that not all of these strings are 2 characters; some are three or more.

The returned list of locales are in the order of the user's preference. For example, a German citizen that is fluent in US English and knows enough Japanese to navigate around Tokyo might have a list like: [ 'de', 'en_US', 'jp', NIL ]. Someone from England might prefer British English (where "color" is spelled "colour", etc), but will settle for anything like it: [ 'en_GB', 'en', NIL ].

This function returns NIL on error, including when the platform does not supply this information at all.

This might be a "slow" call that has to query the operating system. It's best to ask for this once and save the results. However, this list can change, usually because the user has changed a system preference outside of your program; SDL will send an SDL_LOCALECHANGED event in this case, if possible, and you can call this function again to get an updated copy of preferred locales.

\return array of locales, terminated with a locale with a NIL language field. Will return NIL on error.

SDL_GetPrefPath sdl2

Get the user-and-app-specific path where files can be written.

Get the "pref dir". This is meant to be where users can write personal files (preferences and save games, etc) that are specific to your application. This directory is unique per user, per application.

This function will decide the appropriate location in the native filesystem, create the directory if necessary, and return a string of the absolute path to the directory in UTF-8 encoding.

On Windows, the string might look like:

`C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\`

On Linux, the string might look like:

`/home/bob/.local/share/My Program Name/`

On Mac OS X, the string might look like:

`/Users/bob/Library/Application Support/My Program Name/`

You should assume the path returned by this function is the only safe place to write files (and that SDL_GetBasePath(), while it might be writable, or even the parent of the returned path, isn't where you should be writing things).

Both the org and app strings may become part of a directory name, so please follow these rules:

- Try to use the same org string (_including case-sensitivity_) for all your applications that use this function. - Always use a unique app string for each one, and make sure it never changes for an app once you've decided on it. - Unicode characters are legal, as long as it's UTF-8 encoded, but... - ...only use letters, numbers, and spaces. Avoid punctuation like "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.

The returned path is guaranteed to end with a path separator ('\' on Windows, '/' on most other platforms).

The pointer returned is owned by the caller. Please call SDL_free() on the pointer when done with it.

\param org the name of your organization \param app the name of your application \returns a UTF-8 string of the user directory in platform-dependent notation. nil if there's a problem (creating directory failed, etc.).

\since This function is available since SDL 2.0.1.

\sa SDL_GetBasePath

SDL_GetPrimarySelectionText sdl2

Get UTF-8 text from the primary selection, which must be freed with SDL_free().

This functions returns empty string if there was not enough memory left for a copy of the primary selection's content.

\returns the primary selection text on success or an empty string on failure; call SDL_GetError() for more information. Caller must call SDL_free() on the returned pointer when done with it (even if there was an error).

\since This function is available since SDL 2.26.1.

\sa SDL_HasPrimarySelectionText \sa SDL_SetPrimarySelectionText

SDL_GetQueuedAudioSize sdl2

Get the number of bytes of still-queued audio.

For playback devices: this is the number of bytes that have been queued for playback with SDL_QueueAudio(), but have not yet been sent to the hardware.

Once we've sent it to the hardware, this function can not decide the exact byte boundary of what has been played. It's possible that we just gave the hardware several kilobytes right before you called this function, but it hasn't played any of it yet, or maybe half of it, etc.

For capture devices, this is the number of bytes that have been captured by the device and are waiting for you to dequeue. This number may grow at any time, so this only informs of the lower-bound of available data.

You may not queue or dequeue audio on a device that is using an application-supplied callback; calling this function on such a device always returns 0. You have to use the audio callback or queue audio, but not both.

You should not call SDL_LockAudio() on the device before querying; SDL handles locking internally for this function.

\param dev the device ID of which we will query queued audio size \returns the number of bytes (not samples!) of queued audio.

\since This function is available since SDL 2.0.4.

\sa SDL_ClearQueuedAudio \sa SDL_QueueAudio \sa SDL_DequeueAudio

SDL_GetRectDisplayIndex sdl2

Get the index of the display primarily containing a rect

\param rect the rect to query \returns the index of the display entirely containing the rect or closest to the center of the rect on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.24.0.

\sa SDL_GetDisplayBounds \sa SDL_GetNumVideoDisplays

SDL_GetRelativeMouseMode sdl2

Query whether relative mouse mode is enabled.

\returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise.

\since This function is available since SDL 2.0.0.

\sa SDL_SetRelativeMouseMode

SDL_GetRelativeMouseState sdl2

Retrieve the relative state of the mouse.

The current button state is returned as a button bitmask, which can be tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the left, 2 for middle, 3 for the right button), and `x` and `y` are set to the mouse deltas since the last call to SDL_GetRelativeMouseState() or since event initialization. You can pass NULL for either `x` or `y`.

\param x a pointer filled with the last recorded x coordinate of the mouse \param y a pointer filled with the last recorded y coordinate of the mouse \returns a 32-bit button bitmask of the relative button state.

\since This function is available since SDL 2.0.0.

\sa SDL_GetMouseState

SDL_GetRenderDrawBlendMode sdl2

Get the blend mode used for drawing operations.

renderer The renderer from which blend mode should be queried. blendMode A pointer filled in with the current blend mode.

0 on success, or -1 on error

SDL_SetRenderDrawBlendMode()

SDL_GetRenderDrawColor sdl2

Get the color used for drawing operations (Rect, Line and Clear).

renderer The renderer from which drawing color should be queried. r A pointer to the red value used to draw on the rendering target. g A pointer to the green value used to draw on the rendering target. b A pointer to the blue value used to draw on the rendering target. a A pointer to the alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255).

0 on success, or -1 on error

SDL_GetRenderDriverInfo sdl2

Get information about a specific 2D rendering driver for the current display.

index The index of the driver to query information about. info A pointer to an SDL_RendererInfo struct to be filled with information on the rendering driver.

0 on success, -1 if the index was out of range.

SDL_CreateRenderer()

SDL_GetRenderer sdl2

Get the renderer associated with a window.

SDL_GetRendererInfo sdl2

Get information about a rendering context.

SDL_GetRendererOutputSize sdl2

Get the output size of a rendering context.

SDL_GetRenderTarget sdl2

Get the current render target or NULL for the default render target.

The current render target

SDL_SetRenderTarget()

SDL_GetRevision sdl2

Get the code revision of SDL that is linked against your program.

Returns an arbitrary string (a hash value) uniquely identifying the exact revision of the SDL library in use, and is only useful in comparing against other revisions. It is NOT an incrementing number.

SDL_GetRevisionNumber sdl2

Get the revision number of SDL that is linked against your program.

Returns a number uniquely identifying the exact revision of the SDL library in use. It is an incrementing number based on commits to hg.libsdl.org.

SDL_GetRGB sdl2

Get RGB values from a pixel in the specified format.

This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB component (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).

\param pixel a pixel value \param format an SDL_PixelFormat structure describing the format of the pixel \param r a pointer filled in with the red component \param g a pointer filled in with the green component \param b a pointer filled in with the blue component

\since This function is available since SDL 2.0.0.

\sa SDL_GetRGBA \sa SDL_MapRGB \sa SDL_MapRGBA

SDL_GetRGBA sdl2

Get RGBA values from a pixel in the specified format.

This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB component (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).

If the surface has no alpha component, the alpha will be returned as 0xff (100% opaque).

\param pixel a pixel value \param format an SDL_PixelFormat structure describing the format of the pixel \param r a pointer filled in with the red component \param g a pointer filled in with the green component \param b a pointer filled in with the blue component \param a a pointer filled in with the alpha component

\since This function is available since SDL 2.0.0.

\sa SDL_GetRGB \sa SDL_MapRGB \sa SDL_MapRGBA

SDL_GetScancodeFromKey sdl2

Get the scancode corresponding to the given key code according to the current keyboard layout.

See SDL_Scancode for details.

\param key the desired SDL_Keycode to query \returns the SDL_Scancode that corresponds to the given SDL_Keycode.

\since This function is available since SDL 2.0.0.

\sa SDL_GetKeyFromScancode \sa SDL_GetScancodeName

SDL_GetScancodeFromName sdl2

Get a scancode from a human-readable name.

\param name the human-readable scancode name \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't recognized; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_GetKeyFromName \sa SDL_GetScancodeFromKey \sa SDL_GetScancodeName

SDL_GetScancodeName sdl2

Get a human-readable name for a scancode.

See SDL_Scancode for details.

**Warning**: The returned name is by design not stable across platforms, e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left Windows" under Microsoft Windows, and some scancodes like `SDL_SCANCODE_NONUSBACKSLASH` don't have any name at all. There are even scancodes that share names, e.g. `SDL_SCANCODE_RETURN` and `SDL_SCANCODE_RETURN2` (both called "Return"). This function is therefore unsuitable for creating a stable cross-platform two-way mapping between strings and scancodes.

\param scancode the desired SDL_Scancode to query \returns a pointer to the name for the scancode. If the scancode doesn't have a name this function returns an empty string ("").

\since This function is available since SDL 2.0.0.

\sa SDL_GetScancodeFromKey \sa SDL_GetScancodeFromName

SDL_GetShapedWindowMode sdl2

Get the shape parameters of a shaped window.

\param window The shaped window whose parameters should be retrieved. \param shape_mode An empty shape-mode structure to fill, or NIL to check whether the window has a shape. \return 0 if the window has a shape and, provided shape_mode was not NIL, shape_mode has been filled with the mode data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a shapeable window currently lacking a shape.

\since This function is available since SDL 2.0.0.

\sa SDL_WindowShapeMode \sa SDL_SetWindowShape

SDL_GetSurfaceAlphaMod sdl2

Get the additional alpha value used in blit operations.

surface The surface to query. alpha A pointer filled in with the current alpha value.

0 on success, or -1 if the surface is not valid.

SDL_SetSurfaceAlphaMod()

SDL_GetSurfaceBlendMode sdl2

Get the blend mode used for blit operations.

surface The surface to query. blendMode A pointer filled in with the current blend mode.

0 on success, or -1 if the surface is not valid.

SDL_SetSurfaceBlendMode()

SDL_GetSurfaceColorMod sdl2

Get the additional color value used in blit operations.

surface The surface to query. r A pointer filled in with the current red color value. g A pointer filled in with the current green color value. b A pointer filled in with the current blue color value.

0 on success, or -1 if the surface is not valid.

SDL_SetSurfaceColorMod()

SDL_GetSystemRAM sdl2

This function returns the amount of RAM configured in the system, in MB.

SDL_GetTextureAlphaMod sdl2

Get the additional alpha value used in render copy operations.

texture The texture to query. alpha A pointer filled in with the current alpha value.

0 on success, or -1 if the texture is not valid.

SDL_SetTextureAlphaMod()

SDL_GetTextureBlendMode sdl2

Get the blend mode used for texture copy operations.

texture The texture to query. blendMode A pointer filled in with the current blend mode.

0 on success, or -1 if the texture is not valid.

SDL_SetTextureBlendMode()

SDL_GetTextureColorMod sdl2

Get the additional color value used in render copy operations.

texture The texture to query. r A pointer filled in with the current red color value. g A pointer filled in with the current green color value. b A pointer filled in with the current blue color value.

0 on success, or -1 if the texture is not valid.

SDL_SetTextureColorMod()

SDL_GetTextureScaleMode sdl2

Get the scale mode used for texture scale operations.

SDL_GetTextureUserData sdl2

Get the user-specified pointer associated with a texture.

SDL_GetThreadID sdl2

Get the thread identifier for the specified thread.

Equivalent to SDL_ThreadID() if the specified thread is NULL.

SDL_GetThreadName sdl2

Get the thread name, as it was specified in SDL_CreateThread(). This function returns a pointer to a UTF-8 string that names the specified thread, or NULL if it doesn't have a name. This is internal memory, not to be free()'d by the caller, and remains valid until the specified thread is cleaned up by SDL_WaitThread().

SDL_GetTicks sdl2

Get the number of milliseconds since the SDL library initialization.

This value wraps if the program runs for more than ˜49 days.

SDL_GetTicks64 sdl2

Get the number of milliseconds since SDL library initialization.

Note that you should not use the SDL_TICKS_PASSED macro with values returned by this function, as that macro does clever math to compensate for the 32-bit overflow every ˜49 days that SDL_GetTicks() suffers from. 64-bit values from this function can be safely compared directly.

SDL_GetTouchDevice sdl2

Get the touch ID with the given index, or 0 if the index is invalid.

SDL_GetTouchDeviceType sdl2

Get the type of the given touch device.

\since This function is available since SDL 2.0.10.

SDL_GetTouchFinger sdl2

Get the finger object of the given touch, with the given index.

SDL_GetTouchName sdl2

Get the touch device name as reported from the driver, or NIL if the index is invalid.

\since This function is available since SDL 2.0.22.

SDL_GetVersion sdl2

Get the version of SDL that is linked against your program.

If you are linking to SDL dynamically, then it is possible that the current version will be different than the version you compiled against. This function returns the current version, while SDL_VERSION() is a macro that tells you what version you compiled with.

compiled: TSDL_Version; linked: TSDL_Version;

SDL_VERSION(@compiled); SDL_GetVersion(@linked); WriteLn('We compiled against SDL version: ' + IntToStr(compiled.major) + IntToStr(compiled.minor) + IntToStr(compiled.patch)); WriteLn('But we linked against SDL version:' + IntToStr(compiled.major) + IntToStr(compiled.minor) + IntToStr(compiled.patch));

This function may be called safely at any time, even before SDL_Init().

SDL_VERSION

SDL_GetVideoDriver sdl2

Get the name of a built in video driver.

The video drivers are presented in the order in which they are normally checked during initialization.

SDL_GetNumVideoDrivers()

SDL_GetWindowBordersSize sdl2

\brief Get the size of a window's borders (decorations) around the client area.

\param window The window to query. \param top Pointer to variable for storing the size of the top border. NULL is permitted. \param left Pointer to variable for storing the size of the left border. NULL is permitted. \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. \param right Pointer to variable for storing the size of the right border. NULL is permitted.

\return 0 on success, or -1 if getting this information is not supported.

\note if this function fails (returns -1), the size values will be initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the window in question was borderless.

SDL_GetWindowBrightness sdl2

Get the brightness (gamma correction) for a window.

The last brightness value passed to SDL_SetWindowBrightness()

SDL_SetWindowBrightness()

SDL_GetWindowData sdl2

Retrieve the data pointer associated with a window.

window The window to query. name The name of the pointer.

The value associated with 'name'

SDL_SetWindowData()

SDL_GetWindowDisplayIndex sdl2

Get the display index associated with a window.

the display index of the display containing the center of the window, or -1 on error.

SDL_GetWindowDisplayMode sdl2

Fill in information about the display mode used when a fullscreen window is visible.

SDL_SetWindowDisplayMode() SDL_SetWindowFullscreen()

SDL_GetWindowFlags sdl2

Get the window flags.

SDL_GetWindowFromID sdl2

Get a window from a stored ID, or nil if it doesn't exist.

SDL_GetWindowGammaRamp sdl2

Get the gamma ramp for a window.

red A pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or nil. green A pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or nil. blue A pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or nil.

0 on success, or -1 if gamma ramps are unsupported.

SDL_SetWindowGammaRamp()

SDL_GetWindowGrab sdl2

Get a window's input grab mode.

This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.

SDL_SetWindowGrab()

SDL_GetWindowICCProfile sdl2

Get the raw ICC profile data for the screen the window is currently on.

Data returned should be freed with SDL_free().

\param window the window to query \param size the size of the ICC profile \returns the raw ICC profile data on success or NIL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.18.

SDL_GetWindowID sdl2

Get the numeric ID of a window, for logging purposes.

SDL_GetWindowKeyboardGrab sdl2

Get a window's keyboard grab mode.

Returns SDL_TRUE if keyboard is grabbed, and SDL_FALSE otherwise.

SDL_SetWindowKeyboardGrab()

SDL_GetWindowMaximumSize sdl2

Get the maximum size of a window's client area.

w Pointer to variable for storing the maximum width, may be nil h Pointer to variable for storing the maximum height, may be nil

SDL_GetWindowMinimumSize() SDL_SetWindowMaximumSize()

SDL_GetWindowMinimumSize sdl2

Get the minimum size of a window's client area.

w Pointer to variable for storing the minimum width, may be nil h Pointer to variable for storing the minimum height, may be nil

SDL_GetWindowMaximumSize() SDL_SetWindowMinimumSize()

SDL_GetWindowMouseGrab sdl2

Get a window's mouse grab mode.

Returns SDL_TRUE if mouse is grabbed, and SDL_FALSE otherwise.

SDL_SetWindowMouseGrab()

SDL_GetWindowMouseRect sdl2

Get the mouse confinement rectangle of a window.

Returns A pointer to the mouse confinement rectangle of a window, or NULL if there isn't one.

SDL_SetWindowMouseRect()

SDL_GetWindowOpacity sdl2

\brief Get the opacity of a window.

If transparency isn't supported on this platform, opacity will be reported as 1.0f without error.

\param window The window in question. \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque)

\return 0 on success, or -1 on error (invalid window, etc).

\sa SDL_SetWindowOpacity()

SDL_GetWindowPixelFormat sdl2

Get the pixel format associated with the window.

SDL_GetWindowPosition sdl2

Get the position of a window.

x Pointer to variable for storing the x position, may be nil y Pointer to variable for storing the y position, may be nil

SDL_SetWindowPosition()

SDL_GetWindowSize sdl2

Get the size of a window's client area.

w Pointer to variable for storing the width, may be nil h Pointer to variable for storing the height, may be nil

SDL_SetWindowSize()

SDL_GetWindowSurface sdl2

Get the SDL surface associated with the window.

The window's framebuffer surface, or nil on error.

A new surface will be created with the optimal format for the window, if necessary. This surface will be freed when the window is destroyed.

You may not combine this with 3D or the rendering API on this window.

SDL_UpdateWindowSurface() SDL_UpdateWindowSurfaceRects()

SDL_GetWindowTitle sdl2

Get the title of a window, in UTF-8 format.

SDL_SetWindowTitle()

SDL_GetWindowWMInfo sdl2

Get driver-specific information about a window.

You must include SDL_syswm.h for the declaration of SDL_SysWMinfo.

The caller must initialize the `info` structure's version by using `SDL_VERSION(&info.version)`, and then this function will fill in the rest of the structure with information about the given window.

\param window the window about which information is being requested \param info an SDL_SysWMinfo structure filled in with window information \returns SDL_TRUE if the function is implemented and the `version` member of the `info` struct is valid, or SDL_FALSE if the information could not be retrieved; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_GetYUVConversionMode sdl2

\brief Get the YUV conversion mode

SDL_GetYUVConversionModeForResolution sdl2

\brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC

SDL_GFX_VERSION sdl2_gfx

 

SDL_GL_BindTexture sdl2

Bind the texture to the current OpenGL/ES/ES2 context for use with OpenGL instructions.

texture The SDL texture to bind texw A pointer to a float that will be filled with the texture width texh A pointer to a float that will be filled with the texture height

0 on success, or -1 if the operation is not supported

SDL_GL_CreateContext sdl2

Create an OpenGL context for use with an OpenGL window, and make it current.

SDL_GL_DeleteContext()

SDL_GL_DeleteContext sdl2

Delete an OpenGL context.

SDL_GL_CreateContext()

SDL_GL_ExtensionSupported sdl2

Return true if an OpenGL extension is supported for the current context.

SDL_GL_GetAttribute sdl2

Get the actual value for an attribute from the current context.

SDL_GL_GetCurrentContext sdl2

Get the currently active OpenGL context.

SDL_GL_GetCurrentWindow sdl2

Get the currently active OpenGL window.

SDL_GL_GetDrawableSize sdl2

Get the size of a window's underlying drawable in pixels (for use with glViewport).

window Window from which the drawable size should be queried w Pointer to variable for storing the width in pixels, may be NULL h Pointer to variable for storing the height in pixels, may be NULL

This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-DPI support (Apple calls this "Retina"), and not disabled by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.

SDL_GetWindowSize() SDL_CreateWindow()

SDL_GL_GetProcAddress sdl2

Get the address of an OpenGL function.

SDL_GL_GetSwapInterval sdl2

Get the swap interval for the current OpenGL context.

0 if there is no vertical retrace synchronization, 1 if the buffer swap is synchronized with the vertical retrace, and -1 if late swaps happen immediately instead of waiting for the next retrace. If the system can't determine the swap interval, or there isn't a valid current context, this will return 0 as a safe default.

SDL_GL_SetSwapInterval()

SDL_GL_LoadLibrary sdl2

Dynamically load an OpenGL library.

path The platform dependent OpenGL library name, or nil to open the default OpenGL library.

0 on success, or -1 if the library couldn't be loaded.

This should be done after initializing the video driver, but before creating any OpenGL windows. If no OpenGL library is loaded, the default library will be loaded upon creation of the first OpenGL window.

If you do this, you need to retrieve all of the GL functions used in your program from the dynamic library using SDL_GL_GetProcAddress().

SDL_GL_GetProcAddress() SDL_GL_UnloadLibrary()

SDL_GL_MakeCurrent sdl2

Set up an OpenGL context for rendering into an OpenGL window.

The context must have been created with a compatible window.

SDL_GL_ResetAttributes sdl2

Reset all previously set OpenGL context attributes to their default values

SDL_GL_SetAttribute sdl2

Set an OpenGL window attribute before window creation.

SDL_GL_SetSwapInterval sdl2

Set the swap interval for the current OpenGL context.

interval 0 for immediate updates, 1 for updates synchronized with the vertical retrace. If the system supports it, you may specify -1 to allow late swaps to happen immediately instead of waiting for the next retrace.

0 on success, or -1 if setting the swap interval is not supported.

SDL_GL_GetSwapInterval()

SDL_GL_SwapWindow sdl2

Swap the OpenGL buffers for a window, if double-buffering is supported.

SDL_GL_UnbindTexture sdl2

Unbind a texture from the current OpenGL/ES/ES2 context.

texture The SDL texture to unbind

0 on success, or -1 if the operation is not supported

SDL_GL_UnloadLibrary sdl2

Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().

SDL_GL_LoadLibrary()

SDL_GUIDFromString sdl2

Convert a GUID string into a ::SDL_GUID structure.

Performs no error checking. If this function is given a string containing an invalid GUID, the function will silently succeed, but the GUID generated will not be useful.

\param pchGUID string containing an ASCII representation of a GUID \returns a ::SDL_GUID structure.

\since This function is available since SDL 2.24.0.

\sa SDL_GUIDToString

SDL_GUIDToString sdl2

Get an ASCII string representation for a given ::SDL_GUID.

You should supply at least 33 bytes for pszGUID.

\param guid the ::SDL_GUID you wish to convert to string \param pszGUID buffer in which to write the ASCII string \param cbGUID the size of pszGUID

\since This function is available since SDL 2.24.0.

\sa SDL_GUIDFromString

SDL_HapticClose sdl2

Close a haptic device previously opened with SDL_HapticOpen().

\param haptic the SDL_Haptic device to close

\since This function is available since SDL 2.0.0.

\sa SDL_HapticOpen

SDL_HapticDestroyEffect sdl2

Destroy a haptic effect on the device.

This will stop the effect if it's running. Effects are automatically destroyed when the device is closed.

\param haptic the SDL_Haptic device to destroy the effect on \param effect the ID of the haptic effect to destroy

\since This function is available since SDL 2.0.0.

\sa SDL_HapticNewEffect

SDL_HapticEffectSupported sdl2

Check to see if an effect is supported by a haptic device.

\param haptic the SDL_Haptic device to query \param effect the desired effect to query \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticNewEffect \sa SDL_HapticQuery

SDL_HapticGetEffectStatus sdl2

Get the status of the current effect on the specified haptic device.

Device must support the SDL_HAPTIC_STATUS feature.

\param haptic the SDL_Haptic device to query for the effect status on \param effect the ID of the haptic effect to query its status \returns 0 if it isn't playing, 1 if it is playing, or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticRunEffect \sa SDL_HapticStopEffect

SDL_HapticIndex sdl2

Get the index of a haptic device.

\param haptic the SDL_Haptic device to query \returns the index of the specified haptic device or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticOpen \sa SDL_HapticOpened

SDL_HapticName sdl2

Get the implementation dependent name of a haptic device.

This can be called before any joysticks are opened. If no name can be found, this function returns NULL.

\param device_index index of the device to query. \returns the name of the device or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_NumHaptics

SDL_HapticNewEffect sdl2

Create a new haptic effect on a specified device.

\param haptic an SDL_Haptic device to create the effect on \param effect an SDL_HapticEffect structure containing the properties of the effect to create \returns the ID of the effect on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticDestroyEffect \sa SDL_HapticRunEffect \sa SDL_HapticUpdateEffect

SDL_HapticNumAxes sdl2

Get the number of haptic axes the device has.

The number of haptic axes might be useful if working with the SDL_HapticDirection effect.

\param haptic the SDL_Haptic device to query \returns the number of axes on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_HapticNumEffects sdl2

Get the number of effects a haptic device can store.

On some platforms this isn't fully supported, and therefore is an approximation. Always check to see if your created effect was actually created and do not rely solely on SDL_HapticNumEffects().

\param haptic the SDL_Haptic device to query \returns the number of effects the haptic device can store or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticNumEffectsPlaying \sa SDL_HapticQuery

SDL_HapticNumEffectsPlaying sdl2

Get the number of effects a haptic device can play at the same time.

This is not supported on all platforms, but will always return a value.

\param haptic the SDL_Haptic device to query maximum playing effects \returns the number of effects the haptic device can play at the same time or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticNumEffects \sa SDL_HapticQuery

SDL_HapticOpen sdl2

Open a haptic device for use.

The index passed as an argument refers to the N'th haptic device on this system.

When opening a haptic device, its gain will be set to maximum and autocenter will be disabled. To modify these values use SDL_HapticSetGain() and SDL_HapticSetAutocenter().

\param device_index index of the device to open \returns the device identifier or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticClose \sa SDL_HapticIndex \sa SDL_HapticOpenFromJoystick \sa SDL_HapticOpenFromMouse \sa SDL_HapticPause \sa SDL_HapticSetAutocenter \sa SDL_HapticSetGain \sa SDL_HapticStopAll

SDL_HapticOpened sdl2

Check if the haptic device at the designated index has been opened.

\param device_index the index of the device to query \returns 1 if it has been opened, 0 if it hasn't or on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticIndex \sa SDL_HapticOpen

SDL_HapticOpenFromJoystick sdl2

Open a haptic device for use from a joystick device.

You must still close the haptic device separately. It will not be closed with the joystick.

When opened from a joystick you should first close the haptic device before closing the joystick device. If not, on some implementations the haptic device will also get unallocated and you'll be unable to use force feedback on that device.

\param joystick the SDL_Joystick to create a haptic device from \returns a valid haptic device identifier on success or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticClose \sa SDL_HapticOpen \sa SDL_JoystickIsHaptic

SDL_HapticOpenFromMouse sdl2

Try to open a haptic device from the current mouse.

\returns the haptic device identifier or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticOpen \sa SDL_MouseIsHaptic

SDL_HapticPause sdl2

Pause a haptic device.

Device must support the `SDL_HAPTIC_PAUSE` feature. Call SDL_HapticUnpause() to resume playback.

Do not modify the effects nor add new ones while the device is paused. That can cause all sorts of weird errors.

\param haptic the SDL_Haptic device to pause \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticUnpause

SDL_HapticQuery sdl2

Get the haptic device's supported features in bitwise manner.

\param haptic the SDL_Haptic device to query \returns a list of supported haptic features in bitwise manner (OR'd), or 0 on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticEffectSupported \sa SDL_HapticNumEffects

SDL_HapticRumbleInit sdl2

Initialize a haptic device for simple rumble playback.

\param haptic the haptic device to initialize for simple rumble playback \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticOpen \sa SDL_HapticRumblePlay \sa SDL_HapticRumbleStop \sa SDL_HapticRumbleSupported

SDL_HapticRumblePlay sdl2

Run a simple rumble effect on a haptic device.

\param haptic the haptic device to play the rumble effect on \param strength strength of the rumble to play as a 0-1 float value \param length length of the rumble to play in milliseconds \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticRumbleInit \sa SDL_HapticRumbleStop \sa SDL_HapticRumbleSupported

SDL_HapticRumbleStop sdl2

Stop the simple rumble on a haptic device.

\param haptic the haptic device to stop the rumble effect on \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticRumbleInit \sa SDL_HapticRumblePlay \sa SDL_HapticRumbleSupported

SDL_HapticRumbleSupported sdl2

Check whether rumble is supported on a haptic device.

\param haptic haptic device to check for rumble support \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticRumbleInit \sa SDL_HapticRumblePlay \sa SDL_HapticRumbleStop

SDL_HapticRunEffect sdl2

Run the haptic effect on its associated haptic device.

To repeat the effect over and over indefinitely, set `iterations` to `SDL_HAPTIC_INFINITY`. (Repeats the envelope - attack and fade.) To make one instance of the effect last indefinitely (so the effect does not fade), set the effect's `length` in its structure/union to `SDL_HAPTIC_INFINITY` instead.

\param haptic the SDL_Haptic device to run the effect on \param effect the ID of the haptic effect to run \param iterations the number of iterations to run the effect; use `SDL_HAPTIC_INFINITY` to repeat forever \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticDestroyEffect \sa SDL_HapticGetEffectStatus \sa SDL_HapticStopEffect

SDL_HapticSetAutocenter sdl2

Set the global autocenter of the device.

Autocenter should be between 0 and 100. Setting it to 0 will disable autocentering.

Device must support the SDL_HAPTIC_AUTOCENTER feature.

\param haptic the SDL_Haptic device to set autocentering on \param autocenter value to set autocenter to (0-100) \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticQuery

SDL_HapticSetGain sdl2

Set the global gain of the specified haptic device.

Device must support the SDL_HAPTIC_GAIN feature.

The user may specify the maximum gain by setting the environment variable `SDL_HAPTIC_GAIN_MAX` which should be between 0 and 100. All calls to SDL_HapticSetGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the maximum.

\param haptic the SDL_Haptic device to set the gain on \param gain value to set the gain to, should be between 0 and 100 (0 - 100) \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticQuery

SDL_HapticStopAll sdl2

Stop all the currently playing effects on a haptic device.

\param haptic the SDL_Haptic device to stop \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_HapticStopEffect sdl2

Stop the haptic effect on its associated haptic device.

*

\param haptic the SDL_Haptic device to stop the effect on \param effect the ID of the haptic effect to stop \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticDestroyEffect \sa SDL_HapticRunEffect

SDL_HapticUnpause sdl2

Unpause a haptic device.

Call to unpause after SDL_HapticPause().

\param haptic the SDL_Haptic device to unpause \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticPause

SDL_HapticUpdateEffect sdl2

Update the properties of an effect.

Can be used dynamically, although behavior when dynamically changing direction may be strange. Specifically the effect may re-upload itself and start playing from the start. You also cannot change the type either when running SDL_HapticUpdateEffect().

\param haptic the SDL_Haptic device that has the effect \param effect the identifier of the effect to update \param data an SDL_HapticEffect structure containing the new effect properties to use \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticDestroyEffect \sa SDL_HapticNewEffect \sa SDL_HapticRunEffect

SDL_Has3DNow sdl2

This function returns true if the CPU has 3DNow! features.

This always returns false on CPUs that aren't using AMD instruction sets.

SDL_HasAltiVec sdl2

This function returns true if the CPU has AltiVec features.

This always returns false on CPUs that aren't using PowerPC instruction sets.

SDL_HasARMSIMD sdl2

Determine whether the CPU has ARM SIMD (ARMv6) features. This is different from ARM NEON, which is a different instruction set.

This always returns false on CPUs that aren't using ARM instruction sets.

SDL_HasAVX sdl2

This function returns true if the CPU has AVX features.

This always returns false on CPUs that aren't using Intel instruction sets.

SDL_HasAVX2 sdl2

This function returns true if the CPU has AVX2 features.

This always returns false on CPUs that aren't using Intel instruction sets.

SDL_HasAVX512F sdl2

Determine whether the CPU has AVX-512F (foundation) features.

This always returns false on CPUs that aren't using Intel instruction sets.

SDL_HasClipboardText sdl2

Query whether the clipboard exists and contains a non-empty text string.

\returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not.

\since This function is available since SDL 2.0.0.

\sa SDL_GetClipboardText \sa SDL_SetClipboardText

SDL_HasColorKey sdl2

\brief Returns whether the surface has a color key

\return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key

SDL_HasEvent sdl2

Checks to see if certain event types are in the event queue.

SDL_HasEvents sdl2

 

SDL_HasIntersection sdl2

Determine whether two rectangles intersect.

SDL_TRUE if there is an intersection, SDL_FALSE otherwise.

SDL_HasIntersectionF sdl2

Determine whether two rectangles intersect with float precision.

If either pointer is NIL the function will return SDL_FALSE.

\param A an SDL_FRect structure representing the first rectangle \param B an SDL_FRect structure representing the second rectangle \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.

\since This function is available since SDL 2.0.22.

\sa SDL_IntersectRect

SDL_HasMMX sdl2

This function returns true if the CPU has MMX features.

This always returns false on CPUs that aren't using Intel instruction sets.

SDL_HasNEON sdl2

Determine whether the CPU has NEON (ARM SIMD) features.

This always returns false on CPUs that aren't using ARM instruction sets.

SDL_HasPrimarySelectionText sdl2

Query whether the primary selection exists and contains a non-empty text string.

\returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it does not.

\since This function is available since SDL 2.26.1.

\sa SDL_GetPrimarySelectionText \sa SDL_SetPrimarySelectionText

SDL_HasRDTSC sdl2

This function returns true if the CPU has the RDTSC instruction.

This always returns false on CPUs that aren't using Intel instruction sets.

SDL_HasScreenKeyboardSupport sdl2

Check whether the platform has screen keyboard support.

\returns SDL_TRUE if the platform has some screen keyboard support or SDL_FALSE if not.

\since This function is available since SDL 2.0.0.

\sa SDL_StartTextInput \sa SDL_IsScreenKeyboardShown

SDL_HasSSE sdl2

This function returns true if the CPU has SSE features.

This always returns false on CPUs that aren't using Intel instruction sets.

SDL_HasSSE2 sdl2

This function returns true if the CPU has SSE2 features.

This always returns false on CPUs that aren't using Intel instruction sets.

SDL_HasSSE3 sdl2

This function returns true if the CPU has SSE3 features.

This always returns false on CPUs that aren't using Intel instruction sets.

SDL_HasSSE41 sdl2

This function returns true if the CPU has SSE4.1 features.

This always returns false on CPUs that aren't using Intel instruction sets.

SDL_HasSSE42 sdl2

This function returns true if the CPU has SSE4.2 features.

This always returns false on CPUs that aren't using Intel instruction sets.

SDL_HasSurfaceRLE sdl2

\brief Returns whether the surface is RLE enabled

\return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled

SDL_HideWindow sdl2

Hide a window.

SDL_ShowWindow()

SDL_hid_ble_scan sdl2

Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers

\param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan

\since This function is available since SDL 2.0.18.

SDL_hid_close sdl2

Close a HID device.

\param dev A device handle returned from SDL_hid_open().

\since This function is available since SDL 2.0.18.

SDL_hid_device_change_count sdl2

Check to see if devices may have been added or removed.

Enumerating the HID devices is an expensive operation, so you can call this to see if there have been any system device changes since the last call to this function. A change in the counter returned doesn't necessarily mean that anything has changed, but you can call SDL_hid_enumerate() to get an updated device list.

Calling this function for the first time may cause a thread or other system resource to be allocated to track device change notifications.

\returns a change counter that is incremented with each potential device change, or 0 if device change detection isn't available.

\since This function is available since SDL 2.0.18.

\sa SDL_hid_enumerate

SDL_hid_enumerate sdl2

Enumerate the HID Devices.

This function returns a linked list of all the HID devices attached to the system which match vendor_id and product_id. If `vendor_id` is set to 0 then any vendor matches. If `product_id` is set to 0 then any product matches. If `vendor_id` and `product_id` are both set to 0, then all HID devices will be returned.

\param vendor_id The Vendor ID (VID) of the types of device to open. \param product_id The Product ID (PID) of the types of device to open. \returns a pointer to a linked list of type SDL_hid_device_info, containing information about the HID devices attached to the system, or NIL in the case of failure. Free this linked list by calling SDL_hid_free_enumeration().

\since This function is available since SDL 2.0.18.

\sa SDL_hid_device_change_count

SDL_hid_exit sdl2

Finalize the HIDAPI library.

This function frees all of the static data associated with HIDAPI. It should be called at the end of execution to avoid memory leaks.

\returns 0 on success and -1 on error.

\since This function is available since SDL 2.0.18.

\sa SDL_hid_init

SDL_hid_free_enumeration sdl2

Free an enumeration Linked List

This function frees a linked list created by SDL_hid_enumerate().

\param devs Pointer to a list of struct_device returned from SDL_hid_enumerate().

\since This function is available since SDL 2.0.18.

SDL_hid_get_feature_report sdl2

Get a feature report from a HID device.

Set the first byte of `data` to the Report ID of the report to be read. Make sure to allow space for this extra byte in `data`. Upon return, the first byte will still contain the Report ID, and the report data will start in data[1].

\param dev A device handle returned from SDL_hid_open(). \param data A buffer to put the read data into, including the Report ID. Set the first byte of `data` to the Report ID of the report to be read, or set it to zero if your device does not use numbered reports. \param length The number of bytes to read, including an extra byte for the report ID. The buffer can be longer than the actual report. \returns the number of bytes read plus one for the report ID (which is still in the first byte), or -1 on error.

\since This function is available since SDL 2.0.18.

SDL_hid_get_indexed_string sdl2

Get a string from a HID device, based on its string index.

\param dev A device handle returned from SDL_hid_open(). \param string_index The index of the string to get. \param string A wide string buffer to put the data into. \param maxlen The length of the buffer in multiples of wchar_t. \returns 0 on success and -1 on error.

\since This function is available since SDL 2.0.18.

SDL_hid_get_manufacturer_string sdl2

Get The Manufacturer String from a HID device.

\param dev A device handle returned from SDL_hid_open(). \param string A wide string buffer to put the data into. \param maxlen The length of the buffer in multiples of wchar_t. \returns 0 on success and -1 on error.

\since This function is available since SDL 2.0.18.

SDL_hid_get_product_string sdl2

Get The Product String from a HID device.

\param dev A device handle returned from SDL_hid_open(). \param string A wide string buffer to put the data into. \param maxlen The length of the buffer in multiples of wchar_t. \returns 0 on success and -1 on error.

\since This function is available since SDL 2.0.18.

SDL_hid_get_serial_number_string sdl2

Get The Serial Number String from a HID device.

\param dev A device handle returned from SDL_hid_open(). \param string A wide string buffer to put the data into. \param maxlen The length of the buffer in multiples of wchar_t. \returns 0 on success and -1 on error.

\since This function is available since SDL 2.0.18.

SDL_hid_init sdl2

Initialize the HIDAPI library.

This function initializes the HIDAPI library. Calling it is not strictly necessary, as it will be called automatically by SDL_hid_enumerate() and any of the SDL_hid_open_*() functions if it is needed. This function should be called at the beginning of execution however, if there is a chance of HIDAPI handles being opened by different threads simultaneously.

Each call to this function should have a matching call to SDL_hid_exit()

\returns 0 on success and -1 on error.

\since This function is available since SDL 2.0.18.

\sa SDL_hid_exit

SDL_hid_open sdl2

Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number.

If `serial_number` is NULL, the first device with the specified VID and PID is opened.

\param vendor_id The Vendor ID (VID) of the device to open. \param product_id The Product ID (PID) of the device to open. \param serial_number The Serial Number of the device to open (optionally NIL). \returns a pointer to a SDL_hid_device object on success or NIL on failure.

\since This function is available since SDL 2.0.18.

SDL_hid_open_path sdl2

Open a HID device by its path name.

The path name be determined by calling SDL_hid_enumerate(), or a platform-specific path name can be used (eg: /dev/hidraw0 on Linux).

\param path The path name of the device to open \returns a pointer to a SDL_hid_device object on success or NIL on failure.

\since This function is available since SDL 2.0.18.

SDL_hid_read sdl2

Read an Input report from a HID device.

Input reports are returned to the host through the INTERRUPT IN endpoint. The first byte will contain the Report number if the device uses numbered reports.

\param dev A device handle returned from SDL_hid_open(). \param data A buffer to put the read data into. \param length The number of bytes to read. For devices with multiple reports, make sure to read an extra byte for the report number. \returns the actual number of bytes read and -1 on error. If no packet was available to be read and the handle is in non-blocking mode, this function returns 0.

\since This function is available since SDL 2.0.18.

SDL_hid_read_timeout sdl2

Read an Input report from a HID device with timeout.

Input reports are returned to the host through the INTERRUPT IN endpoint. The first byte will contain the Report number if the device uses numbered reports.

\param dev A device handle returned from SDL_hid_open(). \param data A buffer to put the read data into. \param length The number of bytes to read. For devices with multiple reports, make sure to read an extra byte for the report number. \param milliseconds timeout in milliseconds or -1 for blocking wait. \returns the actual number of bytes read and -1 on error. If no packet was available to be read within the timeout period, this function returns 0.

\since This function is available since SDL 2.0.18.

SDL_hid_send_feature_report sdl2

Send a Feature report to the device.

Feature reports are sent over the Control endpoint as a Set_Report transfer. The first byte of `data` must contain the Report ID. For devices which only support a single report, this must be set to 0x0. The remaining bytes contain the report data. Since the Report ID is mandatory, calls to SDL_hid_send_feature_report() will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for devices which do not use numbered reports), followed by the report data (16 bytes). In this example, the length passed in would be 17.

\param dev A device handle returned from SDL_hid_open(). \param data The data to send, including the report number as the first byte. \param length The length in bytes of the data to send, including the report number. \returns the actual number of bytes written and -1 on error.

\since This function is available since SDL 2.0.18.

SDL_hid_set_nonblocking sdl2

Set the device handle to be non-blocking.

In non-blocking mode calls to SDL_hid_read() will return immediately with a value of 0 if there is no data to be read. In blocking mode, SDL_hid_read() will wait (block) until there is data to read before returning.

Nonblocking can be turned on and off at any time.

\param dev A device handle returned from SDL_hid_open(). \param nonblock enable or not the nonblocking reads - 1 to enable nonblocking - 0 to disable nonblocking. \returns 0 on success and -1 on error.

\since This function is available since SDL 2.0.18.

SDL_hid_write sdl2

Write an Output report to a HID device.

The first byte of `data` must contain the Report ID. For devices which only support a single report, this must be set to 0x0. The remaining bytes contain the report data. Since the Report ID is mandatory, calls to SDL_hid_write() will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to SDL_hid_write(), the Report ID (or 0x0, for devices with a single report), followed by the report data (16 bytes). In this example, the length passed in would be 17.

SDL_hid_write() will send the data on the first OUT endpoint, if one exists. If it does not, it will send the data through the Control Endpoint (Endpoint 0).

\param dev A device handle returned from SDL_hid_open(). \param data The data to send, including the report number as the first byte. \param length The length in bytes of the data to send. \returns the actual number of bytes written and -1 on error.

\since This function is available since SDL 2.0.18.

SDL_iconv sdl2

 

SDL_iconv_close sdl2

 

SDL_iconv_open sdl2

 

SDL_iconv_string sdl2

This function converts a string between encodings in one pass, returning a string that must be freed with SDL_free(), or NIL on error.

\since This function is available since SDL 2.0.0.

SDL_iconv_utf8_locale sdl2

These are macros in the original C headers, we will reimplement them as simple Pascal functions.

SDL_iconv_utf8_ucs2 sdl2

 

SDL_iconv_utf8_ucs4 sdl2

 

SDL_imageFilterAbsDiff sdl2_gfx

SDL_imageFilterAbsDiff: D = | S1 - S2 |

SDL_imageFilterAdd sdl2_gfx

SDL_imageFilterAdd: D = saturation255(S1 + S2)

SDL_imageFilterAddByte sdl2_gfx

SDL_imageFilterAddByte: D = saturation255(S + C)

SDL_imageFilterAddByteToHalf sdl2_gfx

SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)

SDL_imageFilterAddUsInt32 sdl2_gfx

SDL_imageFilterAddUsInt32: D = saturation255(S + (usInt32)C)

SDL_imageFilterBinarizeUsingThreshold sdl2_gfx

SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0

SDL_imageFilterBitAnd sdl2_gfx

SDL_imageFilterBitAnd: D = S1 & S2

SDL_imageFilterBitNegation sdl2_gfx

SDL_imageFilterBitNegation: D = !S

SDL_imageFilterBitOr sdl2_gfx

SDL_imageFilterBitOr: D = S1 | S2

SDL_imageFilterClipToRange sdl2_gfx

SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0

SDL_imageFilterDiv sdl2_gfx

SDL_imageFilterDiv: D = S1 / S2 (non-MMX)

SDL_imageFilterMean sdl2_gfx

SDL_imageFilterMean: D = S1/2 + S2/2

SDL_imageFilterMMXdetect sdl2_gfx

Detect MMX capability in CPU

SDL_imageFilterMMXoff sdl2_gfx

Force use of MMX off (or turn possible use back on)

SDL_imageFilterMMXon sdl2_gfx

 

SDL_imageFilterMult sdl2_gfx

SDL_imageFilterMult: D = saturation(S1 * S2)

SDL_imageFilterMultByByte sdl2_gfx

SDL_imageFilterMultByByte: D = saturation255(S * C)

SDL_imageFilterMultDivby2 sdl2_gfx

SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)

SDL_imageFilterMultDivby4 sdl2_gfx

SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)

SDL_imageFilterMultNor sdl2_gfx

SDL_imageFilterMultNor: D = S1 * S2 (non-MMX)

SDL_imageFilterNormalizeLinear sdl2_gfx

SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)

SDL_imageFilterShiftLeft sdl2_gfx

SDL_imageFilterShiftLeft: D = saturation255(S << N)

SDL_imageFilterShiftLeftByte sdl2_gfx

SDL_imageFilterShiftLeftByte: D = (S << N)

SDL_imageFilterShiftLeftUsInt32 sdl2_gfx

SDL_imageFilterShiftLeftUsInt32: D = ((usInt32)S << N)

SDL_imageFilterShiftRight sdl2_gfx

SDL_imageFilterShiftRight: D = saturation0(S >> N)

SDL_imageFilterShiftRightAndMultByByte sdl2_gfx

SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)

SDL_imageFilterShiftRightUsInt32 sdl2_gfx

SDL_imageFilterShiftRightUsInt32: D = saturation0((usInt32)S >> N)

SDL_imageFilterSub sdl2_gfx

SDL_imageFilterSub: D = saturation0(S1 - S2)

SDL_imageFilterSubByte sdl2_gfx

SDL_imageFilterSubByte: D = saturation0(S - C)

SDL_imageFilterSubUsInt32 sdl2_gfx

SDL_imageFilterSubUsInt32: D = saturation0(S - (usInt32)C)

SDL_IMAGE_VERSION sdl2_image

This macro can be used to fill a version structure with the compile-time version of the SDL_image library.

SDL_Init sdl2

This function initializes the subsystems specified by flags Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup signal handlers for some commonly ignored fatal signals (like SIGSEGV).

SDL_initFramerate sdl2_gfx

 

SDL_InitSubSystem sdl2

This function initializes specific SDL subsystems

SDL_IntersectFRect sdl2

Calculate the intersection of two rectangles with float precision.

If `result` is NIL then this function will return SDL_FALSE.

\param A an SDL_FRect structure representing the first rectangle \param B an SDL_FRect structure representing the second rectangle \param result an SDL_FRect structure filled in with the intersection of rectangles `A` and `B` \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.

\since This function is available since SDL 2.0.22.

\sa SDL_HasIntersectionF

SDL_IntersectFRectAndLine sdl2

Calculate the intersection of a rectangle and line segment with float precision.

This function is used to clip a line segment to a rectangle. A line segment contained entirely within the rectangle or that does not intersect will remain unchanged. A line segment that crosses the rectangle at either or both ends will be clipped to the boundary of the rectangle and the new coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.

\param rect an SDL_FRect structure representing the rectangle to intersect \param X1 a pointer to the starting X-coordinate of the line \param Y1 a pointer to the starting Y-coordinate of the line \param X2 a pointer to the ending X-coordinate of the line \param Y2 a pointer to the ending Y-coordinate of the line \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.

\since This function is available since SDL 2.0.22.

SDL_IntersectRect sdl2

Calculate the intersection of two rectangles.

SDL_TRUE if there is an intersection, SDL_FALSE otherwise.

SDL_IntersectRectAndLine sdl2

Calculate the intersection of a rectangle and line segment.

SDL_TRUE if there is an intersection, SDL_FALSE otherwise.

SDL_isalnum sdl2

Check if the provided ASCII character is an alphanumeric character.

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.16.

SDL_isalpha sdl2

Check if the provided ASCII character is an alphabetic character (a letter).

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.16.

SDL_isblank sdl2

Check if the provided ASCII character is a blank character (a space or a tab).

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.16.

SDL_iscntrl sdl2

Check if the provided ASCII character is a control character.

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.16.

SDL_isdigit sdl2

Check if the provided ASCII character is a decimal digit.

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.4.

SDL_IsGameController sdl2

Is the joystick on this index supported by the game controller interface?

SDL_isgraph sdl2

Check if the provided ASCII character is a printable character (excluding space).

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.16.

SDL_islower sdl2

Check if the provided ASCII character is a lowercase letter.

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.12.

SDL_ISPIXELFORMAT_FOURCC sdl2

The flag is set to 1 because 0x1? is not in the printable ASCII range *

SDL_isprint sdl2

Check if the provided ASCII character is a printable character (including space).

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.16.

SDL_ispunct sdl2

Check if the provided ASCII character is any printable character which is not a space or an alphanumeric character.

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.16.

SDL_IsScreenKeyboardShown sdl2

Check whether the screen keyboard is shown for given window.

\param window the window for which screen keyboard should be queried \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not.

\since This function is available since SDL 2.0.0.

\sa SDL_HasScreenKeyboardSupport

SDL_IsScreenSaverEnabled sdl2

Returns whether the screensaver is currently enabled (default on).

SDL_EnableScreenSaver() SDL_DisableScreenSaver()

SDL_IsShapedWindow sdl2

Return whether the given window is a shaped window.

\param window The window to query for being shaped. \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NIL.

\since This function is available since SDL 2.0.0.

\sa SDL_CreateShapedWindow

SDL_isspace sdl2

Check if the provided ASCII character is a whitespace character. This set includes the following characters: space, form feed (FF), newline/line feed (LF), carriage return (CR), horizontal tab (HT), vertical tab (VT).

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.4.

SDL_IsTablet sdl2

Query if the current device is a tablet.

If SDL can't determine this, it will return SDL_FALSE.

\returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise.

\since This function is available since SDL 2.0.9.

SDL_IsTextInputActive sdl2

Check whether or not Unicode text input events are enabled.

\returns SDL_TRUE if text input events are enabled else SDL_FALSE.

\since This function is available since SDL 2.0.0.

\sa SDL_StartTextInput

SDL_IsTextInputShown sdl2

Returns if an IME Composite or Candidate window is currently shown.

\since This function is available since SDL 2.0.22.

SDL_isupper sdl2

Check if the provided ASCII character is an uppercase letter.

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.12.

SDL_isxdigit sdl2

Check if the provided ASCII character is a hexadecimal digit.

\returns 1 if the check passes, 0 otherwise.

\since This function is available since SDL 2.0.16.

SDL_JoystickAttachVirtual sdl2

Attach a new virtual joystick.

\returns the joystick's device index, or -1 if an error occurred.

\since This function is available since SDL 2.0.14.

SDL_JoystickAttachVirtualEx sdl2

/** Attach a new virtual joystick with extended properties.

\returns the joystick's device index, or -1 if an error occurred.

\since This function is available since SDL 2.24.0. /

SDL_JoystickClose sdl2

Close a joystick previously opened with SDL_JoystickOpen().

\param joystick The joystick device to close

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickOpen

SDL_JoystickCurrentPowerLevel sdl2

Get the battery level of a joystick as SDL_JoystickPowerLevel.

\param joystick the SDL_Joystick to query \returns the current battery level as SDL_JoystickPowerLevel on success or `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown

\since This function is available since SDL 2.0.4.

SDL_JoystickDetachVirtual sdl2

Detach a virtual joystick.

\param device_index a value previously returned from SDL_JoystickAttachVirtual() \returns 0 on success, or -1 if an error occurred.

\since This function is available since SDL 2.0.14.

SDL_JoystickEventState sdl2

Enable/disable joystick event polling.

If joystick events are disabled, you must call SDL_JoystickUpdate() yourself and manually check the state of the joystick when you want joystick information.

It is recommended that you leave joystick event handling enabled.

**WARNING**: Calling this function may delete all events currently in SDL's event queue.

\param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE` \returns 1 if enabled, 0 if disabled, or a negative error code on failure; call SDL_GetError() for more information.

If `state` is `SDL_QUERY` then the current state is returned, otherwise the new processing state is returned.

\since This function is available since SDL 2.0.0.

\sa SDL_GameControllerEventState

SDL_JoystickFromInstanceID sdl2

Get the SDL_Joystick associated with an instance id.

\param instance_id the instance id to get the SDL_Joystick for \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.4.

SDL_JoystickFromPlayerIndex sdl2

Get the SDL_Joystick associated with a player index.

\param player_index the player index to get the SDL_Joystick for \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.12.

SDL_JoystickGetAttached sdl2

Get the status of a specified joystick.

\param joystick the joystick to query \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickClose \sa SDL_JoystickOpen

SDL_JoystickGetAxis sdl2

Get the current state of an axis control on a joystick.

SDL makes no promises about what part of the joystick any given axis refers to. Your game should have some sort of configuration UI to let users specify what each axis should be bound to. Alternately, SDL's higher-level Game Controller API makes a great effort to apply order to this lower-level interface, so you know that a specific axis is the "left thumb stick," etc.

The value returned by SDL_JoystickGetAxis() is a signed integer (-32768 to 32767) representing the current position of the axis. It may be necessary to impose certain tolerances on these values to account for jitter.

\param joystick an SDL_Joystick structure containing joystick information \param axis the axis to query; the axis indices start at index 0 \returns a 16-bit signed integer representing the current position of the axis or 0 on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickNumAxes

SDL_JoystickGetAxisInitialState sdl2

Get the initial state of an axis control on a joystick.

The state is a value ranging from -32768 to 32767.

The axis indices start at index 0.

\param joystick an SDL_Joystick structure containing joystick information \param axis the axis to query; the axis indices start at index 0 \param state Upon return, the initial value is supplied here. \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.

\since This function is available since SDL 2.0.6.

SDL_JoystickGetBall sdl2

Get the ball axis change since the last poll.

Trackballs can only return relative motion since the last call to SDL_JoystickGetBall(), these motion deltas are placed into `dx` and `dy`.

Most joysticks do not have trackballs.

\param joystick the SDL_Joystick to query \param ball the ball index to query; ball indices start at index 0 \param dx stores the difference in the x axis position since the last poll \param dy stores the difference in the y axis position since the last poll \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickNumBalls

SDL_JoystickGetButton sdl2

Get the current state of a button on a joystick.

\param joystick an SDL_Joystick structure containing joystick information \param button the button index to get the state from; indices start at index 0 \returns 1 if the specified button is pressed, 0 otherwise.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickNumButtons

SDL_JoystickGetDeviceGUID sdl2

Return the GUID for the joystick at this index This can be called before any joysticks are opened.

SDL_JoystickGetDeviceInstanceID sdl2

Get the instance ID of a joystick.

This can be called before any joysticks are opened. If the index is out of range, this function will return -1.

\param device_index the index of the joystick to query (the N'th joystick on the system \returns the instance id of the selected joystick. If called on an invalid index, this function returns zero

\since This function is available since SDL 2.0.6.

SDL_JoystickGetDevicePlayerIndex sdl2

Get the player index of a joystick, or -1 if it's not available This can be called before any joysticks are opened.

\since This function is available since SDL 2.0.9.

SDL_JoystickGetDeviceProduct sdl2

Get the USB product ID of a joystick, if available.

This can be called before any joysticks are opened. If the product ID isn't available this function returns 0.

\param device_index the index of the joystick to query (the N'th joystick on the system \returns the USB product ID of the selected joystick. If called on an invalid index, this function returns zero

\since This function is available since SDL 2.0.6.

SDL_JoystickGetDeviceProductVersion sdl2

Get the product version of a joystick, if available.

This can be called before any joysticks are opened. If the product version isn't available this function returns 0.

\param device_index the index of the joystick to query (the N'th joystick on the system \returns the product version of the selected joystick. If called on an invalid index, this function returns zero

\since This function is available since SDL 2.0.6.

SDL_JoystickGetDeviceType sdl2

Get the type of a joystick, if available.

This can be called before any joysticks are opened.

\param device_index the index of the joystick to query (the N'th joystick on the system \returns the SDL_JoystickType of the selected joystick. If called on an invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN`

\since This function is available since SDL 2.0.6.

SDL_JoystickGetDeviceVendor sdl2

Get the USB vendor ID of a joystick, if available.

This can be called before any joysticks are opened. If the vendor ID isn't available this function returns 0.

\param device_index the index of the joystick to query (the N'th joystick on the system \returns the USB vendor ID of the selected joystick. If called on an invalid index, this function returns zero

\since This function is available since SDL 2.0.6.

SDL_JoystickGetFirmwareVersion sdl2

Get the firmware version of an opened joystick, if available.

If the firmware version isn't available this function returns 0.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the firmware version of the selected joystick, or 0 if unavailable.

\since This function is available since SDL 2.24.0.

SDL_JoystickGetGUID sdl2

Get the implementation-dependent GUID for the joystick.

This function requires an open joystick.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the GUID of the given joystick. If called on an invalid index, this function returns a zero GUID; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickGetDeviceGUID \sa SDL_JoystickGetGUIDString

SDL_JoystickGetGUIDFromString sdl2

Convert a GUID string into a SDL_JoystickGUID structure.

Performs no error checking. If this function is given a string containing an invalid GUID, the function will silently succeed, but the GUID generated will not be useful.

\param pchGUID string containing an ASCII representation of a GUID \returns a SDL_JoystickGUID structure.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickGetGUIDString

SDL_JoystickGetGUIDString sdl2

Get an ASCII string representation for a given SDL_JoystickGUID.

You should supply at least 33 bytes for pszGUID.

\param guid the SDL_JoystickGUID you wish to convert to string \param pszGUID buffer in which to write the ASCII string \param cbGUID the size of pszGUID

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickGetDeviceGUID \sa SDL_JoystickGetGUID \sa SDL_JoystickGetGUIDFromString

SDL_JoystickGetHat sdl2

Get the current state of a POV hat on a joystick.

The returned value will be one of the following positions:

- `SDL_HAT_CENTERED` - `SDL_HAT_UP` - `SDL_HAT_RIGHT` - `SDL_HAT_DOWN` - `SDL_HAT_LEFT` - `SDL_HAT_RIGHTUP` - `SDL_HAT_RIGHTDOWN` - `SDL_HAT_LEFTUP` - `SDL_HAT_LEFTDOWN`

\param joystick an SDL_Joystick structure containing joystick information \param hat the hat index to get the state from; indices start at index 0 \returns the current hat position.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickNumHats

SDL_JoystickGetPlayerIndex sdl2

Get the player index of an opened joystick.

For XInput controllers this returns the XInput user index. Many joysticks will not be able to supply this information.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the player index, or -1 if it's not available.

\since This function is available since SDL 2.0.9.

SDL_JoystickGetProduct sdl2

Get the USB product ID of an opened joystick, if available.

If the product ID isn't available this function returns 0.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the USB product ID of the selected joystick, or 0 if unavailable.

\since This function is available since SDL 2.0.6.

SDL_JoystickGetProductVersion sdl2

Get the product version of an opened joystick, if available.

If the product version isn't available this function returns 0.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the product version of the selected joystick, or 0 if unavailable.

\since This function is available since SDL 2.0.6.

SDL_JoystickGetSerial sdl2

Get the serial number of an opened joystick, if available.

Returns the serial number of the joystick, or NULL if it is not available.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the serial number of the selected joystick, or NULL if unavailable.

\since This function is available since SDL 2.0.14.

SDL_JoystickGetType sdl2

Get the type of an opened joystick.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the SDL_JoystickType of the selected joystick.

\since This function is available since SDL 2.0.6.

SDL_JoystickGetVendor sdl2

Get the USB vendor ID of an opened joystick, if available.

If the vendor ID isn't available this function returns 0.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the USB vendor ID of the selected joystick, or 0 if unavailable.

\since This function is available since SDL 2.0.6.

SDL_JoystickHasLED sdl2

Query whether a joystick has an LED.

An example of a joystick LED is the light on the back of a PlayStation 4's DualShock 4 controller.

\param joystick The joystick to query \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise.

\since This function is available since SDL 2.0.14.

SDL_JoystickHasRumble sdl2

Query whether a joystick has rumble support.

\param joystick The joystick to query \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise.

\since This function is available since SDL 2.0.18.

\sa SDL_JoystickRumble

SDL_JoystickHasRumbleTriggers sdl2

Query whether a joystick has rumble support on triggers.

\param joystick The joystick to query \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise.

\since This function is available since SDL 2.0.18.

\sa SDL_JoystickRumbleTriggers

SDL_JoystickInstanceID sdl2

Get the instance ID of an opened joystick.

\param joystick an SDL_Joystick structure containing joystick information \returns the instance ID of the specified joystick on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickOpen

SDL_JoystickIsHaptic sdl2

Query if a joystick has haptic features.

\param joystick the SDL_Joystick to test for haptic capabilities \returns SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't, or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticOpenFromJoystick

SDL_JoystickIsVirtual sdl2

Query whether or not the joystick at a given device index is virtual.

\param device_index a joystick device index. \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise.

\since This function is available since SDL 2.0.14.

SDL_JoystickName sdl2

Get the implementation dependent name of a joystick.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the name of the selected joystick. If no name can be found, this function returns NULL; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickNameForIndex \sa SDL_JoystickOpen

SDL_JoystickNameForIndex sdl2

Get the implementation dependent name of a joystick.

This can be called before any joysticks are opened.

\param device_index the index of the joystick to query (the N'th joystick on the system) \returns the name of the selected joystick. If no name can be found, this function returns NULL; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickName \sa SDL_JoystickOpen

SDL_JoystickNumAxes sdl2

Get the number of general axis controls on a joystick.

Often, the directional pad on a game controller will either look like 4 separate buttons or a POV hat, and not axes, but all of this is up to the device and platform.

\param joystick an SDL_Joystick structure containing joystick information \returns the number of axis controls/number of axes on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickGetAxis \sa SDL_JoystickOpen

SDL_JoystickNumBalls sdl2

Get the number of trackballs on a joystick.

Joystick trackballs have only relative motion events associated with them and their state cannot be polled.

Most joysticks do not have trackballs.

\param joystick an SDL_Joystick structure containing joystick information \returns the number of trackballs on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickGetBall

SDL_JoystickNumButtons sdl2

Get the number of buttons on a joystick.

\param joystick an SDL_Joystick structure containing joystick information \returns the number of buttons on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickGetButton \sa SDL_JoystickOpen

SDL_JoystickNumHats sdl2

Get the number of POV hats on a joystick.

\param joystick an SDL_Joystick structure containing joystick information \returns the number of POV hats on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickGetHat \sa SDL_JoystickOpen

SDL_JoystickOpen sdl2

Open a joystick for use.

The `device_index` argument refers to the N'th joystick presently recognized by SDL on the system. It is **NOT** the same as the instance ID used to identify the joystick in future events. See SDL_JoystickInstanceID() for more details about instance IDs.

The joystick subsystem must be initialized before a joystick can be opened for use.

\param device_index the index of the joystick to query \returns a joystick identifier or NULL if an error occurred; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickClose \sa SDL_JoystickInstanceID

SDL_JoystickPath sdl2

Get the implementation dependent path of a joystick.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the path of the selected joystick. If no path can be found, this function returns NULL; call SDL_GetError() for more information.

\since This function is available since SDL 2.24.0.

\sa SDL_JoystickPathForIndex

SDL_JoystickPathForIndex sdl2

Get the implementation dependent path of a joystick.

This can be called before any joysticks are opened.

\param device_index the index of the joystick to query (the N'th joystick on the system) \returns the path of the selected joystick. If no path can be found, this function returns NULL; call SDL_GetError() for more information.

\since This function is available since SDL 2.24.0.

\sa SDL_JoystickPath \sa SDL_JoystickOpen

SDL_JoystickRumble sdl2

Start a rumble effect.

Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.

\param joystick The joystick to vibrate \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF \param duration_ms The duration of the rumble effect, in milliseconds \returns 0, or -1 if rumble isn't supported on this joystick

\since This function is available since SDL 2.0.9.

\sa SDL_JoystickHasRumble

SDL_JoystickRumbleTriggers sdl2

Start a rumble effect in the joystick's triggers

Each call to this function cancels any previous trigger rumble effect, and calling it with 0 intensity stops any rumbling.

Note that this is rumbling of the _triggers_ and not the game controller as a whole. This is currently only supported on Xbox One controllers. If you want the (more common) whole-controller rumble, use SDL_JoystickRumble() instead.

\param joystick The joystick to vibrate \param left_rumble The intensity of the left trigger rumble motor, from 0 to 0xFFFF \param right_rumble The intensity of the right trigger rumble motor, from 0 to 0xFFFF \param duration_ms The duration of the rumble effect, in milliseconds \returns 0, or -1 if trigger rumble isn't supported on this joystick

\since This function is available since SDL 2.0.14.

\sa SDL_JoystickHasRumbleTriggers

SDL_JoystickSendEffect sdl2

Send a joystick specific effect packet

\param joystick The joystick to affect \param data The data to send to the joystick \param size The size of the data to send to the joystick \returns 0, or -1 if this joystick or driver doesn't support effect packets

\since This function is available since SDL 2.0.16.

SDL_JoystickSetLED sdl2

Update a joystick's LED color.

An example of a joystick LED is the light on the back of a PlayStation 4's DualShock 4 controller.

\param joystick The joystick to update \param red The intensity of the red LED \param green The intensity of the green LED \param blue The intensity of the blue LED \returns 0 on success, -1 if this joystick does not have a modifiable LED

\since This function is available since SDL 2.0.14.

SDL_JoystickSetPlayerIndex sdl2

Set the player index of an opened joystick.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \param player_index Player index to assign to this joystick, or -1 to clear the player index and turn off player LEDs.

\since This function is available since SDL 2.0.12.

SDL_JoystickSetVirtualAxis sdl2

Set values on an opened, virtual-joystick's axis.

Please note that values set here will not be applied until the next call to SDL_JoystickUpdate, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.

Note that when sending trigger axes, you should scale the value to the full range of Sint16. For example, a trigger at rest would have the value of `SDL_JOYSTICK_AXIS_MIN`.

\param joystick the virtual joystick on which to set state. \param axis the specific axis on the virtual joystick to set. \param value the new value for the specified axis. \returns 0 on success, -1 on error.

\since This function is available since SDL 2.0.14.

SDL_JoystickSetVirtualButton sdl2

Set values on an opened, virtual-joystick's button.

Please note that values set here will not be applied until the next call to SDL_JoystickUpdate, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.

\param joystick the virtual joystick on which to set state. \param button the specific button on the virtual joystick to set. \param value the new value for the specified button. \returns 0 on success, -1 on error.

\since This function is available since SDL 2.0.14.

SDL_JoystickSetVirtualHat sdl2

Set values on an opened, virtual-joystick's hat.

Please note that values set here will not be applied until the next call to SDL_JoystickUpdate, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.

\param joystick the virtual joystick on which to set state. \param hat the specific hat on the virtual joystick to set. \param value the new value for the specified hat. \returns 0 on success, -1 on error.

\since This function is available since SDL 2.0.14.

SDL_JoystickUpdate sdl2

Update the current state of the open joysticks.

This is called automatically by the event loop if any joystick events are enabled.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickEventState

SDL_LoadBMP sdl2

Load a surface from a file.

Convenience macro.

SDL_LoadBMP_RW sdl2

Load a surface from a seekable SDL data stream (memory or file).

If freesrc is non-zero, the stream will be closed after being read.

The new surface should be freed with SDL_FreeSurface().

the new surface, or NULL if there was an error.

SDL_LoadDollarTemplates sdl2

Load Dollar Gesture templates from a file.

\param touchId a touch id \param src a SDL_RWops to load from \returns the number of loaded templates on success or a negative error code (or 0) on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_SaveAllDollarTemplates \sa SDL_SaveDollarTemplate

SDL_LoadFile sdl2

Load an entire file.

The data is allocated with a zero byte at the end (null terminated)

If \c datasize is not NULL, it is filled with the size of the data read.

If \c freesrc is non-zero, the stream will be closed after being read.

The data should be freed with SDL_free().

\return the data, or NULL if there was an error.

SDL_LoadFile_RW sdl2

Load all the data from an SDL data stream.

The data is allocated with a zero byte at the end (null terminated)

If \c datasize is not NULL, it is filled with the size of the data read.

If \c freesrc is non-zero, the stream will be closed after being read.

The data should be freed with SDL_free().

\return the data, or NULL if there was an error.

SDL_LoadFunction sdl2

Look up the address of the named function in a shared object.

This function pointer is no longer valid after calling SDL_UnloadObject().

This function can only look up C function names. Other languages may have name mangling and intrinsic language support that varies from compiler to compiler.

Make sure you declare your function pointers with the same calling convention as the actual library function. Your code will crash mysteriously if you do not do this.

If the requested function doesn't exist, nil is returned.

\param handle a valid shared object handle returned by SDL_LoadObject() \param name the name of the function to look up \returns a pointer to the function or nil if there was an error; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_LoadObject \sa SDL_UnloadObject

SDL_LoadObject sdl2

Dynamically load a shared object.

\param sofile a system-dependent name of the object file \returns an opaque pointer to the object handle or nil if there was an error; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_LoadFunction \sa SDL_UnloadObject

SDL_LoadWAV sdl2

Loads a WAV from a file. Compatibility convenience function.

SDL_LoadWAV_RW sdl2

Load the audio data of a WAVE file into memory.

Loading a WAVE file requires `src`, `spec`, `audio_buf` and `audio_len` to be valid pointers. The entire data portion of the file is then loaded into memory and decoded if necessary.

If `freesrc` is non-zero, the data source gets automatically closed and freed before the function returns.

Supported formats are RIFF WAVE files with the formats PCM (8, 16, 24, and 32 bits), IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and A-law and mu-law (8 bits). Other formats are currently unsupported and cause an error.

If this function succeeds, the pointer returned by it is equal to `spec` and the pointer to the audio data allocated by the function is written to `audio_buf` and its length in bytes to `audio_len`. The SDL_AudioSpec members `freq`, `channels`, and `format` are set to the values of the audio data in the buffer. The `samples` member is set to a sane default and all others are set to zero.

It's necessary to use SDL_FreeWAV() to free the audio data returned in `audio_buf` when it is no longer used.

Because of the underspecification of the .WAV format, there are many problematic files in the wild that cause issues with strict decoders. To provide compatibility with these files, this decoder is lenient in regards to the truncation of the file, the fact chunk, and the size of the RIFF chunk. The hints `SDL_HINT_WAVE_RIFF_CHUNK_SIZE`, `SDL_HINT_WAVE_TRUNCATION`, and `SDL_HINT_WAVE_FACT_CHUNK` can be used to tune the behavior of the loading process.

Any file that is invalid (due to truncation, corruption, or wrong values in the headers), too big, or unsupported causes an error. Additionally, any critical I/O error from the data source will terminate the loading process with an error. The function returns NULL on error and in all cases (with the exception of `src` being NULL), an appropriate error message will be set.

It is required that the data source supports seeking.

Example:

```c SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, &spec, &buf, &len); ```

Note that the SDL_LoadWAV macro does this same thing for you, but in a less messy way:

```c SDL_LoadWAV("sample.wav", &spec, &buf, &len); ```

\param src The data source for the WAVE data \param freesrc If non-zero, SDL will _always_ free the data source \param spec An SDL_AudioSpec that will be filled in with the wave file's format details \param audio_buf A pointer filled with the audio data, allocated by the function. \param audio_len A pointer filled with the length of the audio data buffer in bytes \returns This function, if successfully called, returns `spec`, which will be filled with the audio data format of the wave source data. `audio_buf` will be filled with a pointer to an allocated buffer containing the audio data, and `audio_len` is filled with the length of that audio buffer in bytes.

This function returns NULL if the .WAV file cannot be opened, uses an unknown data format, or is corrupt; call SDL_GetError() for more information.

When the application is done with the data returned in `audio_buf`, it should call SDL_FreeWAV() to dispose of it.

\since This function is available since SDL 2.0.0.

\sa SDL_FreeWAV \sa SDL_LoadWAV

SDL_LockAudio sdl2

This function is a legacy means of locking the audio device.

New programs might want to use SDL_LockAudioDevice() instead. This function is equivalent to calling...

```c SDL_LockAudioDevice(1); ```

...and is only useful if you used the legacy SDL_OpenAudio() function.

\since This function is available since SDL 2.0.0.

\sa SDL_LockAudioDevice \sa SDL_UnlockAudio \sa SDL_UnlockAudioDevice

SDL_LockAudioDevice sdl2

Use this function to lock out the audio callback function for a specified device.

The lock manipulated by these functions protects the audio callback function specified in SDL_OpenAudioDevice(). During a SDL_LockAudioDevice()/SDL_UnlockAudioDevice() pair, you can be guaranteed that the callback function for that device is not running, even if the device is not paused. While a device is locked, any other unpaused, unlocked devices may still run their callbacks.

Calling this function from inside your audio callback is unnecessary. SDL obtains this lock before calling your function, and releases it when the function returns.

You should not hold the lock longer than absolutely necessary. If you hold it too long, you'll experience dropouts in your audio playback. Ideally, your application locks the device, sets a few variables and unlocks again. Do not do heavy work while holding the lock for a device.

It is safe to lock the audio device multiple times, as long as you unlock it an equivalent number of times. The callback will not run until the device has been unlocked completely in this way. If your application fails to unlock the device appropriately, your callback will never run, you might hear repeating bursts of audio, and SDL_CloseAudioDevice() will probably deadlock.

Internally, the audio device lock is a mutex; if you lock from two threads at once, not only will you block the audio callback, you'll block the other thread.

\param dev the ID of the device to be locked

\since This function is available since SDL 2.0.0.

\sa SDL_UnlockAudioDevice

SDL_LockJoysticks sdl2

Locking for multi-threaded access to the joystick API

If you are using the joystick API or handling events from multiple threads you should use these locking functions to protect access to the joysticks.

In particular, you are guaranteed that the joystick list won't change, so the API functions that take a joystick index will be valid, and joystick and game controller events will not be delivered.

As of SDL 2.26.0, you can take the joystick lock around reinitializing the joystick subsystem, to prevent other threads from seeing joysticks in an uninitialized state. However, all open joysticks will be closed and SDL functions called with them will fail.

\since This function is available since SDL 2.0.7.

SDL_LockMutex sdl2

Lock the mutex.

This will block until the mutex is available, which is to say it is in the unlocked state and the OS has chosen the caller as the next thread to lock it. Of all threads waiting to lock the mutex, only one may do so at a time.

It is legal for the owning thread to lock an already-locked mutex. It must unlock it the same number of times before it is actually made available for other threads in the system (this is known as a "recursive mutex").

\param mutex the mutex to lock \return 0, or -1 on error.

\since This function is available since SDL 2.0.0.

SDL_LockSensors sdl2

Locking for multi-threaded access to the sensor API

If you are using the sensor API or handling events from multiple threads you should use these locking functions to protect access to the sensors.

In particular, you are guaranteed that the sensor list won't change, so the API functions that take a sensor index will be valid, and sensor events will not be delivered.

\since This function is available since SDL 2.0.14.

SDL_LockSurface sdl2

Sets up a surface for directly accessing the pixels.

Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write to and read from surface.pixels, using the pixel format stored in surface.format. Once you are done accessing the surface, you should use SDL_UnlockSurface() to release it.

Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates to 0, then you can read and write to the surface at any time, and the pixel format of the surface will not change.

No operating system or library calls should be made between lock/unlock pairs, as critical system locks may be held during this time.

SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.

SDL_UnlockSurface()

SDL_LockTexture sdl2

Lock a portion of the texture for write-only pixel access.

texture The texture to lock for access, which was created with SDL_TEXTUREACCESS_STREAMING. rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked. pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area. pitch This is filled in with the pitch of the locked pixels.

0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.

SDL_UnlockTexture()

SDL_LockTextureToSurface sdl2

\brief Lock a portion of the texture for write-only pixel access. Expose it as a SDL surface.

\param texture The texture to lock for access, which was created with ::SDL_TEXTUREACCESS_STREAMING. \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked. \param surface This is filled in with a SDL surface representing the locked area Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture.

\return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.

\sa SDL_UnlockTexture()

SDL_Log sdl2

\brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO

SDL_log10 sdl2

Calculate the base 10 logarithm of x.

\since This function is available since SDL 2.0.8.

SDL_log10f sdl2

Calculate the base 10 logarithm of x.

\since This function is available since SDL 2.0.8.

SDL_LogCritical sdl2

\brief Log a message with SDL_LOG_PRIORITY_CRITICAL

SDL_LogDebug sdl2

\brief Log a message with SDL_LOG_PRIORITY_DEBUG

SDL_LogError sdl2

\brief Log a message with SDL_LOG_PRIORITY_ERROR

SDL_LogGetOutputFunction sdl2

\brief Get the current log output function.

SDL_LogGetPriority sdl2

\brief Get the priority of a particular log category

SDL_LogInfo sdl2

\brief Log a message with SDL_LOG_PRIORITY_INFO

SDL_LogMessage sdl2

\brief Log a message with the specified category and priority.

SDL_LogMessageV sdl2

\brief Log a message with the specified category and priority.

SDL_LogResetPriorities sdl2

\brief Reset all priorities to default.

\note This is called in SDL_Quit().

SDL_LogSetAllPriority sdl2

\brief Set the priority of all log categories

SDL_LogSetOutputFunction sdl2

\brief This function allows you to replace the default log output function with one of your own.

SDL_LogSetPriority sdl2

\brief Set the priority of a particular log category

SDL_LogVerbose sdl2

\brief Log a message with SDL_LOG_PRIORITY_VERBOSE

SDL_LogWarn sdl2

\brief Log a message with SDL_LOG_PRIORITY_WARN

SDL_LowerBlit sdl2

This is a semi-private blit function and it performs low-level surface blitting only.

SDL_LowerBlitScaled sdl2

This is a semi-private blit function and it performs low-level surface scaled blitting only.

SDL_lround sdl2

Round to nearest integer, away from zero.

\since This function is available since SDL 2.0.16.

SDL_lroundf sdl2

Round to nearest integer, away from zero.

\since This function is available since SDL 2.0.16.

SDL_malloc sdl2

Allocate a block of memory. The memory is *not* initialized.

SDL_MapRGB sdl2

Map an RGB triple to an opaque pixel value for a given pixel format.

This function maps the RGB color value to the specified pixel format and returns the pixel value best approximating the given RGB color value for the given pixel format.

If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.

If the specified pixel format has an alpha component it will be returned as all 1 bits (fully opaque).

If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).

\param format an SDL_PixelFormat structure describing the pixel format \param r the red component of the pixel in the range 0-255 \param g the green component of the pixel in the range 0-255 \param b the blue component of the pixel in the range 0-255 \returns a pixel value

\since This function is available since SDL 2.0.0.

\sa SDL_GetRGB \sa SDL_GetRGBA \sa SDL_MapRGBA

SDL_MapRGBA sdl2

Map an RGBA quadruple to a pixel value for a given pixel format.

This function maps the RGBA color value to the specified pixel format and returns the pixel value best approximating the given RGBA color value for the given pixel format.

If the specified pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette).

If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.

If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).

\param format an SDL_PixelFormat structure describing the format of the pixel \param r the red component of the pixel in the range 0-255 \param g the green component of the pixel in the range 0-255 \param b the blue component of the pixel in the range 0-255 \param a the alpha component of the pixel in the range 0-255 \returns a pixel value

\since This function is available since SDL 2.0.0.

\sa SDL_GetRGB \sa SDL_GetRGBA \sa SDL_MapRGB

SDL_MasksToPixelFormatEnum sdl2

Convert a bpp value and RGBA masks to an enumerated pixel format.

This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't possible.

\param bpp a bits per pixel value; usually 15, 16, or 32 \param Rmask the red mask for the format \param Gmask the green mask for the format \param Bmask the blue mask for the format \param Amask the alpha mask for the format \returns one of the SDL_PixelFormatEnum values

\since This function is available since SDL 2.0.0.

\sa SDL_PixelFormatEnumToMasks

SDL_MaximizeWindow sdl2

Make a window as large as possible.

SDL_RestoreWindow()

SDL_MinimizeWindow sdl2

Minimize a window to an iconic representation.

SDL_RestoreWindow()

SDL_MixAudio sdl2

This function is a legacy means of mixing audio.

This function is equivalent to calling...

```c SDL_MixAudioFormat(dst, src, format, len, volume); ```

...where `format` is the obtained format of the audio device from the legacy SDL_OpenAudio() function.

\param dst the destination for the mixed audio \param src the source audio buffer to be mixed \param len the length of the audio buffer in bytes \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME for full audio volume

\since This function is available since SDL 2.0.0.

\sa SDL_MixAudioFormat

SDL_MixAudioFormat sdl2

Mix audio data in a specified format.

This takes an audio buffer `src` of `len` bytes of `format` data and mixes it into `dst`, performing addition, volume adjustment, and overflow clipping. The buffer pointed to by `dst` must also be `len` bytes of `format` data.

This is provided for convenience – you can mix your own audio data.

Do not use this function for mixing together more than two streams of sample data. The output from repeated application of this function may be distorted by clipping, because there is no accumulator with greater range than the input (not to mention this being an inefficient way of doing it).

It is a common misconception that this function is required to write audio data to an output stream in an audio callback. While you can do that, SDL_MixAudioFormat() is really only needed when you're mixing a single audio stream with a volume adjustment.

\param dst the destination for the mixed audio \param src the source audio buffer to be mixed \param format the SDL_AudioFormat structure representing the desired audio format \param len the length of the audio buffer in bytes \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME for full audio volume

\since This function is available since SDL 2.0.0.

SDL_MIXER_VERSION sdl2_mixer

This macro can be used to fill a version structure with the compile-time version of the SDL_mixer library.

SDL_MouseIsHaptic sdl2

Query whether or not the current mouse has haptic capabilities.

\returns SDL_TRUE if the mouse is haptic or SDL_FALSE if it isn't.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticOpenFromMouse

SDL_MUSTLOCK sdl2

Evaluates to true if the surface needs to be locked before access.

SDL_NET_VERSION sdl2_net

This macro can be used to fill a version structure with the compile-time version of the SDL_net library.

SDL_NewAudioStream sdl2

Create a new audio stream.

\param src_format The format of the source audio \param src_channels The number of channels of the source audio \param src_rate The sampling rate of the source audio \param dst_format The format of the desired audio output \param dst_channels The number of channels of the desired audio output \param dst_rate The sampling rate of the desired audio output \returns 0 on success, or -1 on error.

\since This function is available since SDL 2.0.7.

\sa SDL_AudioStreamPut \sa SDL_AudioStreamGet \sa SDL_AudioStreamAvailable \sa SDL_AudioStreamFlush \sa SDL_AudioStreamClear \sa SDL_FreeAudioStream

SDL_nlog sdl2

Calculate the natural logarithm of x.

\since This function is available since SDL 2.0.4.

SDL2-for-Pascal: ATTENTION: The original C name of this function is SDL_log, but since Pascal names are case-insensitive, it is in conflict with SDL_Log (logging function). Hence we decided to rename it.

SDL_nlogf sdl2

Calculate the natural logarithm of x.

\since This function is available since SDL 2.0.8.

SDL2-for-Pascal: ATTENTION: The original C name of this function is SDL_logf, but to be consistent with the renamed SDL_log function (see comment of SDL_nlog for details), we decided to rename it.

SDL_NumHaptics sdl2

Count the number of haptic devices attached to the system.

\returns the number of haptic devices detected on the system or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_HapticName

SDL_NumJoysticks sdl2

Count the number of joysticks attached to the system.

\returns the number of attached joysticks on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickName \sa SDL_JoystickPath \sa SDL_JoystickOpen

SDL_NumSensors sdl2

Count the number of sensors attached to the system right now.

\returns the number of sensors detected.

\since This function is available since SDL 2.0.9.

SDL_OnApplicationDidBecomeActive sdl2

 

SDL_OnApplicationDidEnterBackground sdl2

 

SDL_OnApplicationDidReceiveMemoryWarning sdl2

 

SDL_OnApplicationWillEnterForeground sdl2

 

SDL_OnApplicationWillResignActive sdl2

 

SDL_OnApplicationWillTerminate sdl2

Functions used by iOS application delegates to notify SDL about state changes

SDL_OpenAudio sdl2

This function is a legacy means of opening the audio device.

This function remains for compatibility with SDL 1.2, but also because it's slightly easier to use than the new functions in SDL 2.0. The new, more powerful, and preferred way to do this is SDL_OpenAudioDevice().

This function is roughly equivalent to:

```c SDL_OpenAudioDevice(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); ```

With two notable exceptions:

- If `obtained` is NULL, we use `desired` (and allow no changes), which means desired will be modified to have the correct values for silence, etc, and SDL will convert any differences between your app's specific request and the hardware behind the scenes. - The return value is always success or failure, and not a device ID, which means you can only have one device open at a time with this function.

\param desired an SDL_AudioSpec structure representing the desired output format. Please refer to the SDL_OpenAudioDevice documentation for details on how to prepare this structure. \param obtained an SDL_AudioSpec structure filled in with the actual parameters, or NULL. \returns 0 if successful, placing the actual hardware parameters in the structure pointed to by `obtained`.

If `obtained` is NULL, the audio data passed to the callback function will be guaranteed to be in the requested format, and will be automatically converted to the actual hardware audio format if necessary. If `obtained` is NULL, `desired` will have fields modified.

This function returns a negative error code on failure to open the audio device or failure to set up the audio thread; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_CloseAudio \sa SDL_LockAudio \sa SDL_PauseAudio \sa SDL_UnlockAudio

SDL_OpenAudioDevice sdl2

Open a specific audio device.

SDL_OpenAudio(), unlike this function, always acts on device ID 1. As such, this function will never return a 1 so as not to conflict with the legacy function.

Please note that SDL 2.0 before 2.0.5 did not support recording; as such, this function would fail if `iscapture` was not zero. Starting with SDL 2.0.5, recording is implemented and this value can be non-zero.

Passing in a `device` name of NULL requests the most reasonable default (and is equivalent to what SDL_OpenAudio() does to choose a device). The `device` name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but some drivers allow arbitrary and driver-specific strings, such as a hostname/IP address for a remote audio server, or a filename in the diskaudio driver.

An opened audio device starts out paused, and should be enabled for playing by calling SDL_PauseAudioDevice(devid, 0) when you are ready for your audio callback function to be called. Since the audio driver may modify the requested size of the audio buffer, you should allocate any local mixing buffers after you open the audio device.

The audio callback runs in a separate thread in most cases; you can prevent race conditions between your callback and other threads without fully pausing playback with SDL_LockAudioDevice(). For more information about the callback, see SDL_AudioSpec.

Managing the audio spec via 'desired' and 'obtained':

When filling in the desired audio spec structure:

- `desired->freq` should be the frequency in sample-frames-per-second (Hz). - `desired->format` should be the audio format (`AUDIO_S16SYS`, etc). - `desired->samples` is the desired size of the audio buffer, in _sample frames_ (with stereo output, two samples–left and right–would make a single sample frame). This number should be a power of two, and may be adjusted by the audio driver to a value more suitable for the hardware. Good values seem to range between 512 and 8096 inclusive, depending on the application and CPU speed. Smaller values reduce latency, but can lead to underflow if the application is doing heavy processing and cannot fill the audio buffer in time. Note that the number of sample frames is directly related to time by the following formula: `ms = (sampleframes*1000)/freq` - `desired->size` is the size in _bytes_ of the audio buffer, and is calculated by SDL_OpenAudioDevice(). You don't initialize this. - `desired->silence` is the value used to set the buffer to silence, and is calculated by SDL_OpenAudioDevice(). You don't initialize this. - `desired->callback` should be set to a function that will be called when the audio device is ready for more data. It is passed a pointer to the audio buffer, and the length in bytes of the audio buffer. This function usually runs in a separate thread, and so you should protect data structures that it accesses by calling SDL_LockAudioDevice() and SDL_UnlockAudioDevice() in your code. Alternately, you may pass a NULL pointer here, and call SDL_QueueAudio() with some frequency, to queue more audio samples to be played (or for capture devices, call SDL_DequeueAudio() with some frequency, to obtain audio samples). - `desired->userdata` is passed as the first parameter to your callback function. If you passed a NULL callback, this value is ignored.

`allowed_changes` can have the following flags OR'd together:

- `SDL_AUDIO_ALLOW_FREQUENCY_CHANGE` - `SDL_AUDIO_ALLOW_FORMAT_CHANGE` - `SDL_AUDIO_ALLOW_CHANNELS_CHANGE` - `SDL_AUDIO_ALLOW_SAMPLES_CHANGE` - `SDL_AUDIO_ALLOW_ANY_CHANGE`

These flags specify how SDL should behave when a device cannot offer a specific feature. If the application requests a feature that the hardware doesn't offer, SDL will always try to get the closest equivalent.

For example, if you ask for float32 audio format, but the sound card only supports int16, SDL will set the hardware to int16. If you had set SDL_AUDIO_ALLOW_FORMAT_CHANGE, SDL will change the format in the `obtained` structure. If that flag was *not* set, SDL will prepare to convert your callback's float32 audio to int16 before feeding it to the hardware and will keep the originally requested format in the `obtained` structure.

The resulting audio specs, varying depending on hardware and on what changes were allowed, will then be written back to `obtained`.

If your application can only handle one specific data format, pass a zero for `allowed_changes` and let SDL transparently handle any differences.

\param device a UTF-8 string reported by SDL_GetAudioDeviceName() or a driver-specific name as appropriate. NULL requests the most reasonable default device. \param iscapture non-zero to specify a device should be opened for recording, not playback \param desired an SDL_AudioSpec structure representing the desired output format; see SDL_OpenAudio() for more information \param obtained an SDL_AudioSpec structure filled in with the actual output format; see SDL_OpenAudio() for more information \param allowed_changes 0, or one or more flags OR'd together \returns a valid device ID that is > 0 on success or 0 on failure; call SDL_GetError() for more information.

For compatibility with SDL 1.2, this will never return 1, since SDL reserves that ID for the legacy SDL_OpenAudio() function.

\since This function is available since SDL 2.0.0.

\sa SDL_CloseAudioDevice \sa SDL_GetAudioDeviceName \sa SDL_LockAudioDevice \sa SDL_OpenAudio \sa SDL_PauseAudioDevice \sa SDL_UnlockAudioDevice

SDL_OpenURL sdl2

\brief Open an URL / URI in the browser or other

Open a URL in a separate, system-provided application. How this works will vary wildly depending on the platform. This will likely launch what makes sense to handle a specific URL's protocol (a web browser for http://, etc), but it might also be able to launch file managers for directories and other things.

What happens when you open a URL varies wildly as well: your game window may lose focus (and may or may not lose focus if your game was fullscreen or grabbing input at the time). On mobile devices, your app will likely move to the background or your process might be paused. Any given platform may or may not handle a given URL.

If this is unimplemented (or simply unavailable) for a platform, this will fail with an error. A successful result does not mean the URL loaded, just that we launched something to handle it (or at least believe we did).

All this to say: this function can be useful, but you should definitely test it on every platform you target.

\param url A valid URL to open. \return 0 on success, or -1 on error.

SDL_PauseAudio sdl2

This function is a legacy means of pausing the audio device.

New programs might want to use SDL_PauseAudioDevice() instead. This function is equivalent to calling...

```c SDL_PauseAudioDevice(1, pause_on); ```

...and is only useful if you used the legacy SDL_OpenAudio() function.

\param pause_on non-zero to pause, 0 to unpause

\since This function is available since SDL 2.0.0.

\sa SDL_GetAudioStatus \sa SDL_PauseAudioDevice

SDL_PauseAudioDevice sdl2

Use this function to pause and unpause audio playback on a specified device.

This function pauses and unpauses the audio callback processing for a given device. Newly-opened audio devices start in the paused state, so you must call this function with **pause_on**=0 after opening the specified audio device to start playing sound. This allows you to safely initialize data for your callback function after opening the audio device. Silence will be written to the audio device while paused, and the audio callback is guaranteed to not be called. Pausing one device does not prevent other unpaused devices from running their callbacks.

Pausing state does not stack; even if you pause a device several times, a single unpause will start the device playing again, and vice versa. This is different from how SDL_LockAudioDevice() works.

If you just need to protect a few variables from race conditions vs your callback, you shouldn't pause the audio device, as it will lead to dropouts in the audio playback. Instead, you should use SDL_LockAudioDevice().

\param dev a device opened by SDL_OpenAudioDevice() \param pause_on non-zero to pause, 0 to unpause

\since This function is available since SDL 2.0.0.

\sa SDL_LockAudioDevice

SDL_PeepEvents sdl2

Checks the event queue for messages and optionally returns them.

If action is SDL_ADDEVENT, up to numevents events will be added to the back of the event queue.

If action is SDL_PEEKEVENT, up to numevents events at the front of the event queue, within the specified minimum and maximum type, will be returned and will not be removed from the queue.

If action is SDL_GETEVENT, up to numevents events at the front of the event queue, within the specified minimum and maximum type, will be returned and will be removed from the queue.

Result: The number of events actually stored, or -1 if there was an error.

This function is thread-safe.

SDL_PIXELFLAG sdl2

SDL2-for-Pascal: The SDL_DEFINE_PIXELFORMAT macro returns the underlying pixel format based on five arguments.

The original C macro: #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ ((bits) << 8) | ((bytes) << 0))

This C implementation could be replaced by a Pascal function, but from a performance stand point this will be slower. Therefore we decided to keep it as it has been implemented before by the original binding authors and translate every pixel format constant by the very same expression:

SDL_PIXELFORMAT_[...] = (1 shl 28) or (SDL_PIXELTYPE_[...] shl 24) or (SDL_BITMAPORDER_[...] shl 20) or ([...] shl 16) or ([...] shl 8) or ([...] shl 0);

In the future it may be desirable to have a Pascal function. The prototype could look like this: function SDL_DEFINE_PIXELFORMAT(type, order, layour, bit, bytes: cuint32): Result;

SDL_PixelFormatEnumToMasks sdl2

Convert one of the enumerated pixel formats to a bpp value and RGBA masks.

\param format one of the SDL_PixelFormatEnum values \param bpp a bits per pixel value; usually 15, 16, or 32 \param Rmask a pointer filled in with the red mask for the format \param Gmask a pointer filled in with the green mask for the format \param Bmask a pointer filled in with the blue mask for the format \param Amask a pointer filled in with the alpha mask for the format \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't possible; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_MasksToPixelFormatEnum

SDL_PIXELLAYOUT sdl2

 

SDL_PIXELORDER sdl2

 

SDL_PIXELTYPE sdl2

 

SDL_PointInFRect sdl2

Returns true if point resides inside a rectangle.

SDL_PointInRect sdl2

Returns true if point resides inside a rectangle.

SDL_PollEvent sdl2

Polls for currently pending events.

1 if there are any pending events, or 0 if there are none available.

event - If not nil, the next event is removed from the queue and stored in that area.

SDL_pow sdl2

Calculate the value of x raised to the power of y.

\since This function is available since SDL 2.0.4.

SDL_powf sdl2

Calculate the value of x raised to the power of y.

\since This function is available since SDL 2.0.8.

SDL_PumpEventscdecl sdl2

Pumps the event loop, gathering events from the input devices.

This function updates the event queue and internal input device state.

This should only be run in the thread that sets the video mode.

SDL_PushEvent sdl2

Add an event to the event queue.

1 on success, 0 if the event was filtered, or -1 if the event queue was full or there was some other error.

SDL_QueryTexture sdl2

Query the attributes of a texture

texture A texture to be queried. format A pointer filled in with the raw format of the texture. The actual format may differ, but pixel transfers will use this format. access A pointer filled in with the actual access to the texture. w A pointer filled in with the width of the texture in pixels. h A pointer filled in with the height of the texture in pixels.

0 on success, or -1 if the texture is not valid.

SDL_QueueAudio sdl2

Queue more audio on non-callback devices.

If you are looking to retrieve queued audio from a non-callback capture device, you want SDL_DequeueAudio() instead. SDL_QueueAudio() will return -1 to signify an error if you use it with capture devices.

SDL offers two ways to feed audio to the device: you can either supply a callback that SDL triggers with some frequency to obtain more audio (pull method), or you can supply no callback, and then SDL will expect you to supply data at regular intervals (push method) with this function.

There are no limits on the amount of data you can queue, short of exhaustion of address space. Queued data will drain to the device as necessary without further intervention from you. If the device needs audio but there is not enough queued, it will play silence to make up the difference. This means you will have skips in your audio playback if you aren't routinely queueing sufficient data.

This function copies the supplied data, so you are safe to free it when the function returns. This function is thread-safe, but queueing to the same device from two threads at once does not promise which buffer will be queued first.

You may not queue audio on a device that is using an application-supplied callback; doing so returns an error. You have to use the audio callback or queue audio with this function, but not both.

You should not call SDL_LockAudio() on the device before queueing; SDL handles locking internally for this function.

Note that SDL2 does not support planar audio. You will need to resample from planar audio formats into a non-planar one (see SDL_AudioFormat) before queuing audio.

\param dev the device ID to which we will queue audio \param data the data to queue to the device for later playback \param len the number of bytes (not samples!) to which `data` points \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.4.

\sa SDL_ClearQueuedAudio \sa SDL_GetQueuedAudioSize

SDL_Quit sdl2

This function cleans up all initialized subsystems. You should call it upon all exit conditions.

SDL_QuitSubSystem sdl2

This function cleans up specific SDL subsystems

SDL_RaiseWindow sdl2

Raise a window above other windows and set the input focus.

SDL_ReadBE16 sdl2

 

SDL_ReadBE32 sdl2

 

SDL_ReadBE64 sdl2

 

SDL_ReadLE16 sdl2

 

SDL_ReadLE32 sdl2

 

SDL_ReadLE64 sdl2

 

SDL_ReadU8 sdl2

Read endian functions

Read an item of the specified endianness and return in native format.

SDL_realloc sdl2

Resize a block of memory allocated previously with SDL_malloc() or SDL_calloc().

The returned pointer may or may not be the same as the original pointer. If the new size is larger than the old size, any new memory will *not* be initialized.

SDL_RecordGesture sdl2

/** Begin recording a gesture on a specified touch device or all touch devices.

If the parameter `touchId` is -1 (i.e., all devices), this function will always return 1, regardless of whether there actually are any devices.

\param touchId the touch device id, or -1 for all touch devices \returns 1 on success or 0 if the specified device could not be found.

\since This function is available since SDL 2.0.0.

\sa SDL_GetTouchDevice

SDL_RectEmpty sdl2

Returns true if the rectangle has no area.

SDL_RectEquals sdl2

Returns true if the two rectangles are equal.

SDL_RegisterEvents sdl2

This function allocates a set of user-defined events, and returns the beginning event number for that set of events.

If there aren't enough user-defined events left, this function returns (Uint32)-1

SDL_RemoveTimer sdl2

Remove a timer knowing its ID.

A boolean value indicating success or failure.

It is not safe to remove a timer multiple times.

SDL_RenderClear sdl2

Clear the current rendering target with the drawing color

This function clears the entire rendering target, ignoring the viewport.

0 on success, or -1 on error

SDL_RenderCopy sdl2

Copy a portion of the texture to the current rendering target.

renderer The renderer which should copy parts of a texture. texture The source texture. srcrect A pointer to the source rectangle, or NULL for the entire texture. dstrect A pointer to the destination rectangle, or NULL for the entire rendering target.

0 on success, or -1 on error

SDL_RenderCopyEx sdl2

Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center

renderer The renderer which should copy parts of a texture. texture The source texture. srcrect A pointer to the source rectangle, or NULL for the entire texture. dstrect A pointer to the destination rectangle, or NULL for the entire rendering target. angle An angle in degrees that indicates the rotation that will be applied to dstrect center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2) flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture

0 on success, or -1 on error

SDL_RenderCopyExF sdl2

Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center

renderer The renderer which should copy parts of a texture. texture The source texture. srcrect A pointer to the source rectangle, or NIL for the entire texture. dstrect A pointer to the destination rectangle, or NIL for the entire rendering target. angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction center A pointer to a point indicating the point around which dstrect will be rotated (if NIL, rotation will be done around dstrect.w/2, dstrect.h/2). flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture

0 on success, or -1 on error

SDL_RenderCopyF sdl2

Copy a portion of the texture to the current rendering target.

renderer The renderer which should copy parts of a texture. texture The source texture. srcrect A pointer to the source rectangle, or NIL for the entire texture. dstrect A pointer to the destination rectangle, or NIL for the entire rendering target.

0 on success, or -1 on error

SDL_RenderDrawLine sdl2

Draw a line on the current rendering target.

renderer The renderer which should draw a line. x1 The x coordinate of the start point. y1 The y coordinate of the start point. x2 The x coordinate of the end point. y2 The y coordinate of the end point.

0 on success, or -1 on error

SDL_RenderDrawLineF sdl2

Draw a line on the current rendering target.

renderer The renderer which should draw a line. x1 The x coordinate of the start point. y1 The y coordinate of the start point. x2 The x coordinate of the end point. y2 The y coordinate of the end point.

0 on success, or -1 on error

SDL_RenderDrawLines sdl2

\brief Draw a series of connected lines on the current rendering target.

\param renderer The renderer which should draw multiple lines. \param points The points along the lines \param count The number of points, drawing count-1 lines

\return 0 on success, or -1 on error

SDL_RenderDrawLinesF sdl2

Draw a series of connected lines on the current rendering target.

renderer The renderer which should draw multiple lines. points The points along the lines count The number of points, drawing count-1 lines

0 on success, or -1 on error

SDL_RenderDrawPoint sdl2

Draw a point on the current rendering target.

renderer The renderer which should draw a point. x The x coordinate of the point. y The y coordinate of the point.

0 on success, or -1 on error

SDL_RenderDrawPointF sdl2

Draw a point on the current rendering target.

renderer The renderer which should draw a point. x The x coordinate of the point. y The y coordinate of the point.

0 on success, or -1 on error

SDL_RenderDrawPoints sdl2

Draw multiple points on the current rendering target.

renderer The renderer which should draw multiple points. points The points to draw count The number of points to draw

0 on success, or -1 on error

SDL_RenderDrawPointsF sdl2

Draw multiple points on the current rendering target.

renderer The renderer which should draw multiple points. points The points to draw count The number of points to draw

0 on success, or -1 on error

SDL_RenderDrawRect sdl2

Draw a rectangle on the current rendering target.

renderer The renderer which should draw a rectangle. rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.

0 on success, or -1 on error

SDL_RenderDrawRectF sdl2

Draw a rectangle on the current rendering target.

renderer The renderer which should draw a rectangle. rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.

0 on success, or -1 on error

SDL_RenderDrawRects sdl2

Draw some number of rectangles on the current rendering target.

renderer The renderer which should draw multiple rectangles. rects A pointer to an array of destination rectangles. count The number of rectangles.

0 on success, or -1 on error

SDL_RenderDrawRectsF sdl2

Draw some number of rectangles on the current rendering target.

renderer The renderer which should draw multiple rectangles. rects A pointer to an array of destination rectangles. count The number of rectangles.

0 on success, or -1 on error

SDL_RenderFillRect sdl2

Fill a rectangle on the current rendering target with the drawing color.

renderer The renderer which should fill a rectangle. rect A pointer to the destination rectangle, or NULL for the entire rendering target.

0 on success, or -1 on error

SDL_RenderFillRectF sdl2

Fill a rectangle on the current rendering target with the drawing color.

renderer The renderer which should fill a rectangle. rect A pointer to the destination rectangle, or NULL for the entire rendering target.

0 on success, or -1 on error

SDL_RenderFillRects sdl2

Fill some number of rectangles on the current rendering target with the drawing color.

renderer The renderer which should fill multiple rectangles. rects A pointer to an array of destination rectangles. count The number of rectangles.

0 on success, or -1 on error

SDL_RenderFillRectsF sdl2

Fill some number of rectangles on the current rendering target with the drawing color.

renderer The renderer which should fill multiple rectangles. rects A pointer to an array of destination rectangles. count The number of rectangles.

0 on success, or -1 on error

SDL_RenderFlush sdl2

Force the rendering context to flush any pending commands to the underlying rendering API.

You do not need to (and in fact, shouldn't) call this function unless you are planning to call into OpenGL/Direct3D/Metal/whatever directly in addition to using an SDL_Renderer.

This is for a very-specific case: if you are using SDL's render API, you asked for a specific renderer backend (OpenGL, Direct3D, etc), you set SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever calls in addition to SDL render API calls. If all of this applies, you should call SDL_RenderFlush() between calls to SDL's render API and the low-level API you're using in cooperation.

In all other cases, you can ignore this function. This is only here to get maximum performance out of a specific situation. In all other cases, SDL will do the right thing, perhaps at a performance loss.

This function is first available in SDL 2.0.10, and is not needed in 2.0.9 and earlier, as earlier versions did not queue rendering commands at all, instead flushing them to the OS immediately.

SDL_RenderGeometry sdl2

Render a list of triangles, optionally using a texture and indices into the vertex array. Color and alpha modulation is done per vertex. SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored.

SDL_RenderGeometryRaw sdl2

Render a list of triangles, optionally using a texture and indices into the vertex arrays. Color and alpha modulation is done per vertex. SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored.

SDL_RenderGetClipRect sdl2

Get the clip rectangle for the current target.

renderer The renderer from which clip rectangle should be queried. rect A pointer filled in with the current clip rectangle, or an empty rectangle if clipping is disabled.

SDL_RenderSetClipRect()

SDL_RenderGetIntegerScale sdl2

\brief Get whether integer scales are forced for resolution-independent rendering

\param renderer The renderer from which integer scaling should be queried.

\sa SDL_RenderSetIntegerScale()

SDL_RenderGetLogicalSize sdl2

Get device independent resolution for rendering

renderer The renderer from which resolution should be queried. w A pointer filled with the width of the logical resolution h A pointer filled with the height of the logical resolution

SDL_RenderSetLogicalSize()

SDL_RenderGetMetalCommandEncoder sdl2

Get the Metal command encoder for the current frame

This function returns a raw Pointer, so SDL doesn't have to include Metal's headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.

Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give SDL a drawable to render to, which might happen if the window is hidden/minimized/offscreen. This doesn't apply to command encoders for render targets, just the window's backbacker. Check your return values!

SDL_RenderGetMetalLayer sdl2

Get the CAMetalLayer associated with the given Metal renderer.

This function returns a raw Pointer, so SDL doesn't have to include Metal's headers, but it can be safely cast to a pointer to `CAMetalLayer`.

SDL_RenderGetScale sdl2

Get the drawing scale for the current target.

renderer The renderer from which drawing scale should be queried. scaleX A pointer filled in with the horizontal scaling factor scaleY A pointer filled in with the vertical scaling factor

SDL_RenderSetScale()

SDL_RenderGetViewport sdl2

Get the drawing area for the current target.

SDL_RenderSetViewport()

SDL_RenderGetWindow sdl2

Get the window associated with a renderer.

SDL_RenderIsClipEnabled sdl2

\brief Get whether clipping is enabled on the given renderer.

\param renderer The renderer from which clip state should be queried.

\sa SDL_RenderGetClipRect()

SDL_RenderLogicalToWindow sdl2

Get real coordinates of point in window when given logical coordinates of point in renderer. Logical coordinates will differ from real coordinate when render is scaled and logical renderer size set.

SDL_RenderPresent sdl2

Update the screen with rendering performed.

SDL_RenderReadPixels sdl2

Read pixels from the current rendering target.

renderer The renderer from which pixels should be read. rect A pointer to the rectangle to read, or NULL for the entire render target. format The desired format of the pixel data, or 0 to use the format of the rendering target pixels A pointer to be filled in with the pixel data pitch The pitch of the pixels parameter.

0 on success, or -1 if pixel reading is not supported.

This is a very slow operation, and should not be used frequently.

SDL_RenderSetClipRect sdl2

Set the clip rectangle for the current target.

renderer The renderer for which clip rectangle should be set. rect A pointer to the rectangle to set as the clip rectangle, or NULL to disable clipping.

0 on success, or -1 on error

SDL_RenderGetClipRect()

SDL_RenderSetIntegerScale sdl2

\brief Set whether to force integer scales for resolution-independent rendering

\param renderer The renderer for which integer scaling should be set. \param enable Enable or disable integer scaling

This function restricts the logical viewport to integer values - that is, when a resolution is between two multiples of a logical size, the viewport size is rounded down to the lower multiple.

\sa SDL_RenderSetLogicalSize()

SDL_RenderSetLogicalSize sdl2

Set device independent resolution for rendering

renderer The renderer for which resolution should be set. w The width of the logical resolution h The height of the logical resolution

This function uses the viewport and scaling functionality to allow a fixed logical resolution for rendering, regardless of the actual output resolution. If the actual output resolution doesn't have the same aspect ratio the output rendering will be centered within the output display.

If the output display is a window, mouse events in the window will be filtered and scaled so they seem to arrive within the logical resolution.

If this function results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints.

SDL_RenderGetLogicalSize() SDL_RenderSetScale() SDL_RenderSetViewport()

SDL_RenderSetScale sdl2

Set the drawing scale for rendering on the current target.

renderer The renderer for which the drawing scale should be set. scaleX The horizontal scaling factor scaleY The vertical scaling factor

The drawing coordinates are scaled by the x/y scaling factors before they are used by the renderer. This allows resolution independent drawing with a single coordinate system.

If this results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints. For best results use integer scaling factors.

SDL_RenderGetScale() SDL_RenderSetLogicalSize()

SDL_RenderSetViewport sdl2

Set the drawing area for rendering on the current target.

renderer The renderer for which the drawing area should be set. rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.

The x,y of the viewport rect represents the origin for rendering.

0 on success, or -1 on error

If the window associated with the renderer is resized, the viewport is automatically reset.

SDL_RenderGetViewport() SDL_RenderSetLogicalSize()

SDL_RenderSetVSync sdl2

Toggle VSync of the given renderer.

SDL_RenderTargetSupported sdl2

Determines whether a window supports the use of render targets

renderer The renderer that will be checked

SDL_TRUE if supported, SDL_FALSE if not.

SDL_RenderWindowToLogical sdl2

Get logical coordinates of point in renderer when given real coordinates of point in window. Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set.

SDL_ResetHint sdl2

Reset a hint to the default value.

This will reset a hint to the value of the environment variable, or NIL if the environment isn't set. Callbacks will be called normally with this change.

\param name the hint to set \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise.

\since This function is available since SDL 2.24.0.

SDL_ResetHints sdl2

Reset all hints to the default values.

This will reset all hints to the value of the associated environment variable, or NIL if the environment isn't set. Callbacks will be called normally with this change.

\since This function is available since SDL 2.26.0.

\sa SDL_GetHint \sa SDL_SetHint \sa SDL_ResetHint

SDL_ResetKeyboard sdl2

Clear the state of the keyboard

This function will generate key up events for all pressed keys.

\since This function is available since SDL 2.24.0.

\sa SDL_GetKeyboardState

SDL_RestoreWindow sdl2

Restore the size and position of a minimized or maximized window.

SDL_MaximizeWindow() SDL_MinimizeWindow()

SDL_round sdl2

Round to nearest integral value, away from zero.

\since This function is available since SDL 2.0.16.

SDL_roundf sdl2

Round to nearest integral value, away from zero.

\since This function is available since SDL 2.0.16.

SDL_RWclose sdl2

Close and free an allocated SDL_RWops structure.

\return 0 if successful or -1 on write error when flushing data.

SDL_RWFromConstMem sdl2

 

SDL_RWFromFile sdl2

RWFrom functions

Functions to create SDL_RWops structures from various data streams.

SDL_RWFromFP sdl2

don't know if this works

SDL_RWFromMem sdl2

 

SDL_RWread sdl2

Read up to \c maxnum objects each of size \c size from the data stream to the area pointed at by \c ptr.

\return the number of objects read, or 0 at error or end of file.

SDL_RWseek sdl2

Seek to \c offset relative to \c whence, one of stdio's whence values: RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END

\return the final offset in the data stream, or -1 on error.

SDL_RWsize sdl2

Return the size of the file in this rwops, or -1 if unknown

SDL_RWtell sdl2

Return the current offset in the data stream, or -1 on error.

SDL_RWwrite sdl2

Write exactly \c num objects each of size \c size from the area pointed at by \c ptr to data stream.

\return the number of objects written, or 0 at error or end of file.

SDL_SaveAllDollarTemplates sdl2

Save all currently loaded Dollar Gesture templates.

\param dst a SDL_RWops to save to \returns the number of saved templates on success or 0 on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_LoadDollarTemplates \sa SDL_SaveDollarTemplate

SDL_SaveBMP sdl2

TODO : Check: Why AnsiString instead of PAnsiChar used here? Compare SDL_LoadBMP macro.

SDL_SaveBMP_RW sdl2

Save a surface to a seekable SDL data stream (memory or file).

Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the BMP directly. Other RGB formats with 8-bit or higher get converted to a 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit surface before they are saved. YUV and paletted 1-bit and 4-bit formats are not supported.

If \c freedst is non-zero, the stream will be closed after being written.

\return 0 if successful or -1 if there was an error.

SDL_SaveDollarTemplate sdl2

Save a currently loaded Dollar Gesture template.

\param gestureId a gesture id \param dst a SDL_RWops to save to \returns 1 on success or 0 on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_LoadDollarTemplates \sa SDL_SaveAllDollarTemplates

SDL_scalbn sdl2

Calculate x multiplied by the floating-point radix to the power of n. On most systems, the radix is 2, making this equivalent to x*(2**n).

\since This function is available since SDL 2.0.4.

SDL_scalbnf sdl2

Calculate x multiplied by the floating-point radix to the power of n. On most systems, the radix is 2, making this equivalent to x*(2**n).

\since This function is available since SDL 2.0.8.

SDL_SemPost sdl2

Atomically increment a semaphore's value and wake waiting threads.

\param sem the semaphore to increment \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_SemTryWait sdl2

See if a semaphore has a positive value and decrement it if it does.

This function checks to see if the semaphore pointed to by `sem` has a positive value and atomically decrements the semaphore value if it does. If the semaphore doesn't have a positive value, the function immediately returns SDL_MUTEX_TIMEDOUT.

\param sem the semaphore to wait on \returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait would block, or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_SemValue sdl2

Get the current value of a semaphore.

\param sem the semaphore to query \returns the current value of the semaphore.

\since This function is available since SDL 2.0.0.

SDL_SemWait sdl2

Wait until a semaphore has a positive value and then decrements it.

This function suspends the calling thread until either the semaphore pointed to by `sem` has a positive value or the call is interrupted by a signal or error. If the call is successful it will atomically decrement the semaphore value.

This function is the equivalent of calling SDL_SemWaitTimeout() with a time length of SDL_MUTEX_MAXWAIT.

\param sem the semaphore wait on \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_SemWaitTimeout sdl2

Wait until a semaphore has a positive value and then decrements it.

This function suspends the calling thread until either the semaphore pointed to by `sem` has a positive value, the call is interrupted by a signal or error, or the specified time has elapsed. If the call is successful it will atomically decrement the semaphore value.

\param sem the semaphore to wait on \param ms the length of the timeout, in milliseconds \returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in the allotted time, or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_SensorClose sdl2

Close a sensor previously opened with SDL_SensorOpen().

\param sensor The SDL_Sensor object to close

\since This function is available since SDL 2.0.9.

SDL_SensorFromInstanceID sdl2

Return the SDL_Sensor associated with an instance id.

\param instance_id The sensor from instance id \returns an SDL_Sensor object.

\since This function is available since SDL 2.0.9.

SDL_SensorGetData sdl2

Get the current state of an opened sensor.

The number of values and interpretation of the data is sensor dependent.

\param sensor The SDL_Sensor object to query \param data A pointer filled with the current sensor state \param num_values The number of values to write to data \returns 0 or -1 if an error occurred.

\since This function is available since SDL 2.0.9.

SDL_SensorGetDataWithTimestamp sdl2

Get the current state of an opened sensor with the timestamp of the last update.

The number of values and interpretation of the data is sensor dependent.

\param sensor The SDL_Sensor object to query \param timestamp A pointer filled with the timestamp in microseconds of the current sensor reading if available, or 0 if not \param data A pointer filled with the current sensor state \param num_values The number of values to write to data \returns 0 or -1 if an error occurred.

\since This function is available since SDL 2.26.0.

SDL_SensorGetDeviceInstanceID sdl2

Get the instance ID of a sensor.

\param device_index The sensor to get instance id from \returns the sensor instance ID, or -1 if `device_index` is out of range.

\since This function is available since SDL 2.0.9.

SDL_SensorGetDeviceName sdl2

Get the implementation dependent name of a sensor.

\param device_index The sensor to obtain name from \returns the sensor name, or NIL if `device_index` is out of range.

\since This function is available since SDL 2.0.9.

SDL_SensorGetDeviceNonPortableType sdl2

Get the platform dependent type of a sensor.

\param device_index The sensor to check \returns the sensor platform dependent type, or -1 if `device_index` is out of range.

\since This function is available since SDL 2.0.9.

SDL_SensorGetDeviceType sdl2

Get the type of a sensor.

\param device_index The sensor to get the type from \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is out of range.

\since This function is available since SDL 2.0.9.

SDL_SensorGetInstanceID sdl2

Get the instance ID of a sensor.

\param sensor The SDL_Sensor object to inspect \returns the sensor instance ID, or -1 if `sensor` is NIL.

\since This function is available since SDL 2.0.9.

SDL_SensorGetName sdl2

Get the implementation dependent name of a sensor

\param sensor The SDL_Sensor object \returns the sensor name, or NIL if `sensor` is NIL.

\since This function is available since SDL 2.0.9.

SDL_SensorGetNonPortableType sdl2

Get the platform dependent type of a sensor.

\param sensor The SDL_Sensor object to inspect \returns the sensor platform dependent type, or -1 if `sensor` is NIL.

\since This function is available since SDL 2.0.9.

SDL_SensorGetType sdl2

Get the type of a sensor.

\param sensor The SDL_Sensor object to inspect \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` if `sensor` is NIL.

\since This function is available since SDL 2.0.9.

SDL_SensorOpen sdl2

Open a sensor for use.

\param device_index The sensor to open \returns an SDL_Sensor sensor object, or NIL if an error occurred.

\since This function is available since SDL 2.0.9.

SDL_SensorUpdate sdl2

Update the current state of the open sensors.

This is called automatically by the event loop if sensor events are enabled.

This needs to be called from the thread that initialized the sensor subsystem.

\since This function is available since SDL 2.0.9.

SDL_SetClipboardText sdl2

Put UTF-8 text into the clipboard.

\param text the text to store in the clipboard \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_GetClipboardText \sa SDL_HasClipboardText

SDL_SetClipRect sdl2

Sets the clipping rectangle for the destination surface in a blit.

If the clip rectangle is NULL, clipping will be disabled.

If the clip rectangle doesn't intersect the surface, the function will return SDL_FALSE and blits will be completely clipped. Otherwise the function returns SDL_TRUE and blits to the surface will be clipped to the intersection of the surface area and the clipping rectangle.

Note that blits are automatically clipped to the edges of the source and destination surfaces.

SDL_SetColorKey sdl2

Sets the color key (transparent pixel) in a blittable surface.

surface The surface to update flag Non-zero to enable colorkey and 0 to disable colorkey key The transparent pixel in the native surface format

0 on success, or -1 if the surface is not valid

You can pass SDL_RLEACCEL to enable RLE accelerated blits.

SDL_SetCursor sdl2

Set the active cursor.

This function sets the currently active cursor to the specified one. If the cursor is currently visible, the change will be immediately represented on the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if this is desired for any reason.

\param cursor a cursor to make active

\since This function is available since SDL 2.0.0.

\sa SDL_CreateCursor \sa SDL_GetCursor \sa SDL_ShowCursor

SDL_SetError sdl2

\brief Set the error message for the current thread

\return -1, there is no error handling for this function

SDL_SetEventFilter sdl2

Sets up a filter to process all events before they change internal state and are posted to the internal event queue.

If the filter returns 1, then the event will be added to the internal queue. If it returns 0, then the event will be dropped from the queue, but the internal state will still be updated. This allows selective filtering of dynamically arriving events.

Be very careful of what you do in the event filter function, as it may run in a different thread!

There is one caveat when dealing with the SDL_QUITEVENT event type. The event filter is only called when the window manager desires to close the application window. If the event filter returns 1, then the window will be closed, otherwise the window will remain open if possible.

If the quit event is generated by an interrupt signal, it will bypass the internal queue and be delivered to the application at the next event poll.

SDL_setFramerate sdl2_gfx

 

SDL_SetHint sdl2

/** \brief Set a hint with normal priority

\return SDL_TRUE if the hint was set, SDL_FALSE otherwise /

SDL_SetHintWithPriority sdl2

/** \brief Set a hint with a specific priority

The priority controls the behavior when setting a hint that already has a value. Hints will replace existing hints of their priority and lower. Environment variables are considered to have override priority.

\return SDL_TRUE if the hint was set, SDL_FALSE otherwise /

SDL_SetMemoryFunctions sdl2

Replace SDL's memory allocation functions with a custom set

\since This function is available since SDL 2.0.7.

SDL_SetModState sdl2

Set the current key modifier state for the keyboard.

The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose modifier key states on your application. Simply pass your desired modifier states into `modstate`. This value may be a bitwise, OR'd combination of SDL_Keymod values.

This does not change the keyboard state, only the key modifier flags that SDL reports.

\param modstate the desired SDL_Keymod for the keyboard

\since This function is available since SDL 2.0.0.

\sa SDL_GetModState

SDL_SetPaletteColors sdl2

Set a range of colors in a palette.

\param palette the SDL_Palette structure to modify \param colors an array of SDL_Color structures to copy into the palette \param firstcolor the index of the first palette entry to modify \param ncolors the number of entries to modify \returns 0 on success or a negative error code if not all of the colors could be set; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_AllocPalette \sa SDL_CreateRGBSurface

SDL_SetPixelFormatPalette sdl2

Set the palette for a pixel format structure.

\param format the SDL_PixelFormat structure that will use the palette \param palette the SDL_Palette structure that will be used \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_AllocPalette \sa SDL_FreePalette

SDL_SetPrimarySelectionText sdl2

Put UTF-8 text into the primary selection.

\param text the text to store in the primary selection \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.26.1.

\sa SDL_GetPrimarySelectionText \sa SDL_HasPrimarySelectionText

SDL_SetRelativeMouseMode sdl2

Set relative mouse mode.

While the mouse is in relative mode, the cursor is hidden, and the driver will try to report continuous motion in the current window. Only relative motion events will be delivered, the mouse position will not change.

Note that this function will not be able to provide continuous relative motion when used over Microsoft Remote Desktop, instead motion is limited to the bounds of the screen.

This function will flush any pending mouse motion.

\param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable. \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

If relative mode is not supported, this returns -1.

\since This function is available since SDL 2.0.0.

\sa SDL_GetRelativeMouseMode

SDL_SetRenderDrawBlendMode sdl2

Set the blend mode used for drawing operations (Fill and Line).

renderer The renderer for which blend mode should be set. blendMode SDL_BlendMode to use for blending.

0 on success, or -1 on error

If the blend mode is not supported, the closest supported mode is chosen.

SDL_GetRenderDrawBlendMode()

SDL_SetRenderDrawColor sdl2

Set the color used for drawing operations (Rect, Line and Clear).

renderer The renderer for which drawing color should be set. r The red value used to draw on the rendering target. g The green value used to draw on the rendering target. b The blue value used to draw on the rendering target. a The alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255).

0 on success, or -1 on error

SDL_SetRenderTarget sdl2

Set a texture as the current rendering target.

renderer The renderer. texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target

0 on success, or -1 on error

SDL_GetRenderTarget()

SDL_SetSurfaceAlphaMod sdl2

Set an additional alpha value used in blit operations.

surface The surface to update. alpha The alpha value multiplied into blit operations.

0 on success, or -1 if the surface is not valid.

SDL_GetSurfaceAlphaMod()

SDL_SetSurfaceBlendMode sdl2

Set the blend mode used for blit operations.

surface The surface to update. blendMode ::SDL_BlendMode to use for blit blending.

0 on success, or -1 if the parameters are not valid.

SDL_GetSurfaceBlendMode()

SDL_SetSurfaceColorMod sdl2

Set an additional color value used in blit operations.

surface The surface to update. r The red color value multiplied into blit operations. g The green color value multiplied into blit operations. b The blue color value multiplied into blit operations.

0 on success, or -1 if the surface is not valid.

SDL_GetSurfaceColorMod()

SDL_SetSurfacePalette sdl2

Set the palette used by a surface.

0, or -1 if the surface format doesn't use a palette.

A single palette can be shared with many surfaces.

SDL_SetSurfaceRLE sdl2

Sets the RLE acceleration hint for a surface.

0 on success, or -1 if the surface is not valid

If RLE is enabled, colorkey and alpha blending blits are much faster, but the surface must be locked before directly accessing the pixels.

SDL_SetTextInputRect sdl2

Set the rectangle used to type Unicode text inputs.

To start text input in a given location, this function is intended to be called before SDL_StartTextInput, although some platforms support moving the rectangle even while text input (and a composition) is active.

Note: If you want to use the system native IME window, try setting hint **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you any feedback.

\param rect the SDL_Rect structure representing the rectangle to receive text (ignored if nil)

\since This function is available since SDL 2.0.0.

\sa SDL_StartTextInput

SDL_SetTextureAlphaMod sdl2

Set an additional alpha value used in render copy operations.

texture The texture to update. alpha The alpha value multiplied into copy operations.

0 on success, or -1 if the texture is not valid or alpha modulation is not supported.

SDL_GetTextureAlphaMod()

SDL_SetTextureBlendMode sdl2

Set the blend mode used for texture copy operations.

texture The texture to update. blendMode ::SDL_BlendMode to use for texture blending.

0 on success, or -1 if the texture is not valid or the blend mode is not supported.

If the blend mode is not supported, the closest supported mode is chosen.

SDL_GetTextureBlendMode()

SDL_SetTextureColorMod sdl2

Set an additional color value used in render copy operations.

texture The texture to update. r The red color value multiplied into copy operations. g The green color value multiplied into copy operations. b The blue color value multiplied into copy operations.

0 on success, or -1 if the texture is not valid or color modulation is not supported.

SDL_GetTextureColorMod()

SDL_SetTextureScaleMode sdl2

Set the scale mode used for texture scale operations. If the scale mode is not supported, the closest supported mode is chosen.

SDL_SetTextureUserData sdl2

Associate a user-specified pointer with a texture.

SDL_SetThreadPriority sdl2

Set the priority for the current thread

SDL_SetWindowAlwaysOnTop sdl2

Set the window to always be above the others.

This will add or remove the window's `SDL_WINDOW_ALWAYS_ON_TOP` flag. This will bring the window to the front and keep the window above the rest.

\param window The window of which to change the always on top state \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to disable

\since This function is available since SDL 2.0.16.

\sa SDL_GetWindowFlags

SDL_SetWindowBordered sdl2

Set the border state of a window.

This will add or remove the window's SDL_WINDOW_BORDERLESS flag and add or remove the border from the actual window. This is a no-op if the window's border already matches the requested state.

window The window of which to change the border state. bordered SDL_FALSE to remove border, SDL_TRUE to add border.

You can't change the border state of a fullscreen window.

SDL_GetWindowFlags()

SDL_SetWindowBrightness sdl2

Set the brightness (gamma correction) for a window.

0 on success, or -1 if setting the brightness isn't supported.

SDL_GetWindowBrightness() SDL_SetWindowGammaRamp()

SDL_SetWindowData sdl2

Associate an arbitrary named pointer with a window.

window The window to associate with the pointer. name The name of the pointer. userdata The associated pointer.

The previous value associated with 'name'

The name is case-sensitive.

SDL_GetWindowData()

SDL_SetWindowDisplayMode sdl2

Set the display mode used when a fullscreen window is visible.

By default the window's dimensions and the desktop format and refresh rate are used.

mode The mode to use, or nil for the default mode.

0 on success, or -1 if setting the display mode failed.

SDL_GetWindowDisplayMode() SDL_SetWindowFullscreen()

SDL_SetWindowFullscreen sdl2

Set a window's fullscreen state.

0 on success, or -1 if setting the display mode failed.

SDL_SetWindowDisplayMode() SDL_GetWindowDisplayMode()

SDL_SetWindowGammaRamp sdl2

Set the gamma ramp for a window.

red The translation table for the red channel, or nil. green The translation table for the green channel, or nil. blue The translation table for the blue channel, or nil.

0 on success, or -1 if gamma ramps are unsupported.

Set the gamma translation table for the red, green, and blue channels of the video hardware. Each table is an array of 256 16-bit quantities, representing a mapping between the input and output for that channel. The input is the index into the array, and the output is the 16-bit gamma value at that index, scaled to the output color precision.

SDL_GetWindowGammaRamp()

SDL_SetWindowGrab sdl2

Set a window's input grab mode.

grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.

SDL_GetWindowGrab()

SDL_SetWindowHitTest sdl2

\brief Provide a callback that decides if a window region has special properties.

Normally windows are dragged and resized by decorations provided by the system window manager (a title bar, borders, etc), but for some apps, it makes sense to drag them from somewhere else inside the window itself; for example, one might have a borderless window that wants to be draggable from any part, or simulate its own title bar, etc.

This function lets the app provide a callback that designates pieces of a given window as special. This callback is run during event processing if we need to tell the OS to treat a region of the window specially; the use of this callback is known as "hit testing."

Mouse input may not be delivered to your application if it is within a special area; the OS will often apply that input to moving the window or resizing the window and not deliver it to the application.

Specifying NULL for a callback disables hit-testing. Hit-testing is disabled by default.

Platforms that don't support this functionality will return -1 unconditionally, even if you're attempting to disable hit-testing.

Your callback may fire at any time, and its firing does not indicate any specific behavior (for example, on Windows, this certainly might fire when the OS is deciding whether to drag your window, but it fires for lots of other reasons, too, some unrelated to anything you probably care about _and when the mouse isn't actually at the location it is testing_). Since this can fire at any time, you should try to keep your callback efficient, devoid of allocations, etc.

\param window The window to set hit-testing on. \param callback The callback to call when doing a hit-test. \param callback_data An app-defined void pointer passed to the callback. \return 0 on success, -1 on error (including unsupported).

SDL_SetWindowIcon sdl2

Set the icon for a window.

icon The icon for the window.

SDL_SetWindowInputFocus sdl2

\brief Explicitly sets input focus to the window.

You almost certainly want SDL_RaiseWindow() instead of this function. Use this with caution, as you might give focus to a window that's completely obscured by other windows.

\param window The window that should get the input focus

\return 0 on success, or -1 otherwise. \sa SDL_RaiseWindow()

SDL_SetWindowKeyboardGrab sdl2

Set a window's keyboard grab mode.

Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or the Meta/Super key. Note that not all system keyboard shortcuts can be captured by applications (one example is Ctrl+Alt+Del on Windows).

This is primarily intended for specialized applications such as VNC clients or VM frontends. Normal games should not use keyboard grab.

When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the window is full-screen to ensure the user is not trapped in your application. If you have a custom keyboard shortcut to exit fullscreen mode, you may suppress this behavior with `SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`.

If the caller enables a grab while another window is currently grabbed, the other window loses its grab in favor of the caller's window.

\param window The window for which the keyboard grab mode should be set. \param grabbed This is SDL_TRUE to grab keyboard, and SDL_FALSE to release.

\since This function is available since SDL 2.0.16.

\sa SDL_GetWindowKeyboardGrab \sa SDL_SetWindowMouseGrab \sa SDL_SetWindowGrab

SDL_SetWindowMaximumSize sdl2

Set the maximum size of a window's client area.

max_w The maximum width of the window, must be >0 max_h The maximum height of the window, must be >0

You can't change the maximum size of a fullscreen window, it automatically matches the size of the display mode.

SDL_GetWindowMaximumSize() SDL_SetWindowMinimumSize()

SDL_SetWindowMinimumSize sdl2

Set the minimum size of a window's client area.

min_w The minimum width of the window, must be >0 min_h The minimum height of the window, must be >0

You can't change the minimum size of a fullscreen window, it automatically matches the size of the display mode.

SDL_GetWindowMinimumSize() SDL_SetWindowMaximumSize()

SDL_SetWindowModalFor sdl2

\brief Sets the window as a modal for another window

\param modal_window The window that should be modal \param parent_window The parent window

\return 0 on success, or -1 otherwise.

SDL_SetWindowMouseGrab sdl2

Set a window's mouse grab mode.

window The window for which the mouse grab mode should be set. grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release.

SDL_GetWindowMouseGrab()

SDL_SetWindowMouseRect sdl2

Confines the cursor to the specified area of a window.

window The window that will be associated with the barrier. rect A rectangle area in window-relative coordinates. If NULL the barrier for the specified window will be destroyed.

SDL_GetWindowMouseRect()

SDL_SetWindowOpacity sdl2

\brief Set the opacity for a window

\param window The window which will be made transparent or opaque \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be clamped internally between 0.0f and 1.0f.

\return 0 on success, or -1 if setting the opacity isn't supported.

\sa SDL_GetWindowOpacity()

SDL_SetWindowPosition sdl2

Set the position of a window.

window The window to reposition. x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED. y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED.

The window coordinate origin is the upper left of the display.

SDL_GetWindowPosition()

SDL_SetWindowResizable sdl2

\brief Set the user-resizable state of a window.

This will add or remove the window's SDL_WINDOW_RESIZABLE flag and allow/disallow user resizing of the window. This is a no-op if the window's resizable state already matches the requested state.

\param window The window of which to change the resizable state. \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow.

\note You can't change the resizable state of a fullscreen window.

\sa SDL_GetWindowFlags()

SDL_SetWindowShape sdl2

Set the shape and parameters of a shaped window.

\param window The shaped window whose parameters should be set. \param shape A surface encoding the desired shape for the window. \param shape_mode The parameters to set for the shaped window. \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does not reference a valid shaped window.

\since This function is available since SDL 2.0.0.

\sa SDL_WindowShapeMode \sa SDL_GetShapedWindowMode

SDL_SetWindowSize sdl2

Set the size of a window's client area.

w The width of the window, must be >0 h The height of the window, must be >0

You can't change the size of a fullscreen window, it automatically matches the size of the display mode.

SDL_GetWindowSize()

SDL_SetWindowTitle sdl2

Set the title of a window, in UTF-8 format.

SDL_GetWindowTitle()

SDL_SetYUVConversionMode sdl2

\brief Set the YUV conversion mode

SDL_SHAPEMODEALPHA sdl2

 

SDL_ShowCursor sdl2

Toggle whether or not the cursor is shown.

The cursor starts off displayed but can be turned off. Passing `SDL_ENABLE` displays the cursor and passing `SDL_DISABLE` hides it.

The current state of the mouse cursor can be queried by passing `SDL_QUERY`; either `SDL_DISABLE` or `SDL_ENABLE` will be returned.

\param toggle `SDL_ENABLE` to show the cursor, `SDL_DISABLE` to hide it, `SDL_QUERY` to query the current state without changing it. \returns `SDL_ENABLE` if the cursor is shown, or `SDL_DISABLE` if the cursor is hidden, or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_CreateCursor \sa SDL_SetCursor

SDL_ShowMessageBox sdl2

Create a modal message box.

messageboxdata The SDL_MessageBoxData structure with title, text, etc. buttonid The pointer to which user id of hit button should be copied.

-1 on error, otherwise 0 and buttonid contains user id of button hit or -1 if dialog was closed.

This function should be called on the thread that created the parent window, or on the main thread if the messagebox has no parent. It will block execution of that thread until the user clicks a button or closes the messagebox.

SDL_ShowSimpleMessageBox sdl2

Create a simple modal message box

flags SDL_MessageBoxFlags title UTF-8 title text message UTF-8 message text window The parent window, or NULL for no parent

0 on success, -1 on error

SDL_ShowMessageBox

SDL_ShowWindow sdl2

Show a window.

SDL_HideWindow()

SDL_SIMDAlloc sdl2

Allocate memory in a SIMD-friendly way.

This will allocate a block of memory that is suitable for use with SIMD instructions. Specifically, it will be properly aligned and padded for the system's supported vector instructions.

The memory returned will be padded such that it is safe to read or write an incomplete vector at the end of the memory block. This can be useful so you don't have to drop back to a scalar fallback at the end of your SIMD processing loop to deal with the final elements without overflowing the allocated buffer.

You must free this memory with SDL_FreeSIMD(), not free() or SDL_free().

Note that SDL will only deal with SIMD instruction sets it is aware of; for example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants 64. To be clear: if you can't decide to use an instruction set with an SDL_Has*() function, don't use that instruction set with memory allocated through here.

SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't out of memory, but you are not allowed to dereference it (because you only own zero bytes of that buffer).

SDL_SIMDFree sdl2

Deallocate memory obtained from SDL_SIMDAlloc.

It is not valid to use this function on a pointer from anything but SDL_SIMDAlloc() or SDL_SIMDRealloc(). It can't be used on pointers from SDL_malloc, GetMem, etc.

However, SDL_SIMDFree(NIL) is a legal no-op.

The memory pointed to by `mem` is no longer valid for access upon return, and may be returned to the system or reused by a future allocation. The pointer passed to this function is no longer safe to dereference once this function returns, and should be discarded.

SDL_SIMDGetAlignment sdl2

Report the alignment this system needs for SIMD allocations.

This will return the minimum number of bytes to which a pointer must be aligned to be compatible with SIMD instructions on the current machine. For example, if the machine supports SSE only, it will return 16, but if it supports AVX-512F, it'll return 64 (etc). This only reports values for instruction sets SDL knows about, so if your SDL build doesn't have SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and not 64 for the AVX-512 instructions that exist but SDL doesn't know about. Plan accordingly.

SDL_SIMDRealloc sdl2

Reallocate memory obtained from SDL_SIMDAlloc.

It is not valid to use this function on a pointer from anything but SDL_SIMDAlloc(). It can't be used on pointers from SDL_malloc, GetMem, etc.

SDL_sin sdl2

Calculate the sine of x, where x is given in radians.

\since This function is available since SDL 2.0.4.

SDL_sinf sdl2

Calculate the sine of x, where x is given in radians.

\since This function is available since SDL 2.0.4.

SDL_SoftStretch sdl2

Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.

This function uses a static buffer, and is not thread-safe.

SDL_sqrt sdl2

Calculate the non-negative square root of x.

\since This function is available since SDL 2.0.4.

SDL_sqrtf sdl2

Calculate the non-negative square root of x.

\since This function is available since SDL 2.0.4.

SDL_StartTextInput sdl2

Start accepting Unicode text input events.

This function will start accepting Unicode text input events in the focused SDL window, and start emitting SDL_TextInputEvent (SDL_TEXTINPUT) and SDL_TextEditingEvent (SDL_TEXTEDITING) events. Please use this function in pair with SDL_StopTextInput().

On some platforms using this function activates the screen keyboard.

\since This function is available since SDL 2.0.0.

\sa SDL_SetTextInputRect \sa SDL_StopTextInput

SDL_StopTextInput sdl2

Stop receiving any text input events.

\since This function is available since SDL 2.0.0.

\sa SDL_StartTextInput

SDL_tan sdl2

Calculate the tangent of x, where x is given in radians.

\since This function is available since SDL 2.0.4.

SDL_tanf sdl2

Calculate the tangent of x, where x is given in radians.

\since This function is available since SDL 2.0.4.

SDL_ThreadID sdl2

Get the thread identifier for the current thread.

SDL_TICKS_PASSED sdl2

Type conversion unnecessary bc. types are declared in func. param. list!

SDL_TLSCreate sdl2

Create an identifier that is globally visible to all threads but refers to data that is thread-specific.

The newly created thread local storage identifier, or 0 on error

var tls_lock: TSDL_SpinLock; thread_local_storage: TSDL_TLSID;

procedure SetMyThreadData(value: Pointer)

if not (thread_local_storage) then begin SDL_AtomicLock(@tls_lock); if (!thread_local_storage) thread_local_storage = SDL_TLSCreate();

SDL_AtomicUnLock(@tls_lock);

SDL_TLSSet(thread_local_storage, value); end;

function GetMyThreadData(): Pointer; begin Result := SDL_TLSGet(thread_local_storage); end;

SDL_TLSGet() SDL_TLSSet()

SDL_TLSGet sdl2

Get the value associated with a thread local storage ID for the current thread.

id The thread local storage ID

The value associated with the ID for the current thread, or NULL if no value has been set.

SDL_TLSCreate() SDL_TLSSet()

SDL_TLSSet sdl2

Set the value associated with a thread local storage ID for the current thread.

id The thread local storage ID value The value to associate with the ID for the current thread destructor_ A function called when the thread exits, to free the value.

0 on success, -1 on error

SDL_TLSCreate() SDL_TLSGet()

SDL_tolower sdl2

If the given ASCII character is an uppercase letter, converts it to lowercase. Otherwise returns the original value.

\since This function is available since SDL 2.0.4.

SDL_toupper sdl2

If the given ASCII character is a lowercase letter, converts it to uppercase. Otherwise returns the original value.

\since This function is available since SDL 2.0.4.

SDL_trunc sdl2

Round to nearest integral value, towards zero.

\since This function is available since SDL 2.0.14.

SDL_truncf sdl2

Round to nearest integral value, towards zero.

\since This function is available since SDL 2.0.14.

SDL_TryLockMutex sdl2

Try to lock a mutex without blocking.

This works just like SDL_LockMutex(), but if the mutex is not available, this function returns SDL_MUTEX_TIMEDOUT immediately.

This technique is useful if you need exclusive access to a resource but don't want to wait for it, and will return to it to try again later.

\param mutex the mutex to try to lock \returns 0, SDL_MUTEX_TIMEDOUT, or -1 on error; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

SDL_TTF_VERSION sdl2_ttf

 

SDL_TTF_VERSION_ATLEAST sdl2_ttf

This macro will evaluate to true if compiled with SDL_ttf at least X.Y.Z.

SDL_UnionFRect sdl2

Calculate the union of two rectangles with float precision.

\param A an SDL_FRect structure representing the first rectangle \param B an SDL_FRect structure representing the second rectangle \param result an SDL_FRect structure filled in with the union of rectangles `A` and `B`

\since This function is available since SDL 2.0.22.

SDL_UnionRect sdl2

Calculate the union of two rectangles.

SDL_UnloadObject sdl2

Unload a shared object from memory.

\param handle a valid shared object handle returned by SDL_LoadObject()

\since This function is available since SDL 2.0.0.

\sa SDL_LoadFunction \sa SDL_LoadObject

SDL_UnlockAudio sdl2

This function is a legacy means of unlocking the audio device.

New programs might want to use SDL_UnlockAudioDevice() instead. This function is equivalent to calling...

```c SDL_UnlockAudioDevice(1); ```

...and is only useful if you used the legacy SDL_OpenAudio() function.

\since This function is available since SDL 2.0.0.

\sa SDL_LockAudio \sa SDL_UnlockAudioDevice

SDL_UnlockAudioDevice sdl2

Use this function to unlock the audio callback function for a specified device.

This function should be paired with a previous SDL_LockAudioDevice() call.

\param dev the ID of the device to be unlocked

\since This function is available since SDL 2.0.0.

\sa SDL_LockAudioDevice

SDL_UnlockJoysticks sdl2

Unlocking for multi-threaded access to the joystick API

If you are using the joystick API or handling events from multiple threads you should use these locking functions to protect access to the joysticks.

In particular, you are guaranteed that the joystick list won't change, so the API functions that take a joystick index will be valid, and joystick and game controller events will not be delivered.

\since This function is available since SDL 2.0.7.

SDL_UnlockMutex sdl2

Unlock the mutex.

It is legal for the owning thread to lock an already-locked mutex. It must unlock it the same number of times before it is actually made available for other threads in the system (this is known as a "recursive mutex").

It is an error to unlock a mutex that has not been locked by the current thread, and doing so results in undefined behavior.

It is also an error to unlock a mutex that isn't locked at all.

\param mutex the mutex to unlock. \returns 0, or -1 on error.

\since This function is available since SDL 2.0.0.

SDL_UnlockSensors sdl2

 

SDL_UnlockSurface sdl2

SDL_LockSurface() *

SDL_UnlockTexture sdl2

Unlock a texture, uploading the changes to video memory, if needed.

SDL_LockTexture()

SDL_UpdateNVTexture sdl2

Update a rectangle within a planar NV12 or NV21 texture with new pixels.

You can use SDL_UpdateTexture() as long as your pixel data is a contiguous block of NV12/21 planes in the proper order, but this function is available if your pixel data is not contiguous.

SDL_UpdateTexture sdl2

Update the given texture rectangle with new pixel data.

texture The texture to update rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. pixels The raw pixel data. pitch The number of bytes between rows of pixel data.

0 on success, or -1 if the texture is not valid.

This is a fairly slow function.

SDL_UpdateWindowSurface sdl2

Copy the window surface to the screen.

0 on success, or -1 on error.

SDL_GetWindowSurface() SDL_UpdateWindowSurfaceRects()

SDL_UpdateWindowSurfaceRects sdl2

Copy a number of rectangles on the window surface to the screen.

0 on success, or -1 on error.

SDL_GetWindowSurface() SDL_UpdateWindowSurfaceRect()

SDL_UpdateYUVTexture sdl2

Update a rectangle within a planar YV12 or IYUV texture with new pixel data.

texture The texture to update rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. Yplane The raw pixel data for the Y plane. Ypitch The number of bytes between rows of pixel data for the Y plane. Uplane The raw pixel data for the U plane. Upitch The number of bytes between rows of pixel data for the U plane. Vplane The raw pixel data for the V plane. Vpitch The number of bytes between rows of pixel data for the V plane.

0 on success, or -1 if the texture is not valid.

You can use SDL_UpdateTexture() as long as your pixel data is a contiguous block of Y and U/V planes in the proper order, but this function is available if your pixel data is not contiguous.

SDL_UpperBlit sdl2

This is the public blit function, SDL_BlitSurface(), and it performs rectangle validation and clipping before passing it to SDL_LowerBlit()

SDL_UpperBlitScaled sdl2

This is the public scaled blit function, SDL_BlitScaled(), and it performs rectangle validation and clipping before passing it to SDL_LowerBlitScaled()

SDL_VERSION sdl2

Macro to determine SDL version program was compiled against.

This macro fills in a SDL_version structure with the version of the library you compiled against. This is determined by what header the compiler uses. Note that if you dynamically linked the library, you might have a slightly newer or older version at runtime. That version can be determined with SDL_GetVersion(), which, unlike SDL_VERSION(), is not a macro.

x An instance on TSDL_Version to fill with version data.

SDL_version SDL_GetVersion

SDL_VERSIONNUM sdl2

This macro turns the version numbers into a numeric value:

(1,2,3) -> (1203)

This assumes that there will never be more than 100 patchlevels.

SDL_VERSION_ATLEAST sdl2

This macro will evaluate to true if compiled with SDL at least X.Y.Z.

SDL_VideoInit sdl2

Initialize the video subsystem, optionally specifying a video driver.

driver_name Initialize a specific driver by name, or nil for the default video driver.

0 on success, -1 on error

This function initializes the video subsystem; setting up a connection to the window manager, etc, and determines the available display modes and pixel formats, but does not initialize a window or graphics mode.

SDL_VideoQuit()

SDL_VideoQuit sdl2

Shuts down the video subsystem.

function closes all windows, and restores the original video mode.

SDL_VideoInit()

SDL_WaitEvent sdl2

Waits indefinitely for the next available event.

1, or 0 if there was an error while waiting for events.

event - If not nil, the next event is removed from the queue and stored in that area.

SDL_WaitEventTimeout sdl2

Waits until the specified timeout (in milliseconds) for the next available event.

1, or 0 if there was an error while waiting for events.

event - If not nil, the next event is removed from the queue and stored in that area.

SDL_WaitThread sdl2

Wait for a thread to finish.

The return code for the thread function is placed in the area pointed to by status, if status is not NULL.

SDL_WarpMouseGlobal sdl2

Move the mouse to the given position in global screen space.

This function generates a mouse motion event.

A failure of this function usually means that it is unsupported by a platform.

Note that this function will appear to succeed, but not actually move the mouse when used over Microsoft Remote Desktop.

\param x the x coordinate \param y the y coordinate \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.4.

\sa SDL_WarpMouseInWindow

SDL_WarpMouseInWindow sdl2

Move the mouse cursor to the given position within the window.

This function generates a mouse motion event if relative mode is not enabled. If relative mode is enabled, you can force mouse events for the warp by setting the SDL_HINT_MOUSE_RELATIVE_WARP_MOTION hint.

Note that this function will appear to succeed, but not actually move the mouse when used over Microsoft Remote Desktop.

\param window the window to move the mouse into, or NULL for the current mouse focus \param x the x coordinate within the window \param y the y coordinate within the window

\since This function is available since SDL 2.0.0.

\sa SDL_WarpMouseGlobal

SDL_WasInit sdl2

This function returns a mask of the specified subsystems which have previously been initialized.

If flags is 0, it returns a mask of all initialized subsystems.

SDL_WINDOWPOS_CENTERED_DISPLAY sdl2

 

SDL_WINDOWPOS_ISCENTERED sdl2

 

SDL_WINDOWPOS_ISUNDEFINED sdl2

 

SDL_WINDOWPOS_UNDEFINED_DISPLAY sdl2

 

SDL_WriteBE16 sdl2

 

SDL_WriteBE32 sdl2

 

SDL_WriteBE64 sdl2

 

SDL_WriteLE16 sdl2

 

SDL_WriteLE32 sdl2

 

SDL_WriteLE64 sdl2

 

SDL_WriteU8 sdl2

Write endian functions

Write an item of native format to the specified endianness.

shrinkSurface sdl2_gfx

Shrinking functions

stringColor sdl2_gfx

 

stringRGBA sdl2_gfx

 

texturedPolygon sdl2_gfx

Textured Polygon

thickLineColor sdl2_gfx

Thick Line

thickLineRGBA sdl2_gfx

 

trigonColor sdl2_gfx

Trigon

trigonRGBA sdl2_gfx

 

TTF_ByteSwappedUNICODE sdl2_ttf

Tell SDL_ttf whether UNICODE text is generally byteswapped.

A UNICODE BOM character in a string will override this setting for the remainder of that string.

\param swapped boolean to indicate whether text is byteswapped

\since This function is available since SDL_ttf 2.0.12.

TTF_CloseFont sdl2_ttf

Dispose of a previously-created font.

Call this when done with a font. This function will free any resources associated with it. It is safe to call this function on nil, for example on the result of a failed call to TTF_OpenFont().

The font is not valid after being passed to this function. String pointers from functions that return information on this font, such as TTF_FontFaceFamilyName() and TTF_FontFaceStyleName(), are no longer valid after this call, as well.

\param font the font to dispose of.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_OpenFontIndexDPIRW \sa TTF_OpenFontRW \sa TTF_OpenFontDPI \sa TTF_OpenFontDPIRW \sa TTF_OpenFontIndex \sa TTF_OpenFontIndexDPI \sa TTF_OpenFontIndexDPIRW \sa TTF_OpenFontIndexRW

TTF_FontAscent sdl2_ttf

Query the offset from the baseline to the top of a font.

This is a positive value, relative to the baseline.

\param font the font to query. \returns the font's ascent.

\since This function is available since SDL_ttf 2.0.12.

TTF_FontDescent sdl2_ttf

Query the offset from the baseline to the bottom of a font.

This is a negative value, relative to the baseline.

\param font the font to query. \returns the font's descent.

\since This function is available since SDL_ttf 2.0.12.

TTF_FontFaceFamilyName sdl2_ttf

Query a font's family name.

This string is dictated by the contents of the font file.

Note that the returned string is to internal storage, and should not be modifed or free'd by the caller. The string becomes invalid, with the rest of the font, when `font` is handed to TTF_CloseFont().

\param font the font to query. \returns the font's family name.

\since This function is available since SDL_ttf 2.0.12.

TTF_FontFaceIsFixedWidth sdl2_ttf

Query whether a font is fixed-width.

A "fixed-width" font means all glyphs are the same width across; a lowercase 'i' will be the same size across as a capital 'W', for example. This is common for terminals and text editors, and other apps that treat text as a grid. Most other things (WYSIWYG word processors, web pages, etc) are more likely to not be fixed-width in most cases.

\param font the font to query. \returns non-zero if fixed-width, zero if not.

\since This function is available since SDL_ttf 2.0.12.

TTF_FontFaces sdl2_ttf

Query the number of faces of a font.

\param font the font to query. \returns the number of FreeType font faces.

\since This function is available since SDL_ttf 2.0.12.

TTF_FontFaceStyleName sdl2_ttf

Query a font's style name.

This string is dictated by the contents of the font file.

Note that the returned string is to internal storage, and should not be modifed or free'd by the caller. The string becomes invalid, with the rest of the font, when `font` is handed to TTF_CloseFont().

\param font the font to query. \returns the font's style name.

\since This function is available since SDL_ttf 2.0.12.

TTF_FontHeight sdl2_ttf

Query the total height of a font.

This is usually equal to point size.

\param font the font to query. \returns the font's height.

\since This function is available since SDL_ttf 2.0.12.

TTF_FontLineSkip sdl2_ttf

Query the recommended spacing between lines of text for a font.

\param font the font to query. \returns the font's recommended spacing.

\since This function is available since SDL_ttf 2.0.12.

TTF_GetError sdl2_ttf

Get last SDL_ttf error

\sa TTF_SetError

TTF_GetFontHinting sdl2_ttf

Query a font's current FreeType hinter setting.

The hinter setting is a single value:

- `TTF_HINTING_NORMAL` - `TTF_HINTING_LIGHT` - `TTF_HINTING_MONO` - `TTF_HINTING_NONE` - `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 2.0.18 and later)

\param font the font to query. \returns the font's current hinter value.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_SetFontHinting

TTF_GetFontKerning sdl2_ttf

Query whether or not kerning is allowed for a font.

\param font the font to query. \returns non-zero if kerning is enabled, zero otherwise.

\since This function is available since SDL_ttf 2.0.12.

TTF_GetFontKerningSize sdl2_ttf

Query the kerning size of two glyphs indices.

\deprecated This function accidentally requires FreeType font indexes, not codepoints, which we don't expose through this API, so it could give wildly incorrect results, especially with non-ASCII values. Going forward, please use TTF_GetFontKerningSizeGlyphs() instead, which does what you probably expected this function to do.

\param font the font to query. \param prev_index the font index, NOT codepoint, of the previous character. \param index the font index, NOT codepoint, of the current character. \returns The kerning size between the two specified characters, in pixels, or -1 on error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_GetFontKerningSizeGlyphs

TTF_GetFontKerningSizeGlyphs sdl2_ttf

Query the kerning size of two 16-bit glyphs.

Note that this version of the function takes 16-bit character codes, which covers the Basic Multilingual Plane, but is insufficient to cover the entire set of possible Unicode values, including emoji glyphs. You should use TTF_GetFontKerningSizeGlyphs32() instead, which offers the same functionality but takes a 32-bit codepoints instead.

The only reason to use this function is that it was available since the beginning of time, more or less.

\param font the font to query. \param previous_ch the previous character's code, 16 bits. \param ch the current character's code, 16 bits. \returns The kerning size between the two specified characters, in pixels, or -1 on error.

\since This function is available since SDL_ttf 2.0.14.

\sa TTF_GetFontKerningSizeGlyphs32

TTF_GetFontKerningSizeGlyphs32 sdl2_ttf

Query the kerning size of two 32-bit glyphs.

This is the same as TTF_GetFontKerningSizeGlyphs(), but takes 32-bit characters instead of 16-bit, and thus can manage a larger range. If you are sure you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason not to use this function exclusively.

\param font the font to query. \param previous_ch the previous character's code, 32 bits. \param ch the current character's code, 32 bits. \returns The kerning size between the two specified characters, in pixels, or -1 on error.

\since This function is available since SDL_ttf 2.0.18.

TTF_GetFontOutline sdl2_ttf

Query a font's current outline.

\param font the font to query. \returns the font's current outline value.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_SetFontOutline

TTF_GetFontSDF sdl2_ttf

Const before type ignored

TTF_GetFontStyle sdl2_ttf

Query a font's current style.

The font styles are a set of bit flags, OR'd together:

- `TTF_STYLE_NORMAL` (is zero) - `TTF_STYLE_BOLD` - `TTF_STYLE_ITALIC` - `TTF_STYLE_UNDERLINE` - `TTF_STYLE_STRIKETHROUGH`

\param font the font to query. \returns the current font style, as a set of bit flags.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_SetFontStyle

TTF_GetFontWrappedAlign sdl2_ttf

Query a font's current wrap alignment option.

The wrap alignment option can be one of the following:

- `TTF_WRAPPED_ALIGN_LEFT` - `TTF_WRAPPED_ALIGN_CENTER` - `TTF_WRAPPED_ALIGN_RIGHT`

\param font the font to query. \returns the font's current wrap alignment option.

\since This function is available since SDL_ttf 2.20.0.

\sa TTF_SetFontWrappedAlign

TTF_GetFreeTypeVersion sdl2_ttf

Query the version of the FreeType library in use.

TTF_Init() should be called before calling this function.

\param major to be filled in with the major version number. Can be nil. \param minor to be filled in with the minor version number. Can be nil. \param patch to be filled in with the param version number. Can be nil.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_Init

TTF_GetHarfBuzzVersion sdl2_ttf

Query the version of the HarfBuzz library in use.

If HarfBuzz is not available, the version reported is 0.0.0.

\param major to be filled in with the major version number. Can be nil. \param minor to be filled in with the minor version number. Can be nil. \param patch to be filled in with the param version number. Can be nil.

\since This function is available since SDL_ttf 2.0.18.

TTF_GlyphIsProvided sdl2_ttf

Check whether a glyph is provided by the font for a 16-bit codepoint.

Note that this version of the function takes a 16-bit character code, which covers the Basic Multilingual Plane, but is insufficient to cover the entire set of possible Unicode values, including emoji glyphs. You should use TTF_GlyphIsProvided32() instead, which offers the same functionality but takes a 32-bit codepoint instead.

The only reason to use this function is that it was available since the beginning of time, more or less.

\param font the font to query. \param ch the character code to check. \returns non-zero if font provides a glyph for this character, zero if not.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_GlyphIsProvided32

TTF_GlyphIsProvided32 sdl2_ttf

Check whether a glyph is provided by the font for a 32-bit codepoint.

This is the same as TTF_GlyphIsProvided(), but takes a 32-bit character instead of 16-bit, and thus can query a larger range. If you are sure you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason not to use this function exclusively.

\param font the font to query. \param ch the character code to check. \returns non-zero if font provides a glyph for this character, zero if not.

\since This function is available since SDL_ttf 2.0.18.

TTF_GlyphMetrics sdl2_ttf

Query the metrics (dimensions) of a font's 16-bit glyph.

To understand what these metrics mean, here is a useful link:

https://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html

Note that this version of the function takes a 16-bit character code, which covers the Basic Multilingual Plane, but is insufficient to cover the entire set of possible Unicode values, including emoji glyphs. You should use TTF_GlyphMetrics32() instead, which offers the same functionality but takes a 32-bit codepoint instead.

The only reason to use this function is that it was available since the beginning of time, more or less.

\param font the font to query. \param ch the character code to check.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_GlyphMetrics32

TTF_GlyphMetrics32 sdl2_ttf

Query the metrics (dimensions) of a font's 32-bit glyph.

To understand what these metrics mean, here is a useful link:

https://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html

This is the same as TTF_GlyphMetrics(), but takes a 32-bit character instead of 16-bit, and thus can query a larger range. If you are sure you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason not to use this function exclusively.

\param font the font to query. \param ch the character code to check.

\since This function is available since SDL_ttf 2.0.18.

TTF_Init sdl2_ttf

Initialize SDL_ttf.

You must successfully call this function before it is safe to call any other function in this library, with one exception: a human-readable error message can be retrieved from TTF_GetError() if this function fails.

SDL must be initialized before calls to functions in this library, because this library uses utility functions from the SDL library.

It is safe to call this more than once; the library keeps a counter of init calls, and decrements it on each call to TTF_Quit, so you must pair your init and quit calls.

\returns 0 on success, -1 on error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_Quit

TTF_Linked_Version sdl2_ttf

Const before type ignored

TTF_MeasureText sdl2_ttf

Calculate how much of a Latin1 string will fit in a given width.

This reports the number of characters that can be rendered before reaching `measure_width`.

This does not need to render the string to do this calculation.

You almost certainly want TTF_MeasureUTF8() unless you're sure you have a 1-byte Latin1 encoding. US ASCII characters will work with either function, but most other Unicode characters packed into a `const char *` will need UTF-8.

\param font the font to query. \param text text to calculate, in Latin1 encoding. \param measure_width maximum width, in pixels, available for the string. \param count on return, filled with number of characters that can be rendered. \param extent on return, filled with latest calculated width. \returns 0 if successful, -1 on error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_MeasureText \sa TTF_MeasureUTF8 \sa TTF_MeasureUNICODE

TTF_MeasureUNICODE sdl2_ttf

Calculate how much of a UCS-2 string will fit in a given width.

This reports the number of characters that can be rendered before reaching `measure_width`.

This does not need to render the string to do this calculation.

Please note that this function is named "Unicode" but currently expects UCS-2 encoding (16 bits per codepoint). This does not give you access to large Unicode values, such as emoji glyphs. These codepoints are accessible through the UTF-8 version of this function.

\param font the font to query. \param text text to calculate, in UCS-2 encoding. \param measure_width maximum width, in pixels, available for the string. \param count on return, filled with number of characters that can be rendered. \param extent on return, filled with latest calculated width. \returns 0 if successful, -1 on error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_MeasureText \sa TTF_MeasureUTF8 \sa TTF_MeasureUNICODE

TTF_MeasureUTF8 sdl2_ttf

Calculate how much of a UTF-8 string will fit in a given width.

This reports the number of characters that can be rendered before reaching `measure_width`.

This does not need to render the string to do this calculation.

\param font the font to query. \param text text to calculate, in UTF-8 encoding. \param measure_width maximum width, in pixels, available for the string. \param count on return, filled with number of characters that can be rendered. \param extent on return, filled with latest calculated width. \returns 0 if successful, -1 on error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_MeasureText \sa TTF_MeasureUTF8 \sa TTF_MeasureUNICODE

TTF_OpenFont sdl2_ttf

Create a font from a file, using a specified point size.

Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.

When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.

\param file path to font file. \param ptsize point size to use for the newly-opened font. \returns a valid TTF_Font, or nil on error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_CloseFont

TTF_OpenFontDPI sdl2_ttf

Create a font from a file, using target resolutions (in DPI).

DPI scaling only applies to scalable fonts (e.g. TrueType).

Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.

When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.

\param file path to font file. \param ptsize point size to use for the newly-opened font. \param hdpi the target horizontal DPI. \param vdpi the target vertical DPI. \returns a valid TTF_Font, or nil on error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_CloseFont

TTF_OpenFontDPIRW sdl2_ttf

Opens a font from an SDL_RWops with target resolutions (in DPI).

DPI scaling only applies to scalable fonts (e.g. TrueType).

Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.

If `freesrc` is non-zero, the RWops will be closed before returning, whether this function succeeds or not. SDL_ttf reads everything it needs from the RWops during this call in any case.

When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.

\param src an SDL_RWops to provide a font file's data. \param freesrc non-zero to close the RWops before returning, zero to leave it open. \param ptsize point size to use for the newly-opened font. \param hdpi the target horizontal DPI. \param vdpi the target vertical DPI. \returns a valid TTF_Font, or nil on error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_CloseFont

TTF_OpenFontIndex sdl2_ttf

Create a font from a file, using a specified face index.

Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.

Some fonts have multiple "faces" included. The index specifies which face to use from the font file. Font files with only one face should specify zero for the index.

When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.

\param file path to font file. \param ptsize point size to use for the newly-opened font. \param index index of the face in the font file. \returns a valid TTF_Font, or nil on error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_CloseFont

TTF_OpenFontIndexDPI sdl2_ttf

Create a font from a file, using target resolutions (in DPI).

DPI scaling only applies to scalable fonts (e.g. TrueType).

Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.

Some fonts have multiple "faces" included. The index specifies which face to use from the font file. Font files with only one face should specify zero for the index.

When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.

\param file path to font file. \param ptsize point size to use for the newly-opened font. \param index index of the face in the font file. \param hdpi the target horizontal DPI. \param vdpi the target vertical DPI. \returns a valid TTF_Font, or nil on error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_CloseFont

TTF_OpenFontIndexDPIRW sdl2_ttf

Opens a font from an SDL_RWops with target resolutions (in DPI).

DPI scaling only applies to scalable fonts (e.g. TrueType).

Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.

If `freesrc` is non-zero, the RWops will be closed before returning, whether this function succeeds or not. SDL_ttf reads everything it needs from the RWops during this call in any case.

Some fonts have multiple "faces" included. The index specifies which face to use from the font file. Font files with only one face should specify zero for the index.

When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.

\param src an SDL_RWops to provide a font file's data. \param freesrc non-zero to close the RWops before returning, zero to leave it open. \param ptsize point size to use for the newly-opened font. \param index index of the face in the font file. \param hdpi the target horizontal DPI. \param vdpi the target vertical DPI. \returns a valid TTF_Font, or nil on error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_CloseFont

TTF_OpenFontIndexRW sdl2_ttf

Create a font from an SDL_RWops, using a specified face index.

Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.

If `freesrc` is non-zero, the RWops will be closed before returning, whether this function succeeds or not. SDL_ttf reads everything it needs from the RWops during this call in any case.

Some fonts have multiple "faces" included. The index specifies which face to use from the font file. Font files with only one face should specify zero for the index.

When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.

\param src an SDL_RWops to provide a font file's data. \param freesrc non-zero to close the RWops before returning, zero to leave it open. \param ptsize point size to use for the newly-opened font. \param index index of the face in the font file. \returns a valid TTF_Font, or nil on error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_CloseFont

TTF_OpenFontRW sdl2_ttf

Create a font from an SDL_RWops, using a specified point size.

Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.

If `freesrc` is non-zero, the RWops will be closed before returning, whether this function succeeds or not. SDL_ttf reads everything it needs from the RWops during this call in any case.

When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.

\param src an SDL_RWops to provide a font file's data. \param freesrc non-zero to close the RWops before returning, zero to leave it open. \param ptsize point size to use for the newly-opened font. \returns a valid TTF_Font, or nil on error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_CloseFont

TTF_Quit sdl2_ttf

Deinitialize SDL_ttf.

You must call this when done with the library, to free internal resources. It is safe to call this when the library isn't initialized, as it will just return immediately.

Once you have as many quit calls as you have had successful calls to TTF_Init, the library will actually deinitialize.

Please note that this does not automatically close any fonts that are still open at the time of deinitialization, and it is possibly not safe to close them afterwards, as parts of the library will no longer be initialized to deal with it. A well-written program should call TTF_CloseFont() on any open fonts before calling this function!

\since This function is available since SDL_ttf 2.0.12.

TTF_RenderGlyph32_Blended sdl2_ttf

Render a single 32-bit glyph at high quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nil if there was an error.

The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.

This is the same as TTF_RenderGlyph_Blended(), but takes a 32-bit character instead of 16-bit, and thus can render a larger range. If you are sure you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason not to use this function exclusively.

You can render at other quality levels with TTF_RenderGlyph32_Solid, TTF_RenderGlyph32_Shaded, and TTF_RenderGlyph32_LCD.

\param font the font to render with. \param ch the character to render. \param fg the foreground color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderGlyph32_Solid \sa TTF_RenderGlyph32_Shaded \sa TTF_RenderGlyph32_LCD

TTF_RenderGlyph32_LCD sdl2_ttf

Render a single 32-bit glyph at LCD subpixel quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nil if there was an error.

The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.

This is the same as TTF_RenderGlyph_LCD(), but takes a 32-bit character instead of 16-bit, and thus can render a larger range. Between the two, you should always use this function.

You can render at other quality levels with TTF_RenderGlyph32_Solid, TTF_RenderGlyph32_Shaded, and TTF_RenderGlyph32_Blended.

\param font the font to render with. \param ch the character to render. \param fg the foreground color for the text. \param bg the background color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.20.0.

\sa TTF_RenderGlyph32_Solid \sa TTF_RenderGlyph32_Shaded \sa TTF_RenderGlyph32_Blended

TTF_RenderGlyph32_Shaded sdl2_ttf

Render a single 32-bit glyph at high quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nil if there was an error.

The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.

This is the same as TTF_RenderGlyph_Shaded(), but takes a 32-bit character instead of 16-bit, and thus can render a larger range. If you are sure you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason not to use this function exclusively.

You can render at other quality levels with TTF_RenderGlyph32_Solid, TTF_RenderGlyph32_Blended, and TTF_RenderGlyph32_LCD.

\param font the font to render with. \param ch the character to render. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderGlyph32_Solid \sa TTF_RenderGlyph32_Blended \sa TTF_RenderGlyph32_LCD

TTF_RenderGlyph32_Solid sdl2_ttf

Render a single 32-bit glyph at fast quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.

The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.

This is the same as TTF_RenderGlyph_Solid(), but takes a 32-bit character instead of 16-bit, and thus can render a larger range. If you are sure you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason not to use this function exclusively.

You can render at other quality levels with TTF_RenderGlyph32_Shaded, TTF_RenderGlyph32_Blended, and TTF_RenderGlyph32_LCD.

\param font the font to render with. \param ch the character to render. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderGlyph32_Shaded \sa TTF_RenderGlyph32_Blended \sa TTF_RenderGlyph32_LCD

TTF_RenderGlyph_Blended sdl2_ttf

Render a single 16-bit glyph at high quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nil if there was an error.

The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.

Note that this version of the function takes a 16-bit character code, which covers the Basic Multilingual Plane, but is insufficient to cover the entire set of possible Unicode values, including emoji glyphs. You should use TTF_RenderGlyph32_Blended() instead, which offers the same functionality but takes a 32-bit codepoint instead.

The only reason to use this function is that it was available since the beginning of time, more or less.

You can render at other quality levels with TTF_RenderGlyph_Solid, TTF_RenderGlyph_Shaded, and TTF_RenderGlyph_LCD.

\param font the font to render with. \param ch the character to render. \param fg the foreground color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderGlyph32_Blended

TTF_RenderGlyph_LCD sdl2_ttf

Render a single 16-bit glyph at LCD subpixel quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nil if there was an error.

The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.

Note that this version of the function takes a 16-bit character code, which covers the Basic Multilingual Plane, but is insufficient to cover the entire set of possible Unicode values, including emoji glyphs. You should use TTF_RenderGlyph32_LCD() instead, which offers the same functionality but takes a 32-bit codepoint instead.

This function only exists for consistency with the existing API at the time of its addition.

You can render at other quality levels with TTF_RenderGlyph_Solid, TTF_RenderGlyph_Shaded, and TTF_RenderGlyph_Blended.

\param font the font to render with. \param ch the character to render. \param fg the foreground color for the text. \param bg the background color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.20.0.

\sa TTF_RenderGlyph32_LCD

TTF_RenderGlyph_Shaded sdl2_ttf

Render a single 16-bit glyph at high quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nil if there was an error.

The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.

Note that this version of the function takes a 16-bit character code, which covers the Basic Multilingual Plane, but is insufficient to cover the entire set of possible Unicode values, including emoji glyphs. You should use TTF_RenderGlyph32_Shaded() instead, which offers the same functionality but takes a 32-bit codepoint instead.

The only reason to use this function is that it was available since the beginning of time, more or less.

You can render at other quality levels with TTF_RenderGlyph_Solid, TTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.

\param font the font to render with. \param ch the character to render. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderGlyph32_Shaded

TTF_RenderGlyph_Solid sdl2_ttf

Render a single 16-bit glyph at fast quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.

The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.

Note that this version of the function takes a 16-bit character code, which covers the Basic Multilingual Plane, but is insufficient to cover the entire set of possible Unicode values, including emoji glyphs. You should use TTF_RenderGlyph32_Solid() instead, which offers the same functionality but takes a 32-bit codepoint instead.

The only reason to use this function is that it was available since the beginning of time, more or less.

You can render at other quality levels with TTF_RenderGlyph_Shaded, TTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.

\param font the font to render with. \param ch the character to render. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderGlyph32_Solid

TTF_RenderText sdl2_ttf

For compatibility with previous versions, here are the old functions *

TTF_RenderText_Blended sdl2_ttf

Render Latin1 text at high quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nil if there was an error.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderText_Blended_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

You almost certainly want TTF_RenderUTF8_Blended() unless you're sure you have a 1-byte Latin1 encoding. US ASCII characters will work with either function, but most other Unicode characters packed into a `const char *` will need UTF-8.

You can render at other quality levels with TTF_RenderText_Solid, TTF_RenderText_Blended, and TTF_RenderText_LCD.

\param font the font to render with. \param text text to render, in Latin1 encoding. \param fg the foreground color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderUTF8_Shaded \sa TTF_RenderUNICODE_Shaded

TTF_RenderText_Blended_Wrapped sdl2_ttf

Render word-wrapped Latin1 text at high quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nil if there was an error.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

You almost certainly want TTF_RenderUTF8_Blended_Wrapped() unless you're sure you have a 1-byte Latin1 encoding. US ASCII characters will work with either function, but most other Unicode characters packed into a `const char *` will need UTF-8.

You can render at other quality levels with TTF_RenderText_Solid_Wrapped, TTF_RenderText_Shaded_Wrapped, and TTF_RenderText_LCD_Wrapped.

\param font the font to render with. \param text text to render, in Latin1 encoding. \param fg the foreground color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderUTF8_Blended_Wrapped \sa TTF_RenderUNICODE_Blended_Wrapped

TTF_RenderText_LCD sdl2_ttf

Render Latin1 text at LCD subpixel quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nil if there was an error.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderText_LCD_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

You almost certainly want TTF_RenderUTF8_LCD() unless you're sure you have a 1-byte Latin1 encoding. US ASCII characters will work with either function, but most other Unicode characters packed into a `const char *` will need UTF-8.

You can render at other quality levels with TTF_RenderText_Solid, TTF_RenderText_Shaded, and TTF_RenderText_Blended.

\param font the font to render with. \param text text to render, in Latin1 encoding. \param fg the foreground color for the text. \param bg the background color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.20.0.

\sa TTF_RenderUTF8_LCD \sa TTF_RenderUNICODE_LCD

TTF_RenderText_LCD_Wrapped sdl2_ttf

Render word-wrapped Latin1 text at LCD subpixel quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nil if there was an error.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

You almost certainly want TTF_RenderUTF8_LCD_Wrapped() unless you're sure you have a 1-byte Latin1 encoding. US ASCII characters will work with either function, but most other Unicode characters packed into a `const char *` will need UTF-8.

You can render at other quality levels with TTF_RenderText_Solid_Wrapped, TTF_RenderText_Shaded_Wrapped, and TTF_RenderText_Blended_Wrapped.

\param font the font to render with. \param text text to render, in Latin1 encoding. \param fg the foreground color for the text. \param bg the background color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.20.0.

\sa TTF_RenderUTF8_LCD_Wrapped \sa TTF_RenderUNICODE_LCD_Wrapped

TTF_RenderText_Shaded sdl2_ttf

Render Latin1 text at high quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nil if there was an error.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderText_Shaded_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

You almost certainly want TTF_RenderUTF8_Shaded() unless you're sure you have a 1-byte Latin1 encoding. US ASCII characters will work with either function, but most other Unicode characters packed into a `const char *` will need UTF-8.

You can render at other quality levels with TTF_RenderText_Solid, TTF_RenderText_Blended, and TTF_RenderText_LCD.

\param font the font to render with. \param text text to render, in Latin1 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderUTF8_Shaded \sa TTF_RenderUNICODE_Shaded

TTF_RenderText_Shaded_Wrapped sdl2_ttf

Render word-wrapped Latin1 text at high quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nil if there was an error.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

You almost certainly want TTF_RenderUTF8_Shaded_Wrapped() unless you're sure you have a 1-byte Latin1 encoding. US ASCII characters will work with either function, but most other Unicode characters packed into a `const char *` will need UTF-8.

You can render at other quality levels with TTF_RenderText_Solid_Wrapped, TTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.

\param font the font to render with. \param text text to render, in Latin1 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderUTF8_Shaded_Wrapped \sa TTF_RenderUNICODE_Shaded_Wrapped

TTF_RenderText_Solid sdl2_ttf

Render Latin1 text at fast quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderText_Solid_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

You almost certainly want TTF_RenderUTF8_Solid() unless you're sure you have a 1-byte Latin1 encoding. US ASCII characters will work with either function, but most other Unicode characters packed into a `const char *` will need UTF-8.

You can render at other quality levels with TTF_RenderText_Shaded, TTF_RenderText_Blended, and TTF_RenderText_LCD.

\param font the font to render with. \param text text to render, in Latin1 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderUTF8_Solid \sa TTF_RenderUNICODE_Solid

TTF_RenderText_Solid_Wrapped sdl2_ttf

Render word-wrapped Latin1 text at fast quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

You almost certainly want TTF_RenderUTF8_Solid_Wrapped() unless you're sure you have a 1-byte Latin1 encoding. US ASCII characters will work with either function, but most other Unicode characters packed into a `const char *` will need UTF-8.

You can render at other quality levels with TTF_RenderText_Shaded_Wrapped, TTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.

\param font the font to render with. \param text text to render, in Latin1 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderUTF8_Solid_Wrapped \sa TTF_RenderUNICODE_Solid_Wrapped

TTF_RenderUNICODE sdl2_ttf

 

TTF_RenderUNICODE_Blended sdl2_ttf

Render UCS-2 text at high quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nil if there was an error.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderUNICODE_Blended_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

Please note that this function is named "Unicode" but currently expects UCS-2 encoding (16 bits per codepoint). This does not give you access to large Unicode values, such as emoji glyphs. These codepoints are accessible through the UTF-8 version of this function.

You can render at other quality levels with TTF_RenderUNICODE_Solid, TTF_RenderUNICODE_Shaded, and TTF_RenderUNICODE_LCD.

\param font the font to render with. \param text text to render, in UCS-2 encoding. \param fg the foreground color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderUTF8_Blended

TTF_RenderUNICODE_Blended_Wrapped sdl2_ttf

Render word-wrapped UCS-2 text at high quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nil if there was an error.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

Please note that this function is named "Unicode" but currently expects UCS-2 encoding (16 bits per codepoint). This does not give you access to large Unicode values, such as emoji glyphs. These codepoints are accessible through the UTF-8 version of this function.

You can render at other quality levels with TTF_RenderUNICODE_Solid_Wrapped, TTF_RenderUNICODE_Shaded_Wrapped, and TTF_RenderUNICODE_LCD_Wrapped.

\param font the font to render with. \param text text to render, in UCS-2 encoding. \param fg the foreground color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderUTF8_Blended_Wrapped

TTF_RenderUNICODE_LCD sdl2_ttf

Render UCS-2 text at LCD subpixel quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nil if there was an error.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderUNICODE_LCD_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

Please note that this function is named "Unicode" but currently expects UCS-2 encoding (16 bits per codepoint). This does not give you access to large Unicode values, such as emoji glyphs. These codepoints are accessible through the UTF-8 version of this function.

You can render at other quality levels with TTF_RenderUNICODE_Solid, TTF_RenderUNICODE_Shaded, and TTF_RenderUNICODE_Blended.

\param font the font to render with. \param text text to render, in UCS-2 encoding. \param fg the foreground color for the text. \param bg the background color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.20.0.

\sa TTF_RenderUTF8_LCD

TTF_RenderUNICODE_LCD_Wrapped sdl2_ttf

Render word-wrapped UCS-2 text at LCD subpixel quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nil if there was an error.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

Please note that this function is named "Unicode" but currently expects UCS-2 encoding (16 bits per codepoint). This does not give you access to large Unicode values, such as emoji glyphs. These codepoints are accessible through the UTF-8 version of this function.

You can render at other quality levels with TTF_RenderUNICODE_Solid_Wrapped, TTF_RenderUNICODE_Shaded_Wrapped, and TTF_RenderUNICODE_Blended_Wrapped.

\param font the font to render with. \param text text to render, in UCS-2 encoding. \param fg the foreground color for the text. \param bg the background color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.20.0.

\sa TTF_RenderUTF8_LCD_Wrapped

TTF_RenderUNICODE_Shaded sdl2_ttf

Render UCS-2 text at high quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nil if there was an error.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderUNICODE_Shaded_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

Please note that this function is named "Unicode" but currently expects UCS-2 encoding (16 bits per codepoint). This does not give you access to large Unicode values, such as emoji glyphs. These codepoints are accessible through the UTF-8 version of this function.

You can render at other quality levels with TTF_RenderUNICODE_Solid, TTF_RenderUNICODE_Blended, and TTF_RenderUNICODE_LCD.

\param font the font to render with. \param text text to render, in UCS-2 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderUTF8_Shaded

TTF_RenderUNICODE_Shaded_Wrapped sdl2_ttf

Render word-wrapped UCS-2 text at high quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nil if there was an error.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

Please note that this function is named "Unicode" but currently expects UCS-2 encoding (16 bits per codepoint). This does not give you access to large Unicode values, such as emoji glyphs. These codepoints are accessible through the UTF-8 version of this function.

You can render at other quality levels with TTF_RenderUNICODE_Solid_Wrapped, TTF_RenderUNICODE_Blended_Wrapped, and TTF_RenderUNICODE_LCD_Wrapped.

\param font the font to render with. \param text text to render, in UCS-2 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderUTF8_Shaded_Wrapped

TTF_RenderUNICODE_Solid sdl2_ttf

Render UCS-2 text at fast quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderUNICODE_Solid_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

Please note that this function is named "Unicode" but currently expects UCS-2 encoding (16 bits per codepoint). This does not give you access to large Unicode values, such as emoji glyphs. These codepoints are accessible through the UTF-8 version of this function.

You can render at other quality levels with TTF_RenderUNICODE_Shaded, TTF_RenderUNICODE_Blended, and TTF_RenderUNICODE_LCD.

\param font the font to render with. \param text text to render, in UCS-2 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderUTF8_Solid

TTF_RenderUNICODE_Solid_Wrapped sdl2_ttf

Render word-wrapped UCS-2 text at fast quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

Please note that this function is named "Unicode" but currently expects UCS-2 encoding (16 bits per codepoint). This does not give you access to large Unicode values, such as emoji glyphs. These codepoints are accessible through the UTF-8 version of this function.

You can render at other quality levels with TTF_RenderUNICODE_Shaded_Wrapped, TTF_RenderUNICODE_Blended_Wrapped, and TTF_RenderUNICODE_LCD_Wrapped.

\param font the font to render with. \param text text to render, in UCS-2 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderUTF8_Solid_Wrapped

TTF_RenderUTF8 sdl2_ttf

 

TTF_RenderUTF8_Blended sdl2_ttf

Render UTF-8 text at high quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nil if there was an error.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderUTF8_Blended_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

You can render at other quality levels with TTF_RenderUTF8_Solid, TTF_RenderUTF8_Shaded, and TTF_RenderUTF8_LCD.

\param font the font to render with. \param text text to render, in UTF-8 encoding. \param fg the foreground color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderUNICODE_Blended

TTF_RenderUTF8_Blended_Wrapped sdl2_ttf

Render word-wrapped UTF-8 text at high quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nil if there was an error.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

You can render at other quality levels with TTF_RenderUTF8_Solid_Wrapped, TTF_RenderUTF8_Shaded_Wrapped, and TTF_RenderUTF8_LCD_Wrapped.

\param font the font to render with. \param text text to render, in UTF-8 encoding. \param fg the foreground color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderUTF8_Solid_Wrapped \sa TTF_RenderUTF8_Shaded_Wrapped \sa TTF_RenderUTF8_LCD_Wrapped

TTF_RenderUTF8_LCD sdl2_ttf

Render UTF-8 text at LCD subpixel quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nil if there was an error.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderUTF8_LCD_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

You can render at other quality levels with TTF_RenderUTF8_Solid, TTF_RenderUTF8_Shaded, and TTF_RenderUTF8_Blended.

\param font the font to render with. \param text text to render, in UTF-8 encoding. \param fg the foreground color for the text. \param bg the background color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.20.0.

\sa TTF_RenderUNICODE_LCD

TTF_RenderUTF8_LCD_Wrapped sdl2_ttf

Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB surface.

This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nil if there was an error.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

You can render at other quality levels with TTF_RenderUTF8_Solid_Wrapped, TTF_RenderUTF8_Shaded_Wrapped, and TTF_RenderUTF8_Blended_Wrapped.

\param font the font to render with. \param text text to render, in UTF-8 encoding. \param fg the foreground color for the text. \param bg the background color for the text. \returns a new 32-bit, ARGB surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.20.0.

\sa TTF_RenderUTF8_Solid_Wrapped \sa TTF_RenderUTF8_Shaded_Wrapped \sa TTF_RenderUTF8_Blended_Wrapped

TTF_RenderUTF8_Shaded sdl2_ttf

Render UTF-8 text at high quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nil if there was an error.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderUTF8_Shaded_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

You can render at other quality levels with TTF_RenderUTF8_Solid, TTF_RenderUTF8_Blended, and TTF_RenderUTF8_LCD.

\param font the font to render with. \param text text to render, in UTF-8 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderUNICODE_Shaded

TTF_RenderUTF8_Shaded_Wrapped sdl2_ttf

Render word-wrapped UTF-8 text at high quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nil if there was an error.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

You can render at other quality levels with TTF_RenderUTF8_Solid_Wrapped, TTF_RenderUTF8_Blended_Wrapped, and TTF_RenderUTF8_LCD_Wrapped.

\param font the font to render with. \param text text to render, in UTF-8 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderUTF8_Solid_Wrapped \sa TTF_RenderUTF8_Blended_Wrapped \sa TTF_RenderUTF8_LCD_Wrapped

TTF_RenderUTF8_Solid sdl2_ttf

Render UTF-8 text at fast quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.

This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use TTF_RenderUTF8_Solid_Wrapped() instead if you need to wrap the output to multiple lines.

This will not wrap on newline characters.

You can render at other quality levels with TTF_RenderUTF8_Shaded, TTF_RenderUTF8_Blended, and TTF_RenderUTF8_LCD.

\param font the font to render with. \param text text to render, in UTF-8 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_RenderUTF8_Shaded \sa TTF_RenderUTF8_Blended \sa TTF_RenderUTF8_LCD

TTF_RenderUTF8_Solid_Wrapped sdl2_ttf

Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.

This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond `wrapLength` in pixels.

If wrapLength is 0, this function will only wrap on newline characters.

You can render at other quality levels with TTF_RenderUTF8_Shaded_Wrapped, TTF_RenderUTF8_Blended_Wrapped, and TTF_RenderUTF8_LCD_Wrapped.

\param font the font to render with. \param text text to render, in UTF-8 encoding. \param fg the foreground color for the text. \returns a new 8-bit, palettized surface, or nil if there was an error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_RenderUTF8_Shaded_Wrapped \sa TTF_RenderUTF8_Blended_Wrapped \sa TTF_RenderUTF8_LCD_Wrapped

TTF_SetDirection sdl2_ttf

Set a global direction to be used for text shaping.

\deprecated This function expects an hb_direction_t value, from HarfBuzz, cast to an int, and affects all fonts globally. Please use TTF_SetFontDirection() instead, which uses an enum supplied by SDL_ttf itself and operates on a per-font basis.

This is a global setting; fonts will favor a value set with TTF_SetFontDirection(), but if they have not had one explicitly set, they will use the value specified here.

The default value is `HB_DIRECTION_LTR` (left-to-right text flow).

\param direction an hb_direction_t value. \returns 0, or -1 if SDL_ttf is not compiled with HarfBuzz support.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_SetFontDirection

TTF_SetError sdl2_ttf

Report SDL_ttf errors

\sa TTF_GetError

TTF_SetFontDirection sdl2_ttf

Set direction to be used for text shaping by a font.

Any value supplied here will override the global direction set with the deprecated TTF_SetDirection().

Possible direction values are:

- `TTF_DIRECTION_LTR` (Left to Right) - `TTF_DIRECTION_RTL` (Right to Left) - `TTF_DIRECTION_TTB` (Top to Bottom) - `TTF_DIRECTION_BTT` (Bottom to Top)

If SDL_ttf was not built with HarfBuzz support, this function returns -1.

\param font the font to specify a direction for. \param direction the new direction for text to flow. \returns 0 on success, or -1 on error.

\since This function is available since SDL_ttf 2.20.0.

TTF_SetFontHinting sdl2_ttf

Set a font's current hinter setting.

Setting it clears already-generated glyphs, if any, from the cache.

The hinter setting is a single value:

- `TTF_HINTING_NORMAL` - `TTF_HINTING_LIGHT` - `TTF_HINTING_MONO` - `TTF_HINTING_NONE` - `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 2.0.18 and later)

\param font the font to set a new hinter setting on. \param hinting the new hinter setting.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_GetFontHinting

TTF_SetFontKerning sdl2_ttf

Set if kerning is allowed for a font.

Newly-opened fonts default to allowing kerning. This is generally a good policy unless you have a strong reason to disable it, as it tends to produce better rendering (with kerning disabled, some fonts might render the word `kerning` as something that looks like `keming` for example).

\param font the font to set kerning on. \param allowed non-zero to allow kerning, zero to disallow.

\since This function is available since SDL_ttf 2.0.12.

TTF_SetFontOutline sdl2_ttf

Set a font's current outline.

\param font the font to set a new outline on. \param outline positive outline value, 0 to default.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_GetFontOutline

TTF_SetFontScriptName sdl2_ttf

Set script to be used for text shaping by a font.

Any value supplied here will override the global script set with the deprecated TTF_SetScript().

The supplied script value must be a null-terminated string of exactly four characters.

If SDL_ttf was not built with HarfBuzz support, this function returns -1.

\param font the font to specify a direction for. \param script null-terminated string of exactly 4 characters. \returns 0 on success, or -1 on error.

\since This function is available since SDL_ttf 2.20.0.

TTF_SetFontSDF sdl2_ttf

Enable Signed Distance Field rendering for a font.

This works with the Blended APIs. SDF is a technique that helps fonts look sharp even when scaling and rotating.

This clears already-generated glyphs, if any, from the cache.

\param font the font to set SDF support on. \param on_off SDL_TRUE to enable SDF, SDL_FALSE to disable.

\returns 0 on success, -1 on error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_GetFontSDF

TTF_SetFontSize sdl2_ttf

Set a font's size dynamically.

This clears already-generated glyphs, if any, from the cache.

\param font the font to resize. \param ptsize the new point size. \returns 0 if successful, -1 on error

\since This function is available since SDL_ttf 2.0.18.

TTF_SetFontSizeDPI sdl2_ttf

Set font size dynamically with target resolutions (in DPI).

This clears already-generated glyphs, if any, from the cache.

\param font the font to resize. \param ptsize the new point size. \param hdpi the target horizontal DPI. \param vdpi the target vertical DPI. \returns 0 if successful, -1 on error.

\since This function is available since SDL_ttf 2.0.18.

TTF_SetFontStyle sdl2_ttf

Set a font's current style.

Setting the style clears already-generated glyphs, if any, from the cache.

The font styles are a set of bit flags, OR'd together:

- `TTF_STYLE_NORMAL` (is zero) - `TTF_STYLE_BOLD` - `TTF_STYLE_ITALIC` - `TTF_STYLE_UNDERLINE` - `TTF_STYLE_STRIKETHROUGH`

\param font the font to set a new style on. \param style the new style values to set, OR'd together.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_GetFontStyle

TTF_SetFontWrappedAlign sdl2_ttf

Set a font's current wrap alignment option.

The wrap alignment option can be one of the following:

- `TTF_WRAPPED_ALIGN_LEFT` - `TTF_WRAPPED_ALIGN_CENTER` - `TTF_WRAPPED_ALIGN_RIGHT`

\param font the font to set a new wrap alignment option on. \param align the new wrap alignment option.

\since This function is available since SDL_ttf 2.20.0.

\sa TTF_GetFontWrappedAlign

TTF_SetScript sdl2_ttf

Set a global script to be used for text shaping.

\deprecated This function expects an hb_script_t value, from HarfBuzz, cast to an int, and affects all fonts globally. Please use TTF_SetFontScriptName() instead, which accepts a string that is converted to an equivalent int internally, and operates on a per-font basis.

This is a global setting; fonts will favor a value set with TTF_SetFontScriptName(), but if they have not had one explicitly set, they will use the value specified here.

The default value is `HB_SCRIPT_UNKNOWN`.

\returns 0, or -1 if SDL_ttf is not compiled with HarfBuzz support.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_SetFontScriptName

TTF_SizeText sdl2_ttf

Calculate the dimensions of a rendered string of Latin1 text.

This will report the width and height, in pixels, of the space that the specified string will take to fully render.

This does not need to render the string to do this calculation.

You almost certainly want TTF_SizeUTF8() unless you're sure you have a 1-byte Latin1 encoding. US ASCII characters will work with either function, but most other Unicode characters packed into a `const char *` will need UTF-8.

\param font the font to query. \param text text to calculate, in Latin1 encoding. \param w will be filled with width, in pixels, on return. \param h will be filled with height, in pixels, on return. \returns 0 if successful, -1 on error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_SizeUTF8 \sa TTF_SizeUNICODE

TTF_SizeUNICODE sdl2_ttf

Calculate the dimensions of a rendered string of UCS-2 text.

This will report the width and height, in pixels, of the space that the specified string will take to fully render.

This does not need to render the string to do this calculation.

Please note that this function is named "Unicode" but currently expects UCS-2 encoding (16 bits per codepoint). This does not give you access to large Unicode values, such as emoji glyphs. These codepoints are accessible through the UTF-8 version of this function.

\param font the font to query. \param text text to calculate, in UCS-2 encoding. \param w will be filled with width, in pixels, on return. \param h will be filled with height, in pixels, on return. \returns 0 if successful, -1 on error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_SizeUTF8

TTF_SizeUTF8 sdl2_ttf

Calculate the dimensions of a rendered string of UTF-8 text.

This will report the width and height, in pixels, of the space that the specified string will take to fully render.

This does not need to render the string to do this calculation.

\param font the font to query. \param text text to calculate, in UTF-8 encoding. \param w will be filled with width, in pixels, on return. \param h will be filled with height, in pixels, on return. \returns 0 if successful, -1 on error.

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_SizeUNICODE

TTF_VERSION sdl2_ttf

 

TTF_WasInit sdl2_ttf

Check if SDL_ttf is initialized.

This reports the number of times the library has been initialized by a call to TTF_Init(), without a paired deinitialization request from TTF_Quit().

In short: if it's greater than zero, the library is currently initialized and ready to work. If zero, it is not initialized.

Despite the return value being a signed integer, this function should not return a negative number.

\returns the current number of initialization calls, that need to eventually be paired with this many calls to TTF_Quit().

\since This function is available since SDL_ttf 2.0.12.

\sa TTF_Init \sa TTF_Quit

vlineColor sdl2_gfx

Vertical line

vlineRGBA sdl2_gfx

 

zoomSurface sdl2_gfx

Zooming functions

zoomSurfaceSize sdl2_gfx

 


Generated by PasDoc 0.16.0.