Creates a Swift Playground app with a Metal view and basic input support. Very early alpha.
- Create a new Swift Playground, choosing the Playground Type 'App'
- Long press on the left side bar below the code section
- Choose Add Swift Package
- Paste the Web Url of this project:
https://github.com/oftheoldschool/KoboldFramework.gitand hit return - When the Package has been resolved, choose 'Add to App Playground'
- Delete ContentView.swift, and replace the code in MyApp.swift with the following:
import SwiftUI
import KoboldFramework
@main
struct KoboldMain: App {
var koboldApp = ExampleApp()
var body: some Scene {
koboldApp.body
}
}
class ExampleApp: KoboldApp {
override var appName: String { "Example App" }
// override things from KoboldApp here
}- Run the Playground. You should see a loading screen followed by a Metal view that changes colour
See KoboldApp.swift for a list of all the open vars and funcs that can be overridden to customise the behaviour.
Of particular note is override public func createFrameHandler(sysLink: KSysLink) -> KFrameHandler with KFrameHandler being the protocol for the class that will be executed each frame. The example implementation provided here is ExampleBasicFrameHandler.swift
Use at your own risk.