mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 13:11:33 +00:00
rotating flip flags
This commit is contained in:
@ -6,8 +6,8 @@ public struct Sprite {
|
||||
}
|
||||
|
||||
public static let none: Self = Self(rawValue: 0)
|
||||
public static let x: Self = Self(rawValue: 1 << 0)
|
||||
public static let y: Self = Self(rawValue: 1 << 1)
|
||||
public static let horz: Self = Self(rawValue: 1 << 0)
|
||||
public static let vert: Self = Self(rawValue: 1 << 1)
|
||||
public static let diag: Self = Self(rawValue: 1 << 2)
|
||||
}
|
||||
|
||||
@ -21,3 +21,15 @@ public struct Sprite {
|
||||
var flip: Flip
|
||||
var color: Color<Float>
|
||||
}
|
||||
|
||||
public extension Sprite.Flip {
|
||||
var clockwise: Self {
|
||||
[Self](arrayLiteral: [ .vert, .diag ], [ .horz, .vert, .diag ], .diag,
|
||||
[ .horz, .diag ], .horz, .none, [ .horz, .vert ], .vert)[Int(self.rawValue)]
|
||||
}
|
||||
|
||||
var counterClockwise: Self {
|
||||
[Self](arrayLiteral: [ .horz, .diag ], .diag, [ .horz, .vert, .diag ],
|
||||
[ .vert, .diag ], .vert, [ .horz, .vert ], .none, .horz)[Int(self.rawValue)]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user