ios: Move animation callback to its own typedef.
This commit is contained in:
parent
5b0f14a936
commit
5416bd5fdc
6 changed files with 27 additions and 6 deletions
|
@ -225,7 +225,7 @@ Game Center
|
||||||
|
|
||||||
Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
|
Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
|
||||||
|
|
||||||
int SDL_iOSSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
|
int SDL_iOSSetAnimationCallback(SDL_Window * window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam);
|
||||||
|
|
||||||
This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
|
This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,22 @@ extern SDL_DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threa
|
||||||
*/
|
*/
|
||||||
#ifdef SDL_PLATFORM_IOS
|
#ifdef SDL_PLATFORM_IOS
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The prototype for an Apple iOS animation callback.
|
||||||
|
*
|
||||||
|
* This datatype is only useful on Apple iOS.
|
||||||
|
*
|
||||||
|
* After passing a function pointer of this type to SDL_iOSSetAnimationCallback,
|
||||||
|
* the system will call that function pointer at a regular interval.
|
||||||
|
*
|
||||||
|
* \param userdata what was passed as `callbackParam` to SDL_iOSSetAnimationCallback as `callbackParam`.
|
||||||
|
*
|
||||||
|
* \since This datatype is available since SDL 3.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_iOSSetAnimationCallback
|
||||||
|
*/
|
||||||
|
typedef void (SDLCALL *SDL_iOSAnimationCallback)(void *userdata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this function to set the animation callback on Apple iOS.
|
* Use this function to set the animation callback on Apple iOS.
|
||||||
*
|
*
|
||||||
|
@ -228,7 +244,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threa
|
||||||
*
|
*
|
||||||
* \sa SDL_iOSSetEventPump
|
* \sa SDL_iOSSetEventPump
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_iOSSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam);
|
extern SDL_DECLSPEC int SDLCALL SDL_iOSSetAnimationCallback(SDL_Window * window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this function to enable or disable the SDL event pump on Apple iOS.
|
* Use this function to enable or disable the SDL event pump on Apple iOS.
|
||||||
|
|
|
@ -950,7 +950,7 @@ SDL_DYNAPI_PROC(int,SDL_hid_read_timeout,(SDL_hid_device *a, unsigned char *b, s
|
||||||
SDL_DYNAPI_PROC(int,SDL_hid_send_feature_report,(SDL_hid_device *a, const unsigned char *b, size_t c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_hid_send_feature_report,(SDL_hid_device *a, const unsigned char *b, size_t c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_hid_set_nonblocking,(SDL_hid_device *a, int b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_hid_set_nonblocking,(SDL_hid_device *a, int b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_hid_write,(SDL_hid_device *a, const unsigned char *b, size_t c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_hid_write,(SDL_hid_device *a, const unsigned char *b, size_t c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_iOSSetAnimationCallback,(SDL_Window *a, int b, void (SDLCALL *c)(void*), void *d),(a,b,c,d),return)
|
SDL_DYNAPI_PROC(int,SDL_iOSSetAnimationCallback,(SDL_Window *a, int b, SDL_iOSAnimationCallback c, void *d),(a,b,c,d),return)
|
||||||
SDL_DYNAPI_PROC(void,SDL_iOSSetEventPump,(SDL_bool a),(a),)
|
SDL_DYNAPI_PROC(void,SDL_iOSSetEventPump,(SDL_bool a),(a),)
|
||||||
SDL_DYNAPI_PROC(size_t,SDL_iconv,(SDL_iconv_t a, const char **b, size_t *c, char **d, size_t *e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(size_t,SDL_iconv,(SDL_iconv_t a, const char **b, size_t *c, char **d, size_t *e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_iconv_close,(SDL_iconv_t a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_iconv_close,(SDL_iconv_t a),(a),return)
|
||||||
|
|
|
@ -49,4 +49,8 @@ typedef struct XUserHandle XUserHandle;
|
||||||
typedef void *SDL_AndroidRequestPermissionCallback;
|
typedef void *SDL_AndroidRequestPermissionCallback;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SDL_PLATFORM_IOS
|
||||||
|
typedef void *SDL_iOSAnimationCallback;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -93,8 +93,9 @@ void SDL_OnApplicationDidChangeStatusBarOrientation(void)
|
||||||
|
|
||||||
#ifndef SDL_VIDEO_DRIVER_UIKIT
|
#ifndef SDL_VIDEO_DRIVER_UIKIT
|
||||||
|
|
||||||
SDL_DECLSPEC int SDLCALL SDL_iOSSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam);
|
typedef void (SDLCALL *SDL_iOSAnimationCallback)(void *userdata);
|
||||||
int SDL_iOSSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam)
|
SDL_DECLSPEC int SDLCALL SDL_iOSSetAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam);
|
||||||
|
int SDL_iOSSetAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam)
|
||||||
{
|
{
|
||||||
(void)window;
|
(void)window;
|
||||||
(void)interval;
|
(void)interval;
|
||||||
|
|
|
@ -449,7 +449,7 @@ UIKit_GetSupportedOrientations(SDL_Window *window)
|
||||||
}
|
}
|
||||||
#endif /* !SDL_PLATFORM_TVOS */
|
#endif /* !SDL_PLATFORM_TVOS */
|
||||||
|
|
||||||
int SDL_iOSSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam)
|
int SDL_iOSSetAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam)
|
||||||
{
|
{
|
||||||
if (!window || !window->driverdata) {
|
if (!window || !window->driverdata) {
|
||||||
return SDL_SetError("Invalid window");
|
return SDL_SetError("Invalid window");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue