From 817260c73de3adb766a7b1e339a0f0e9ab85eebf Mon Sep 17 00:00:00 2001
From: Max <[EMAIL REDACTED]>
Date: Thu, 30 Jan 2025 14:48:31 +0100
Subject: [PATCH] Updates SDL_SetEventFilter code snippet to SDL3
SDL_EventFilter points to a function that now returns a bool
---
docs/README-android.md | 16 ++++++++--------
docs/README-ios.md | 16 ++++++++--------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/docs/README-android.md b/docs/README-android.md
index 37905c46d540c..e57ca81dddd1e 100644
--- a/docs/README-android.md
+++ b/docs/README-android.md
@@ -242,7 +242,7 @@ not give you any processing time after the events are delivered.
e.g.
- int HandleAppEvents(void *userdata, SDL_Event *event)
+ bool HandleAppEvents(void *userdata, SDL_Event *event)
{
switch (event->type)
{
@@ -250,12 +250,12 @@ e.g.
/* Terminate the app.
Shut everything down before returning from this function.
*/
- return 0;
+ return false;
case SDL_EVENT_LOW_MEMORY:
/* You will get this when your app is paused and iOS wants more memory.
Release as much memory as possible.
*/
- return 0;
+ return false;
case SDL_EVENT_WILL_ENTER_BACKGROUND:
/* Prepare your app to go into the background. Stop loops, etc.
This gets called when the user hits the home button, or gets a call.
@@ -264,15 +264,15 @@ e.g.
in addition, you should set the render target to NULL, if you're using
it, e.g. call SDL_SetRenderTarget(renderer, NULL).
*/
- return 0;
+ return false;
case SDL_EVENT_DID_ENTER_BACKGROUND:
/* Your app is NOT active at this point. */
- return 0;
+ return false;
case SDL_EVENT_WILL_ENTER_FOREGROUND:
/* This call happens when your app is coming back to the foreground.
Restore all your state here.
*/
- return 0;
+ return false;
case SDL_EVENT_DID_ENTER_FOREGROUND:
/* Restart your loops here.
Your app is interactive and getting CPU again.
@@ -283,10 +283,10 @@ e.g.
event SDL_EVENT_RENDER_DEVICE_RESET and recreate your OpenGL context and
restore your textures when you get it, or quit the app.
*/
- return 0;
+ return false;
default:
/* No special processing, add it to the event queue */
- return 1;
+ return true;
}
}
diff --git a/docs/README-ios.md b/docs/README-ios.md
index dbd70f5a702f4..166d18261f441 100644
--- a/docs/README-ios.md
+++ b/docs/README-ios.md
@@ -65,7 +65,7 @@ not give you any processing time after the events are delivered.
e.g.
- int HandleAppEvents(void *userdata, SDL_Event *event)
+ bool HandleAppEvents(void *userdata, SDL_Event *event)
{
switch (event->type)
{
@@ -73,37 +73,37 @@ e.g.
/* Terminate the app.
Shut everything down before returning from this function.
*/
- return 0;
+ return false;
case SDL_EVENT_LOW_MEMORY:
/* You will get this when your app is paused and iOS wants more memory.
Release as much memory as possible.
*/
- return 0;
+ return false;
case SDL_EVENT_WILL_ENTER_BACKGROUND:
/* Prepare your app to go into the background. Stop loops, etc.
This gets called when the user hits the home button, or gets a call.
*/
- return 0;
+ return false;
case SDL_EVENT_DID_ENTER_BACKGROUND:
/* This will get called if the user accepted whatever sent your app to the background.
If the user got a phone call and canceled it, you'll instead get an SDL_EVENT_DID_ENTER_FOREGROUND event and restart your loops.
When you get this, you have 5 seconds to save all your state or the app will be terminated.
Your app is NOT active at this point.
*/
- return 0;
+ return false;
case SDL_EVENT_WILL_ENTER_FOREGROUND:
/* This call happens when your app is coming back to the foreground.
Restore all your state here.
*/
- return 0;
+ return false;
case SDL_EVENT_DID_ENTER_FOREGROUND:
/* Restart your loops here.
Your app is interactive and getting CPU again.
*/
- return 0;
+ return false;
default:
/* No special processing, add it to the event queue */
- return 1;
+ return true;
}
}