Files
voxelotl-engine/Sources/Voxelotl/Program.swift

37 lines
916 B
Swift
Raw Permalink Normal View History

2024-09-03 05:00:28 -04:00
import Foundation
@objc public class Program: NSObject {
@objc public static func run() -> Int32 {
Thread.current.qualityOfService = .userInteractive
var flags: ApplicationConfiguration.Flags = [ .resizable, .highDPI, .onScreenVirtualController ]
if enableFullscreenWindow() {
flags = flags.union(.fullscreen)
}
2024-09-03 05:00:28 -04:00
let app = Application(
delegate: Game(),
configuration: ApplicationConfiguration(
frame: Size(1280, 720),
title: "Voxelotl Demo",
flags: flags,
2024-09-03 05:00:28 -04:00
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
}
2024-09-03 05:00:28 -04:00
}