Skip to content

Instantly share code, notes, and snippets.

@unilock
Created October 30, 2024 23:57
Show Gist options
  • Save unilock/f4e2aff50d891a1ed26d5ea2769764ae to your computer and use it in GitHub Desktop.
Save unilock/f4e2aff50d891a1ed26d5ea2769764ae to your computer and use it in GitHub Desktop.
libSDL2 patch for Terraria on macOS
diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m
index c14f9abdc..5f87f03dc 100644
--- a/src/video/cocoa/SDL_cocoamouse.m
+++ b/src/video/cocoa/SDL_cocoamouse.m
@@ -529,14 +529,14 @@ void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
For continuous scroll events from trackpads, send fractional deltas for smoother scrolling. */
if (![event hasPreciseScrollingDeltas]) {
if (x > 0) {
- x = SDL_ceil(x);
+ x = 1;
} else if (x < 0) {
- x = SDL_floor(x);
+ x = -1;
}
if (y > 0) {
- y = SDL_ceil(y);
+ y = 1;
} else if (y < 0) {
- y = SDL_floor(y);
+ y = -1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment