|
Size: 1763
Comment: create page - 3/29 e427bb6266a4
|
Size: 1780
Comment: update content for consistency - callback (table)
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| ||<tablewidth="100%" style="color: #FF0000;" :> DRAFT|| | |
| Line 17: | Line 16: |
| ||'''handler'''||the callback function called when an assertion fails; see [[#Remarks|Remarks]] for details|| ||'''userdata'''||a pointer passed to the callback as-is|| == Return Value == Returns an [[SDL_assert_state]] value of how to handle the assertion failure. <<Color2(green,This seems to be the RV for the callback. Since this function has a void RV. Should it be listed here anyway?)>> |
||'''handler'''||the function to call when an assertion fails or NULL for the default handler; see [[#Remarks|Remarks]] for details|| ||'''userdata'''||a pointer that is passed to '''handler'''|| |
| Line 31: | Line 25: |
| This ^function^ allows an app to show its own assertion UI and/or force the response to an assertion failure. If the app doesn't provide this, SDL will try to do the right thing, popping up a system-specific GUI dialog, and probably minimizing any fullscreen windows. | This function allows an application to show its own assertion UI and/or force the response to an assertion failure. If the application doesn't provide this, SDL will try to do the right thing, popping up a system-specific GUI dialog, and probably minimizing any fullscreen windows. |
| Line 33: | Line 27: |
| '''handler''' calls the following callback function: | The function prototype for '''handler''' is: |
| Line 35: | Line 29: |
| SDL_assert_state (SDLCALL *SDL_AssertionHandler)( const SDL_assert_data*, void* userdata) |
SDL_assert_state YourAssertionHandler(const SDL_assert_data* data, void* userdata) |
| Line 38: | Line 32: |
| . where `YourAssertionHandler` is the name of your function, and its parameters are: ||`data`||a pointer to the [[SDL_assert_data]] structure corresponding to the current assertion|| ||`userdata`||what was passed as '''userdata''' to [[SDL_SetAssertionHandler]]()|| .This callback should return an [[SDL_assert_state]] value indicating how to handle the assertion failure. |
|
| Line 41: | Line 40: |
| Setting the callback to NULL restores SDL's original internal handler. |
|
| Line 44: | Line 41: |
== Related Functions == .[[SDL_OtherFunction]] |
SDL_SetAssertionHandler
Use this function to set an application-defined assertion handler.
Syntax
void SDL_SetAssertionHandler(SDL_AssertionHandler handler,
void* userdata)
Function Parameters
handler |
the function to call when an assertion fails or NULL for the default handler; see Remarks for details |
userdata |
a pointer that is passed to handler |
Code Examples
You can add your code example here
Remarks
This function allows an application to show its own assertion UI and/or force the response to an assertion failure. If the application doesn't provide this, SDL will try to do the right thing, popping up a system-specific GUI dialog, and probably minimizing any fullscreen windows.
The function prototype for handler is:
SDL_assert_state YourAssertionHandler(const SDL_assert_data* data, void* userdata)where YourAssertionHandler is the name of your function, and its parameters are:
data
a pointer to the SDL_assert_data structure corresponding to the current assertion
userdata
what was passed as userdata to SDL_SetAssertionHandler()
This callback should return an SDL_assert_state value indicating how to handle the assertion failure.
This callback may fire from any thread, but it runs wrapped in a mutex, so it will only fire from one thread at a time.
This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
