Promote subsystem namespaces to the top level of the module

System, Display, Graphics, Sprite, Sound, File, JSON, Lua, Scoreboards,
Network, Rect, SystemEvent, and AccessReply now live at module scope
instead of being nested in the Playdate enum; consumers write
System.log(...) instead of Playdate.System.log(...), and can qualify with
the module name (PlayDate.System) on collision. The Playdate enum remains
only as the raw C API bootstrap (initialize(with:), api, apiPointer), and
Playdate.Error is renamed PlaydateError so no top-level type shadows
Swift.Error.

Breaking change for any existing consumers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 11:10:25 +02:00
co-authored by Claude Fable 5
parent 3ee071e098
commit 6485997edc
22 changed files with 801 additions and 822 deletions
+4 -4
View File
@@ -5,7 +5,7 @@
internal import CPlaydate
extension Playdate.Graphics {
extension Graphics {
/// A font loaded from a .pft file. Wraps `LCDFont`.
public final class Font {
let pointer: OpaquePointer
@@ -19,10 +19,10 @@ extension Playdate.Graphics {
}
/// Loads a font from a file.
public convenience init(path: String) throws(Playdate.Error) {
public convenience init(path: String) throws(PlaydateError) {
var error: UnsafePointer<CChar>?
let pointer = path.withPlaydateCString { gfx.loadFont.unsafelyUnwrapped($0, &error) }
guard let pointer else { throw Playdate.Error(cString: error) }
guard let pointer else { throw PlaydateError(cString: error) }
self.init(pointer: pointer)
}
@@ -42,7 +42,7 @@ extension Playdate.Graphics {
deinit {
// Per the C API docs, fonts are freed with the system allocator.
Playdate.System.systemFree(UnsafeMutableRawPointer(pointer))
System.systemFree(UnsafeMutableRawPointer(pointer))
retainedData?.deallocate()
}