Commit graph

28 commits

Author SHA1 Message Date
Lars Sundström
920faab9a9 IOS7: Implement Apple GCVirtualController
Apple introduced the GCVirtualController in iOS 15 which is a
software emulation of a real controller. The virtual controllers
can be configurable with different inputs. See more info at:
https://developer.apple.com/documentation/gamecontroller/gcvirtualcontroller

A simple gamepad configuration with a dPad and A and B buttons
is added. The user can enable/disable the virtual game controller
swiping two fingers right to left, or through the port-specific
option dialog.
2023-05-06 10:22:20 +02:00
Thierry Crozat
07652d9d82 IOS7: Fix detection of orientation on some devices
The main change in to use the interface orientation and not the device
orientation. This may be different for example when locking the orientation.
This also changes the way orientation changes are detected using the
documented method. However this means dropping support for iOS 7 as this
method is only available since iOS 8, and alternative methods available in
iOS 7 have been deprecated in iOS 13.

Another change is to properly detect the interface orientation instead of
infering it from the view bounds, which was incorrect on some devices.
2023-04-27 21:43:40 +01:00
Lars Sundström
1ace0305ce IOS7: Add general handling of the menu button on game controllers
Expose the handleMainMenuKey function and call that when pressing the
menu button on game controllers.
2023-04-27 21:18:34 +01:00
Lars Sundström
eb4028880e IOS7: Suspend application if menu key pressed and no game is running
Add isInGame property to track if the launcher is shown of if a game is
running. Handle press on menu key different depending on if launcher is
shown or not. If launcher is shown suspend the application to return to
Apple TV Home Screen since that is the parent view of the launcher. If
in game pause the game and show menu. This is according to Apple
guidelines which can ge read here:
https://developer.apple.com/design/human-interface-guidelines/inputs/remotes
2023-04-27 21:18:23 +01:00
Lars Sundström
2c351f85ee IOS7: Check keyboard visible if inputView being first responder
The keyboard can be presented and dismissed without being triggered by
the showKeyboard/hideKeyboard functions e.g. by pressing the menu button
on the Apple TV remote while the keyboard is shown.
If the keyboard visibility is not set entirely by the showKeyboard/
hideKeyboard functions that means that the _keyboardVisible state
variable can be out of sync.

Check if the keyboard is shown based on if the inputView is the first
responder or not. The check has to be made on the main thread.
2023-04-27 21:18:08 +01:00
Lars Sundström
0a9239ad7c IOS7: Put iOS specific code within platform specific macros
iOS and tvOS shares a lot of code. However some there are parts that are
specific to iOS, for instance handling of UI device orientation and
certain types of gestures.

Currently there are also some limitations on the Apple TV that needs to
be flagged to the  engine. There is no support for virtual keyboard, no
clipboard support and no possibility to open URLs.

Put code specific for iOS within the ObjC platfrom macro TARGET_OS_IOS.
The code specific for tvOS are put within the macro TARGET_OS_TV.
2023-04-27 21:16:10 +01:00
Lars Sundström
b1b2e34184 IOS7: Add support for 32 bit pixel formats
This enables some game engines only supporting 32 bit color formats,
e.g. 11th hour and Broken Sword 2.5.

Add support for the pixel formats RGBA8888 and ABGR8888. The pixel
formats are defined in big endian while iOS utilizes little endian,
thus requiring converting some formats to get correct color
representation.

Use the Apple Accelerate framework converting the format requiring
to minimize the CPU load since this is done every frame.
2023-02-12 09:35:48 +01:00
Lars Sundström
e7759ac0ef IOS7: Implement getHardwareInputSet to get connected devices
Trigger EVENT_INPUT_CHANGED when devices connects to make the ScummVM
engine update the hardware input set.
2022-08-08 21:08:56 +01:00
Lars Sundström
db2e15b3f1 IOS7: Factor out touch pointer handling to TouchController class
Move touch inputs to a TouchController class to move some logic from the
iPhoneView class. Only do this for touches on screen since connected
trackpads can generate touches as well. The latter ones are of type
UITouchTypeIndirectPointer while touches on screen are of type
UITouchTypeDirect. They are separated thanks to the preference key
UIApplicationSupportsIndirectInputEvents set to YES in Info.plist.
Without the preference above, there is no way to distinguish touches
from screen from a trackpad.
2022-08-08 21:08:56 +01:00
Lars Sundström
877d1ffa67 IOS7: Add pointerPosition property to iPhoneView class
Let the view keep the current pointer position as a property, allowing
it to be modified by controllers.
2022-08-08 21:08:56 +01:00
Lars Sundström
6387046666 IOS7: Make iPhoneView addEvent and getMouseCoords functions public
Squash with the one above
2022-08-08 21:08:56 +01:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Cameron Cawley
a38103fb23 IOS7: Remove scaler code 2021-03-15 16:48:40 +02:00
Thierry Crozat
c50ffd74c6 IOS7: Properly restore state when the process has been terminated 2020-09-13 00:21:36 +01:00
Thierry Crozat
63627dc26d IOS7: Save state as a background task when entering background
This is better than using an hardcoded delay for two main reasons.
The first one is that the application can terminate as soon as it
has finished saving the state, and the second one is that it will
still work if saving the state takes longer than the delay that
was hardcoded.
2020-09-13 00:21:35 +01:00
Thierry Crozat
28e9910666 IOS7: Implement game state save/restore when switching tasks
This only works if the running engines can save the game at the
time when ScummVM goes to the background.
This should partially fix bug #7871.
2020-09-13 00:21:35 +01:00
sluicebox
42217b5852 IOS7: Implement horizontal shake 2019-11-19 00:20:40 +01:00
sluicebox
b8390fa161 GRAPHICS: Add interface for horizontal shake 2019-11-19 00:20:40 +01:00
Thierry Crozat
4795f2b68a IOS: Implement kFeatureVirtualKeyboard to show/hide the keyboard 2019-02-16 17:20:57 +00:00
Johannes Schickel
f8ef5e2476 IOS7: Make includes match our style. 2016-01-07 12:44:48 +01:00
Johannes Schickel
8fc03872c4 IOS7: Use #include instead of #import.
We always use #include. #import is a nice ObjC feature (in theory), but can
lead to odd results in corner cases.
2016-01-07 12:44:48 +01:00
Johannes Schickel
17a57443ae IOS7: Use standard include guard names. 2016-01-07 12:44:48 +01:00
Vincent Bénony
aa77c0c92d IOS: Disable scalers 2016-01-06 16:20:28 +01:00
Vincent Bénony
cfcd3842ed IOS: Adds iPhone 6/6+ launch screens 2016-01-06 16:17:37 +01:00
Vincent Bénony
7324f87b9a IOS: Switches to OpenGL ES 2.0 to ease debugging with Xcode 2016-01-06 16:17:37 +01:00
Vincent Bénony
80afba232a IOS: Implements scalers 2016-01-06 16:17:37 +01:00
Vincent Bénony
dd950fdb22 IOS: Removes a global variable 2016-01-06 16:17:35 +01:00
Vincent Bénony
699c350481 IOS: Renames iOS7 classes to avoid confusion 2016-01-06 16:17:34 +01:00
Renamed from backends/platform/ios7/iphone_video.h (Browse further)