import CSDL2 //import CSDL2_Image public struct Engine { /// Initalizes SDL. This must be called before any other SDL function. /// /// Errors encountered in this function are considered unrecoverable, and will crash the entire program. /// /// - Parameters: /// - subsystems: The SDL subsystem(s) to start. Default value only initalizes the video subsystem. public static func start(subsystems: InitSubSystems = .video) { try! SDL_InitSubSystem(subsystems.rawValue).sdlThrow(type: type(of: self)) //try! IMG_Init(Int32(IMG_INIT_PNG.rawValue)).sdlThrow(type: type(of: self)) } public static func delay(_ ms: UInt32) { SDL_Delay(ms) } public static func quit() { SDL_Quit() } /// public struct InitSubSystems: OptionSet, Sendable { public let rawValue: UInt32 public init(rawValue: UInt32) { self.rawValue = rawValue } public static let audio = InitSubSystems(rawValue: SDL_INIT_AUDIO) public static let video = InitSubSystems(rawValue: SDL_INIT_VIDEO) public static let joystick = InitSubSystems(rawValue: SDL_INIT_JOYSTICK) public static let haptic = InitSubSystems(rawValue: SDL_INIT_HAPTIC) public static let gameController = InitSubSystems(rawValue: SDL_INIT_GAMEPAD) public static let events = InitSubSystems(rawValue: SDL_INIT_EVENTS) public static let sensor = InitSubSystems(rawValue: SDL_INIT_SENSOR) public static let camera = InitSubSystems(rawValue: SDL_INIT_CAMERA) } public struct InitImageFormats: OptionSet, Sendable { public let rawValue: Int32 public init(rawValue: Int32) { self.rawValue = rawValue } // TODO - fix this! public static let jpg = InitImageFormats(rawValue: 0x00000001) public static let png = InitImageFormats(rawValue: 0x00000002) public static let tif = InitImageFormats(rawValue: 0x00000004) public static let webp = InitImageFormats(rawValue: 0x00000008) public static let jxl = InitImageFormats(rawValue: 0x000000010) public static let avif = InitImageFormats(rawValue: 0x00000020) } }