upgrade SDL3 to d4b80726142d9108f16d4806c09779d612501608

This commit is contained in:
Alex Zenla
2024-09-01 07:26:53 -04:00
committed by a dinosaur
parent f2031ac442
commit fbf66585eb
226 changed files with 24489 additions and 11757 deletions

View File

@ -36,8 +36,10 @@
#define SDL_WINDOW_HIGH_PIXEL_DENSITY 0x0000000000002000UL /**< window uses high pixel density back buffer if possible */
#undef SDL_WINDOW_MOUSE_CAPTURE
#define SDL_WINDOW_MOUSE_CAPTURE 0x0000000000004000UL /**< window has mouse captured (unrelated to MOUSE_GRABBED) */
#undef SDL_WINDOW_MOUSE_RELATIVE_MODE
#define SDL_WINDOW_MOUSE_RELATIVE_MODE 0x0000000000008000UL /**< window has relative mode enabled */
#undef SDL_WINDOW_ALWAYS_ON_TOP
#define SDL_WINDOW_ALWAYS_ON_TOP 0x0000000000008000UL /**< window should always be above others */
#define SDL_WINDOW_ALWAYS_ON_TOP 0x0000000000010000UL /**< window should always be above others */
#undef SDL_WINDOW_UTILITY
#define SDL_WINDOW_UTILITY 0x0000000000020000UL /**< window should be treated as a utility window, not showing in the task bar and window list */
#undef SDL_WINDOW_TOOLTIP

View File

@ -18,7 +18,7 @@ public class Application {
}
private func initialize() -> ApplicationExecutionState {
guard SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD) >= 0 else {
guard SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD) else {
printErr("SDL_Init() error: \(String(cString: SDL_GetError()))")
return .exitFailure
}
@ -39,11 +39,11 @@ public class Application {
// Get window metrics
var backBuffer = Size<Int32>.zero, windowSize = Size<Int32>.zero
guard SDL_GetWindowSizeInPixels(window, &backBuffer.w, &backBuffer.h) >= 0 else {
guard SDL_GetWindowSizeInPixels(window, &backBuffer.w, &backBuffer.h) else {
printErr("SDL_GetWindowSizeInPixels() error: \(String(cString: SDL_GetError()))")
return .exitFailure
}
guard SDL_GetWindowSize(window, &windowSize.w, &windowSize.h) >= 0 else {
guard SDL_GetWindowSize(window, &windowSize.w, &windowSize.h) else {
printErr("SDL_GetWindowSize() error: \(String(cString: SDL_GetError()))")
return .exitFailure
}
@ -100,7 +100,7 @@ public class Application {
return .running
case SDL_EVENT_GAMEPAD_ADDED:
if SDL_IsGamepad(event.gdevice.which) != SDL_FALSE {
if SDL_IsGamepad(event.gdevice.which) {
GameController.instance.connectedEvent(id: event.gdevice.which)
}
return .running
@ -176,7 +176,7 @@ public class Application {
quit: while res == .running {
beginHandleEvents()
var event = SDL_Event()
while SDL_PollEvent(&event) > 0 {
while SDL_PollEvent(&event) {
res = handleEvent(event)
if res != .running {
break quit

View File

@ -43,8 +43,7 @@ public class Mouse {
private func getCapture() -> Bool { self._captured }
private func setCapture(_ toggle: Bool) {
let sdlBool = toggle ? SDL_TRUE : SDL_FALSE
if SDL_SetRelativeMouseMode(sdlBool) >= 0 && SDL_SetWindowMouseGrab(self._window, sdlBool) >= 0 {
if SDL_SetWindowRelativeMouseMode(self._window, toggle) && SDL_SetWindowMouseGrab(self._window, toggle) {
self._captured = toggle
}
}