Skip to content

Lancelotbronner/swift-raylib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swift bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.

NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.

~raysan5

Ready to learn? Jump to code examples!

Chat on Discord Chat on Reddit


RaylibKit

A swifty interface and app lifecycle to ease development with raylib!

Features

  • Use a swifty interface!
  • Support for @main lifecycle
  • Decent examples collection with +23 code 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 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 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published