lancelotbronner/swift-raylib
Swift bindings for [raylib](http://www.raylib.com/), **a simple and easy-to-use library to enjoy videogames programming.**
Features
- Use a swifty interface!
- Support for
@mainlifecycle - Decent examples collection with [+23 code examples][examples]!
- Extensive documentation, both in your IDE and via DocC!
- You can still do C interop if needed, but consider opening a pull request!
import RaylibKit
@main struct MinimalWindow: Applet {
init() {
Window.create(800, by: 450, title: "Example - Core - Basic Window")
Application.target(fps: 60)
}
func draw() {
Renderer2D.text(center: "Congrats! You created your first window!", color: .lightGray)
}
}[The result of the above snippet]
π Getting Started
First you'll need to install raylib as a system library and add this package as a dependency.
You can then start learning! Check out the [examples] to quickly get an idea and make sure your installation works!
Documentation is available via DocC. For Xcode users simply go to Product > Build Documentation or press ββ§βD (alt-shift-command-D). For others the documentation is available in the [releases][releases] as a website you can run locally.
Install raylib as a system library
You should start by installing raylib as a system library, see the official guide here.
The easiest way is via one of the supported package managers.
Add swift-raylib as a package dependency
Add the following line to your Package.swift dependencies...
.package(url: "https://github.com/Lancelotbronner/swift-raylib.git", from: "4.5.0")...along with the following line to your target dependencies and import RaylibKit!
.product(name: "RaylibKit", package: "RaylibKit"),Interop with C
If you still need to interop, you can import raylib and use the [cheatsheet][cheatsheet] for reference.
π Contributing
There is a fully configured workspace for this repository, associated examples and developer tools at swift-raylib-workspace. The goal is to reduce the clone size of swift-raylib as its used as a dependency and avoids adding too many automatically generated Xcode schemes.
[cheatsheet]: https://www.raylib.com/cheatsheet/cheatsheet.html [examples]: https://github.com/Lancelotbronner/swift-raylib-examples [releases]: https://github.com/Lancelotbronner/swift-raylib/releases
Package Metadata
Repository: lancelotbronner/swift-raylib
Default branch: main
README: README.md