mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-05 06:01:34 +00:00
implement on screen virtual controller for iOS
This commit is contained in:
@ -4,14 +4,33 @@ import Foundation
|
||||
@objc public static func run() -> Int32 {
|
||||
Thread.current.qualityOfService = .userInteractive
|
||||
|
||||
var flags: ApplicationConfiguration.Flags = [ .resizable, .highDPI, .onScreenVirtualController ]
|
||||
if enableFullscreenWindow() {
|
||||
flags = flags.union(.fullscreen)
|
||||
}
|
||||
|
||||
let app = Application(
|
||||
delegate: Game(),
|
||||
configuration: ApplicationConfiguration(
|
||||
frame: Size(1280, 720),
|
||||
title: "Voxelotl Demo",
|
||||
flags: [ .resizable, .highDPI ],
|
||||
flags: flags,
|
||||
vsyncMode: .on(interval: 1)))
|
||||
|
||||
return app.run()
|
||||
}
|
||||
|
||||
static func enableFullscreenWindow() -> Bool {
|
||||
return Program.isFrontAndCenterGamingDevice()
|
||||
}
|
||||
|
||||
static func isFrontAndCenterGamingDevice() -> Bool {
|
||||
#if os(iOS)
|
||||
return !(ProcessInfo.processInfo.isiOSAppOnMac || ProcessInfo.processInfo.isMacCatalystApp)
|
||||
#elseif os(tvOS)
|
||||
return true
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user