[Scummvm-git-logs] scummvm master -> 857b7553aac9c07d980531372fb820d2944bad71
larsamannen
noreply at scummvm.org
Tue Oct 10 18:55:57 UTC 2023
This automated email contains information about 13 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fac56ff37d IOS7: Fix position of virtual gamepad controller
ee4319beb3 IOS7: Rename option "onscreen_controls" to "gamepad_controller"
2971029301 IOS7: Configure directional elements on virtual controller
8e9f54ad32 IOS7: Refactor touchpadModeEnabled to a TouchMode
a705235d1a IOS7: Add touch mode configurations in menu, 2D & 3D games
ac98432429 DISTS: IOS7: Add touch mode assets
324569f206 IOS7: Add on-screen controls as UI buttons
00296153df IOS7: Add on-screen controls visibility configuration
316352e868 IOS7: Toggle keyboard with on-screen control button
40f382cace IOS7: Make it possible to toggle alphabetical <-> numpad keyboard
a2de9b0b4e IOS7: Handle HW keyboards better when using "Stage Manager"
f6585ae5f5 IOS7: Disable SCUMMVM_NEON in iOS builds
857b7553aa IOS7: Don't suspend the application in iOS when pressing menu
Commit: fac56ff37d75f06b4c625b594d2ff30e75c00b08
https://github.com/scummvm/scummvm/commit/fac56ff37d75f06b4c625b594d2ff30e75c00b08
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Fix position of virtual gamepad controller
With the release of iOS 17 the fix for adjusting the position of
the virtual controller stopped working. On some devices with so
called safe areas, the action buttons could be placed outside the
screen.
Rework the fix to position the GCControllerView layer instead.
Changed paths:
backends/platform/ios7/ios7_gamepad_controller.mm
diff --git a/backends/platform/ios7/ios7_gamepad_controller.mm b/backends/platform/ios7/ios7_gamepad_controller.mm
index 32bec9e3a94..36eb26863c1 100644
--- a/backends/platform/ios7/ios7_gamepad_controller.mm
+++ b/backends/platform/ios7/ios7_gamepad_controller.mm
@@ -26,6 +26,7 @@
#include "common/config-manager.h"
#include "backends/platform/ios7/ios7_gamepad_controller.h"
#include "backends/platform/ios7/ios7_video.h"
+#include "backends/platform/ios7/ios7_app_delegate.h"
#include <GameController/GameController.h>
@implementation GamepadController {
@@ -76,18 +77,37 @@
// - LayoutContainerView
// - ContainerView
// iPads have an additional layer under the ContainerView
+#if TARGET_OS_IOS
- (BOOL)setGCControllerViewProperties:(NSArray<UIView*>*)subviews {
BOOL stop = NO;
for (UIView *view in subviews) {
if ([[view classForCoder] isEqual:NSClassFromString(@"GCControllerView")]) {
- // Set the virtual controller frame to full screen.
- // Else buttons can be placed partly out of the frame
- // due to the iPhoneView frame is adjusted according
- // to the safe area insets.
- // Also set the frame alpha to the user specified value
+ // Set the frame alpha to the user specified value
// to make the virtual controller more transparent
view.alpha = ((float)ConfMan.getInt("onscreen_control_opacity") / 10.0);
- view.frame = [[UIScreen mainScreen] bounds];
+
+ // Since the iOS7 view controller frame is adjusted for the safe area, the same
+ // has to be done for the gamepad controller view. One could think that subviews
+ // would adjust automatically but it seems that the gamepad controller buttons
+ // can be positioned outside the device screen if not adjusting manually.
+ if (@available(iOS 11.0, *)) {
+ UIEdgeInsets insets = [[[UIApplication sharedApplication] keyWindow] safeAreaInsets];
+ UIInterfaceOrientation orientation = [iOS7AppDelegate currentOrientation];
+
+ // Set anchor point to lower right corner
+ view.layer.anchorPoint = CGPointMake(1, 1);
+
+ // Specify the position of the view layer from the anchor point
+ if (orientation == UIInterfaceOrientationLandscapeLeft) {
+ view.layer.position = CGPointMake(view.frame.size.width, view.layer.position.y);
+ } else if (orientation == UIInterfaceOrientationLandscapeRight) {
+ // When a device with e.g. a sensor bar is rotated so the sensor bar
+ // is to the left, we can adjust the anchor point a bit more to the left
+ // to make the left thumb buttons be at the same distance from the screen
+ // border.
+ view.layer.position = CGPointMake(view.frame.size.width - insets.left, view.layer.position.y);
+ }
+ }
stop = YES;
} else {
// Keep drilling
@@ -99,6 +119,7 @@
}
return stop;
}
+#endif
- (void)virtualController:(bool)connect {
#if TARGET_OS_IOS
Commit: ee4319beb39c087b7bc2debf3ef25462bae34d48
https://github.com/scummvm/scummvm/commit/ee4319beb39c087b7bc2debf3ef25462bae34d48
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Rename option "onscreen_controls" to "gamepad_controller"
The onscreen_controls options should refer to the touch mode setting
and main menu buttons as it's done in the Android backend. The
virtual gamepad controller used the onscreen_controls string to
identify the option. Change the identifier string to
gamepad_controller so onscreen_controller can be used for the buttons
to be added to the iOS backend.
Changed paths:
backends/platform/ios7/ios7_gamepad_controller.mm
backends/platform/ios7/ios7_options.mm
backends/platform/ios7/ios7_osys_events.cpp
backends/platform/ios7/ios7_video.mm
diff --git a/backends/platform/ios7/ios7_gamepad_controller.mm b/backends/platform/ios7/ios7_gamepad_controller.mm
index 36eb26863c1..4cd021dd19d 100644
--- a/backends/platform/ios7/ios7_gamepad_controller.mm
+++ b/backends/platform/ios7/ios7_gamepad_controller.mm
@@ -84,7 +84,7 @@
if ([[view classForCoder] isEqual:NSClassFromString(@"GCControllerView")]) {
// Set the frame alpha to the user specified value
// to make the virtual controller more transparent
- view.alpha = ((float)ConfMan.getInt("onscreen_control_opacity") / 10.0);
+ view.alpha = ((float)ConfMan.getInt("gamepad_controller_opacity") / 10.0);
// Since the iOS7 view controller frame is adjusted for the safe area, the same
// has to be done for the gamepad controller view. One could think that subviews
diff --git a/backends/platform/ios7/ios7_options.mm b/backends/platform/ios7/ios7_options.mm
index c6709ed437b..616630d4bf4 100644
--- a/backends/platform/ios7/ios7_options.mm
+++ b/backends/platform/ios7/ios7_options.mm
@@ -35,7 +35,7 @@
enum {
kHelpCmd = 'Help',
- kOnscreenOpacityChanged = 'osoc',
+ kGamepadControllerOpacityChanged = 'gcoc',
};
class IOS7OptionsWidget final : public GUI::OptionsContainerWidget {
@@ -58,10 +58,10 @@ private:
void saveOrientation(const Common::String &setting, uint32 orientation);
#endif
- GUI::CheckboxWidget *_onscreenCheckbox;
- GUI::StaticTextWidget *_onscreenOpacityDesc;
- GUI::SliderWidget *_onscreenOpacitySlider;
- GUI::StaticTextWidget *_onscreenOpacityLabel;
+ GUI::CheckboxWidget *_gamepadControllerCheckbox;
+ GUI::StaticTextWidget *_gamepadControllerOpacityDesc;
+ GUI::SliderWidget *_gamepadControllerOpacitySlider;
+ GUI::StaticTextWidget *_gamepadControllerOpacityLabel;
GUI::CheckboxWidget *_touchpadCheckbox;
GUI::CheckboxWidget *_clickAndDragCheckbox;
GUI::CheckboxWidget *_keyboardFnBarCheckbox;
@@ -80,12 +80,12 @@ IOS7OptionsWidget::IOS7OptionsWidget(GuiObject *boss, const Common::String &name
const bool inAppDomain = domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain);
- _onscreenCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.OnScreenControl", _("Show On-screen control (iOS 15 and later)"));
- _onscreenOpacityDesc = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.OnScreenControlOpacity", _("Control opacity"));
- _onscreenOpacitySlider = new GUI::SliderWidget(widgetsBoss(), "IOS7OptionsDialog.OnScreenControlOpacitySlider", _("Control opacity"), kOnscreenOpacityChanged);
- _onscreenOpacityLabel = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.OnScreenControlOpacityLabel", Common::U32String(" "), Common::U32String(), GUI::ThemeEngine::kFontStyleBold, Common::UNK_LANG, false);
- _onscreenOpacitySlider->setMinValue(1);
- _onscreenOpacitySlider->setMaxValue(10);
+ _gamepadControllerCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.GamepadController", _("Show Gamepad Controller (iOS 15 and later)"));
+ _gamepadControllerOpacityDesc = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.GamepadControllerOpacity", _("Gamepad opacity"));
+ _gamepadControllerOpacitySlider = new GUI::SliderWidget(widgetsBoss(), "IOS7OptionsDialog.GamepadControllerOpacitySlider", _("Gamepad opacity"), kGamepadControllerOpacityChanged);
+ _gamepadControllerOpacityLabel = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.GamepadControllerOpacityLabel", Common::U32String(" "), Common::U32String(), GUI::ThemeEngine::kFontStyleBold, Common::UNK_LANG, false);
+ _gamepadControllerOpacitySlider->setMinValue(1);
+ _gamepadControllerOpacitySlider->setMaxValue(10);
_touchpadCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.TouchpadMouseMode", _("Touchpad mouse mode"));
_clickAndDragCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.ClickAndDragMode", _("Mouse-click-and-drag mode"));
_keyboardFnBarCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.KeyboardFunctionBar", _("Show keyboard function bar"));
@@ -117,7 +117,7 @@ IOS7OptionsWidget::IOS7OptionsWidget(GuiObject *boss, const Common::String &name
new GUI::ButtonWidget(widgetsBoss(), "IOS7OptionsDialog.ControlsHelp", _("Controls Help"), Common::U32String(), kHelpCmd);
- // setEnabled is normally only called from the EditGameDialog, but some options (OnScreenControl)
+ // setEnabled is normally only called from the EditGameDialog, but some options (GamepadController)
// should be disabled in all domains if system is running a lower version of iOS than 15.0.
setEnabled(_enabled);
}
@@ -131,12 +131,12 @@ void IOS7OptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::Stri
layouts.addDialog(layoutName, overlayedLayout)
.addLayout(GUI::ThemeLayout::kLayoutVertical)
.addPadding(0, 0, 0, 0)
- .addWidget("OnScreenControl", "Checkbox")
+ .addWidget("GamepadController", "Checkbox")
.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
.addPadding(0, 0, 0, 0)
- .addWidget("OnScreenControlOpacity", "OptionsLabel")
- .addWidget("OnScreenControlOpacitySlider", "Slider")
- .addWidget("OnScreenControlOpacityLabel", "OptionsLabel")
+ .addWidget("GamepadControllerOpacity", "OptionsLabel")
+ .addWidget("GamepadControllerOpacitySlider", "Slider")
+ .addWidget("GamepadControllerOpacityLabel", "OptionsLabel")
.closeLayout()
.addWidget("TouchpadMouseMode", "Checkbox")
.addWidget("ClickAndDragMode", "Checkbox")
@@ -199,10 +199,10 @@ void IOS7OptionsWidget::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui
help.runModal();
break;
}
- case kOnscreenOpacityChanged: {
- const int newValue = _onscreenOpacitySlider->getValue();
- _onscreenOpacityLabel->setValue(newValue);
- _onscreenOpacityLabel->markAsDirty();
+ case kGamepadControllerOpacityChanged: {
+ const int newValue = _gamepadControllerOpacitySlider->getValue();
+ _gamepadControllerOpacityLabel->setValue(newValue);
+ _gamepadControllerOpacityLabel->markAsDirty();
break;
}
default:
@@ -250,9 +250,9 @@ void IOS7OptionsWidget::saveOrientation(const Common::String &setting, uint32 or
void IOS7OptionsWidget::load() {
const bool inAppDomain = _domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain);
- _onscreenCheckbox->setState(ConfMan.getBool("onscreen_control", _domain));
- _onscreenOpacitySlider->setValue(ConfMan.getInt("onscreen_control_opacity", _domain));
- _onscreenOpacityLabel->setValue(_onscreenOpacitySlider->getValue());
+ _gamepadControllerCheckbox->setState(ConfMan.getBool("gamepad_controller", _domain));
+ _gamepadControllerOpacitySlider->setValue(ConfMan.getInt("gamepad_controller_opacity", _domain));
+ _gamepadControllerOpacityLabel->setValue(_gamepadControllerOpacitySlider->getValue());
_touchpadCheckbox->setState(ConfMan.getBool("touchpad_mode", _domain));
_clickAndDragCheckbox->setState(ConfMan.getBool("clickanddrag_mode", _domain));
_keyboardFnBarCheckbox->setState(ConfMan.getBool("keyboard_fn_bar", _domain));
@@ -269,8 +269,8 @@ bool IOS7OptionsWidget::save() {
const bool inAppDomain = _domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain);
if (_enabled) {
- ConfMan.setBool("onscreen_control", _onscreenCheckbox->getState(), _domain);
- ConfMan.setInt("onscreen_control_opacity", _onscreenOpacitySlider->getValue(), _domain);
+ ConfMan.setBool("gamepad_controller", _gamepadControllerCheckbox->getState(), _domain);
+ ConfMan.setInt("gamepad_controller_opacity", _gamepadControllerOpacitySlider->getValue(), _domain);
ConfMan.setBool("touchpad_mode", _touchpadCheckbox->getState(), _domain);
ConfMan.setBool("clickanddrag_mode", _clickAndDragCheckbox->getState(), _domain);
ConfMan.setBool("keyboard_fn_bar", _keyboardFnBarCheckbox->getState(), _domain);
@@ -282,8 +282,8 @@ bool IOS7OptionsWidget::save() {
saveOrientation("orientation_games", _orientationGamesPopUp->getSelectedTag());
#endif
} else {
- ConfMan.removeKey("onscreen_control", _domain);
- ConfMan.removeKey("onscreen_control_opacity", _domain);
+ ConfMan.removeKey("gamepad_controller", _domain);
+ ConfMan.removeKey("gamepad_controller_opacity", _domain);
ConfMan.removeKey("touchpad_mode", _domain);
ConfMan.removeKey("clickanddrag_mode", _domain);
ConfMan.removeKey("keyboard_fn_bar", _domain);
@@ -300,8 +300,8 @@ bool IOS7OptionsWidget::save() {
}
bool IOS7OptionsWidget::hasKeys() {
- bool hasKeys = ConfMan.hasKey("onscreen_control", _domain) ||
- ConfMan.hasKey("onscreen_control_opacity", _domain) ||
+ bool hasKeys = ConfMan.hasKey("gamepad_controller", _domain) ||
+ ConfMan.hasKey("gamepad_controller_opacity", _domain) ||
ConfMan.hasKey("touchpad_mode", _domain) ||
ConfMan.hasKey("clickanddrag_mode", _domain);
@@ -321,21 +321,21 @@ void IOS7OptionsWidget::setEnabled(bool e) {
#if TARGET_OS_IOS && defined (__IPHONE_15_0)
// On-screen controls (virtual controller is supported in iOS 15 and later)
if (@available(iOS 15.0, *)) {
- _onscreenCheckbox->setEnabled(e);
- _onscreenOpacityDesc->setEnabled(e);
- _onscreenOpacitySlider->setEnabled(e);
- _onscreenOpacityLabel->setEnabled(e);
+ _gamepadControllerCheckbox->setEnabled(e);
+ _gamepadControllerOpacityDesc->setEnabled(e);
+ _gamepadControllerOpacitySlider->setEnabled(e);
+ _gamepadControllerOpacityLabel->setEnabled(e);
} else {
- _onscreenCheckbox->setEnabled(false);
- _onscreenOpacityDesc->setEnabled(false);
- _onscreenOpacitySlider->setEnabled(false);
- _onscreenOpacityLabel->setEnabled(false);
+ _gamepadControllerCheckbox->setEnabled(false);
+ _gamepadControllerOpacityDesc->setEnabled(false);
+ _gamepadControllerOpacitySlider->setEnabled(false);
+ _gamepadControllerOpacityLabel->setEnabled(false);
}
#else
- _onscreenCheckbox->setEnabled(false);
- _onscreenOpacityDesc->setEnabled(false);
- _onscreenOpacitySlider->setEnabled(false);
- _onscreenOpacityLabel->setEnabled(false);
+ _gamepadControllerCheckbox->setEnabled(false);
+ _gamepadControllerOpacityDesc->setEnabled(false);
+ _gamepadControllerOpacitySlider->setEnabled(false);
+ _gamepadControllerOpacityLabel->setEnabled(false);
#endif
#if TARGET_OS_IOS
_touchpadCheckbox->setEnabled(e);
@@ -360,8 +360,8 @@ GUI::OptionsContainerWidget *OSystem_iOS7::buildBackendOptionsWidget(GUI::GuiObj
}
void OSystem_iOS7::registerDefaultSettings(const Common::String &target) const {
- ConfMan.registerDefault("onscreen_control", false);
- ConfMan.registerDefault("onscreen_control_opacity", 6);
+ ConfMan.registerDefault("gamepad_controller", false);
+ ConfMan.registerDefault("gamepad_controller_opacity", 6);
ConfMan.registerDefault("touchpad_mode", !iOS7_isBigDevice());
ConfMan.registerDefault("clickanddrag_mode", false);
ConfMan.registerDefault("keyboard_fn_bar", true);
@@ -373,7 +373,7 @@ void OSystem_iOS7::registerDefaultSettings(const Common::String &target) const {
}
void OSystem_iOS7::applyBackendSettings() {
- virtualController(ConfMan.getBool("onscreen_control"));
+ virtualController(ConfMan.getBool("gamepad_controller"));
_touchpadModeEnabled = ConfMan.getBool("touchpad_mode");
_mouseClickAndDragEnabled = ConfMan.getBool("clickanddrag_mode");
diff --git a/backends/platform/ios7/ios7_osys_events.cpp b/backends/platform/ios7/ios7_osys_events.cpp
index e60e38bf428..203ca7659ac 100644
--- a/backends/platform/ios7/ios7_osys_events.cpp
+++ b/backends/platform/ios7/ios7_osys_events.cpp
@@ -454,8 +454,8 @@ bool OSystem_iOS7::handleEvent_swipe(Common::Event &event, int direction, int to
case kUIViewSwipeLeft: {
// Swipe left
- bool connect = !ConfMan.getBool("onscreen_control");
- ConfMan.setBool("onscreen_control", connect);
+ bool connect = !ConfMan.getBool("gamepad_controller");
+ ConfMan.setBool("gamepad_controller", connect);
ConfMan.flushToDisk();
virtualController(connect);
return false;
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 2f0087896de..6acc3b471fe 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -341,7 +341,7 @@ bool iOS7_fetchEvent(InternalEvent *event) {
[self virtualController:false];
} else {
// Connect or disconnect the virtual controller
- [self virtualController:ConfMan.getBool("onscreen_control")];
+ [self virtualController:ConfMan.getBool("gamepad_controller")];
}
#endif
}
Commit: 2971029301507e98b007ac2d83f8ba4bebce5312
https://github.com/scummvm/scummvm/commit/2971029301507e98b007ac2d83f8ba4bebce5312
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Configure directional elements on virtual controller
The virtual controller can be configured with different directional
elements. A thumbstick button and Dpad buttons (left, right, down,
up) can be configured.
A user might want to configure which directional element they want
on the virtual controller. Create two different virtual controllers
which can be switched between depending on the setting in the
backend specific option dialog.
Changed paths:
backends/platform/ios7/ios7_common.h
backends/platform/ios7/ios7_gamepad_controller.mm
backends/platform/ios7/ios7_options.mm
diff --git a/backends/platform/ios7/ios7_common.h b/backends/platform/ios7/ios7_common.h
index c0d2bfbfbde..f07489558dc 100644
--- a/backends/platform/ios7/ios7_common.h
+++ b/backends/platform/ios7/ios7_common.h
@@ -61,6 +61,11 @@ enum ScreenOrientation {
kScreenOrientationFlippedLandscape
};
+enum DirectionalInput {
+ kDirectionalInputThumbstick,
+ kDirectionalInputDpad,
+};
+
enum UIViewSwipeDirection {
kUIViewSwipeUp = 1,
kUIViewSwipeDown = 2,
diff --git a/backends/platform/ios7/ios7_gamepad_controller.mm b/backends/platform/ios7/ios7_gamepad_controller.mm
index 4cd021dd19d..b18439faa42 100644
--- a/backends/platform/ios7/ios7_gamepad_controller.mm
+++ b/backends/platform/ios7/ios7_gamepad_controller.mm
@@ -34,9 +34,15 @@
#if TARGET_OS_IOS
#ifdef __IPHONE_15_0
API_AVAILABLE(ios(15.0))
- GCVirtualController *_virtualController;
+ GCVirtualController *_virtualControllerThumbstick;
API_AVAILABLE(ios(15.0))
- GCVirtualControllerConfiguration *_config;
+ GCVirtualController *_virtualControllerDpad;
+ API_AVAILABLE(ios(15.0))
+ GCVirtualController *_currentController;
+ API_AVAILABLE(ios(15.0))
+ GCVirtualControllerConfiguration *_configDpad;
+ API_AVAILABLE(ios(15.0))
+ GCVirtualControllerConfiguration *_configThumbstick;
#endif
#endif
int _currentDpadXValue;
@@ -58,9 +64,13 @@
#ifdef __IPHONE_15_0
if (@available(iOS 15.0, *)) {
// Configure a simple game controller with dPad and A and B buttons
- _config = [[GCVirtualControllerConfiguration alloc] init];
- _config.elements = [[NSSet alloc] initWithObjects:GCInputDirectionPad, GCInputButtonA, GCInputButtonB, GCInputButtonX, GCInputButtonY, nil];
- _virtualController = [[GCVirtualController alloc] initWithConfiguration:_config];
+ _configDpad = [[GCVirtualControllerConfiguration alloc] init];
+ _configDpad.elements = [[NSSet alloc] initWithObjects:GCInputDirectionPad, GCInputButtonA, GCInputButtonB, GCInputButtonX, GCInputButtonY, nil];
+ _configThumbstick = [[GCVirtualControllerConfiguration alloc] init];
+ _configThumbstick.elements = [[NSSet alloc] initWithObjects:GCInputLeftThumbstick, GCInputButtonA, GCInputButtonB, GCInputButtonX, GCInputButtonY, nil];
+ _virtualControllerThumbstick = [[GCVirtualController alloc] initWithConfiguration:_configThumbstick];
+ _virtualControllerDpad = [[GCVirtualController alloc] initWithConfiguration:_configDpad];
+ _currentController = _virtualControllerThumbstick;
}
#endif
#endif
@@ -125,13 +135,19 @@
#if TARGET_OS_IOS
#ifdef __IPHONE_15_0
if (@available(iOS 15.0, *)) {
+ GCVirtualController *controller = ConfMan.getInt("gamepad_controller_directional_input") == kDirectionalInputThumbstick ? _virtualControllerThumbstick : _virtualControllerDpad;
+ if (_currentController != controller) {
+ [_currentController disconnect];
+ }
+
if (connect) {
- [_virtualController connectWithReplyHandler:^(NSError * _Nullable error) {
+ [controller connectWithReplyHandler:^(NSError * _Nullable error) {
[self setGCControllerViewProperties:[[[UIApplication sharedApplication] keyWindow] subviews]];
}];
+ _currentController = controller;
}
else {
- [_virtualController disconnect];
+ [_currentController disconnect];
[self setIsConnected:NO];
}
}
diff --git a/backends/platform/ios7/ios7_options.mm b/backends/platform/ios7/ios7_options.mm
index 616630d4bf4..99403fdf7d2 100644
--- a/backends/platform/ios7/ios7_options.mm
+++ b/backends/platform/ios7/ios7_options.mm
@@ -53,6 +53,9 @@ private:
// OptionsContainerWidget API
void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
+ uint32 loadDirectionalInput(const Common::String &setting, bool acceptDefault, uint32 defaultValue);
+ void saveDirectionalInput(const Common::String &setting, uint32 input);
+
#if TARGET_OS_IOS
uint32 loadOrientation(const Common::String &setting, bool acceptDefault, uint32 defaultValue);
void saveOrientation(const Common::String &setting, uint32 orientation);
@@ -62,6 +65,8 @@ private:
GUI::StaticTextWidget *_gamepadControllerOpacityDesc;
GUI::SliderWidget *_gamepadControllerOpacitySlider;
GUI::StaticTextWidget *_gamepadControllerOpacityLabel;
+ GUI::StaticTextWidget *_gamepadControllerDirectionalInputDesc;
+ GUI::PopUpWidget *_gamepadControllerDirectionalInputPopUp;
GUI::CheckboxWidget *_touchpadCheckbox;
GUI::CheckboxWidget *_clickAndDragCheckbox;
GUI::CheckboxWidget *_keyboardFnBarCheckbox;
@@ -86,6 +91,10 @@ IOS7OptionsWidget::IOS7OptionsWidget(GuiObject *boss, const Common::String &name
_gamepadControllerOpacityLabel = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.GamepadControllerOpacityLabel", Common::U32String(" "), Common::U32String(), GUI::ThemeEngine::kFontStyleBold, Common::UNK_LANG, false);
_gamepadControllerOpacitySlider->setMinValue(1);
_gamepadControllerOpacitySlider->setMaxValue(10);
+ _gamepadControllerDirectionalInputDesc = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.GamepadControllerLeftButton", _("Directional button:"));
+ _gamepadControllerDirectionalInputPopUp = new GUI::PopUpWidget(widgetsBoss(), "IOS7OptionsDialog.GamepadControllerLeftButtonPopUp");
+ _gamepadControllerDirectionalInputPopUp->appendEntry(_("Thumbstick"), kDirectionalInputThumbstick);
+ _gamepadControllerDirectionalInputPopUp->appendEntry(_("Dpad"), kDirectionalInputDpad);
_touchpadCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.TouchpadMouseMode", _("Touchpad mouse mode"));
_clickAndDragCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.ClickAndDragMode", _("Mouse-click-and-drag mode"));
_keyboardFnBarCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.KeyboardFunctionBar", _("Show keyboard function bar"));
@@ -132,6 +141,11 @@ void IOS7OptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::Stri
.addLayout(GUI::ThemeLayout::kLayoutVertical)
.addPadding(0, 0, 0, 0)
.addWidget("GamepadController", "Checkbox")
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("GamepadControllerLeftButton", "OptionsLabel")
+ .addWidget("GamepadControllerLeftButtonPopUp", "PopUp")
+ .closeLayout()
.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
.addPadding(0, 0, 0, 0)
.addWidget("GamepadControllerOpacity", "OptionsLabel")
@@ -210,6 +224,36 @@ void IOS7OptionsWidget::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui
}
}
+uint32 IOS7OptionsWidget::loadDirectionalInput(const Common::String &setting, bool acceptDefault, uint32 defaultValue) {
+ if (!acceptDefault || ConfMan.hasKey(setting, _domain)) {
+ Common::String input = ConfMan.get(setting, _domain);
+ if (input == "thumbstick") {
+ return kDirectionalInputThumbstick;
+ } else if (input == "dpad") {
+ return kScreenOrientationPortrait;
+ } else {
+ return defaultValue;
+ }
+ } else {
+ return kDirectionalInputThumbstick;
+ }
+}
+
+void IOS7OptionsWidget::saveDirectionalInput(const Common::String &setting, uint32 input) {
+ switch (input) {
+ case kDirectionalInputThumbstick:
+ ConfMan.set(setting, "thumbstick", _domain);
+ break;
+ case kDirectionalInputDpad:
+ ConfMan.set(setting, "dpad", _domain);
+ break;
+ default:
+ // default
+ ConfMan.removeKey(setting, _domain);
+ break;
+ }
+}
+
#if TARGET_OS_IOS
uint32 IOS7OptionsWidget::loadOrientation(const Common::String &setting, bool acceptDefault, uint32 defaultValue) {
if (!acceptDefault || ConfMan.hasKey(setting, _domain)) {
@@ -253,6 +297,7 @@ void IOS7OptionsWidget::load() {
_gamepadControllerCheckbox->setState(ConfMan.getBool("gamepad_controller", _domain));
_gamepadControllerOpacitySlider->setValue(ConfMan.getInt("gamepad_controller_opacity", _domain));
_gamepadControllerOpacityLabel->setValue(_gamepadControllerOpacitySlider->getValue());
+ _gamepadControllerDirectionalInputPopUp->setSelectedTag(loadDirectionalInput("gamepad_controller_directional_input", !inAppDomain, kDirectionalInputThumbstick));
_touchpadCheckbox->setState(ConfMan.getBool("touchpad_mode", _domain));
_clickAndDragCheckbox->setState(ConfMan.getBool("clickanddrag_mode", _domain));
_keyboardFnBarCheckbox->setState(ConfMan.getBool("keyboard_fn_bar", _domain));
@@ -271,6 +316,7 @@ bool IOS7OptionsWidget::save() {
if (_enabled) {
ConfMan.setBool("gamepad_controller", _gamepadControllerCheckbox->getState(), _domain);
ConfMan.setInt("gamepad_controller_opacity", _gamepadControllerOpacitySlider->getValue(), _domain);
+ ConfMan.setInt("gamepad_controller_directional_input", _gamepadControllerDirectionalInputPopUp->getSelectedTag(), _domain);
ConfMan.setBool("touchpad_mode", _touchpadCheckbox->getState(), _domain);
ConfMan.setBool("clickanddrag_mode", _clickAndDragCheckbox->getState(), _domain);
ConfMan.setBool("keyboard_fn_bar", _keyboardFnBarCheckbox->getState(), _domain);
@@ -284,6 +330,7 @@ bool IOS7OptionsWidget::save() {
} else {
ConfMan.removeKey("gamepad_controller", _domain);
ConfMan.removeKey("gamepad_controller_opacity", _domain);
+ ConfMan.removeKey("gamepad_controller_directional_input", _domain);
ConfMan.removeKey("touchpad_mode", _domain);
ConfMan.removeKey("clickanddrag_mode", _domain);
ConfMan.removeKey("keyboard_fn_bar", _domain);
@@ -302,6 +349,7 @@ bool IOS7OptionsWidget::save() {
bool IOS7OptionsWidget::hasKeys() {
bool hasKeys = ConfMan.hasKey("gamepad_controller", _domain) ||
ConfMan.hasKey("gamepad_controller_opacity", _domain) ||
+ ConfMan.hasKey("gamepad_controller_directional_input", _domain) ||
ConfMan.hasKey("touchpad_mode", _domain) ||
ConfMan.hasKey("clickanddrag_mode", _domain);
@@ -322,17 +370,21 @@ void IOS7OptionsWidget::setEnabled(bool e) {
// On-screen controls (virtual controller is supported in iOS 15 and later)
if (@available(iOS 15.0, *)) {
_gamepadControllerCheckbox->setEnabled(e);
+ _gamepadControllerDirectionalInputPopUp->setEnabled(e);
_gamepadControllerOpacityDesc->setEnabled(e);
_gamepadControllerOpacitySlider->setEnabled(e);
_gamepadControllerOpacityLabel->setEnabled(e);
} else {
_gamepadControllerCheckbox->setEnabled(false);
+ _gamepadControllerDirectionalInputPopUp->setEnabled(false);
_gamepadControllerOpacityDesc->setEnabled(false);
_gamepadControllerOpacitySlider->setEnabled(false);
_gamepadControllerOpacityLabel->setEnabled(false);
}
#else
_gamepadControllerCheckbox->setEnabled(false);
+ _gamepadControllerDirectionalInputDesc->setEnabled(false);
+ _gamepadControllerDirectionalInputPopUp->setEnabled(false);
_gamepadControllerOpacityDesc->setEnabled(false);
_gamepadControllerOpacitySlider->setEnabled(false);
_gamepadControllerOpacityLabel->setEnabled(false);
@@ -362,6 +414,7 @@ GUI::OptionsContainerWidget *OSystem_iOS7::buildBackendOptionsWidget(GUI::GuiObj
void OSystem_iOS7::registerDefaultSettings(const Common::String &target) const {
ConfMan.registerDefault("gamepad_controller", false);
ConfMan.registerDefault("gamepad_controller_opacity", 6);
+ ConfMan.registerDefault("gamepad_controller_directional_input", kDirectionalInputThumbstick);
ConfMan.registerDefault("touchpad_mode", !iOS7_isBigDevice());
ConfMan.registerDefault("clickanddrag_mode", false);
ConfMan.registerDefault("keyboard_fn_bar", true);
Commit: 8e9f54ad3297e8e2491b0161b6d3dc8b0ccc4fa7
https://github.com/scummvm/scummvm/commit/8e9f54ad3297e8e2491b0161b6d3dc8b0ccc4fa7
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Refactor touchpadModeEnabled to a TouchMode
Change the boolean parameter indicating if "touch mode" is enabled
or not to an enum which could contain several different touch modes.
Changed paths:
backends/platform/ios7/ios7_common.h
backends/platform/ios7/ios7_options.mm
backends/platform/ios7/ios7_osys_events.cpp
backends/platform/ios7/ios7_osys_main.cpp
backends/platform/ios7/ios7_osys_main.h
diff --git a/backends/platform/ios7/ios7_common.h b/backends/platform/ios7/ios7_common.h
index f07489558dc..c5d46d01721 100644
--- a/backends/platform/ios7/ios7_common.h
+++ b/backends/platform/ios7/ios7_common.h
@@ -66,6 +66,11 @@ enum DirectionalInput {
kDirectionalInputDpad,
};
+enum TouchMode {
+ kTouchModeDirect,
+ kTouchModeTouchpad,
+};
+
enum UIViewSwipeDirection {
kUIViewSwipeUp = 1,
kUIViewSwipeDown = 2,
@@ -98,6 +103,6 @@ void iOS7_buildSharedOSystemInstance();
void iOS7_main(int argc, char **argv);
Common::String iOS7_getDocumentsDir();
Common::String iOS7_getAppBundleDir();
-bool iOS7_touchpadModeEnabled();
+TouchMode iOS7_getCurrentTouchMode();
#endif
diff --git a/backends/platform/ios7/ios7_options.mm b/backends/platform/ios7/ios7_options.mm
index 99403fdf7d2..67e1742de75 100644
--- a/backends/platform/ios7/ios7_options.mm
+++ b/backends/platform/ios7/ios7_options.mm
@@ -427,7 +427,7 @@ void OSystem_iOS7::registerDefaultSettings(const Common::String &target) const {
void OSystem_iOS7::applyBackendSettings() {
virtualController(ConfMan.getBool("gamepad_controller"));
- _touchpadModeEnabled = ConfMan.getBool("touchpad_mode");
+ _currentTouchMode = ConfMan.getBool("touchpad_mode") ? kTouchModeTouchpad : kTouchModeDirect;
_mouseClickAndDragEnabled = ConfMan.getBool("clickanddrag_mode");
#if TARGET_OS_IOS
diff --git a/backends/platform/ios7/ios7_osys_events.cpp b/backends/platform/ios7/ios7_osys_events.cpp
index 203ca7659ac..ef41c26b892 100644
--- a/backends/platform/ios7/ios7_osys_events.cpp
+++ b/backends/platform/ios7/ios7_osys_events.cpp
@@ -180,13 +180,13 @@ bool OSystem_iOS7::handleEvent_touchFirstDown(Common::Event &event, int x, int y
_lastPadX = x;
_lastPadY = y;
- if (!_touchpadModeEnabled) {
+ if (_currentTouchMode == kTouchModeDirect) {
Common::Point mouse(x, y);
dynamic_cast<iOSCommonGraphics *>(_graphicsManager)->notifyMousePosition(mouse);
}
if (_mouseClickAndDragEnabled) {
- if (_touchpadModeEnabled) {
+ if (_currentTouchMode == kTouchModeTouchpad) {
_queuedInputEvent.type = Common::EVENT_LBUTTONDOWN;
_queuedEventTime = getMillis() + 250;
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
@@ -209,7 +209,7 @@ bool OSystem_iOS7::handleEvent_touchFirstUp(Common::Event &event, int x, int y)
if (!handleEvent_touchSecondUp(event, x, y))
return false;
} else if (_mouseClickAndDragEnabled) {
- if (_touchpadModeEnabled && _queuedInputEvent.type == Common::EVENT_LBUTTONDOWN) {
+ if (_currentTouchMode == kTouchModeTouchpad && _queuedInputEvent.type == Common::EVENT_LBUTTONDOWN) {
// This has not been sent yet, send it right away
event = _queuedInputEvent;
_queuedInputEvent.type = Common::EVENT_LBUTTONUP;
@@ -280,7 +280,7 @@ bool OSystem_iOS7::handleEvent_touchFirstDragged(Common::Event &event, int x, in
_lastPadX = x;
_lastPadY = y;
- if (_touchpadModeEnabled) {
+ if (_currentTouchMode == kTouchModeTouchpad) {
if (_mouseClickAndDragEnabled && _queuedInputEvent.type == Common::EVENT_LBUTTONDOWN) {
// Cancel the button down event since this was a pure mouse move
_queuedInputEvent.type = Common::EVENT_INVALID;
@@ -439,11 +439,14 @@ bool OSystem_iOS7::handleEvent_swipe(Common::Event &event, int direction, int to
case kUIViewSwipeRight: {
// Swipe right
- _touchpadModeEnabled = !_touchpadModeEnabled;
- ConfMan.setBool("touchpad_mode", _touchpadModeEnabled);
- ConfMan.flushToDisk();
+ if (_currentTouchMode == kTouchModeDirect) {
+ _currentTouchMode = kTouchModeTouchpad;
+ } else {
+ _currentTouchMode = kTouchModeDirect;
+ }
+
Common::U32String dialogMsg;
- if (_touchpadModeEnabled)
+ if (_currentTouchMode == kTouchModeTouchpad)
dialogMsg = _("Touchpad mode enabled.");
else
dialogMsg = _("Touchpad mode disabled.");
diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index 3a72ef87609..972e86ca55b 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -93,7 +93,7 @@ OSystem_iOS7::OSystem_iOS7() :
_screenOrientation(kScreenOrientationAuto),
_timeSuspended(0), _runningTasks(0) {
_queuedInputEvent.type = Common::EVENT_INVALID;
- _touchpadModeEnabled = ConfMan.getBool("touchpad_mode");
+ _currentTouchMode = kTouchModeTouchpad;
_mouseClickAndDragEnabled = ConfMan.getBool("clickanddrag_mode");
_chrootBasePath = iOS7_getDocumentsDir();
@@ -112,10 +112,6 @@ OSystem_iOS7::~OSystem_iOS7() {
delete _graphicsManager;
}
-bool OSystem_iOS7::touchpadModeEnabled() const {
- return _touchpadModeEnabled;
-}
-
#if defined(USE_OPENGL) && defined(USE_GLAD)
void *OSystem_iOS7::getOpenGLProcAddress(const char *name) const {
return dlsym(RTLD_SELF, name);
@@ -429,15 +425,18 @@ void OSystem_iOS7::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
}
}
-bool iOS7_touchpadModeEnabled() {
- OSystem_iOS7 *sys = dynamic_cast<OSystem_iOS7 *>(g_system);
- return sys && sys->touchpadModeEnabled();
-}
-
void iOS7_buildSharedOSystemInstance() {
OSystem_iOS7::sharedInstance();
}
+TouchMode iOS7_getCurrentTouchMode() {
+ OSystem_iOS7 *sys = dynamic_cast<OSystem_iOS7 *>(g_system);
+ if (!sys) {
+ abort();
+ }
+ return sys->getCurrentTouchMode();
+}
+
void iOS7_main(int argc, char **argv) {
//OSystem_iOS7::migrateApp();
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index 9ea5990fe42..7df99b31b05 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -68,7 +68,7 @@ protected:
Common::Event _queuedInputEvent;
bool _secondaryTapped;
bool _mouseClickAndDragEnabled;
- bool _touchpadModeEnabled;
+ TouchMode _currentTouchMode;
int _lastPadX;
int _lastPadY;
@@ -101,7 +101,8 @@ public:
bool setGraphicsMode(int mode, uint flags) override;
- bool touchpadModeEnabled() const;
+ TouchMode getCurrentTouchMode() const { return _currentTouchMode; };
+ void setCurrentTouchMode(TouchMode mode) { _currentTouchMode = mode; };
#if TARGET_OS_IOS
void applyOrientationSettings();
Commit: a705235d1a656850d4032b7c85761711fa7921a7
https://github.com/scummvm/scummvm/commit/a705235d1a656850d4032b7c85761711fa7921a7
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Add touch mode configurations in menu, 2D & 3D games
In the Android port it's possible to configure differnet touch modes
in ScummVM menus, 2D games and 3D games. Add the same possibility in
the iOS port. In Android it's possible to configure a touch based
game controller as well. That's not in scope for iOS in this commit
but can be added in the future.
Changed paths:
backends/graphics/ios/ios-graphics.cpp
backends/graphics/ios/ios-graphics.h
backends/graphics3d/ios/ios-graphics3d.cpp
backends/platform/ios7/ios7_options.mm
backends/platform/ios7/ios7_osys_main.h
diff --git a/backends/graphics/ios/ios-graphics.cpp b/backends/graphics/ios/ios-graphics.cpp
index d1a6e75b4d3..d51004048f9 100644
--- a/backends/graphics/ios/ios-graphics.cpp
+++ b/backends/graphics/ios/ios-graphics.cpp
@@ -51,6 +51,11 @@ void iOSGraphicsManager::initSurface() {
Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
#endif
handleResize(sys->getScreenWidth(), sys->getScreenHeight());
+
+ _old_touch_mode = kTouchModeTouchpad;
+
+ // not in 3D, not in GUI
+ sys->applyTouchSettings(false, false);
}
void iOSGraphicsManager::deinitSurface() {
@@ -95,6 +100,32 @@ bool iOSGraphicsManager::loadVideoMode(uint requestedWidth, uint requestedHeight
return true;
}
+void iOSGraphicsManager::showOverlay(bool inGUI) {
+ if (_overlayVisible && inGUI == _overlayInGUI)
+ return;
+
+ // Don't change touch mode when not changing mouse coordinates
+ if (inGUI) {
+ _old_touch_mode = dynamic_cast<OSystem_iOS7 *>(g_system)->getCurrentTouchMode();
+ // not in 3D, in overlay
+ dynamic_cast<OSystem_iOS7 *>(g_system)->applyTouchSettings(false, true);
+ } else if (_overlayInGUI) {
+ // Restore touch mode active before overlay was shown
+ dynamic_cast<OSystem_iOS7 *>(g_system)->setCurrentTouchMode(static_cast<TouchMode>(_old_touch_mode));
+ }
+
+ OpenGL::OpenGLGraphicsManager::showOverlay(inGUI);
+}
+
+void iOSGraphicsManager::hideOverlay() {
+ if (_overlayInGUI) {
+ // Restore touch mode active before overlay was shown
+ dynamic_cast<OSystem_iOS7 *>(g_system)->setCurrentTouchMode(static_cast<TouchMode>(_old_touch_mode));
+ }
+
+ OpenGL::OpenGLGraphicsManager::hideOverlay();
+}
+
float iOSGraphicsManager::getHiDPIScreenFactor() const {
return dynamic_cast<OSystem_iOS7 *>(g_system)->getSystemHiDPIScreenFactor();
}
diff --git a/backends/graphics/ios/ios-graphics.h b/backends/graphics/ios/ios-graphics.h
index a0de4136d10..3fc7ef59011 100644
--- a/backends/graphics/ios/ios-graphics.h
+++ b/backends/graphics/ios/ios-graphics.h
@@ -66,6 +66,9 @@ public:
* Sets up a basic state of the graphics manager.
*/
virtual bool setState(const State &state) = 0;
+
+protected:
+ int _old_touch_mode;
};
class iOSGraphicsManager :
@@ -91,6 +94,8 @@ protected:
void setSystemMousePosition(const int x, const int y) override {}
bool loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format) override;
+ void showOverlay(bool inGUI) override;
+ void hideOverlay() override;
void refreshScreen() override;
};
diff --git a/backends/graphics3d/ios/ios-graphics3d.cpp b/backends/graphics3d/ios/ios-graphics3d.cpp
index 84d1f21de5a..17b0345cbfa 100644
--- a/backends/graphics3d/ios/ios-graphics3d.cpp
+++ b/backends/graphics3d/ios/ios-graphics3d.cpp
@@ -82,6 +82,8 @@ void iOSGraphics3dManager::initSurface() {
error("Framebuffer is not complete! status: %d", status);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ _old_touch_mode = kTouchModeTouchpad;
+
//initSize will be called to set the size
}
@@ -424,6 +426,16 @@ void iOSGraphics3dManager::showOverlay(bool inGUI) {
return;
}
+ // Don't change touch mode when not changing mouse coordinates
+ if (inGUI) {
+ _old_touch_mode = dynamic_cast<OSystem_iOS7 *>(g_system)->getCurrentTouchMode();
+ // in 3D, in overlay
+ dynamic_cast<OSystem_iOS7 *>(g_system)->applyTouchSettings(true, true);
+ } else if (_overlayInGUI) {
+ // Restore touch mode active before overlay was shown
+ dynamic_cast<OSystem_iOS7 *>(g_system)->setCurrentTouchMode(static_cast<TouchMode>(_old_touch_mode));
+ }
+
WindowedGraphicsManager::showOverlay(inGUI);
delete _overlayBackground;
@@ -447,6 +459,12 @@ void iOSGraphics3dManager::hideOverlay() {
if (!_overlayVisible) {
return;
}
+
+ if (_overlayInGUI) {
+ // Restore touch mode active before overlay was shown
+ dynamic_cast<OSystem_iOS7 *>(g_system)->setCurrentTouchMode(static_cast<TouchMode>(_old_touch_mode));
+ }
+
WindowedGraphicsManager::hideOverlay();
delete _overlayBackground;
diff --git a/backends/platform/ios7/ios7_options.mm b/backends/platform/ios7/ios7_options.mm
index 67e1742de75..4ad2edfe4c9 100644
--- a/backends/platform/ios7/ios7_options.mm
+++ b/backends/platform/ios7/ios7_options.mm
@@ -57,6 +57,8 @@ private:
void saveDirectionalInput(const Common::String &setting, uint32 input);
#if TARGET_OS_IOS
+ uint32 loadTouchMode(const Common::String &setting, bool acceptDefault, uint32 defaultValue);
+ void saveTouchMode(const Common::String &setting, uint32 mode);
uint32 loadOrientation(const Common::String &setting, bool acceptDefault, uint32 defaultValue);
void saveOrientation(const Common::String &setting, uint32 orientation);
#endif
@@ -67,10 +69,18 @@ private:
GUI::StaticTextWidget *_gamepadControllerOpacityLabel;
GUI::StaticTextWidget *_gamepadControllerDirectionalInputDesc;
GUI::PopUpWidget *_gamepadControllerDirectionalInputPopUp;
- GUI::CheckboxWidget *_touchpadCheckbox;
+
GUI::CheckboxWidget *_clickAndDragCheckbox;
GUI::CheckboxWidget *_keyboardFnBarCheckbox;
#if TARGET_OS_IOS
+ GUI::StaticTextWidget *_preferredTouchModeDesc;
+ GUI::StaticTextWidget *_preferredTouchModeMenusDesc;
+ GUI::PopUpWidget *_preferredTouchModeMenusPopUp;
+ GUI::StaticTextWidget *_preferredTouchMode2DGamesDesc;
+ GUI::PopUpWidget *_preferredTouchMode2DGamesPopUp;
+ GUI::StaticTextWidget *_preferredTouchMode3DGamesDesc;
+ GUI::PopUpWidget *_preferredTouchMode3DGamesPopUp;
+
GUI::StaticTextWidget *_orientationDesc;
GUI::StaticTextWidget *_orientationMenusDesc;
GUI::PopUpWidget *_orientationMenusPopUp;
@@ -95,11 +105,38 @@ IOS7OptionsWidget::IOS7OptionsWidget(GuiObject *boss, const Common::String &name
_gamepadControllerDirectionalInputPopUp = new GUI::PopUpWidget(widgetsBoss(), "IOS7OptionsDialog.GamepadControllerLeftButtonPopUp");
_gamepadControllerDirectionalInputPopUp->appendEntry(_("Thumbstick"), kDirectionalInputThumbstick);
_gamepadControllerDirectionalInputPopUp->appendEntry(_("Dpad"), kDirectionalInputDpad);
- _touchpadCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.TouchpadMouseMode", _("Touchpad mouse mode"));
+
_clickAndDragCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.ClickAndDragMode", _("Mouse-click-and-drag mode"));
_keyboardFnBarCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.KeyboardFunctionBar", _("Show keyboard function bar"));
#if TARGET_OS_IOS
+ _preferredTouchModeDesc = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.PreferredTouchModeText", _("Choose the preferred touch mode:"));
+ if (inAppDomain) {
+ _preferredTouchModeMenusDesc = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.TouchModeMenusText", _("In menus"));
+ _preferredTouchModeMenusPopUp = new GUI::PopUpWidget(widgetsBoss(), "IOS7OptionsDialog.TouchModeMenus");
+ _preferredTouchModeMenusPopUp->appendEntry(_("Touchpad emulation"), kTouchModeTouchpad);
+ _preferredTouchModeMenusPopUp->appendEntry(_("Direct mouse"), kTouchModeDirect); // TODO: Find a better name
+ } else {
+ _preferredTouchModeMenusDesc = nullptr;
+ _preferredTouchModeMenusPopUp = nullptr;
+ }
+
+ _preferredTouchMode2DGamesDesc = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.TouchMode2DGamesText", _("In 2D games"));
+ _preferredTouchMode2DGamesPopUp = new GUI::PopUpWidget(widgetsBoss(), "IOS7OptionsDialog.TouchMode2DGames");
+ _preferredTouchMode3DGamesDesc = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.TouchMode3DGamesText", _("In 3D games"));
+ _preferredTouchMode3DGamesPopUp = new GUI::PopUpWidget(widgetsBoss(), "IOS7OptionsDialog.TouchMode3DGames");
+
+ if (!inAppDomain) {
+ _preferredTouchMode2DGamesPopUp->appendEntry(_("<default>"), kTouchModeTouchpad);
+ _preferredTouchMode3DGamesPopUp->appendEntry(_("<default>"), kTouchModeTouchpad);
+ }
+
+ _preferredTouchMode2DGamesPopUp->appendEntry(_("Touchpad emulation"), kTouchModeTouchpad);
+ _preferredTouchMode3DGamesPopUp->appendEntry(_("Touchpad emulation"), kTouchModeTouchpad);
+
+ _preferredTouchMode2DGamesPopUp->appendEntry(_("Direct mouse"), kTouchModeDirect); // TODO: Find a better name
+ _preferredTouchMode3DGamesPopUp->appendEntry(_("Direct mouse"), kTouchModeDirect);
+
_orientationDesc = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.OrientationText", _("Select the orientation:"));
if (inAppDomain) {
_orientationMenusDesc = new GUI::StaticTextWidget(widgetsBoss(), "IOS7OptionsDialog.OMenusText", _("In menus"));
@@ -152,13 +189,32 @@ void IOS7OptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::Stri
.addWidget("GamepadControllerOpacitySlider", "Slider")
.addWidget("GamepadControllerOpacityLabel", "OptionsLabel")
.closeLayout()
- .addWidget("TouchpadMouseMode", "Checkbox")
.addWidget("ClickAndDragMode", "Checkbox")
.addWidget("KeyboardFunctionBar", "Checkbox")
.addPadding(0, 0, 0, 0)
.addWidget("ControlsHelp", "WideButton");
#if TARGET_OS_IOS
+ layouts.addWidget("PreferredTouchModeText", "", -1, layouts.getVar("Globals.Line.Height"));
+ if (inAppDomain) {
+ layouts.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("TouchModeMenusText", "OptionsLabel")
+ .addWidget("TouchModeMenus", "PopUp")
+ .closeLayout();
+ }
+ layouts.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("TouchMode2DGamesText", "OptionsLabel")
+ .addWidget("TouchMode2DGames", "PopUp")
+ .closeLayout();
+
+ layouts.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("TouchMode3DGamesText", "OptionsLabel")
+ .addWidget("TouchMode3DGames", "PopUp")
+ .closeLayout();
+
layouts.addWidget("OrientationText", "", -1, layouts.getVar("Globals.Line.Height"));
if (inAppDomain) {
layouts.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
@@ -255,6 +311,36 @@ void IOS7OptionsWidget::saveDirectionalInput(const Common::String &setting, uint
}
#if TARGET_OS_IOS
+uint32 IOS7OptionsWidget::loadTouchMode(const Common::String &setting, bool acceptDefault, uint32 defaultValue) {
+ if (!acceptDefault || ConfMan.hasKey(setting, _domain)) {
+ Common::String mode = ConfMan.get(setting, _domain);
+ if (mode == "direct") {
+ return kTouchModeDirect;
+ } else if (mode == "touchpad") {
+ return kTouchModeTouchpad;
+ } else {
+ return defaultValue;
+ }
+ } else {
+ return iOS7_isBigDevice() ? kTouchModeDirect : kTouchModeTouchpad;
+ }
+}
+
+void IOS7OptionsWidget::saveTouchMode(const Common::String &setting, uint32 mode) {
+ switch (mode) {
+ case kTouchModeDirect:
+ ConfMan.set(setting, "direct", _domain);
+ break;
+ case kTouchModeTouchpad:
+ ConfMan.set(setting, "touchpad", _domain);
+ break;
+ default:
+ // default
+ ConfMan.removeKey(setting, _domain);
+ break;
+ }
+}
+
uint32 IOS7OptionsWidget::loadOrientation(const Common::String &setting, bool acceptDefault, uint32 defaultValue) {
if (!acceptDefault || ConfMan.hasKey(setting, _domain)) {
Common::String orientation = ConfMan.get(setting, _domain);
@@ -298,11 +384,17 @@ void IOS7OptionsWidget::load() {
_gamepadControllerOpacitySlider->setValue(ConfMan.getInt("gamepad_controller_opacity", _domain));
_gamepadControllerOpacityLabel->setValue(_gamepadControllerOpacitySlider->getValue());
_gamepadControllerDirectionalInputPopUp->setSelectedTag(loadDirectionalInput("gamepad_controller_directional_input", !inAppDomain, kDirectionalInputThumbstick));
- _touchpadCheckbox->setState(ConfMan.getBool("touchpad_mode", _domain));
+
_clickAndDragCheckbox->setState(ConfMan.getBool("clickanddrag_mode", _domain));
_keyboardFnBarCheckbox->setState(ConfMan.getBool("keyboard_fn_bar", _domain));
#if TARGET_OS_IOS
+ if (inAppDomain) {
+ _preferredTouchModeMenusPopUp->setSelectedTag(loadTouchMode("touch_mode_menus", !inAppDomain, kTouchModeDirect));
+ }
+ _preferredTouchMode2DGamesPopUp->setSelectedTag(loadTouchMode("touch_mode_2d_games", !inAppDomain, kTouchModeTouchpad));
+ _preferredTouchMode3DGamesPopUp->setSelectedTag(loadTouchMode("touch_mode_3d_games", !inAppDomain, kTouchModeDirect));
+
if (inAppDomain) {
_orientationMenusPopUp->setSelectedTag(loadOrientation("orientation_menus", !inAppDomain, kScreenOrientationAuto));
}
@@ -317,11 +409,17 @@ bool IOS7OptionsWidget::save() {
ConfMan.setBool("gamepad_controller", _gamepadControllerCheckbox->getState(), _domain);
ConfMan.setInt("gamepad_controller_opacity", _gamepadControllerOpacitySlider->getValue(), _domain);
ConfMan.setInt("gamepad_controller_directional_input", _gamepadControllerDirectionalInputPopUp->getSelectedTag(), _domain);
- ConfMan.setBool("touchpad_mode", _touchpadCheckbox->getState(), _domain);
+
ConfMan.setBool("clickanddrag_mode", _clickAndDragCheckbox->getState(), _domain);
ConfMan.setBool("keyboard_fn_bar", _keyboardFnBarCheckbox->getState(), _domain);
#if TARGET_OS_IOS
+ if (inAppDomain) {
+ saveTouchMode("touch_mode_menus", _preferredTouchModeMenusPopUp->getSelectedTag());
+ }
+ saveTouchMode("touch_mode_2d_games", _preferredTouchMode2DGamesPopUp->getSelectedTag());
+ saveTouchMode("touch_mode_3d_games", _preferredTouchMode3DGamesPopUp->getSelectedTag());
+
if (inAppDomain) {
saveOrientation("orientation_menus", _orientationMenusPopUp->getSelectedTag());
}
@@ -331,11 +429,17 @@ bool IOS7OptionsWidget::save() {
ConfMan.removeKey("gamepad_controller", _domain);
ConfMan.removeKey("gamepad_controller_opacity", _domain);
ConfMan.removeKey("gamepad_controller_directional_input", _domain);
- ConfMan.removeKey("touchpad_mode", _domain);
+
+#if TARGET_OS_IOS
+ if (inAppDomain) {
+ ConfMan.removeKey("touch_mode_menus", _domain);
+ }
+ ConfMan.removeKey("touch_mode_2d_games", _domain);
+ ConfMan.removeKey("touch_mode_3d_games", _domain);
+
ConfMan.removeKey("clickanddrag_mode", _domain);
ConfMan.removeKey("keyboard_fn_bar", _domain);
-#if TARGET_OS_IOS
if (inAppDomain) {
ConfMan.removeKey("orientation_menus", _domain);
}
@@ -350,7 +454,11 @@ bool IOS7OptionsWidget::hasKeys() {
bool hasKeys = ConfMan.hasKey("gamepad_controller", _domain) ||
ConfMan.hasKey("gamepad_controller_opacity", _domain) ||
ConfMan.hasKey("gamepad_controller_directional_input", _domain) ||
- ConfMan.hasKey("touchpad_mode", _domain) ||
+
+ ConfMan.hasKey("touch_mode_menus", _domain) ||
+ ConfMan.hasKey("touch_mode_2d_games", _domain) ||
+ ConfMan.hasKey("touch_mode_3d_games", _domain) ||
+
ConfMan.hasKey("clickanddrag_mode", _domain);
#if TARGET_OS_IOS
@@ -359,7 +467,6 @@ bool IOS7OptionsWidget::hasKeys() {
#endif
return hasKeys;
-
}
void IOS7OptionsWidget::setEnabled(bool e) {
@@ -388,16 +495,21 @@ void IOS7OptionsWidget::setEnabled(bool e) {
_gamepadControllerOpacityDesc->setEnabled(false);
_gamepadControllerOpacitySlider->setEnabled(false);
_gamepadControllerOpacityLabel->setEnabled(false);
-#endif
-#if TARGET_OS_IOS
- _touchpadCheckbox->setEnabled(e);
-#else
- _touchpadCheckbox->setEnabled(false);
-#endif
+#endif /* TARGET_OS_IOS */
+
_clickAndDragCheckbox->setEnabled(e);
_keyboardFnBarCheckbox->setEnabled(e);
#if TARGET_OS_IOS
+ if (inAppDomain) {
+ _preferredTouchModeMenusDesc->setEnabled(e);
+ _preferredTouchModeMenusPopUp->setEnabled(e);
+ }
+ _preferredTouchMode2DGamesDesc->setEnabled(e);
+ _preferredTouchMode2DGamesPopUp->setEnabled(e);
+ _preferredTouchMode3DGamesDesc->setEnabled(e);
+ _preferredTouchMode3DGamesPopUp->setEnabled(e);
+
if (inAppDomain) {
_orientationMenusDesc->setEnabled(e);
_orientationMenusPopUp->setEnabled(e);
@@ -415,7 +527,15 @@ void OSystem_iOS7::registerDefaultSettings(const Common::String &target) const {
ConfMan.registerDefault("gamepad_controller", false);
ConfMan.registerDefault("gamepad_controller_opacity", 6);
ConfMan.registerDefault("gamepad_controller_directional_input", kDirectionalInputThumbstick);
- ConfMan.registerDefault("touchpad_mode", !iOS7_isBigDevice());
+
+ ConfMan.registerDefault("touch_mode_menus", "direct");
+ ConfMan.registerDefault("touch_mode_2d_games", "touchpad");
+ ConfMan.registerDefault("touch_mode_3d_games", "gamepad");
+
+ ConfMan.registerDefault("touch_mode_menus", "direct");
+ ConfMan.registerDefault("touch_mode_2d_games", "touchpad");
+ ConfMan.registerDefault("touch_mode_3d_games", "gamepad");
+
ConfMan.registerDefault("clickanddrag_mode", false);
ConfMan.registerDefault("keyboard_fn_bar", true);
@@ -427,7 +547,7 @@ void OSystem_iOS7::registerDefaultSettings(const Common::String &target) const {
void OSystem_iOS7::applyBackendSettings() {
virtualController(ConfMan.getBool("gamepad_controller"));
- _currentTouchMode = ConfMan.getBool("touchpad_mode") ? kTouchModeTouchpad : kTouchModeDirect;
+ // _currentTouchMode is applied by the graphic manager
_mouseClickAndDragEnabled = ConfMan.getBool("clickanddrag_mode");
#if TARGET_OS_IOS
@@ -457,5 +577,35 @@ void OSystem_iOS7::applyOrientationSettings() {
} else {
setSupportedScreenOrientation(kScreenOrientationAuto);
}
- }
+}
#endif
+
+void OSystem_iOS7::applyTouchSettings(bool _3dMode, bool overlayShown) {
+#if TARGET_OS_IOS
+ Common::String setting;
+ Common::String defaultMode;
+
+ if (overlayShown) {
+ setting = "touch_mode_menus";
+ defaultMode = "direct";
+ } else if (_3dMode) {
+ setting = "touch_mode_3d_games";
+ defaultMode = "direct";
+ } else {
+ setting = "touch_mode_2d_games";
+ defaultMode = "touchpad";
+ }
+
+ Common::String preferredTouchMode = ConfMan.get(setting);
+ if (preferredTouchMode == "direct") {
+ _currentTouchMode = kTouchModeDirect;
+ } else if (preferredTouchMode == "touchpad") {
+ _currentTouchMode = kTouchModeTouchpad;
+ } else {
+ _currentTouchMode = kTouchModeTouchpad;
+ }
+#else
+ (void)_3dMode;
+ (void)overlayShown;
+#endif
+}
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index 7df99b31b05..0b8dc38e3ba 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -108,6 +108,7 @@ public:
void applyOrientationSettings();
void setSupportedScreenOrientation(ScreenOrientation screenOrientation);
#endif
+ void applyTouchSettings(bool _3dMode, bool overlayShown);
uint createOpenGLContext();
void destroyOpenGLContext();
Commit: ac9843242942776bc877b8c0fec3858f361da7de
https://github.com/scummvm/scummvm/commit/ac9843242942776bc877b8c0fec3858f361da7de
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
DISTS: IOS7: Add touch mode assets
The Android backend have two on-screen controls. One for configuring
the touch mode setting and one for accessing the main menu.
The on-screen controls are presented as two clickable buttons.
The image of the touch mode setting changes depending on which mode
that is configured.
Add the same images as assets to the iOS port. Unfortunately it's
not possible to share the same resource files becuase the assets
in Android are of type Android vector drawable.
iOS can handle vector based images, but only in form as a PDF.
There's a lot to read about this format but luckily there are free
converter tools between the formats.
Add converted versions to the iOS7 port.
Changed paths:
A dists/ios7/Images.xcassets/ic_action_gamepad.imageset/Contents.json
A dists/ios7/Images.xcassets/ic_action_gamepad.imageset/ic_action_gamepad.pdf
A dists/ios7/Images.xcassets/ic_action_keyboard.imageset/Contents.json
A dists/ios7/Images.xcassets/ic_action_keyboard.imageset/ic_action_keyboard.pdf
A dists/ios7/Images.xcassets/ic_action_menu.imageset/Contents.json
A dists/ios7/Images.xcassets/ic_action_menu.imageset/ic_action_menu.pdf
A dists/ios7/Images.xcassets/ic_action_mouse.imageset/Contents.json
A dists/ios7/Images.xcassets/ic_action_mouse.imageset/ic_action_mouse.pdf
A dists/ios7/Images.xcassets/ic_action_touchpad.imageset/Contents.json
A dists/ios7/Images.xcassets/ic_action_touchpad.imageset/ic_action_touchpad.pdf
dists/ios7/Images.xcassets/Contents.json
diff --git a/dists/ios7/Images.xcassets/Contents.json b/dists/ios7/Images.xcassets/Contents.json
index da4a164c918..73c00596a7f 100644
--- a/dists/ios7/Images.xcassets/Contents.json
+++ b/dists/ios7/Images.xcassets/Contents.json
@@ -1,6 +1,6 @@
{
"info" : {
- "version" : 1,
- "author" : "xcode"
+ "author" : "xcode",
+ "version" : 1
}
-}
\ No newline at end of file
+}
diff --git a/dists/ios7/Images.xcassets/ic_action_gamepad.imageset/Contents.json b/dists/ios7/Images.xcassets/ic_action_gamepad.imageset/Contents.json
new file mode 100644
index 00000000000..4fda1fef3e7
--- /dev/null
+++ b/dists/ios7/Images.xcassets/ic_action_gamepad.imageset/Contents.json
@@ -0,0 +1,12 @@
+{
+ "images": [
+ {
+ "idiom": "universal",
+ "filename": "ic_action_gamepad.pdf"
+ }
+ ],
+ "info": {
+ "version": 1,
+ "author": "xcode"
+ }
+}
diff --git a/dists/ios7/Images.xcassets/ic_action_gamepad.imageset/ic_action_gamepad.pdf b/dists/ios7/Images.xcassets/ic_action_gamepad.imageset/ic_action_gamepad.pdf
new file mode 100644
index 00000000000..5cc329035ff
Binary files /dev/null and b/dists/ios7/Images.xcassets/ic_action_gamepad.imageset/ic_action_gamepad.pdf differ
diff --git a/dists/ios7/Images.xcassets/ic_action_keyboard.imageset/Contents.json b/dists/ios7/Images.xcassets/ic_action_keyboard.imageset/Contents.json
new file mode 100644
index 00000000000..39f0951d1c0
--- /dev/null
+++ b/dists/ios7/Images.xcassets/ic_action_keyboard.imageset/Contents.json
@@ -0,0 +1,12 @@
+{
+ "images": [
+ {
+ "idiom": "universal",
+ "filename": "ic_action_keyboard.pdf"
+ }
+ ],
+ "info": {
+ "version": 1,
+ "author": "xcode"
+ }
+}
diff --git a/dists/ios7/Images.xcassets/ic_action_keyboard.imageset/ic_action_keyboard.pdf b/dists/ios7/Images.xcassets/ic_action_keyboard.imageset/ic_action_keyboard.pdf
new file mode 100644
index 00000000000..c5022cf022a
Binary files /dev/null and b/dists/ios7/Images.xcassets/ic_action_keyboard.imageset/ic_action_keyboard.pdf differ
diff --git a/dists/ios7/Images.xcassets/ic_action_menu.imageset/Contents.json b/dists/ios7/Images.xcassets/ic_action_menu.imageset/Contents.json
new file mode 100644
index 00000000000..c83f9de22d3
--- /dev/null
+++ b/dists/ios7/Images.xcassets/ic_action_menu.imageset/Contents.json
@@ -0,0 +1,12 @@
+{
+ "images": [
+ {
+ "idiom": "universal",
+ "filename": "ic_action_menu.pdf"
+ }
+ ],
+ "info": {
+ "version": 1,
+ "author": "xcode"
+ }
+}
diff --git a/dists/ios7/Images.xcassets/ic_action_menu.imageset/ic_action_menu.pdf b/dists/ios7/Images.xcassets/ic_action_menu.imageset/ic_action_menu.pdf
new file mode 100644
index 00000000000..a01a800464c
Binary files /dev/null and b/dists/ios7/Images.xcassets/ic_action_menu.imageset/ic_action_menu.pdf differ
diff --git a/dists/ios7/Images.xcassets/ic_action_mouse.imageset/Contents.json b/dists/ios7/Images.xcassets/ic_action_mouse.imageset/Contents.json
new file mode 100644
index 00000000000..49c2b5ec359
--- /dev/null
+++ b/dists/ios7/Images.xcassets/ic_action_mouse.imageset/Contents.json
@@ -0,0 +1,12 @@
+{
+ "images": [
+ {
+ "idiom": "universal",
+ "filename": "ic_action_mouse.pdf"
+ }
+ ],
+ "info": {
+ "version": 1,
+ "author": "xcode"
+ }
+}
diff --git a/dists/ios7/Images.xcassets/ic_action_mouse.imageset/ic_action_mouse.pdf b/dists/ios7/Images.xcassets/ic_action_mouse.imageset/ic_action_mouse.pdf
new file mode 100644
index 00000000000..92d059f2c24
Binary files /dev/null and b/dists/ios7/Images.xcassets/ic_action_mouse.imageset/ic_action_mouse.pdf differ
diff --git a/dists/ios7/Images.xcassets/ic_action_touchpad.imageset/Contents.json b/dists/ios7/Images.xcassets/ic_action_touchpad.imageset/Contents.json
new file mode 100644
index 00000000000..4b08289b09d
--- /dev/null
+++ b/dists/ios7/Images.xcassets/ic_action_touchpad.imageset/Contents.json
@@ -0,0 +1,12 @@
+{
+ "images": [
+ {
+ "idiom": "universal",
+ "filename": "ic_action_touchpad.pdf"
+ }
+ ],
+ "info": {
+ "version": 1,
+ "author": "xcode"
+ }
+}
diff --git a/dists/ios7/Images.xcassets/ic_action_touchpad.imageset/ic_action_touchpad.pdf b/dists/ios7/Images.xcassets/ic_action_touchpad.imageset/ic_action_touchpad.pdf
new file mode 100644
index 00000000000..1101fc58e1e
Binary files /dev/null and b/dists/ios7/Images.xcassets/ic_action_touchpad.imageset/ic_action_touchpad.pdf differ
Commit: 324569f2068e972a338731642cd8da4ed9e0a0eb
https://github.com/scummvm/scummvm/commit/324569f2068e972a338731642cd8da4ed9e0a0eb
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Add on-screen controls as UI buttons
Add two UI buttons which are placed to the top right corner over
the main view. The left button controls the current touch mode.
When pressed the button changes image to represent the new touch
mode using the mouse and touchpad assets added in previous commit.
The right button triggers the call to the main menu.
Changed paths:
backends/platform/ios7/ios7_common.h
backends/platform/ios7/ios7_options.mm
backends/platform/ios7/ios7_osys_events.cpp
backends/platform/ios7/ios7_osys_main.h
backends/platform/ios7/ios7_osys_video.mm
backends/platform/ios7/ios7_video.h
backends/platform/ios7/ios7_video.mm
diff --git a/backends/platform/ios7/ios7_common.h b/backends/platform/ios7/ios7_common.h
index c5d46d01721..f80222286ca 100644
--- a/backends/platform/ios7/ios7_common.h
+++ b/backends/platform/ios7/ios7_common.h
@@ -50,7 +50,8 @@ enum InputEvent {
kInputJoystickAxisMotion,
kInputJoystickButtonDown,
kInputJoystickButtonUp,
- kInputScreenChanged
+ kInputScreenChanged,
+ kInputTouchModeChanged
};
enum ScreenOrientation {
diff --git a/backends/platform/ios7/ios7_options.mm b/backends/platform/ios7/ios7_options.mm
index 4ad2edfe4c9..6e7f14e71c7 100644
--- a/backends/platform/ios7/ios7_options.mm
+++ b/backends/platform/ios7/ios7_options.mm
@@ -552,6 +552,7 @@ void OSystem_iOS7::applyBackendSettings() {
#if TARGET_OS_IOS
applyOrientationSettings();
+ updateTouchMode();
#endif
}
@@ -604,6 +605,8 @@ void OSystem_iOS7::applyTouchSettings(bool _3dMode, bool overlayShown) {
} else {
_currentTouchMode = kTouchModeTouchpad;
}
+
+ updateTouchMode();
#else
(void)_3dMode;
(void)overlayShown;
diff --git a/backends/platform/ios7/ios7_osys_events.cpp b/backends/platform/ios7/ios7_osys_events.cpp
index ef41c26b892..4b1671c9be3 100644
--- a/backends/platform/ios7/ios7_osys_events.cpp
+++ b/backends/platform/ios7/ios7_osys_events.cpp
@@ -161,6 +161,10 @@ bool OSystem_iOS7::pollEvent(Common::Event &event) {
event.type = Common::EVENT_SCREEN_CHANGED;
break;
+ case kInputTouchModeChanged:
+ handleEvent_touchModeChanged();
+ break;
+
default:
break;
}
@@ -353,6 +357,20 @@ void OSystem_iOS7::handleEvent_orientationChanged(int orientation) {
}
}
+void OSystem_iOS7::handleEvent_touchModeChanged() {
+ switch (_currentTouchMode) {
+ case kTouchModeDirect:
+ _currentTouchMode = kTouchModeTouchpad;
+ break;
+ case kTouchModeTouchpad:
+ default:
+ _currentTouchMode = kTouchModeDirect;
+ break;
+ }
+
+ updateTouchMode();
+}
+
void OSystem_iOS7::rebuildSurface() {
updateOutputSurface();
}
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index 0b8dc38e3ba..b08a4480c0d 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -169,6 +169,7 @@ public:
protected:
void updateOutputSurface();
+ void updateTouchMode();
void setShowKeyboard(bool);
bool isKeyboardShown() const;
@@ -183,6 +184,7 @@ protected:
bool handleEvent_tap(Common::Event &event, UIViewTapDescription type, int touches);
void handleEvent_keyPressed(Common::Event &event, int keyPressed);
void handleEvent_orientationChanged(int orientation);
+ void handleEvent_touchModeChanged();
void handleEvent_applicationSuspended();
void handleEvent_applicationResumed();
void handleEvent_applicationSaveState();
diff --git a/backends/platform/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm
index 72f98ec171d..3ce3550efce 100644
--- a/backends/platform/ios7/ios7_osys_video.mm
+++ b/backends/platform/ios7/ios7_osys_video.mm
@@ -151,6 +151,12 @@ void OSystem_iOS7::updateOutputSurface() {
});
}
+void OSystem_iOS7::updateTouchMode() {
+ execute_on_main_thread(^ {
+ [[iOS7AppDelegate iPhoneView] updateTouchMode];
+ });
+}
+
void OSystem_iOS7::virtualController(bool connect) {
execute_on_main_thread(^ {
[[iOS7AppDelegate iPhoneView] virtualController:connect];
diff --git a/backends/platform/ios7/ios7_video.h b/backends/platform/ios7/ios7_video.h
index 0d4c5540f3c..8b222786b9e 100644
--- a/backends/platform/ios7/ios7_video.h
+++ b/backends/platform/ios7/ios7_video.h
@@ -76,6 +76,7 @@ uint getSizeNextPOT(uint size);
#if TARGET_OS_IOS
- (void)interfaceOrientationChanged:(UIInterfaceOrientation)orientation;
+- (void)updateTouchMode;
#endif
- (void)showKeyboard;
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 6acc3b471fe..b4c2e3dbd26 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -78,7 +78,12 @@ bool iOS7_fetchEvent(InternalEvent *event) {
return fetched;
}
- at implementation iPhoneView
+ at implementation iPhoneView {
+#if TARGET_OS_IOS
+ UIButton *_menuButton;
+ UIButton *_toggleTouchModeButton;
+#endif
+}
+ (Class)layerClass {
return [CAEAGLLayer class];
@@ -293,6 +298,22 @@ bool iOS7_fetchEvent(InternalEvent *event) {
_backgroundSaveStateTask = UIBackgroundTaskInvalid;
#if TARGET_OS_IOS
_currentOrientation = UIInterfaceOrientationUnknown;
+
+ // On-screen control buttons
+ UIImage *menuBtnImage = [UIImage imageNamed:@"ic_action_menu"];
+ _menuButton = [[UIButton alloc] initWithFrame:CGRectMake(self.frame.size.width - menuBtnImage.size.width, 0, menuBtnImage.size.width, menuBtnImage.size.height)];
+ [_menuButton setImage:menuBtnImage forState:UIControlStateNormal];
+ [_menuButton setAlpha:0.5];
+ [_menuButton addTarget:self action:@selector(handleMainMenuKey) forControlEvents:UIControlEventTouchUpInside];
+ [self addSubview:_menuButton];
+
+ // The mode will be updated when OSystem has loaded its presets
+ UIImage *toggleTouchModeBtnImage = [UIImage imageNamed:@"ic_action_touchpad"];
+ _toggleTouchModeButton = [[UIButton alloc] initWithFrame:CGRectMake(self.frame.size.width - menuBtnImage.size.width - toggleTouchModeBtnImage.size.width, 0, toggleTouchModeBtnImage.size.width, toggleTouchModeBtnImage.size.height)];
+ [_toggleTouchModeButton setImage:toggleTouchModeBtnImage forState:UIControlStateNormal];
+ [_toggleTouchModeButton setAlpha:0.5];
+ [_toggleTouchModeButton addTarget:self action:@selector(triggerTouchModeChanged) forControlEvents:UIControlEventTouchUpInside];
+ [self addSubview:_toggleTouchModeButton];
#endif
[self setupGestureRecognizers];
@@ -314,6 +335,27 @@ bool iOS7_fetchEvent(InternalEvent *event) {
return self;
}
+#if TARGET_OS_IOS
+- (void)triggerTouchModeChanged {
+ [self addEvent:InternalEvent(kInputTouchModeChanged, 0, 0)];
+}
+
+- (void)updateTouchMode {
+ UIImage *btnImage;
+ TouchMode currentTouchMode = iOS7_getCurrentTouchMode();
+
+ if (currentTouchMode == kTouchModeDirect) {
+ btnImage = [UIImage imageNamed:@"ic_action_mouse"];
+ } else if (currentTouchMode == kTouchModeTouchpad) {
+ btnImage = [UIImage imageNamed:@"ic_action_touchpad"];
+ } else {
+ return;
+ }
+
+ [_toggleTouchModeButton setImage: btnImage forState:UIControlStateNormal];
+}
+#endif
+
- (void)dealloc {
[_keyboardView release];
@@ -390,6 +432,10 @@ bool iOS7_fetchEvent(InternalEvent *event) {
} else if ( orientation == UIInterfaceOrientationLandscapeRight ) {
newFrame = CGRectMake(screenSize.origin.x + inset.left, screenSize.origin.y, screenSize.size.width - inset.left, height);
}
+
+ // The onscreen control buttons have to be moved accordingly
+ [_menuButton setFrame:CGRectMake(newFrame.size.width - _menuButton.imageView.image.size.width, 0, _menuButton.imageView.image.size.width, _menuButton.imageView.image.size.height)];
+ [_toggleTouchModeButton setFrame:CGRectMake(newFrame.size.width - _toggleTouchModeButton.imageView.image.size.width - _toggleTouchModeButton.imageView.image.size.width, 0, _toggleTouchModeButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height)];
#endif
self.frame = newFrame;
}
@@ -456,6 +502,10 @@ bool iOS7_fetchEvent(InternalEvent *event) {
screenOrientation = kScreenOrientationFlippedLandscape;
}
+ // The onscreen control buttons have to be moved accordingly
+ [_menuButton setFrame:CGRectMake(self.frame.size.width - _menuButton.imageView.image.size.width, 0, _menuButton.imageView.image.size.width, _menuButton.imageView.image.size.height)];
+ [_toggleTouchModeButton setFrame:CGRectMake(self.frame.size.width - _menuButton.imageView.image.size.width - _toggleTouchModeButton.imageView.image.size.width, 0, _toggleTouchModeButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height)];
+
[self addEvent:InternalEvent(kInputOrientationChanged, screenOrientation, 0)];
if (UIInterfaceOrientationIsLandscape(orientation)) {
[self hideKeyboard];
Commit: 00296153df177cadf306677004fb2b798cb8dd4b
https://github.com/scummvm/scummvm/commit/00296153df177cadf306677004fb2b798cb8dd4b
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Add on-screen controls visibility configuration
Make it possible to configure the visibility of the on-screen control
buttons. If configured to not be shown both buttons are hidden and
disabled.
Changed paths:
backends/platform/ios7/ios7_options.mm
backends/platform/ios7/ios7_video.mm
diff --git a/backends/platform/ios7/ios7_options.mm b/backends/platform/ios7/ios7_options.mm
index 6e7f14e71c7..791b8e5b454 100644
--- a/backends/platform/ios7/ios7_options.mm
+++ b/backends/platform/ios7/ios7_options.mm
@@ -86,6 +86,8 @@ private:
GUI::PopUpWidget *_orientationMenusPopUp;
GUI::StaticTextWidget *_orientationGamesDesc;
GUI::PopUpWidget *_orientationGamesPopUp;
+
+ GUI::CheckboxWidget *_onscreenCheckbox;
#endif
bool _enabled;
};
@@ -159,6 +161,8 @@ IOS7OptionsWidget::IOS7OptionsWidget(GuiObject *boss, const Common::String &name
_orientationGamesPopUp->appendEntry(_("Automatic"), kScreenOrientationAuto);
_orientationGamesPopUp->appendEntry(_("Portrait"), kScreenOrientationPortrait);
_orientationGamesPopUp->appendEntry(_("Landscape"), kScreenOrientationLandscape);
+
+ _onscreenCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.OnscreenControl", _("Show On-screen control"));
#endif
new GUI::ButtonWidget(widgetsBoss(), "IOS7OptionsDialog.ControlsHelp", _("Controls Help"), Common::U32String(), kHelpCmd);
@@ -177,6 +181,9 @@ void IOS7OptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::Stri
layouts.addDialog(layoutName, overlayedLayout)
.addLayout(GUI::ThemeLayout::kLayoutVertical)
.addPadding(0, 0, 0, 0)
+#if TARGET_OS_IOS
+ .addWidget("OnscreenControl", "Checkbox")
+#endif
.addWidget("GamepadController", "Checkbox")
.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
.addPadding(0, 0, 0, 0)
@@ -399,6 +406,8 @@ void IOS7OptionsWidget::load() {
_orientationMenusPopUp->setSelectedTag(loadOrientation("orientation_menus", !inAppDomain, kScreenOrientationAuto));
}
_orientationGamesPopUp->setSelectedTag(loadOrientation("orientation_games", !inAppDomain, kScreenOrientationAuto));
+
+ _onscreenCheckbox->setState(ConfMan.getBool("onscreen_control", _domain));
#endif
}
@@ -424,6 +433,8 @@ bool IOS7OptionsWidget::save() {
saveOrientation("orientation_menus", _orientationMenusPopUp->getSelectedTag());
}
saveOrientation("orientation_games", _orientationGamesPopUp->getSelectedTag());
+
+ ConfMan.setBool("onscreen_control", _onscreenCheckbox->getState(), _domain);
#endif
} else {
ConfMan.removeKey("gamepad_controller", _domain);
@@ -444,6 +455,8 @@ bool IOS7OptionsWidget::save() {
ConfMan.removeKey("orientation_menus", _domain);
}
ConfMan.removeKey("orientation_games", _domain);
+
+ ConfMan.removeKey("onscreen_control", _domain);
#endif
}
@@ -463,7 +476,8 @@ bool IOS7OptionsWidget::hasKeys() {
#if TARGET_OS_IOS
hasKeys = hasKeys || (_domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("orientation_menus", _domain)) ||
- ConfMan.hasKey("orientation_games", _domain);
+ ConfMan.hasKey("orientation_games", _domain) ||
+ ConfMan.hasKey("onscreen_control", _domain);
#endif
return hasKeys;
@@ -473,7 +487,10 @@ void IOS7OptionsWidget::setEnabled(bool e) {
const bool inAppDomain = _domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain);
_enabled = e;
-#if TARGET_OS_IOS && defined (__IPHONE_15_0)
+#if TARGET_OS_IOS
+ _onscreenCheckbox->setEnabled(e);
+
+#if __IPHONE_15_0
// On-screen controls (virtual controller is supported in iOS 15 and later)
if (@available(iOS 15.0, *)) {
_gamepadControllerCheckbox->setEnabled(e);
@@ -488,7 +505,8 @@ void IOS7OptionsWidget::setEnabled(bool e) {
_gamepadControllerOpacitySlider->setEnabled(false);
_gamepadControllerOpacityLabel->setEnabled(false);
}
-#else
+#endif /* __IPHONE_15_0 */
+#else /* TARGET_OS_IOS */
_gamepadControllerCheckbox->setEnabled(false);
_gamepadControllerDirectionalInputDesc->setEnabled(false);
_gamepadControllerDirectionalInputPopUp->setEnabled(false);
@@ -542,6 +560,8 @@ void OSystem_iOS7::registerDefaultSettings(const Common::String &target) const {
#if TARGET_OS_IOS
ConfMan.registerDefault("orientation_menus", "auto");
ConfMan.registerDefault("orientation_games", "auto");
+
+ ConfMan.registerDefault("onscreen_control", true);
#endif
}
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index b4c2e3dbd26..caee755fb93 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -343,6 +343,7 @@ bool iOS7_fetchEvent(InternalEvent *event) {
- (void)updateTouchMode {
UIImage *btnImage;
TouchMode currentTouchMode = iOS7_getCurrentTouchMode();
+ bool isEnabled = ConfMan.getBool("onscreen_control");
if (currentTouchMode == kTouchModeDirect) {
btnImage = [UIImage imageNamed:@"ic_action_mouse"];
@@ -353,6 +354,11 @@ bool iOS7_fetchEvent(InternalEvent *event) {
}
[_toggleTouchModeButton setImage: btnImage forState:UIControlStateNormal];
+
+ [_toggleTouchModeButton setEnabled:isEnabled];
+ [_toggleTouchModeButton setHidden:!isEnabled];
+ [_menuButton setEnabled:isEnabled];
+ [_menuButton setHidden:!isEnabled];
}
#endif
Commit: 316352e8686d9623eef6c2c7b0cb403f5b11fb94
https://github.com/scummvm/scummvm/commit/316352e8686d9623eef6c2c7b0cb403f5b11fb94
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Toggle keyboard with on-screen control button
Add a long press gesture to the touch mode control button, which
when triggered, shows the keyboard. The image of the UI button
changes to the keyboard image asset as long as the keyboard is
visible. If pressing the touch mode control button while the
keyboard is visible it will dismiss the keyboard.
The updates of the on-screen button image is done in the general
"showKeyboard" and "hideKeyboard" functions which makes sure that
the button image is updated also if showing/hiding of the keyboard
is triggered by the OSystem callback.
Changed paths:
backends/platform/ios7/ios7_video.mm
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index caee755fb93..adaccc7dbc2 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -184,6 +184,11 @@ bool iOS7_fetchEvent(InternalEvent *event) {
- (void)setupGestureRecognizers {
#if TARGET_OS_IOS
+ UILongPressGestureRecognizer *longPressKeyboard = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressKeyboard:)];
+ [longPressKeyboard setMinimumPressDuration:1];
+ [_toggleTouchModeButton addGestureRecognizer:longPressKeyboard];
+ [longPressKeyboard release];
+
UIPinchGestureRecognizer *pinchKeyboard = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardPinch:)];
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(twoFingersSwipeRight:)];
@@ -337,7 +342,11 @@ bool iOS7_fetchEvent(InternalEvent *event) {
#if TARGET_OS_IOS
- (void)triggerTouchModeChanged {
- [self addEvent:InternalEvent(kInputTouchModeChanged, 0, 0)];
+ if ([self isKeyboardShown]) {
+ [self hideKeyboard];
+ } else {
+ [self addEvent:InternalEvent(kInputTouchModeChanged, 0, 0)];
+ }
}
- (void)updateTouchMode {
@@ -525,10 +534,16 @@ bool iOS7_fetchEvent(InternalEvent *event) {
- (void)showKeyboard {
[_keyboardView showKeyboard];
+#if TARGET_OS_IOS
+ [_toggleTouchModeButton setImage:[UIImage imageNamed:@"ic_action_keyboard"] forState:UIControlStateNormal];
+#endif
}
- (void)hideKeyboard {
[_keyboardView hideKeyboard];
+#if TARGET_OS_IOS
+ [self updateTouchMode];
+#endif
}
- (BOOL)isKeyboardShown {
@@ -620,6 +635,14 @@ bool iOS7_fetchEvent(InternalEvent *event) {
#endif
#if TARGET_OS_IOS
+- (void)longPressKeyboard:(UILongPressGestureRecognizer *)recognizer {
+ if (![self isKeyboardShown]) {
+ if (recognizer.state == UIGestureRecognizerStateBegan) {
+ [self showKeyboard];
+ }
+ }
+}
+
- (void)keyboardPinch:(UIPinchGestureRecognizer *)recognizer {
if ([recognizer scale] < 0.8)
[self showKeyboard];
Commit: 40f382cace750dd66be24460e5e89dc7e238a6c0
https://github.com/scummvm/scummvm/commit/40f382cace750dd66be24460e5e89dc7e238a6c0
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Make it possible to toggle alphabetical <-> numpad keyboard
Some games have some actions mapped to the numeric keyboard, e.g.
Indiana Jones and the last crusade fight scenes.
The alphabetical keyboard doesn't have the numeric button row so
it's a bit tricky to play these scenes without holding the "number
button switch" at the same time you need to press the correct number
button being showed.
Make it possible to switch between an alphabetical keyboard layout
to a numpad layout by adding a button to the toolbar.
Changed paths:
backends/platform/ios7/ios7_keyboard.mm
diff --git a/backends/platform/ios7/ios7_keyboard.mm b/backends/platform/ios7/ios7_keyboard.mm
index 5921618b8a4..62f105d3b5b 100644
--- a/backends/platform/ios7/ios7_keyboard.mm
+++ b/backends/platform/ios7/ios7_keyboard.mm
@@ -70,11 +70,13 @@
toolbar = [[UITabBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)];
toolbar.barTintColor = keyboard.backgroundColor;
- toolbar.tintColor = keyboard.tintColor;
+ toolbar.tintColor = [UIColor grayColor];
toolbar.translucent = NO;
toolbar.delegate = self;
toolbar.items = @[
+ // Keyboard layout button
+ [[[UITabBarItem alloc] initWithTitle:@"123" image:nil tag:0] autorelease],
// GMM button
[[[UITabBarItem alloc] initWithTitle:@"\u2630" image:nil tag:1] autorelease],
// Escape key
@@ -167,6 +169,9 @@
-(void)selectUITabBarItem:(UITapGestureRecognizer *)recognizer {
switch ([[toolbar selectedItem] tag]) {
+ case 0:
+ [self switchKeyboardLayout];
+ break;
case 1:
[self mainMenuKey];
break;
@@ -382,6 +387,17 @@
[softKeyboard handleKeyPress:Common::KEYCODE_RETURN];
}
+- (void) switchKeyboardLayout {
+ if ([self keyboardType] == UIKeyboardTypeDefault) {
+ [self setKeyboardType:UIKeyboardTypeNumberPad];
+ [[toolbar selectedItem] setTitle:@"abc"];
+ } else {
+ [self setKeyboardType:UIKeyboardTypeDefault];
+ [[toolbar selectedItem] setTitle:@"123"];
+ }
+
+ [self reloadInputViews];
+}
@end
@@ -449,6 +465,7 @@
inputView = [[TextInputHandler alloc] initWithKeyboard:self];
inputView.delegate = self;
inputView.clearsOnBeginEditing = YES;
+ inputView.keyboardType = UIKeyboardTypeDefault;
[inputView layoutIfNeeded];
_keyboardVisible = NO;
return self;
Commit: a2de9b0b4eb58b02eb3e87b14bdbce868bf739cd
https://github.com/scummvm/scummvm/commit/a2de9b0b4eb58b02eb3e87b14bdbce868bf739cd
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Handle HW keyboards better when using "Stage Manager"
When having a hardware keyboard connected to the iOS device the
software keyboard is not shown. However when using stage manager
the notification that the keyboard is shown is still triggered.
This results in that the game screen is resized even though no
keyboard is visible in the area below.
This is some kind of workaround for that where a check for any
connected hardware keyboard is made. If a keyboard is connected
then the screen is not resized, except if the accessory bar should
be shown. In that case the screen is resized only for the height
of the accessory bar.
Changed paths:
backends/platform/ios7/ios7_keyboard.h
backends/platform/ios7/ios7_keyboard.mm
backends/platform/ios7/ios7_video.mm
diff --git a/backends/platform/ios7/ios7_keyboard.h b/backends/platform/ios7/ios7_keyboard.h
index 3e6f7c7930c..b5a7f583289 100644
--- a/backends/platform/ios7/ios7_keyboard.h
+++ b/backends/platform/ios7/ios7_keyboard.h
@@ -32,6 +32,8 @@
TextInputHandler *inputView;
}
+ at property BOOL hwKeyboardConnected;
+
- (id)initWithFrame:(CGRect)frame;
- (void)dealloc;
- (UITextField *)inputView;
diff --git a/backends/platform/ios7/ios7_keyboard.mm b/backends/platform/ios7/ios7_keyboard.mm
index 62f105d3b5b..36ceba33bfd 100644
--- a/backends/platform/ios7/ios7_keyboard.mm
+++ b/backends/platform/ios7/ios7_keyboard.mm
@@ -405,6 +405,8 @@
BOOL _keyboardVisible;
}
+ at synthesize hwKeyboardConnected;
+
#if TARGET_OS_IOS
- (void)resizeParentFrame:(NSNotification*)notification keyboardDidShow:(BOOL)didShow
{
@@ -414,7 +416,15 @@
// Base the new frame size on the current parent frame size
CGRect newFrame = self.superview.frame;
- newFrame.size.height += (keyboardFrame.size.height) * (didShow ? -1 : 1);
+ if ([self hwKeyboardConnected]) {
+ if (inputView.inputAccessoryView.hidden) {
+ return;
+ } else {
+ newFrame.size.height += (inputView.inputAccessoryView.frame.size.height) * (didShow ? -1 : 1);
+ }
+ } else {
+ newFrame.size.height += (keyboardFrame.size.height) * (didShow ? -1 : 1);
+ }
// Resize with a fancy animation
NSNumber *rate = notification.userInfo[UIKeyboardAnimationDurationUserInfoKey];
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index adaccc7dbc2..4d477fe942b 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -31,6 +31,10 @@
#include "backends/platform/ios7/ios7_app_delegate.h"
+#ifdef __IPHONE_14_0
+#include <GameController/GameController.h>
+#endif
+
#if 0
static long g_lastTick = 0;
static int g_frames = 0;
@@ -533,6 +537,17 @@ bool iOS7_fetchEvent(InternalEvent *event) {
#endif
- (void)showKeyboard {
+ if (@available(iOS 14.0, tvOS 14.0, *)) {
+ // This will check if any hardware keyboard is connected, this also includes keyboards connected through Universal
+ // Control. If hardware keyboard is disconnected it might take some time before the software keyboard is shown again.
+ // This also happens in iOS system as well so it's not specific to ScummVM.
+ if (GCKeyboard.coalescedKeyboard != nil) {
+ [_keyboardView setHwKeyboardConnected:YES];
+ } else {
+ [_keyboardView setHwKeyboardConnected:NO];
+ }
+ }
+
[_keyboardView showKeyboard];
#if TARGET_OS_IOS
[_toggleTouchModeButton setImage:[UIImage imageNamed:@"ic_action_keyboard"] forState:UIControlStateNormal];
Commit: f6585ae5f5787fa9f8fce87f983511dc077e0695
https://github.com/scummvm/scummvm/commit/f6585ae5f5787fa9f8fce87f983511dc077e0695
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Disable SCUMMVM_NEON in iOS builds
Due to the current graphic problems when enabling the NEON
optimisations, disable it for the iOS port until the problems
have been fixed.
Changed paths:
configure
devtools/create_project/xcode.cpp
diff --git a/configure b/configure
index 71e355fea85..8c1a5d6b2f3 100755
--- a/configure
+++ b/configure
@@ -3673,7 +3673,7 @@ if test -n "$_host"; then
_backend="ios7"
_seq_midi=no
_timidity=no
- _ext_neon=yes
+ _ext_neon=no
;;
kos32)
# neither pkg-config nor *-config work, so we setup everything manually
diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp
index 32375d627d9..6624bbf2a26 100644
--- a/devtools/create_project/xcode.cpp
+++ b/devtools/create_project/xcode.cpp
@@ -1410,7 +1410,7 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
// Separate iphoneos and iphonesimulator definitions since simulator running on x86_64
// hosts doesn't support NEON
ValueList scummvmIOS_defines = scummvmIOSsimulator_defines;
- ADD_DEFINE(scummvmIOS_defines, "SCUMMVM_NEON");
+ // ADD_DEFINE(scummvmIOS_defines, "SCUMMVM_NEON");
ADD_SETTING_LIST(iPhone_Debug, "\"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*]\"", scummvmIOS_defines, kSettingsNoQuote | kSettingsAsList, 5);
ADD_SETTING(iPhone_Debug, "ASSETCATALOG_COMPILER_APPICON_NAME", "AppIcon");
ADD_SETTING(iPhone_Debug, "ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME", "LaunchImage");
@@ -1573,7 +1573,7 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
// Separate appletvos and appletvsimulator definitions since simulator running on x86_64
// hosts doesn't support NEON
ValueList scummvmTVOS_defines = scummvmTVOSsimulator_defines;
- ADD_DEFINE(scummvmTVOS_defines, "SCUMMVM_NEON");
+ // ADD_DEFINE(scummvmTVOS_defines, "SCUMMVM_NEON");
ADD_SETTING_LIST(tvOS_Debug, "\"GCC_PREPROCESSOR_DEFINITIONS[sdk=appletvos*]\"", scummvmTVOS_defines, kSettingsNoQuote | kSettingsAsList, 5);
ADD_SETTING(tvOS_Debug, "ASSETCATALOG_COMPILER_APPICON_NAME", "AppIcon");
ADD_SETTING(tvOS_Debug, "ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME", "LaunchImage");
Commit: 857b7553aac9c07d980531372fb820d2944bad71
https://github.com/scummvm/scummvm/commit/857b7553aac9c07d980531372fb820d2944bad71
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-10-10T20:55:48+02:00
Commit Message:
IOS7: Don't suspend the application in iOS when pressing menu
The Apple guidelines for Apple TV tells that when pressing the menu
button from the root view the user shall be brought to the "Home"
screen, suspending the app. Prevent this to be done in iOS.
Changed paths:
backends/platform/ios7/ios7_video.mm
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 4d477fe942b..1e87ee14ac0 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -713,9 +713,14 @@ bool iOS7_fetchEvent(InternalEvent *event) {
- (void)handleMainMenuKey {
if ([self isInGame]) {
[self addEvent:InternalEvent(kInputMainMenu, 0, 0)];
- } else {
+ }
+#if TARGET_OS_TV
+ else {
+ // According to Apple's guidelines the app should return to the
+ // home screen when pressing the menu button from the root view.
[[UIApplication sharedApplication] performSelector:@selector(suspend)];
}
+#endif
}
- (void)applicationSuspend {
More information about the Scummvm-git-logs
mailing list