Tightened the source code and README documentations in the library.

This commit is contained in:
2026-09-18 12:45:39 +02:00
parent c9f887bacb
commit 9ae10590cc
97 changed files with 854 additions and 1142 deletions
@@ -1,7 +1,7 @@
internal import CPlaydate
extension System {
/// The state of the d-pad and face buttons, as an option set.
/// A set of d-pad and A/B buttons. Wraps `PDButtons`.
public struct Buttons: OptionSet, Sendable {
public let rawValue: UInt32
public init(rawValue: UInt32) { self.rawValue = rawValue }
@@ -1,18 +1,21 @@
internal import CPlaydate
extension System {
/// A calendar date and time, mirroring `PDDateTime`.
/// A calendar date and time. Mirrors `PDDateTime`.
public struct DateTime: Sendable {
/// Full year, e.g. 2026.
public var year: UInt16
/// 1...12
/// 1...12.
public var month: UInt8
/// 1...31
/// 1...31.
public var day: UInt8
/// 1 = Monday ... 7 = Sunday
/// 1 (Monday)...7 (Sunday); 0 when unset.
public var weekday: UInt8
/// 0...23
/// 0...23.
public var hour: UInt8
/// 0...59.
public var minute: UInt8
/// 0...59.
public var second: UInt8
public init(year: UInt16, month: UInt8, day: UInt8, weekday: UInt8 = 0,
@@ -1,11 +1,10 @@
extension System {
/// OS, language, and pdx version information, mirroring `PDInfo`.
/// OS, language, and SDK version information. Mirrors `PDInfo`.
public struct Info: Sendable {
/// The Playdate OS version.
/// E.g. 20705 for 2.7.5.
public let osVersion: UInt32
/// The system language.
public let language: Language
/// The version of the game's pdx.
/// The pdxinfo `pdxversion`: the SDK version the game was built with.
public let pdxVersion: UInt32
}
}
@@ -1,12 +1,13 @@
internal import CPlaydate
extension System {
/// Peripherals that can be enabled with `setPeripheralsEnabled(_:)`.
/// Peripherals for `setPeripheralsEnabled(_:)`. Wraps `PDPeripherals`.
public struct Peripherals: OptionSet, Sendable {
public let rawValue: UInt32
public init(rawValue: UInt32) { self.rawValue = rawValue }
public static let none = Peripherals([])
/// Disabled by default.
public static let accelerometer = Peripherals(rawValue: UInt32(kAccelerometer.rawValue))
public static let all = Peripherals(rawValue: UInt32(kAllPeripherals.rawValue))
}
@@ -1,16 +1,14 @@
internal import CPlaydate
extension System {
/// Battery and power supply state.
/// Battery and power supply state. Wraps `PDPowerStatus`.
public struct PowerStatus: OptionSet, Sendable {
public let rawValue: UInt32
public init(rawValue: UInt32) { self.rawValue = rawValue }
/// The battery is charging.
public static let charging = PowerStatus(rawValue: UInt32(kPDPowerStatusCharging.rawValue))
/// Power is supplied over USB.
public static let usb = PowerStatus(rawValue: UInt32(kPDPowerStatusUsb.rawValue))
/// Power is supplied through the accessory screw terminals.
/// Powered through the corner screw pads.
public static let screws = PowerStatus(rawValue: UInt32(kPDPowerStatusScrews.rawValue))
}
}