[Scummvm-git-logs] scummvm master -> ef5e31aaa61185728e4e5f5f798b26d0490dc5ef

larsamannen noreply at scummvm.org
Mon Oct 14 18:37:30 UTC 2024


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5ffb00df5d IOS7: Hide burger menu button when in launcher
f2b1bbd243 IOS7: Put burger menu button below touch mode button
f460c6cb02 IOS7: Add margins to on-screen control buttons
ef5e31aaa6 IOS7: Fix crash (abort) on boot


Commit: 5ffb00df5d10c48e04316e0c523cd47ffba4616e
    https://github.com/scummvm/scummvm/commit/5ffb00df5d10c48e04316e0c523cd47ffba4616e
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2024-10-14T20:37:26+02:00

Commit Message:
IOS7: Hide burger menu button when in launcher

The burger menu button doesn't fill any purpose while in the launcher.
Nothing happens when the user press the button in the launcher. This
is considered as bad user experience according to Apple guidelines.
The button must be hidden while in the launcher.

Show the menu button only while an engine is running.

Changed paths:
    backends/platform/ios7/ios7_osys_video.mm
    backends/platform/ios7/ios7_video.mm


diff --git a/backends/platform/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm
index 9b58074b11e..4ebf6d0945a 100644
--- a/backends/platform/ios7/ios7_osys_video.mm
+++ b/backends/platform/ios7/ios7_osys_video.mm
@@ -96,6 +96,7 @@ void OSystem_iOS7::engineInit() {
 
 #if TARGET_OS_IOS
 	applyOrientationSettings();
+	updateTouchMode();
 
 	// Automatically open the keyboard when starting a game and in portrait mode.
 	// This is preferred for text input games and there's a lot of screen space to
@@ -119,6 +120,7 @@ void OSystem_iOS7::engineDone() {
 
 #if TARGET_OS_IOS
 	applyOrientationSettings();
+	updateTouchMode();
 
 	// Hide keyboard when going back to launcher
 	execute_on_main_thread(^ {
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 5c9d7483071..9cf635c7d5a 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -444,8 +444,8 @@ bool iOS7_fetchEvent(InternalEvent *event) {
 
 	[_toggleTouchModeButton setEnabled:isEnabled];
 	[_toggleTouchModeButton setHidden:!isEnabled];
-	[_menuButton setEnabled:isEnabled];
-	[_menuButton setHidden:!isEnabled];
+	[_menuButton setEnabled:isEnabled && [self isInGame]];
+	[_menuButton setHidden:!isEnabled || ![self isInGame]];
 }
 
 - (BOOL)isiOSAppOnMac {


Commit: f2b1bbd2433284a4fbbdaa831f8900538157e636
    https://github.com/scummvm/scummvm/commit/f2b1bbd2433284a4fbbdaa831f8900538157e636
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2024-10-14T20:37:26+02:00

Commit Message:
IOS7: Put burger menu button below touch mode button

Put the menu button below the touch mode button to remove the empty
gap while in the launcher. By putting the buttons along the right
side they interfere less with the game interface. This is how the
Android port place the buttons. Align the iOS port accordingly.

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 9cf635c7d5a..83cb2022d2f 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -535,9 +535,10 @@ bool iOS7_fetchEvent(InternalEvent *event) {
 			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)];
+		// Touch mode button on top
+		[_toggleTouchModeButton setFrame:CGRectMake(self.frame.size.width - _toggleTouchModeButton.imageView.image.size.width, 0, _toggleTouchModeButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height)];
+		// Burger menu button below
+		[_menuButton setFrame:CGRectMake(self.frame.size.width - _menuButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height, _menuButton.imageView.image.size.width, _menuButton.imageView.image.size.height)];
 #endif
 		self.frame = newFrame;
 	}
@@ -622,9 +623,11 @@ 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)];
+	// Touch mode button on top
+	[_toggleTouchModeButton setFrame:CGRectMake(self.frame.size.width - _toggleTouchModeButton.imageView.image.size.width, 0, _toggleTouchModeButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height)];
+	// Burger menu button below
+	[_menuButton setFrame:CGRectMake(self.frame.size.width - _menuButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height, _menuButton.imageView.image.size.width, _menuButton.imageView.image.size.height)];
+
 
 	[self addEvent:InternalEvent(kInputOrientationChanged, screenOrientation, 0)];
 	if (UIInterfaceOrientationIsLandscape(orientation)) {


Commit: f460c6cb027f3a01ae2e99ade882fcbbf0bae691
    https://github.com/scummvm/scummvm/commit/f460c6cb027f3a01ae2e99ade882fcbbf0bae691
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2024-10-14T20:37:26+02:00

Commit Message:
IOS7: Add margins to on-screen control buttons

The button images can become cropped if placed too close to the
corners on modern iPhones and iPads. This due to the squircle form
of the screen corners. iPhones have safe area insets that can be
used to calculate a margin. On iPads the safe area inset values
are 0, but still the button images can be cropped due to the round
form of the screen corners. Use a constant value of 10 in those
cases.

This looks good on devices with big screens (iPads) and smaller
screens (iPhone 12 mini).

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 83cb2022d2f..e8fbcbbcd4d 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -535,10 +535,19 @@ bool iOS7_fetchEvent(InternalEvent *event) {
 			newFrame = CGRectMake(screenSize.origin.x + inset.left, screenSize.origin.y, screenSize.size.width - inset.left, height);
 		}
 
+		// Add margins to respect the iPhone and iPad safe areas. Use the right
+		// safe area inset if available since the position of the buttons are
+		// on the right hand side. The iPhone corners on the later models have
+		// the form of squircles rather than circles which cause button images
+		// to become cropped if placed too close to the corner.
+		// iPads has a more rectangular screen form. The inset margin on iPads
+		// is 0, however due to the rounding of the corners images gets cropped
+		// if placed too close to the corners. Use a constant margin for those.
+		const CGFloat margin = inset.right > 0 ? inset.right/4 : 10;
 		// Touch mode button on top
-		[_toggleTouchModeButton setFrame:CGRectMake(self.frame.size.width - _toggleTouchModeButton.imageView.image.size.width, 0, _toggleTouchModeButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height)];
+		[_toggleTouchModeButton setFrame:CGRectMake(self.frame.size.width - _toggleTouchModeButton.imageView.image.size.width - margin, margin, _toggleTouchModeButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height)];
 		// Burger menu button below
-		[_menuButton setFrame:CGRectMake(self.frame.size.width - _menuButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height, _menuButton.imageView.image.size.width, _menuButton.imageView.image.size.height)];
+		[_menuButton setFrame:CGRectMake(self.frame.size.width - _menuButton.imageView.image.size.width - margin, _toggleTouchModeButton.imageView.image.size.height + margin, _menuButton.imageView.image.size.width, _menuButton.imageView.image.size.height)];
 #endif
 		self.frame = newFrame;
 	}
@@ -623,11 +632,13 @@ bool iOS7_fetchEvent(InternalEvent *event) {
 		screenOrientation = kScreenOrientationFlippedLandscape;
 	}
 
+	// This function is executed also on older device models. The screens
+	// have sharp corners and no safe area insets. Use a constant margin.
+	const CGFloat margin = 10;
 	// Touch mode button on top
-	[_toggleTouchModeButton setFrame:CGRectMake(self.frame.size.width - _toggleTouchModeButton.imageView.image.size.width, 0, _toggleTouchModeButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height)];
+	[_toggleTouchModeButton setFrame:CGRectMake(self.frame.size.width - _toggleTouchModeButton.imageView.image.size.width - margin, margin, _toggleTouchModeButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height)];
 	// Burger menu button below
-	[_menuButton setFrame:CGRectMake(self.frame.size.width - _menuButton.imageView.image.size.width, _toggleTouchModeButton.imageView.image.size.height, _menuButton.imageView.image.size.width, _menuButton.imageView.image.size.height)];
-
+	[_menuButton setFrame:CGRectMake(self.frame.size.width - _menuButton.imageView.image.size.width - margin, _toggleTouchModeButton.imageView.image.size.height + margin, _menuButton.imageView.image.size.width, _menuButton.imageView.image.size.height)];
 
 	[self addEvent:InternalEvent(kInputOrientationChanged, screenOrientation, 0)];
 	if (UIInterfaceOrientationIsLandscape(orientation)) {


Commit: ef5e31aaa61185728e4e5f5f798b26d0490dc5ef
    https://github.com/scummvm/scummvm/commit/ef5e31aaa61185728e4e5f5f798b26d0490dc5ef
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2024-10-14T20:37:26+02:00

Commit Message:
IOS7: Fix crash (abort) on boot

Some crash reports from AppStore was reported due to system abort
while trying to read the current touch mode on system startup.
When the ViewController loads it tries to read the touch mode to
know which icon to show. The scummvm system runs in a different
thread and might not have finished loading at the time.

This causes an uneccessary race condition and it's a bit hard to
abort the application in this scenario. It should be just fine to
return the default "Direct touch" mouse mode when this happens.

Changed paths:
    backends/platform/ios7/ios7_osys_main.cpp


diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index 241501e70f2..8098789395b 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -445,7 +445,9 @@ void iOS7_buildSharedOSystemInstance() {
 TouchMode iOS7_getCurrentTouchMode() {
 	OSystem_iOS7 *sys = dynamic_cast<OSystem_iOS7 *>(g_system);
 	if (!sys) {
-		abort();
+		// If the system has not finished loading, just return a
+		// default value.
+		return kTouchModeDirect;
 	}
 	return sys->getCurrentTouchMode();
 }




More information about the Scummvm-git-logs mailing list