This is emitted by GCC if -Wredundant-decls is passed.
The Bison source files to generate this header should be modified to
fix this, but I am unclear on the required workflow.
This commit fixes the compiler warnings regarding:
- The local declaration of 'view' hides instance variable [-Wshadow-ivar]
- Some of the gamepad controller buttons is only available in specific
versions of iOS and tvOS.
- Use of non-standard escape character '\E'. \E is a GNU shortcut.
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
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.
All buttons and triggers on MFi game controllers are pressure sensitive
which means that when pressing buttons the registered
valueChangedHandler function is called multiple times providing updates
on the pressure value the button is pressed with. This causes multiple
kInputJoystickButtonDown events to be sent to the EventManager.
In adventure games the pressure value is not relevant and could cause
problems for the user that it triggers multiple presses on e.g. the B
button which often is mapped to the right mouse button. In some games
a click on the right mouse button changes what action that should be
performed.
Keep track on if the joystick buttons A or B (often mapped as left and
right mouse buttons) are being pressed. If the button is already
pressed do not add a new event until the button isn't pressed anymore.
To not interfere with any open dialog, don't send key events while the
keyboard is visible.
The inputAccessoryView is only shown if no hardware keyboard is
connected. Some hardware keyboards doesn't necessary have all keys,
e.g. the Apple magic keyboard to the iPads which lacks the escape
key and all function keys.
To give the user the possibility to use these buttons, always show
the inputAccessoryView.
The UIAlertView was deprecated in iOS 9 and therefore not supported in
tvOS. Replace the UIAlertView with the suggested UIAlertAction, which is
supported by both iOS and tvOS.
Define a macro to find the root view controller of a view. Use the view
controller of the iPhoneView to present the alert.
There's a difference between UITextFields and UITextViews that the
delegate function textView:shouldChangeTextInRange:replacementText:
is called when pressing the backward button on a keyboard also when
the textView is empty. This is not the case for UITextFields, the
function textField:shouldChangeTextInRange:replacementText: is not
called if the textField is empty which is problematic in the cases
where there's already text in the open dialog (e.g. the save dialog
when the user wants to overwrite an existing slot). There's currently
no possibility to propagate existing text elements from dialog into
the textField. To be able to handle the cases where the user wants to
delete existing texts when the textField is empty the inputView has
to implement the UITextInput protocol function deleteBackward that is
called every time the backward key is pressed.
The UITextView is becoming focused by default in iOS and brings up the
keyboard for user input. This is not the case in tvOS. UITextView in
tvOS is not becoming focused by default and if manually setting it to
focused it will still not bring up the keyboard screen.
The UITextField is however becoming focused in both iOS and tvOS and
requires basically the same implementation. So the UITextView is
replaced with UITextField to bring up keyboard in both iOS and tvOS.
The UIToolbar class is not supported in tvOS. Instead implement the
toolbar as a UITabBar. The UITabBar is set directly as the
inputAccessoryView to the keyboard view in tvOS while in iOS it's put in
a UIScrollView (as the previous UIToolbar) to be able to scale the
inputAccessoryView better for small screens.
The UITabBar behaves a little bit different on iOS and tvOS where in
tvOS the delegate function
-(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
is called when navigated to a specific toolbar item, while in iOS called
when clicking on an item. To get the tvOS to trigger action on presses,
add a gesture recognizer to handle touch events.
Since the keyboard view on Apple TV always full screen prompted texts
gets hidden behind the keyboard. Delay the showing of the keyboard to
allow the user to understand what's requested as input.
The Apple TV remote has a touch area which functions as a touch
controller. It also has a few buttons that can be programmed for
different actions.
The "touchpad mode" is not really relevant for the Apple TV remote.
However the pointer should be moved when swiping on the touch area
on the remote. Since we don't want to generate actions on touchBegan
and touchEnded for the remote, make sure these are only triggered if
the touch is made on direct contact with the screen, UITouchTypeDirect.
Implement the button handling by implement the microGamepad profile in
the GamepadController class. Only buttons A, X and the menu buttons are
relevant since the touch area is using the touch controller class.
The tvOS simulator however doesn't call the lambda functions defined for
the microGamepad buttons, hence the implementation of the "pressesBegan"
and "pressesEnded" which is called instead when running the simulator.
Implement common handling of the menu button. If the menu button is
pressed the soft keyboard will be shown. If pressing the menu button
again the soft keyboard will be hidden. If pressing the menu button
a third time the application will be suspended.
Implement new gesture recognizers that can be used with the Apple TV
remote. Up/down/left/right actions are triggered on press on the arrow
buttons, or tap on the edges of the touch area.
A long press, 5 seconds, of "Play/Pause" button toggles Mouse-click-and-
drag mode needed by some games.
Joystick button up events was not sent to the EventManager due to a
missing break in the kInputJoystickButtonUp case. This caused button
presses in the launcher and dialogs not to be triggered.
Adding the break enables use of joystick buttons in ScummVM GUIs.
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.
Add Apple TV OS as a new target to the xcode project creator utility.
Make sure that TV OS specific files are not part of the iOS and macOS
targets and the other way around.
The TV OS project will utilize the same source code files as the iOS
project but will instead use the tvos dist files.
The Apple TV OS requires a different type of storyboard than iOS. Also,
the Info.plist file differ since the tvOS platform doesn't handle
different orientations.
The Apple TV OS also need a different set of icons with different
resolutions more suitable for TV screens.
The application icons are required to be of layered type, which means
that a single PNG file is not accepted as an icon file. The icons must
have at least two layers, hence the ScummVM icon is defined by a back
image with just the background color and a front image with the ScummVM
logo.
The icons are then put together when archiving the application in Xcode
to an Assets.car file. However the linux builds are not building the
application using Xcode. Therefore a pre-compiled Assets.car file
containing the image assets (icons, splash screen etc) is added to the
tvos folder. This file is copied to the application bundle. If the icons
are changed in the future a new Assets.car file has to be compiled. This
can only be done on a computer with Xcode installed. To compile run the
following command in the tvos folder:
xcrun actool ./Images.xcassets --compile build --platform appletvos \
--minimum-deployment-target 9.0 --app-icon AppIcon \
--output-partial-info-plist build/partial.plist \
--launch-image LaunchImage
The partial.plist file generated will show what to add to the Info.plist
and if something must be changed in the ports.mk section for the
tvosbundle.