Use C99 bool internally in SDL

This commit is contained in:
Sam Lantinga
2024-08-22 09:21:26 -07:00
parent 6501e90018
commit 8f546bb3c9
450 changed files with 6046 additions and 6033 deletions

View File

@@ -29,7 +29,7 @@ static SDL_AtomicInt apprc; // use an atomic, since events might land from any
static void *SDL_main_appstate = NULL;
// Return true if this event needs to be processed before returning from the event watcher
static SDL_bool ShouldDispatchImmediately(SDL_Event *event)
static bool ShouldDispatchImmediately(SDL_Event *event)
{
switch (event->type) {
case SDL_EVENT_TERMINATING:
@@ -38,9 +38,9 @@ static SDL_bool ShouldDispatchImmediately(SDL_Event *event)
case SDL_EVENT_DID_ENTER_BACKGROUND:
case SDL_EVENT_WILL_ENTER_FOREGROUND:
case SDL_EVENT_DID_ENTER_FOREGROUND:
return SDL_TRUE;
return true;
default:
return SDL_FALSE;
return false;
}
}
@@ -78,15 +78,15 @@ static SDL_bool SDLCALL SDL_MainCallbackEventWatcher(void *userdata, SDL_Event *
} else {
// We'll process this event later from the main event queue
}
return SDL_TRUE;
return true;
}
SDL_bool SDL_HasMainCallbacks(void)
bool SDL_HasMainCallbacks(void)
{
if (SDL_main_iteration_callback) {
return SDL_TRUE;
return true;
}
return SDL_FALSE;
return false;
}
SDL_AppResult SDL_InitMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
@@ -113,7 +113,7 @@ SDL_AppResult SDL_InitMainCallbacks(int argc, char* argv[], SDL_AppInit_func app
return SDL_AtomicGet(&apprc);
}
SDL_AppResult SDL_IterateMainCallbacks(SDL_bool pump_events)
SDL_AppResult SDL_IterateMainCallbacks(bool pump_events)
{
if (pump_events) {
SDL_PumpEvents();

View File

@@ -22,9 +22,9 @@
#ifndef SDL_main_callbacks_h_
#define SDL_main_callbacks_h_
SDL_bool SDL_HasMainCallbacks(void);
bool SDL_HasMainCallbacks(void);
SDL_AppResult SDL_InitMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func _appiter, SDL_AppEvent_func _appevent, SDL_AppQuit_func _appquit);
SDL_AppResult SDL_IterateMainCallbacks(SDL_bool pump_events);
SDL_AppResult SDL_IterateMainCallbacks(bool pump_events);
void SDL_QuitMainCallbacks(void);
#endif // SDL_main_callbacks_h_

View File

@@ -26,7 +26,7 @@
static void EmscriptenInternalMainloop(void)
{
const SDL_AppResult rc = SDL_IterateMainCallbacks(SDL_TRUE);
const SDL_AppResult rc = SDL_IterateMainCallbacks(true);
if (rc != SDL_APP_CONTINUE) {
SDL_QuitMainCallbacks();
emscripten_cancel_main_loop(); // kill" the mainloop, so it stops calling back into it.

View File

@@ -45,7 +45,7 @@ int SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit,
Uint64 next_iteration = callback_rate_increment ? (SDL_GetTicksNS() + callback_rate_increment) : 0;
while ((rc = SDL_IterateMainCallbacks(SDL_TRUE)) == SDL_APP_CONTINUE) {
while ((rc = SDL_IterateMainCallbacks(true)) == SDL_APP_CONTINUE) {
// !!! FIXME: this can be made more complicated if we decide to
// !!! FIXME: optionally hand off callback responsibility to the
// !!! FIXME: video subsystem (for example, if Wayland has a

View File

@@ -50,7 +50,7 @@ static SDLIosMainCallbacksDisplayLink *globalDisplayLink;
- (void)appIteration:(CADisplayLink *)sender
{
const SDL_AppResult rc = SDL_IterateMainCallbacks(SDL_TRUE);
const SDL_AppResult rc = SDL_IterateMainCallbacks(true);
if (rc != SDL_APP_CONTINUE) {
[self.displayLink invalidate];
self.displayLink = nil;