Use C99 bool internally in SDL

This commit is contained in:
Sam Lantinga committed 2024-08-22 13:30:02 -07:00
1 parent 6501e90018
commit 8f546bb3c9
450 files changed
+6046 -6033

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ char *Android_GetClipboardText(SDL_VideoDevice *_this)
return Android_JNI_GetClipboardText();
}
SDL_bool Android_HasClipboardText(SDL_VideoDevice *_this)
bool Android_HasClipboardText(SDL_VideoDevice *_this)
{
return Android_JNI_HasClipboardText();
}
+1 -1
View File
@@ -25,6 +25,6 @@
extern int Android_SetClipboardText(SDL_VideoDevice *_this, const char *text);
extern char *Android_GetClipboardText(SDL_VideoDevice *_this);
extern SDL_bool Android_HasClipboardText(SDL_VideoDevice *_this);
extern bool Android_HasClipboardText(SDL_VideoDevice *_this);
#endif // SDL_androidclipboard_h_
+20 -20
View File
@@ -47,7 +47,7 @@ static void android_egl_context_restore(SDL_Window *window)
event.common.timestamp = 0;
SDL_PushEvent(&event);
}
data->backup_done = SDL_FALSE;
data->backup_done = false;
if (data->has_swap_interval) {
SDL_GL_SetSwapInterval(data->swap_interval);
@@ -72,7 +72,7 @@ static void android_egl_context_backup(SDL_Window *window)
// We need to do this so the EGLSurface can be freed
SDL_GL_MakeCurrent(window, NULL);
data->backup_done = SDL_TRUE;
data->backup_done = true;
}
}
#endif
@@ -80,19 +80,19 @@ static void android_egl_context_backup(SDL_Window *window)
/*
* Android_ResumeSem and Android_PauseSem are signaled from Java_org_libsdl_app_SDLActivity_nativePause and Java_org_libsdl_app_SDLActivity_nativeResume
*/
static SDL_bool Android_EventsInitialized;
static SDL_bool Android_BlockOnPause = SDL_TRUE;
static SDL_bool Android_Paused;
static SDL_bool Android_PausedAudio;
static SDL_bool Android_Destroyed;
static bool Android_EventsInitialized;
static bool Android_BlockOnPause = true;
static bool Android_Paused;
static bool Android_PausedAudio;
static bool Android_Destroyed;
void Android_InitEvents(void)
{
if (!Android_EventsInitialized) {
Android_BlockOnPause = SDL_GetHintBoolean(SDL_HINT_ANDROID_BLOCK_ON_PAUSE, SDL_TRUE);
Android_Paused = SDL_FALSE;
Android_Destroyed = SDL_FALSE;
Android_EventsInitialized = SDL_TRUE;
Android_BlockOnPause = SDL_GetHintBoolean(SDL_HINT_ANDROID_BLOCK_ON_PAUSE, true);
Android_Paused = false;
Android_Destroyed = false;
Android_EventsInitialized = true;
}
}
@@ -100,7 +100,7 @@ static void Android_PauseAudio(void)
{
OPENSLES_PauseDevices();
AAUDIO_PauseDevices();
Android_PausedAudio = SDL_TRUE;
Android_PausedAudio = true;
}
static void Android_ResumeAudio(void)
@@ -108,7 +108,7 @@ static void Android_ResumeAudio(void)
if (Android_PausedAudio) {
OPENSLES_ResumeDevices();
AAUDIO_ResumeDevices();
Android_PausedAudio = SDL_FALSE;
Android_PausedAudio = false;
}
}
@@ -135,12 +135,12 @@ static void Android_OnPause(void)
Android_PauseAudio();
}
Android_Paused = SDL_TRUE;
Android_Paused = true;
}
static void Android_OnResume(void)
{
Android_Paused = SDL_FALSE;
Android_Paused = false;
SDL_OnApplicationWillEnterForeground();
@@ -180,7 +180,7 @@ static void Android_OnDestroy(void)
SDL_SendQuit();
SDL_SendAppEvent(SDL_EVENT_TERMINATING);
Android_Destroyed = SDL_TRUE;
Android_Destroyed = true;
}
static void Android_HandleLifecycleEvent(SDL_AndroidLifecycleEvent event)
@@ -206,7 +206,7 @@ static void Android_HandleLifecycleEvent(SDL_AndroidLifecycleEvent event)
}
}
static Sint64 GetLifecycleEventTimeout(SDL_bool paused, Sint64 timeoutNS)
static Sint64 GetLifecycleEventTimeout(bool paused, Sint64 timeoutNS)
{
if (Android_Paused) {
if (Android_BlockOnPause) {
@@ -221,7 +221,7 @@ static Sint64 GetLifecycleEventTimeout(SDL_bool paused, Sint64 timeoutNS)
void Android_PumpEvents(Sint64 timeoutNS)
{
SDL_AndroidLifecycleEvent event;
SDL_bool paused = Android_Paused;
bool paused = Android_Paused;
while (!Android_Destroyed &&
Android_WaitLifecycleEvent(&event, GetLifecycleEventTimeout(paused, timeoutNS))) {
@@ -237,7 +237,7 @@ void Android_PumpEvents(Sint64 timeoutNS)
break;
case SDL_ANDROID_LIFECYCLE_RESUME:
// Finish handling events at the resume state timeout
paused = SDL_FALSE;
paused = false;
break;
default:
break;
@@ -262,7 +262,7 @@ int Android_WaitActiveAndLockActivity(void)
void Android_QuitEvents(void)
{
Android_EventsInitialized = SDL_FALSE;
Android_EventsInitialized = false;
}
#endif // SDL_VIDEO_DRIVER_ANDROID
+6 -6
View File
@@ -353,7 +353,7 @@ static SDL_Scancode Android_Keycodes[] = {
SDL_SCANCODE_PASTE, // AKEYCODE_PASTE
};
static SDL_bool SDL_screen_keyboard_shown;
static bool SDL_screen_keyboard_shown;
static SDL_Scancode TranslateKeycode(int keycode)
{
@@ -378,9 +378,9 @@ int Android_OnKeyUp(int keycode)
return SDL_SendKeyboardKey(0, SDL_DEFAULT_KEYBOARD_ID, keycode, TranslateKeycode(keycode), SDL_RELEASED);
}
SDL_bool Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this)
bool Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this)
{
return SDL_TRUE;
return true;
}
void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props)
@@ -444,13 +444,13 @@ void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_
}
}
Android_JNI_ShowScreenKeyboard(input_type, &window->text_input_rect);
SDL_screen_keyboard_shown = SDL_TRUE;
SDL_screen_keyboard_shown = true;
}
void Android_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
{
Android_JNI_HideScreenKeyboard();
SDL_screen_keyboard_shown = SDL_FALSE;
SDL_screen_keyboard_shown = false;
}
void Android_RestoreScreenKeyboardOnResume(SDL_VideoDevice *_this, SDL_Window *window)
@@ -460,7 +460,7 @@ void Android_RestoreScreenKeyboardOnResume(SDL_VideoDevice *_this, SDL_Window *w
}
}
SDL_bool Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window)
bool Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window)
{
return Android_JNI_IsScreenKeyboardShown();
}
+2 -2
View File
@@ -25,8 +25,8 @@
extern int Android_OnKeyDown(int keycode);
extern int Android_OnKeyUp(int keycode);
extern SDL_bool Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this);
extern bool Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this);
extern void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props);
extern void Android_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window);
extern void Android_RestoreScreenKeyboardOnResume(SDL_VideoDevice *_this, SDL_Window *window);
extern SDL_bool Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window);
extern bool Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window);
+2 -2
View File
@@ -155,7 +155,7 @@ static int Android_ShowCursor(SDL_Cursor *cursor)
}
}
static int Android_SetRelativeMouseMode(SDL_bool enabled)
static int Android_SetRelativeMouseMode(bool enabled)
{
if (!Android_JNI_SupportsRelativeMouse()) {
return SDL_Unsupported();
@@ -206,7 +206,7 @@ static Uint8 TranslateButton(int state)
}
}
void Android_OnMouse(SDL_Window *window, int state, int action, float x, float y, SDL_bool relative)
void Android_OnMouse(SDL_Window *window, int state, int action, float x, float y, bool relative)
{
int changes;
Uint8 button;
+1 -1
View File
@@ -25,7 +25,7 @@
#include "SDL_androidvideo.h"
extern void Android_InitMouse(void);
extern void Android_OnMouse(SDL_Window *window, int button, int action, float x, float y, SDL_bool relative);
extern void Android_OnMouse(SDL_Window *window, int button, int action, float x, float y, bool relative);
extern void Android_QuitMouse(void);
#endif // SDL_androidmouse_h_
+2 -2
View File
@@ -72,7 +72,7 @@ void Android_OnTouch(SDL_Window *window, int touch_device_id_in, int pointer_fin
switch (action) {
case ACTION_DOWN:
case ACTION_POINTER_DOWN:
SDL_SendTouch(0, touchDeviceId, fingerId, window, SDL_TRUE, x, y, p);
SDL_SendTouch(0, touchDeviceId, fingerId, window, true, x, y, p);
break;
case ACTION_MOVE:
@@ -81,7 +81,7 @@ void Android_OnTouch(SDL_Window *window, int touch_device_id_in, int pointer_fin
case ACTION_UP:
case ACTION_POINTER_UP:
SDL_SendTouch(0, touchDeviceId, fingerId, window, SDL_FALSE, x, y, p);
SDL_SendTouch(0, touchDeviceId, fingerId, window, false, x, y, p);
break;
default:
+3 -3
View File
@@ -162,8 +162,8 @@ int Android_VideoInit(SDL_VideoDevice *_this)
SDL_VideoDisplay *display;
SDL_DisplayMode mode;
videodata->isPaused = SDL_FALSE;
videodata->isPausing = SDL_FALSE;
videodata->isPaused = false;
videodata->isPausing = false;
SDL_zero(mode);
mode.format = Android_ScreenFormat;
@@ -271,7 +271,7 @@ void Android_SendResize(SDL_Window *window)
}
}
void Android_SetDarkMode(SDL_bool enabled)
void Android_SetDarkMode(bool enabled)
{
SDL_VideoDevice *device = SDL_GetVideoDevice();
+1 -1
View File
@@ -29,7 +29,7 @@
extern void Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, float density, float rate);
extern void Android_SetFormat(int format_wanted, int format_got);
extern void Android_SendResize(SDL_Window *window);
extern void Android_SetDarkMode(SDL_bool enabled);
extern void Android_SetDarkMode(bool enabled);
// Private display data
+4 -4
View File
@@ -40,8 +40,8 @@ int Android_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
{
VkExtensionProperties *extensions = NULL;
Uint32 i, extensionCount = 0;
SDL_bool hasSurfaceExtension = SDL_FALSE;
SDL_bool hasAndroidSurfaceExtension = SDL_FALSE;
bool hasSurfaceExtension = false;
bool hasAndroidSurfaceExtension = false;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
if (_this->vulkan_config.loader_handle) {
return SDL_SetError("Vulkan already loaded");
@@ -81,9 +81,9 @@ int Android_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
}
for (i = 0; i < extensionCount; i++) {
if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasSurfaceExtension = SDL_TRUE;
hasSurfaceExtension = true;
} else if (SDL_strcmp(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasAndroidSurfaceExtension = SDL_TRUE;
hasAndroidSurfaceExtension = true;
}
}
SDL_free(extensions);
+1 -1
View File
@@ -165,7 +165,7 @@ void Android_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
Android_JNI_MinizeWindow();
}
void Android_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool resizable)
void Android_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool resizable)
{
// Set orientation
Android_JNI_SetOrientation(window->w, window->h, window->flags & SDL_WINDOW_RESIZABLE, SDL_GetHint(SDL_HINT_ORIENTATIONS));
+2 -2
View File
@@ -30,7 +30,7 @@ extern int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_
extern void Android_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
extern int Android_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen);
extern void Android_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern void Android_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool resizable);
extern void Android_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool resizable);
extern void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern SDL_Window *Android_Window;
@@ -43,7 +43,7 @@ struct SDL_WindowData
int has_swap_interval; // Save/Restore the swap interval / vsync
int swap_interval;
#endif
SDL_bool backup_done;
bool backup_done;
ANativeWindow *native_window;
};