Skip to content

Commit

Permalink
Migrate macos controller API to GameController.h
Browse files Browse the repository at this point in the history
This should fix a lot of issues regarding to old controller API, such as vibration

Haptics (vibrations) are only available in macOS 11+, so haptics are now
processed in macOS 11+ only. Also, this doesn't interfere with
controller's input as controller support is available in macOS 10.9+.

Added a Note for macOS regarding vibration support
  • Loading branch information
JezerM committed Feb 20, 2024
1 parent b714563 commit 07313a0
Show file tree
Hide file tree
Showing 9 changed files with 663 additions and 695 deletions.
1 change: 1 addition & 0 deletions doc/classes/Input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@
<description>
Starts to vibrate the joypad. Joypads usually come with two rumble motors, a strong and a weak one. [param weak_magnitude] is the strength of the weak motor (between 0 and 1) and [param strong_magnitude] is the strength of the strong motor (between 0 and 1). [param duration] is the duration of the effect in seconds (a duration of 0 will try to play the vibration indefinitely). The vibration can be stopped early by calling [method stop_joy_vibration].
[b]Note:[/b] Not every hardware is compatible with long effect durations; it is recommended to restart an effect if it has to be played for more than a few seconds.
[b]Note:[/b] For macOS, vibration is only supported in macOS 11 and later.
</description>
</method>
<method name="stop_joy_vibration">
Expand Down
2 changes: 1 addition & 1 deletion platform/macos/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ files = [
"godot_open_save_delegate.mm",
"dir_access_macos.mm",
"tts_macos.mm",
"joypad_macos.cpp",
"joypad_macos.mm",
"rendering_context_driver_vulkan_macos.mm",
"gl_manager_macos_angle.mm",
"gl_manager_macos_legacy.mm",
Expand Down
4 changes: 3 additions & 1 deletion platform/macos/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ def configure(env: "SConsEnvironment"):
"-framework",
"IOKit",
"-framework",
"ForceFeedback",
"GameController",
"-framework",
"CoreHaptics",
"-framework",
"CoreVideo",
"-framework",
Expand Down
Loading

0 comments on commit 07313a0

Please sign in to comment.