Skip to content

Instantly share code, notes, and snippets.

@jarrodnorwell
Last active June 4, 2024 18:12
Show Gist options
  • Save jarrodnorwell/7857397f4fbec7e336c4b19608e50c83 to your computer and use it in GitHub Desktop.
Save jarrodnorwell/7857397f4fbec7e336c4b19608e50c83 to your computer and use it in GitHub Desktop.
struct Skin : Codable {
struct Button : Codable {
let origin: CGPoint
let size: CGSize
let type: VirtualControllerButton.ButtonType
}
struct Screen : Codable {
let origin: CGPoint
let size: CGSize
}
struct Device : Codable {
enum Orientation : Int, Codable {
case portrait, landscape
}
let device: String
let orientation: Orientation
let buttons: [Button]
let screens: [Screen]
}
let author, description, name: String
let core: Core
let devices: [Device]
}
_ = Skin(author: "Antique", description: "A basic skin for Game Boy Advance", name: "GBA Skin", core: .grape, devices: [
.init(device: "iPhone16,2", orientation: .portrait, buttons: [
.init(origin: .init(x: 100, y: 100), size: .init(width: 60, height: 60), type: .a)
], screens: [
.init(origin: .init(x: 0, y: 0), size: .init(width: 0, height: 0))
]),
.init(device: "iPhone16,2", orientation: .landscape, buttons: [
.init(origin: .init(x: 100, y: 100), size: .init(width: 60, height: 60), type: .a)
], screens: [
.init(origin: .init(x: 0, y: 0), size: .init(width: 0, height: 0))
])
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment