love
love copied to clipboard
fullscreen config in `conf.lua` prevents setting initial orientation on iOS 16
It seems this issue love-android #196 happens on iOS16 again. If you use the following configs:
t.window.width,t.window.height=1280,720
t.window.fullscreen=true
t.window.resizeable=false
Then launch the game with your phone standing portrait, the game would be in portrait mode even the window.width is greater than window.height.
This didn't happen on iOS 15. See discussions in our game's issue: Techmino #847
Example project code on Techmino/ci-ios-test, result on 15 and 16:

Here's the commit for that Android fix: 9c4db00e9490742317d4a493f5c11d7f7e200124
If you could change the relevant codepath to also run on iOS, by changing the #if by adding LOVE_IOS define check too, does it solves the issue?
Would test with git patch and love-actions-ios CI, since I have no mac dev env for now
I doubt that Android-specific change would affect much at all on iOS. The two platforms have radically different codepaths in SDL (which is meant to handle this stuff) - historically SDL's Android backend has sort of been its own thing, whereas the iOS backend behaves similarly to other platforms.
As a workaround, setting the available orientations via the Xcode project will probably work in the meantime. See platform/xcode/love-ios.plist if you want to edit the file that has that information (UISupportedInterfaceOrientations etc).
I doubt that Android-specific change would affect much at all on iOS. The two platforms have radically different codepaths in SDL (which is meant to handle this stuff) - historically SDL's Android backend has sort of been its own thing, whereas the iOS backend behaves similarly to other platforms.
As a workaround, setting the available orientations via the Xcode project will probably work in the meantime. See
platform/xcode/love-ios.plistif you want to edit the file that has that information (UISupportedInterfaceOrientationsetc).
I've tried, but our game need to change orientation with in game settings
Actually it behaves weird, as if the game read the wrong width and length data, the game scene is cropped.
Launch portrait:

Launch landscape:

Sorry but I can’t provide any debugging information, since my Mac is too old and keeps running out of memory. Test branch: ci-ios-fix Git patch: love.patch
This isn't something love's own source code can likely fix either way. There was a workaround recently for something similar inside SDL's source code (https://github.com/libsdl-org/SDL/issues/6289) but I don't think the workaround will necessarily fix this issue - you could try using the latest SDL2 release even so.
is there any build script let me can build SDL2.xcframework library??
https://github.com/love2d/love-apple-dependencies/tree/main/iOS/libraries/SDL2.xcframework
I'm new to iOS develop, I think may it has a script like: https://github.com/love2d/love/blob/9963d1247c05b303caf7c61e8016315a1cd33465/platform/xcode/ios/luajit-iOS.sh#L10
is there any build script let me can build SDL2.xcframework library?
The Xcode project in the latest SDL2 versions has an xcframework iOS target I believe. I haven't tested it myself yet but hopefully it'll work without needing to change anything. Otherwise you can build a static library and use the xcodebuild -create-xcframework command to generate one from one or more static libraries.
the xcframework target in SDL2 framework's structure like this:

but the xcframework of love2d is:

this will cause an error:

Thanks for your second advice, I will try it later.
looks like SDL2 2.26.3(latest) still have this problem.
you can use follow steps to create a new SDL2.xcframework
Firstly, build static library for iOS:
then open the build folder and copy that path:

xcodebuild -create-xcframework -library {BUILD_PATH}/Products/Release-iphoneos/libSDL2.a -headers {SOURCE_DIR}/include -library {BUILD_PATH}/Products/Release-iphonesimulator/libSDL2.a -headers {SOURCE_DIR}/include -output SDL2.xcframework
replace the {SOURCE_DIR} to source code path, replace the {BUILD_PATH} to the xcode build folder.
I've done some debugging and I have a potential fix for the issue in SDL, but I need to test it more.
However, setting fullscreen without setting exclusive fullscreen will use fullscreen-desktop mode. Fullscreen-desktop always uses the native screen resolution instead of changing it based on the requested dimensions. On iOS that means even if you request landscape or whatever via setting width and height it won't use it, and will likely default to portrait mode.
The bug still exists when you request exclusive fullscreen with landscape though, and that's what I'm fixing.