Posts

Post marked as solved
2 Replies
772 Views
The documentation says the pixel format of the environmentTexture in an AREnvironmentProbeAnchor is bgra8Unorm_srgb. https://developer.apple.com/documentation/arkit/arenvironmentprobeanchor/2977511-environmenttexture However, when I inspect the pixelFormat property of the MTLTexture it says it's rgba16Float. I'm trying to read the texture out as a PNG, and because it's a 16-bit float image, I'm assuming its color space is CGColorSpace.displayP3, but I'm not 100% sure. The texture looks darker than what I expected. Could it be that the color space is sRGB, but it's 16-bit because it's actually an HDR texture stored as linear RGB? (Tested on iPhone 12, iOS 15)
Posted
by endavid.
Last updated
.
Post not yet marked as solved
4 Replies
4.4k Views
I'm trying to port a game to macOS using Mac Catalyst. The game content doesn't dynamically resize and I'm trying to force a fixed 3:4 aspect ratio (like an iPad on portrait) at the start of the app, so I've added this to my AppDelegate class: 	func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {         #if targetEnvironment(macCatalyst) 						/* some margin */             let titleHeight: CGFloat = 34 * 4             UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.forEach { windowScene in                 windowScene.titlebar?.titleVisibility = .hidden                 /* screen seems to always be 1920x1080 ??? */                 let height = windowScene.screen.nativeBounds.height - titleHeight                 let width = 3 * height / 4                 windowScene.sizeRestrictions?.minimumSize = CGSize(width: width, height: height)                 windowScene.sizeRestrictions?.maximumSize = CGSize(width: width, height: height)             }         #endif 	} That works in fixing the aspect, but the window looks small in a 15-inch MacBook Pro. nativeBounds is always 1920x1080, where the native resolution should be 1920x1200. UIScreen.main gives me 1920x1080 as well. How can I get the real size of the screen?
Posted
by endavid.
Last updated
.
Post not yet marked as solved
2 Replies
501 Views
Every time I submit an achievement to Game Center on macOS, using Mac Catalyst, my game crashes with this: [GKAchievementInternal showBanner]: unrecognized selector sent to instance 0x600002616ca0 No call stack. I set a break point for all the Obj-C exceptions but it's just stopped in the AppDelegate. Everything is fine on iOS and iPadOS, and the rest of the Game Center behaviour on macOS seems to be fine. For reference, this is how I submit the achievements:     private func submitAchievements(_ aList: [Achievement]) {         if !isGameCenterEnabled {             return         }         var achievements : [GKAchievement] = []         for kvp in AchievementFromId {             if aList.contains(kvp.1) {                 let achievement = GKAchievement(identifier: kvp.0)                 achievement.showsCompletionBanner = true                 achievement.percentComplete = 100.0                 achievements.append(achievement)             }         }         if achievements.count > 0 {             GKAchievement.report(achievements, withCompletionHandler: { (error: Error?) -> Void in                 if let err = error {                     NSLog("submitAchievements: \(err.localizedDescription)")                 }             })         }     } That function uses these data structures: enum Achievement : Int {     case     clearTutorial =   0x00000001,     clearLevel1   =   0x00000002,     clearLevel2   =   0x00000004, } let AchievementFromId : [String : Achievement] = [     "Tutorial": .clearTutorial,     "Level1": .clearLevel1,     "Level2": .clearLevel2, ] Also, how can I reset the achievements for one user? Because in order to debug this I already run out of chances... I need to keep creating new users in order to test the completion banner, since it's shown only once.
Posted
by endavid.
Last updated
.