Wiki Page Content

Differences between revisions 3 and 4
Revision 3 as of 2011-04-18 19:16:35
Size: 2142
Editor: SheenaSmith
Comment: update content (in progress)
Revision 4 as of 2011-04-18 19:27:08
Size: 1981
Editor: SheenaSmith
Comment: update content (in progress)
Deletions are marked like this. Additions are marked like this.
Line 20: Line 20:
== Return Value ==
Returns a value from the callback. ??? or delete this section?
Line 29: Line 26:
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 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.
Line 33: Line 30:
SDL_assert_state (SDLCALL *SDL_AssertionHandler)(
                           const SDL_assert_data*, void* userdata)
SDL_assert_state YourAssertionHandler(const SDL_assert_data* data,
                                      void*                  userdata)
Line 36: Line 33:
<<Color2(green,Should this be formatted like a regular function?)>>
 . where `(SDLCALL *SDL_AssertionHandler)` is the name of the callback, `data` is a pointer to an [[SDL_assert_data]] struct, and `userdata` takes what is passed in '''userdata'''.
<<Color2(green,Should the callback info be described here?)>>
 . where `YourAssertionHandler` is the name of your callback function, `data` is a pointer to the [[SDL_assert_data]] struct corresponding to the current assertion, and `userdata` is what was passed as '''userdata'''.

DRAFT

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 callback function called when an assertion fails; see Remarks for details

userdata

a pointer passed to the callback as-is

Code Examples

You can add your code example here

Remarks

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.

handler has the following form:

  • SDL_assert_state YourAssertionHandler(const SDL_assert_data* data,
                                          void*                  userdata)
  • where YourAssertionHandler is the name of your callback function, data is a pointer to the SDL_assert_data struct corresponding to the current assertion, and userdata is what was passed as userdata.

  • The callback returns an SDL_assert_state value of how to handle the assertion failure.

green

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.

Setting the callback to NULL restores SDL's original internal handler.

This callback is NOT reset to SDL's internal handler upon SDL_Quit()!


CategoryAPI, CategoryAssertions

None: SDL_SetAssertionHandler (last edited 2015-02-21 10:20:56 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit