Wiki Page Content

Differences between revisions 11 and 12
Revision 11 as of 2014-02-08 20:38:28
Size: 1851
Comment: Added Related Functions with SDL_GetAssertionHandler.
Revision 12 as of 2015-02-21 10:20:56
Size: 1845
Comment: Updated prototype.
Deletions are marked like this. Additions are marked like this.
Line 29: Line 29:
SDL_assert_state YourAssertionHandler(const SDL_assert_data* data,
  void*  userdata)
SDL_AssertState YourAssertionHandler(const SDL_AssertData* data,
                                     void* userdata)
Line 33: Line 33:
 ||`data`||a pointer to the [[SDL_assert_data]] structure corresponding to the current assertion||  ||`data`||a pointer to the [[SDL_AssertData]] structure corresponding to the current assertion||
Line 36: Line 36:
 .This callback should return an [[SDL_assert_state]] value indicating how to handle the assertion failure.  .This callback should return an [[SDL_AssertState]] value indicating how to handle the assertion failure.

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_AssertState YourAssertionHandler(const SDL_AssertData* data,
                                     void*                 userdata)
  • where YourAssertionHandler is the name of your function and its parameters are:

    data

    a pointer to the SDL_AssertData structure corresponding to the current assertion

    userdata

    what was passed as userdata to SDL_SetAssertionHandler()

  • This callback should return an SDL_AssertState 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()!


CategoryAPI, CategoryAssertions

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

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