| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Init
Contents
Description
All SDL programs need to initialize the library before starting to work with it.
Almost everything can simply call near startup, with a handful of flags to specify subsystems to touch. These are here to make sure SDL does not even attempt to touch low-level pieces of the operating system that you don't intend to use. For example, you might be using SDL for video and input but chose an external library for audio, and in this case you would just need to leave off the init flag to make sure that external library has complete control.sDL_INIT_AUDIO
Most apps, when terminating, should call . This will clean up (nearly) everything that SDL might have allocated, and crucially, it'll make sure that the display's resolution is back to what the user expects if you had previously changed it for your game.quit
SDL3 apps are strongly encouraged to call at startup to fill in details about the program. This is completely optional, but it helps in small ways (we can provide an About dialog box for the macOS menu, we can name the app in the system's audio mixer, etc). Those that want to provide a lot of information should look at the more-detailed setAppMetadata. Initialization flags for setAppMetadataPropertyinit and/or initSubSystem
These are the flags which may be passed to . You should specify the subsystems which you will be using in your application.init
- See also
init,quit,initSubSystem,quitSubSystem,wasInit
FFI conventions
Unsuffixed aliases are unsafe foreign imports; aliases suffixed Safe are safe. Functions whose callbacks fire during the call export only the Safe alias (the genuine unsafe import stays reachable under SDL3.Sys.Bindgen.Init.Unsafe); functions curated unsafe-only export only the unsuffixed one. Each alias's documentation records its flavor and rationale.
Full conventions: SDL3.Sys.
Since: 3.2.0
Synopsis
- module SDL3.Sys.Bindgen.Init
- pattern SDL_INIT_AUDIO :: SDL_InitFlags
- pattern SDL_INIT_VIDEO :: SDL_InitFlags
- pattern SDL_INIT_JOYSTICK :: SDL_InitFlags
- pattern SDL_INIT_HAPTIC :: SDL_InitFlags
- pattern SDL_INIT_GAMEPAD :: SDL_InitFlags
- pattern SDL_INIT_EVENTS :: SDL_InitFlags
- pattern SDL_INIT_SENSOR :: SDL_InitFlags
- pattern SDL_INIT_CAMERA :: SDL_InitFlags
- init :: SDL_InitFlags -> IO Bool
- initSafe :: SDL_InitFlags -> IO Bool
- initSubSystem :: SDL_InitFlags -> IO Bool
- initSubSystemSafe :: SDL_InitFlags -> IO Bool
- quitSubSystem :: SDL_InitFlags -> IO ()
- quitSubSystemSafe :: SDL_InitFlags -> IO ()
- wasInit :: SDL_InitFlags -> IO SDL_InitFlags
- wasInitSafe :: SDL_InitFlags -> IO SDL_InitFlags
- quit :: IO ()
- quitSafe :: IO ()
- isMainThread :: IO Bool
- isMainThreadSafe :: IO Bool
- runOnMainThreadSafe :: SDL_MainThreadCallback -> Ptr Void -> Bool -> IO Bool
- setAppMetadata :: PtrConst CChar -> PtrConst CChar -> PtrConst CChar -> IO Bool
- setAppMetadataSafe :: PtrConst CChar -> PtrConst CChar -> PtrConst CChar -> IO Bool
- setAppMetadataProperty :: PtrConst CChar -> PtrConst CChar -> IO Bool
- setAppMetadataPropertySafe :: PtrConst CChar -> PtrConst CChar -> IO Bool
- getAppMetadataProperty :: PtrConst CChar -> IO (PtrConst CChar)
- getAppMetadataPropertySafe :: PtrConst CChar -> IO (PtrConst CChar)
Documentation
module SDL3.Sys.Bindgen.Init
Typed constants
pattern SDL_INIT_AUDIO :: SDL_InitFlags Source #
Typed constant for macro SDL_INIT_AUDIO. Combine with .|. from Data.Bits.
pattern SDL_INIT_VIDEO :: SDL_InitFlags Source #
Typed constant for macro SDL_INIT_VIDEO. Combine with .|. from Data.Bits.
pattern SDL_INIT_JOYSTICK :: SDL_InitFlags Source #
Typed constant for macro SDL_INIT_JOYSTICK. Combine with .|. from Data.Bits.
pattern SDL_INIT_HAPTIC :: SDL_InitFlags Source #
Typed constant for macro SDL_INIT_HAPTIC. Combine with .|. from Data.Bits.
pattern SDL_INIT_GAMEPAD :: SDL_InitFlags Source #
Typed constant for macro SDL_INIT_GAMEPAD. Combine with .|. from Data.Bits.
pattern SDL_INIT_EVENTS :: SDL_InitFlags Source #
Typed constant for macro SDL_INIT_EVENTS. Combine with .|. from Data.Bits.
pattern SDL_INIT_SENSOR :: SDL_InitFlags Source #
Typed constant for macro SDL_INIT_SENSOR. Combine with .|. from Data.Bits.
pattern SDL_INIT_CAMERA :: SDL_InitFlags Source #
Typed constant for macro SDL_INIT_CAMERA. Combine with .|. from Data.Bits.
Function aliases
Arguments
| :: SDL_InitFlags |
|
| -> IO Bool |
Initialize the SDL library.
simply forwards to calling init. Therefore, the two may be used interchangeably. Though for readability of your code initSubSystem might be preferred.initSubSystem
The file I/O (for example: SDL_IOFromFile) and threading (SDL_CreateThread) subsystems are initialized by default. Message boxes (SDL_ShowSimpleMessageBox) also attempt to work without initializing the video subsystem, in hopes of being useful in showing an error dialog when init fails. You must specifically initialize other subsystems if you use them in your application.
Logging (such as SDL_Log) works without initialization, too.
flags may be any of the following OR'd together:
: audio subsystem; automatically initializes the events subsystemsDL_INIT_AUDIO: video subsystem; automatically initializes the events subsystem, should be initialized on the main thread.sDL_INIT_VIDEO: joystick subsystem; automatically initializes the events subsystemsDL_INIT_JOYSTICK: haptic (force feedback) subsystemsDL_INIT_HAPTIC: gamepad subsystem; automatically initializes the joystick subsystemsDL_INIT_GAMEPAD: events subsystemsDL_INIT_EVENTS: sensor subsystem; automatically initializes the events subsystemsDL_INIT_SENSOR: camera subsystem; automatically initializes the events subsystemsDL_INIT_CAMERA
Subsystem initialization is ref-counted, you must call for each quitSubSystem to correctly shutdown a subsystem manually (or call initSubSystem to force shutdown). If a subsystem is already loaded then this call will increase the ref-count and return.quit
Consider reporting some basic metadata about your application before calling init, using either or setAppMetadata.setAppMetadataProperty
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
setAppMetadata,setAppMetadataProperty,initSubSystem,quit,setMainReady,wasInit
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_Init. The safe flavor isinitSafe: driver loading can take hundreds of milliseconds. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_Init, defined atSDL3/SDL_init.h 238:34
Since: 3.2.0
Arguments
| :: SDL_InitFlags |
|
| -> IO Bool |
Initialize the SDL library.
simply forwards to calling init. Therefore, the two may be used interchangeably. Though for readability of your code initSubSystem might be preferred.initSubSystem
The file I/O (for example: SDL_IOFromFile) and threading (SDL_CreateThread) subsystems are initialized by default. Message boxes (SDL_ShowSimpleMessageBox) also attempt to work without initializing the video subsystem, in hopes of being useful in showing an error dialog when init fails. You must specifically initialize other subsystems if you use them in your application.
Logging (such as SDL_Log) works without initialization, too.
flags may be any of the following OR'd together:
: audio subsystem; automatically initializes the events subsystemsDL_INIT_AUDIO: video subsystem; automatically initializes the events subsystem, should be initialized on the main thread.sDL_INIT_VIDEO: joystick subsystem; automatically initializes the events subsystemsDL_INIT_JOYSTICK: haptic (force feedback) subsystemsDL_INIT_HAPTIC: gamepad subsystem; automatically initializes the joystick subsystemsDL_INIT_GAMEPAD: events subsystemsDL_INIT_EVENTS: sensor subsystem; automatically initializes the events subsystemsDL_INIT_SENSOR: camera subsystem; automatically initializes the events subsystemsDL_INIT_CAMERA
Subsystem initialization is ref-counted, you must call for each quitSubSystem to correctly shutdown a subsystem manually (or call initSubSystem to force shutdown). If a subsystem is already loaded then this call will increase the ref-count and return.quit
Consider reporting some basic metadata about your application before calling init, using either or setAppMetadata.setAppMetadataProperty
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
setAppMetadata,setAppMetadataProperty,initSubSystem,quit,setMainReady,wasInit
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_Init. The unsafe flavor isinit: driver loading can take hundreds of milliseconds. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_Init, defined atSDL3/SDL_init.h 238:34
Since: 3.2.0
Arguments
| :: SDL_InitFlags | |
| -> IO Bool |
Compatibility function to initialize the SDL library.
This function and are interchangeable.init
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
init,quit,quitSubSystem
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_InitSubSystem. The safe flavor isinitSubSystemSafe: driver loading can take hundreds of milliseconds. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_InitSubSystem, defined atSDL3/SDL_init.h 257:34
Since: 3.2.0
Arguments
| :: SDL_InitFlags | |
| -> IO Bool |
Compatibility function to initialize the SDL library.
This function and are interchangeable.init
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
init,quit,quitSubSystem
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_InitSubSystem. The unsafe flavor isinitSubSystem: driver loading can take hundreds of milliseconds. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_InitSubSystem, defined atSDL3/SDL_init.h 257:34
Since: 3.2.0
Arguments
| :: SDL_InitFlags | |
| -> IO () |
Shut down specific SDL subsystems.
You still need to call even if you close all open subsystems with quit.quitSubSystem
- Thread safety
- This function is not thread safe.
- See also
initSubSystem,quit
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_QuitSubSystem. The safe flavor isquitSubSystemSafe: video quit invokes the clipboard cleanup callback synchronously. - C declaration
SDL_QuitSubSystem, defined atSDL3/SDL_init.h 274:34
Since: 3.2.0
Arguments
| :: SDL_InitFlags | |
| -> IO () |
Shut down specific SDL subsystems.
You still need to call even if you close all open subsystems with quit.quitSubSystem
- Thread safety
- This function is not thread safe.
- See also
initSubSystem,quit
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_QuitSubSystem. The unsafe flavor isquitSubSystem: video quit invokes the clipboard cleanup callback synchronously. - C declaration
SDL_QuitSubSystem, defined atSDL3/SDL_init.h 274:34
Since: 3.2.0
Arguments
| :: SDL_InitFlags | |
| -> IO SDL_InitFlags |
Get a mask of the specified subsystems which are currently initialized.
- Returns
- a mask of all initialized subsystems if
flagsis 0, otherwise it returns the initialization status of the specified subsystems. - Thread safety
- This function is not thread safe.
- See also
init,initSubSystem
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_WasInit. The safe flavor iswasInitSafe. - C declaration
SDL_WasInit, defined atSDL3/SDL_init.h 290:43
Since: 3.2.0
Arguments
| :: SDL_InitFlags | |
| -> IO SDL_InitFlags |
Get a mask of the specified subsystems which are currently initialized.
- Returns
- a mask of all initialized subsystems if
flagsis 0, otherwise it returns the initialization status of the specified subsystems. - Thread safety
- This function is not thread safe.
- See also
init,initSubSystem
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_WasInit. The unsafe flavor iswasInit. - C declaration
SDL_WasInit, defined atSDL3/SDL_init.h 290:43
Since: 3.2.0
Clean up all initialized subsystems.
You should call this function even if you have already shutdown each initialized subsystem with . It is safe to call this function even in the case of errors in initialization.quitSubSystem
You can use this function with atexit() to ensure that it is run when your application is shutdown, but it is not wise to do this from a library or other dynamically loaded code.
- Thread safety
- This function should only be called on the main thread.
- See also
init,quitSubSystem
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_Quit. The safe flavor isquitSafe: video quit invokes the clipboard cleanup callback synchronously. - C declaration
SDL_Quit, defined atSDL3/SDL_init.h 310:34
Since: 3.2.0
Clean up all initialized subsystems.
You should call this function even if you have already shutdown each initialized subsystem with . It is safe to call this function even in the case of errors in initialization.quitSubSystem
You can use this function with atexit() to ensure that it is run when your application is shutdown, but it is not wise to do this from a library or other dynamically loaded code.
- Thread safety
- This function should only be called on the main thread.
- See also
init,quitSubSystem
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_Quit. The unsafe flavor isquit: video quit invokes the clipboard cleanup callback synchronously. - C declaration
SDL_Quit, defined atSDL3/SDL_init.h 310:34
Since: 3.2.0
isMainThread :: IO Bool Source #
Return whether this is the main thread.
On Apple platforms, the main thread is the thread that runs your program's main() entry point. On other platforms, the main thread is the one that calls SDL_Init(SDL_INIT_VIDEO), which should usually be the one that runs your program's main() entry point. If you are using the main callbacks, SDL_AppInit(), SDL_AppIterate(), and SDL_AppQuit() are all called on the main thread.
- Returns
- true if this thread is the main thread, or false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
runOnMainThreadSafe
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_IsMainThread. The safe flavor isisMainThreadSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_IsMainThread, defined atSDL3/SDL_init.h 330:34
Since: 3.2.0
isMainThreadSafe :: IO Bool Source #
Return whether this is the main thread.
On Apple platforms, the main thread is the thread that runs your program's main() entry point. On other platforms, the main thread is the one that calls SDL_Init(SDL_INIT_VIDEO), which should usually be the one that runs your program's main() entry point. If you are using the main callbacks, SDL_AppInit(), SDL_AppIterate(), and SDL_AppQuit() are all called on the main thread.
- Returns
- true if this thread is the main thread, or false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
runOnMainThreadSafe
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_IsMainThread. The unsafe flavor isisMainThread. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_IsMainThread, defined atSDL3/SDL_init.h 330:34
Since: 3.2.0
Arguments
| :: SDL_MainThreadCallback |
|
| -> Ptr Void |
|
| -> Bool |
|
| -> IO Bool |
Call a function on the main thread during event processing.
If this is called on the main thread, the callback is executed immediately. If this is called on another thread, this callback is queued for execution on the main thread during event processing.
Be careful of deadlocks when using this functionality. You should not have the main thread wait for the current thread while this function is being called with wait_complete true.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
isMainThread
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_RunOnMainThread. The unsafe import is not exported : invokes synchronously on the main thread, or blocks until the main thread runs it. If your callback is a non-Haskell function pointer that never re-enters the Haskell runtime, the unsafe import remains available asSDL3.Sys.Bindgen.Init.Unsafe.sDL_RunOnMainThread. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_RunOnMainThread, defined atSDL3/SDL_init.h 367:34
Since: 3.2.0
Arguments
| :: PtrConst CChar |
|
| -> PtrConst CChar |
|
| -> PtrConst CChar |
|
| -> IO Bool |
Specify basic metadata about your app.
You can optionally provide metadata about your app to SDL. This is not required, but strongly encouraged.
There are several locations where SDL can make use of metadata (an "About" box in the macOS menu bar, the name of the app can be shown on some audio mixers, etc). Any piece of metadata can be left as NULL, if a specific detail doesn't make sense for the app.
This function should be called as early as possible, before init. Multiple calls to this function are allowed, but various state might not change once it has been set up with a previous call to this function.
Passing a NULL removes any previous metadata.
This is a simplified interface for the most important information. You can supply significantly more detailed metadata with .setAppMetadataProperty
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
setAppMetadataProperty
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetAppMetadata. The safe flavor issetAppMetadataSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_SetAppMetadata, defined atSDL3/SDL_init.h 405:34
Since: 3.2.0
Arguments
| :: PtrConst CChar |
|
| -> PtrConst CChar |
|
| -> PtrConst CChar |
|
| -> IO Bool |
Specify basic metadata about your app.
You can optionally provide metadata about your app to SDL. This is not required, but strongly encouraged.
There are several locations where SDL can make use of metadata (an "About" box in the macOS menu bar, the name of the app can be shown on some audio mixers, etc). Any piece of metadata can be left as NULL, if a specific detail doesn't make sense for the app.
This function should be called as early as possible, before init. Multiple calls to this function are allowed, but various state might not change once it has been set up with a previous call to this function.
Passing a NULL removes any previous metadata.
This is a simplified interface for the most important information. You can supply significantly more detailed metadata with .setAppMetadataProperty
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
setAppMetadataProperty
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetAppMetadata. The unsafe flavor issetAppMetadata. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_SetAppMetadata, defined atSDL3/SDL_init.h 405:34
Since: 3.2.0
setAppMetadataProperty Source #
Arguments
| :: PtrConst CChar |
|
| -> PtrConst CChar |
|
| -> IO Bool |
Specify metadata about your app through a set of properties.
You can optionally provide metadata about your app to SDL. This is not required, but strongly encouraged.
There are several locations where SDL can make use of metadata (an "About" box in the macOS menu bar, the name of the app can be shown on some audio mixers, etc). Any piece of metadata can be left out, if a specific detail doesn't make sense for the app.
This function should be called as early as possible, before init. Multiple calls to this function are allowed, but various state might not change once it has been set up with a previous call to this function.
Once set, this metadata can be read using .getAppMetadataProperty
These are the supported properties:
: The human-readable name of the application, like "My Game 2: Bad Guy's Revenge!". This will show up anywhere the OS shows the name of the application separately from window titles, such as volume control applets, etc. If not provided by the app, SDL will attempt to pick a reasonable default (the app's binary's name if the platform can provide it, or "SDL Application" if all else fails).sDL_PROP_APP_METADATA_NAME_STRING: The version of the app that is running; there are no rules on format, so "1.0.3beta2" and "April 22nd, 2024" and a git hash are all valid options. This has no default.sDL_PROP_APP_METADATA_VERSION_STRING: A unique string that identifies this app. This must be in reverse-domain format, like "com.example.mygame2". This string is used by desktop compositors to identify and group windows together, as well as match applications with associated desktop settings and icons. If you plan to package your application in a container such as Flatpak, the app ID should match the name of your Flatpak container as well. This has no default.sDL_PROP_APP_METADATA_IDENTIFIER_STRING: The human-readable name of the creator/developer/maker of this app, like "MojoWorkshop, LLC"sDL_PROP_APP_METADATA_CREATOR_STRING: The human-readable copyright notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this to one line, don't paste a copy of a whole software license in here. This has no default.sDL_PROP_APP_METADATA_COPYRIGHT_STRING: A URL to the app on the web. Maybe a product page, or a storefront, or even a GitHub repository, for user's further information This has no default.sDL_PROP_APP_METADATA_URL_STRING: The type of application this is. Currently this string can be "game" for a video game, "mediaplayer" for a media player, or generically "application" if nothing else applies. Future versions of SDL might add new types. This defaults to "application".sDL_PROP_APP_METADATA_TYPE_STRING
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
getAppMetadataProperty,setAppMetadata
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetAppMetadataProperty. The safe flavor issetAppMetadataPropertySafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_SetAppMetadataProperty, defined atSDL3/SDL_init.h 469:34
Since: 3.2.0
setAppMetadataPropertySafe Source #
Arguments
| :: PtrConst CChar |
|
| -> PtrConst CChar |
|
| -> IO Bool |
Specify metadata about your app through a set of properties.
You can optionally provide metadata about your app to SDL. This is not required, but strongly encouraged.
There are several locations where SDL can make use of metadata (an "About" box in the macOS menu bar, the name of the app can be shown on some audio mixers, etc). Any piece of metadata can be left out, if a specific detail doesn't make sense for the app.
This function should be called as early as possible, before init. Multiple calls to this function are allowed, but various state might not change once it has been set up with a previous call to this function.
Once set, this metadata can be read using .getAppMetadataProperty
These are the supported properties:
: The human-readable name of the application, like "My Game 2: Bad Guy's Revenge!". This will show up anywhere the OS shows the name of the application separately from window titles, such as volume control applets, etc. If not provided by the app, SDL will attempt to pick a reasonable default (the app's binary's name if the platform can provide it, or "SDL Application" if all else fails).sDL_PROP_APP_METADATA_NAME_STRING: The version of the app that is running; there are no rules on format, so "1.0.3beta2" and "April 22nd, 2024" and a git hash are all valid options. This has no default.sDL_PROP_APP_METADATA_VERSION_STRING: A unique string that identifies this app. This must be in reverse-domain format, like "com.example.mygame2". This string is used by desktop compositors to identify and group windows together, as well as match applications with associated desktop settings and icons. If you plan to package your application in a container such as Flatpak, the app ID should match the name of your Flatpak container as well. This has no default.sDL_PROP_APP_METADATA_IDENTIFIER_STRING: The human-readable name of the creator/developer/maker of this app, like "MojoWorkshop, LLC"sDL_PROP_APP_METADATA_CREATOR_STRING: The human-readable copyright notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this to one line, don't paste a copy of a whole software license in here. This has no default.sDL_PROP_APP_METADATA_COPYRIGHT_STRING: A URL to the app on the web. Maybe a product page, or a storefront, or even a GitHub repository, for user's further information This has no default.sDL_PROP_APP_METADATA_URL_STRING: The type of application this is. Currently this string can be "game" for a video game, "mediaplayer" for a media player, or generically "application" if nothing else applies. Future versions of SDL might add new types. This defaults to "application".sDL_PROP_APP_METADATA_TYPE_STRING
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
getAppMetadataProperty,setAppMetadata
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetAppMetadataProperty. The unsafe flavor issetAppMetadataProperty. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_SetAppMetadataProperty, defined atSDL3/SDL_init.h 469:34
Since: 3.2.0
getAppMetadataProperty Source #
Get metadata about your app.
This returns metadata previously set using or setAppMetadata. See setAppMetadataProperty for the list of available properties and their meanings.setAppMetadataProperty
- Returns
- the current value of the metadata property, or the default if it is not set, NULL for properties with no default.
- Thread safety
- It is safe to call this function from any thread, although the string returned is not protected and could potentially be freed if you call
to set that property from another thread.setAppMetadataProperty - See also
setAppMetadata,setAppMetadataProperty
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetAppMetadataProperty. The safe flavor isgetAppMetadataPropertySafe. - C declaration
SDL_GetAppMetadataProperty, defined atSDL3/SDL_init.h 500:42
Since: 3.2.0
getAppMetadataPropertySafe Source #
Get metadata about your app.
This returns metadata previously set using or setAppMetadata. See setAppMetadataProperty for the list of available properties and their meanings.setAppMetadataProperty
- Returns
- the current value of the metadata property, or the default if it is not set, NULL for properties with no default.
- Thread safety
- It is safe to call this function from any thread, although the string returned is not protected and could potentially be freed if you call
to set that property from another thread.setAppMetadataProperty - See also
setAppMetadata,setAppMetadataProperty
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetAppMetadataProperty. The unsafe flavor isgetAppMetadataProperty. - C declaration
SDL_GetAppMetadataProperty, defined atSDL3/SDL_init.h 500:42
Since: 3.2.0