Renamed SDL life cycle functions

This maps better to how SDL delivers the events, and the iOS delegate methods are in the documentation for reference.
This commit is contained in:
Sam Lantinga 2024-07-23 21:59:35 -07:00
parent 06c0ed68b1
commit fa0918a686
10 changed files with 30 additions and 14 deletions

View File

@ -3586,3 +3586,13 @@ typedef SDL_JoystickGUID, SDL_GUID;
- SDL_GUIDFromString - SDL_GUIDFromString
+ SDL_StringToGUID + SDL_StringToGUID
(...) (...)
@@
@@
- SDL_OnApplicationWillResignActive
+ SDL_OnApplicationWillEnterBackground
(...)
@@
@@
- SDL_OnApplicationDidBecomeActive
+ SDL_OnApplicationDidEnterForeground
(...)

View File

@ -1799,6 +1799,8 @@ The following functions have been renamed:
* SDL_GDKGetTaskQueue() => SDL_GetGDKTaskQueue() * SDL_GDKGetTaskQueue() => SDL_GetGDKTaskQueue()
* SDL_LinuxSetThreadPriority() => SDL_SetLinuxThreadPriority() * SDL_LinuxSetThreadPriority() => SDL_SetLinuxThreadPriority()
* SDL_LinuxSetThreadPriorityAndPolicy() => SDL_SetLinuxThreadPriorityAndPolicy() * SDL_LinuxSetThreadPriorityAndPolicy() => SDL_SetLinuxThreadPriorityAndPolicy()
* SDL_OnApplicationDidBecomeActive() => SDL_OnApplicationDidEnterForeground()
* SDL_OnApplicationWillResignActive() => SDL_OnApplicationWillEnterBackground()
* SDL_WinRTGetDeviceFamily() => SDL_GetWinRTDeviceFamily() * SDL_WinRTGetDeviceFamily() => SDL_GetWinRTDeviceFamily()
* SDL_GetWinRTFSPathUTF8() => SDL_GetWinRTFSPath() * SDL_GetWinRTFSPathUTF8() => SDL_GetWinRTFSPath()
* SDL_iOSSetAnimationCallback() => SDL_SetiOSAnimationCallback() * SDL_iOSSetAnimationCallback() => SDL_SetiOSAnimationCallback()

View File

@ -618,6 +618,8 @@
#define SDL_GDKGetTaskQueue SDL_GetGDKTaskQueue #define SDL_GDKGetTaskQueue SDL_GetGDKTaskQueue
#define SDL_LinuxSetThreadPriority SDL_SetLinuxThreadPriority #define SDL_LinuxSetThreadPriority SDL_SetLinuxThreadPriority
#define SDL_LinuxSetThreadPriorityAndPolicy SDL_SetLinuxThreadPriorityAndPolicy #define SDL_LinuxSetThreadPriorityAndPolicy SDL_SetLinuxThreadPriorityAndPolicy
#define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidEnterForeground
#define SDL_OnApplicationWillResignActive SDL_OnApplicationWillEnterBackground
#define SDL_WinRTGetDeviceFamily SDL_GetWinRTDeviceFamily #define SDL_WinRTGetDeviceFamily SDL_GetWinRTDeviceFamily
#define SDL_GetWinRTFSPathUTF8 SDL_GetWinRTFSPath #define SDL_GetWinRTFSPathUTF8 SDL_GetWinRTFSPath
#define SDL_iOSSetAnimationCallback SDL_SetiOSAnimationCallback #define SDL_iOSSetAnimationCallback SDL_SetiOSAnimationCallback
@ -1237,6 +1239,8 @@
#define SDL_GDKGetTaskQueue SDL_GDKGetTaskQueue_renamed_SDL_GetGDKTaskQueue #define SDL_GDKGetTaskQueue SDL_GDKGetTaskQueue_renamed_SDL_GetGDKTaskQueue
#define SDL_LinuxSetThreadPriority SDL_LinuxSetThreadPriority_renamed_SDL_SetLinuxThreadPriority #define SDL_LinuxSetThreadPriority SDL_LinuxSetThreadPriority_renamed_SDL_SetLinuxThreadPriority
#define SDL_LinuxSetThreadPriorityAndPolicy SDL_LinuxSetThreadPriorityAndPolicy_renamed_SDL_SetLinuxThreadPriorityAndPolicy #define SDL_LinuxSetThreadPriorityAndPolicy SDL_LinuxSetThreadPriorityAndPolicy_renamed_SDL_SetLinuxThreadPriorityAndPolicy
#define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidBecomeActive_renamed_SDL_OnApplicationDidEnterForeground
#define SDL_OnApplicationWillResignActive SDL_OnApplicationWillResignActive_renamed_SDL_OnApplicationWillEnterBackground
#define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_renamed_SDL_GetWinRTDeviceFamily #define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_renamed_SDL_GetWinRTDeviceFamily
#define SDL_GetWinRTFSPathUTF8 SDL_GetWinRTFSPathUTF8_renamed_SDL_GetWinRTFSPath #define SDL_GetWinRTFSPathUTF8 SDL_GetWinRTFSPathUTF8_renamed_SDL_GetWinRTFSPath
#define SDL_iOSSetAnimationCallback SDL_iOSSetAnimationCallback_renamed_SDL_SetiOSAnimationCallback #define SDL_iOSSetAnimationCallback SDL_iOSSetAnimationCallback_renamed_SDL_SetiOSAnimationCallback

