Files
Picross/Sources/SDL/Engine.swift
T
2024-10-14 16:18:24 -04:00

31 lines
742 B
Swift

import CSDL2
import CSDL2_Image
public struct Engine {
public static func initalize(subsystem: SubSystem) throws {
try SDL_Init(subsystem.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()
}
/// Specific SDL subsystems.
public enum SubSystem: UInt32 {
case timer = 0x00000001
case audio = 0x00000010
case video = 0x00000020
case joystick = 0x00000200
case haptic = 0x00001000
case gameController = 0x00002000
case events = 0x00004000
}
}