Swift 6.4 migration and exhancements #1
@@ -8,7 +8,7 @@
|
|||||||
import CPlaydate
|
import CPlaydate
|
||||||
import PlaydateKit
|
import PlaydateKit
|
||||||
|
|
||||||
@_cdecl("eventHandler")
|
@c(eventHandler)
|
||||||
public func eventHandler(
|
public func eventHandler(
|
||||||
pointer: UnsafeMutableRawPointer,
|
pointer: UnsafeMutableRawPointer,
|
||||||
event: PDSystemEvent,
|
event: PDSystemEvent,
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ targets: [
|
|||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
A Playdate application or game has a single C entry point, `eventHandler`. Export it with `@_cdecl`, initialize the binding on the first event, and install an update callback:
|
A Playdate application or game has a single C entry point, `eventHandler`. Export it with `@c`, initialize the binding on the first event, and install an update callback:
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
import CPlaydate
|
import CPlaydate
|
||||||
import PlaydateKit
|
import PlaydateKit
|
||||||
|
|
||||||
@_cdecl("eventHandler")
|
@c(eventHandler)
|
||||||
func eventHandler(
|
func eventHandler(
|
||||||
pointer: UnsafeMutableRawPointer,
|
pointer: UnsafeMutableRawPointer,
|
||||||
event: PDSystemEvent,
|
event: PDSystemEvent,
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ Bootstrap the bindings from your game's entry point and drive a frame loop.
|
|||||||
|
|
||||||
A Playdate game has a single C entry point, `eventHandler`, which the
|
A Playdate game has a single C entry point, `eventHandler`, which the
|
||||||
firmware calls with a `PlaydateAPI*` and an event code. Export it with
|
firmware calls with a `PlaydateAPI*` and an event code. Export it with
|
||||||
`@_cdecl`, call ``Playdate/initialize(with:)`` on the first event, and
|
`@c`, call ``Playdate/initialize(with:)`` on the first event, and
|
||||||
install an update callback:
|
install an update callback:
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
import CPlaydate
|
import CPlaydate
|
||||||
import PlaydateKit
|
import PlaydateKit
|
||||||
|
|
||||||
@_cdecl("eventHandler")
|
@c(eventHandler)
|
||||||
func eventHandler(
|
func eventHandler(
|
||||||
pointer: UnsafeMutableRawPointer,
|
pointer: UnsafeMutableRawPointer,
|
||||||
event: PDSystemEvent,
|
event: PDSystemEvent,
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ extension String {
|
|||||||
/// The pointer is later released with plain `free`, so it cannot be offset
|
/// The pointer is later released with plain `free`, so it cannot be offset
|
||||||
/// to adjust alignment; the firmware allocator's natural alignment has to
|
/// to adjust alignment; the firmware allocator's natural alignment has to
|
||||||
/// satisfy the request, which the precondition asserts.
|
/// satisfy the request, which the precondition asserts.
|
||||||
@_cdecl("posix_memalign")
|
@c(posix_memalign)
|
||||||
public func posix_memalign(
|
public func posix_memalign(
|
||||||
_ memptr: UnsafeMutablePointer<UnsafeMutableRawPointer?>,
|
_ memptr: UnsafeMutablePointer<UnsafeMutableRawPointer?>,
|
||||||
_ alignment: Int,
|
_ alignment: Int,
|
||||||
|
|||||||
Reference in New Issue
Block a user