View File

@ -716,7 +716,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void);
* *
* \since This function is available since SDL 3.0.0. * \since This function is available since SDL 3.0.0.
*/ */
extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void); extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillEnterBackground(void);
/** /**
* Let iOS apps with external event handling report * Let iOS apps with external event handling report
@ -767,7 +767,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
* *
* \since This function is available since SDL 3.0.0. * \since This function is available since SDL 3.0.0.
*/ */
extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void); extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidEnterForeground(void);
#ifdef SDL_PLATFORM_IOS #ifdef SDL_PLATFORM_IOS

View File

@ -582,12 +582,12 @@ SDL3_0.0.0 {
SDL_Metal_GetLayer; SDL_Metal_GetLayer;
SDL_MinimizeWindow; SDL_MinimizeWindow;
SDL_MixAudio; SDL_MixAudio;
SDL_OnApplicationDidBecomeActive; SDL_OnApplicationDidEnterForeground;
SDL_OnApplicationDidChangeStatusBarOrientation; SDL_OnApplicationDidChangeStatusBarOrientation;
SDL_OnApplicationDidEnterBackground; SDL_OnApplicationDidEnterBackground;
SDL_OnApplicationDidReceiveMemoryWarning; SDL_OnApplicationDidReceiveMemoryWarning;
SDL_OnApplicationWillEnterForeground; SDL_OnApplicationWillEnterForeground;
SDL_OnApplicationWillResignActive; SDL_OnApplicationWillEnterBackground;
SDL_OnApplicationWillTerminate; SDL_OnApplicationWillTerminate;
SDL_OpenAudioDevice; SDL_OpenAudioDevice;
SDL_OpenAudioDeviceStream; SDL_OpenAudioDeviceStream;

View File

@ -607,12 +607,12 @@
#define SDL_Metal_GetLayer SDL_Metal_GetLayer_REAL #define SDL_Metal_GetLayer SDL_Metal_GetLayer_REAL
#define SDL_MinimizeWindow SDL_MinimizeWindow_REAL #define SDL_MinimizeWindow SDL_MinimizeWindow_REAL
#define SDL_MixAudio SDL_MixAudio_REAL #define SDL_MixAudio SDL_MixAudio_REAL
#define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidBecomeActive_REAL #define SDL_OnApplicationDidEnterForeground SDL_OnApplicationDidEnterForeground_REAL
#define SDL_OnApplicationDidChangeStatusBarOrientation SDL_OnApplicationDidChangeStatusBarOrientation_REAL #define SDL_OnApplicationDidChangeStatusBarOrientation SDL_OnApplicationDidChangeStatusBarOrientation_REAL
#define SDL_OnApplicationDidEnterBackground SDL_OnApplicationDidEnterBackground_REAL #define SDL_OnApplicationDidEnterBackground SDL_OnApplicationDidEnterBackground_REAL
#define SDL_OnApplicationDidReceiveMemoryWarning SDL_OnApplicationDidReceiveMemoryWarning_REAL #define SDL_OnApplicationDidReceiveMemoryWarning SDL_OnApplicationDidReceiveMemoryWarning_REAL
#define SDL_OnApplicationWillEnterForeground SDL_OnApplicationWillEnterForeground_REAL #define SDL_OnApplicationWillEnterForeground SDL_OnApplicationWillEnterForeground_REAL
#define SDL_OnApplicationWillResignActive SDL_OnApplicationWillResignActive_REAL #define SDL_OnApplicationWillEnterBackground SDL_OnApplicationWillEnterBackground_REAL
#define SDL_OnApplicationWillTerminate SDL_OnApplicationWillTerminate_REAL #define SDL_OnApplicationWillTerminate SDL_OnApplicationWillTerminate_REAL
#define SDL_OpenAudioDevice SDL_OpenAudioDevice_REAL #define SDL_OpenAudioDevice SDL_OpenAudioDevice_REAL
#define SDL_OpenAudioDeviceStream SDL_OpenAudioDeviceStream_REAL #define SDL_OpenAudioDeviceStream SDL_OpenAudioDeviceStream_REAL

View File

@ -618,12 +618,12 @@ SDL_DYNAPI_PROC(void,SDL_Metal_DestroyView,(SDL_MetalView a),(a),)
SDL_DYNAPI_PROC(void*,SDL_Metal_GetLayer,(SDL_MetalView a),(a),return) SDL_DYNAPI_PROC(void*,SDL_Metal_GetLayer,(SDL_MetalView a),(a),return)
SDL_DYNAPI_PROC(int,SDL_MinimizeWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_MinimizeWindow,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_MixAudio,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, float e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_MixAudio,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, float e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(void,SDL_OnApplicationDidBecomeActive,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidEnterForeground,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationDidChangeStatusBarOrientation,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidChangeStatusBarOrientation,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationDidEnterBackground,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidEnterBackground,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationDidReceiveMemoryWarning,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidReceiveMemoryWarning,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationWillEnterForeground,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationWillEnterForeground,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationWillResignActive,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationWillEnterBackground,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationWillTerminate,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationWillTerminate,(void),(),)
SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_OpenAudioDevice,(SDL_AudioDeviceID a, const SDL_AudioSpec *b),(a,b),return) SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_OpenAudioDevice,(SDL_AudioDeviceID a, const SDL_AudioSpec *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_OpenAudioDeviceStream,(SDL_AudioDeviceID a, const SDL_AudioSpec *b, SDL_AudioStreamCallback c, void *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_OpenAudioDeviceStream,(SDL_AudioDeviceID a, const SDL_AudioSpec *b, SDL_AudioStreamCallback c, void *d),(a,b,c,d),return)

View File

@ -172,14 +172,14 @@ void SDL_SendPendingSignalEvents(void)
#ifdef SDL_BACKGROUNDING_SIGNAL #ifdef SDL_BACKGROUNDING_SIGNAL
if (send_backgrounding_pending) { if (send_backgrounding_pending) {
send_backgrounding_pending = SDL_FALSE; send_backgrounding_pending = SDL_FALSE;
SDL_OnApplicationWillResignActive(); SDL_OnApplicationWillEnterBackground();
} }
#endif #endif
#ifdef SDL_FOREGROUNDING_SIGNAL #ifdef SDL_FOREGROUNDING_SIGNAL
if (send_foregrounding_pending) { if (send_foregrounding_pending) {
send_foregrounding_pending = SDL_FALSE; send_foregrounding_pending = SDL_FALSE;
SDL_OnApplicationDidBecomeActive(); SDL_OnApplicationDidEnterForeground();
} }
#endif #endif
#endif #endif

View File

@ -5497,7 +5497,7 @@ void SDL_OnApplicationDidReceiveMemoryWarning(void)
SDL_SendAppEvent(SDL_EVENT_LOW_MEMORY); SDL_SendAppEvent(SDL_EVENT_LOW_MEMORY);
} }
void SDL_OnApplicationWillResignActive(void) void SDL_OnApplicationWillEnterBackground(void)
{ {
if (_this) { if (_this) {
SDL_Window *window; SDL_Window *window;
@ -5519,7 +5519,7 @@ void SDL_OnApplicationWillEnterForeground(void)
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND); SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
} }
void SDL_OnApplicationDidBecomeActive(void) void SDL_OnApplicationDidEnterForeground(void)
{ {
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND); SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);

View File

@ -71,12 +71,12 @@ static BOOL UIKit_EventPumpEnabled = YES;
- (void)applicationDidBecomeActive - (void)applicationDidBecomeActive
{ {
SDL_OnApplicationDidBecomeActive(); SDL_OnApplicationDidEnterForeground();
} }
- (void)applicationWillResignActive - (void)applicationWillResignActive
{ {
SDL_OnApplicationWillResignActive(); SDL_OnApplicationWillEnterBackground();
} }
- (void)applicationDidEnterBackground - (void)applicationDidEnterBackground