-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add iOS virtual controller support #97530
base: master
Are you sure you want to change the base?
Conversation
@bruvzg Thank you for your review. We have another idea that could work better:
What do you think? |
That's probably OK as well. |
4d04acd
to
8f19e30
Compare
We implemented the proposed changes, please take a look. |
af06459
to
9090de7
Compare
9090de7
to
7903c5f
Compare
Co-authored-by: Micky <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on iPad, seems to be working fine.
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ | ||
/**************************************************************************/ | ||
|
||
#import "virtual_controller_ios.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#import "virtual_controller_ios.h" | |
#import "virtual_controller_ios.h" | |
void IOSVirtualController::controller_connected() { | ||
if (@available(iOS 15.0, *)) { | ||
if (gcv_controller != nil) { | ||
BOOL hasPhysicalController = NO; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BOOL hasPhysicalController = NO; | |
BOOL has_physical_controller = NO; |
Please use snake_case
Use a virtual controller to display software controls that you can customize over your game. | ||
You create a virtual controller from a configuration where you choose the input elements to display. | ||
When you connect the controller to the device, users interact with it similarly to a real controller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a virtual controller to display software controls that you can customize over your game. | |
You create a virtual controller from a configuration where you choose the input elements to display. | |
When you connect the controller to the device, users interact with it similarly to a real controller. | |
Use a virtual controller to display software controls that you can customize over your game. You create a virtual controller from a configuration where you choose the input elements to display. When you connect the controller to the device, users interact with it similarly to a real controller. |
Each new line is a separate paragraph, I think this should be one line
/**************************************************************************/ | ||
|
||
#import "core/input/virtual_controller.h" | ||
#import <GameController/GameController.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#import <GameController/GameController.h> | |
#import <GameController/GameController.h> |
Group includes
void connect_controller(); | ||
void disconnect_controller(); | ||
void initialize(); | ||
void elements_changed(GCInputElementName name, bool hidden); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void elements_changed(GCInputElementName name, bool hidden); | |
void elements_changed(GCInputElementName p_name, bool p_hidden); |
Prefix arguments with p_
enabled_button_y = GLOBAL_GET("input_devices/virtual_controller/ios/enable_button_y"); | ||
} | ||
|
||
void IOSVirtualController::elements_changed(GCInputElementName name, bool hidden) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void IOSVirtualController::elements_changed(GCInputElementName name, bool hidden) { | |
void IOSVirtualController::elements_changed(GCInputElementName p_name, bool p_hidden) { |
Adds iOS virtual controller support to Godot.
The virtual controller may be configured in the project settings.
Apple reference: https://developer.apple.com/documentation/gamecontroller/gcvirtualcontroller?language=objc
Developed by Migeran, sponsored by Xibbon Inc.