All Projects → Not-Nik → raylib-zig

Not-Nik / raylib-zig

Licence: MIT license
Manually tweaked, auto generated raylib bindings for zig. https://github.com/raysan5/raylib

Programming Languages

Zig
133 projects
python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to raylib-zig

simplesquirrel
Yet another simple binding in C++11 for Squirrel scripting language
Stars: ✭ 37 (-69.67%)
Mutual labels:  binding, bindings
raylib-odin
Odin bindings for the raylib gamedev library
Stars: ✭ 29 (-76.23%)
Mutual labels:  raylib, bindings
bound
Data-binding made easy
Stars: ✭ 21 (-82.79%)
Mutual labels:  binding, bindings
janetrs
Rust high level bindings for Janet
Stars: ✭ 36 (-70.49%)
Mutual labels:  binding, bindings
webview
Nim bindings for https://github.com/zserge/webview
Stars: ✭ 91 (-25.41%)
Mutual labels:  binding, bindings
raylib-nelua
Raylib wrapper to nelua language
Stars: ✭ 27 (-77.87%)
Mutual labels:  binding, raylib
nuklear4j
Java binding for nuklear
Stars: ✭ 61 (-50%)
Mutual labels:  binding, bindings
node-raylib
Node.js bindings for Raylib
Stars: ✭ 156 (+27.87%)
Mutual labels:  raylib
cl-liballegro
Common Lisp bindings and interface to the Allegro 5 game programming library
Stars: ✭ 44 (-63.93%)
Mutual labels:  bindings
x264-rs
x264 bindings
Stars: ✭ 32 (-73.77%)
Mutual labels:  bindings
skinner
Skin export / import tools for Autodesk Maya
Stars: ✭ 68 (-44.26%)
Mutual labels:  binding
OpenGL.NET
This repository contains low-level bindings for OpenGL and OpenGLES used in Evergine.
Stars: ✭ 29 (-76.23%)
Mutual labels:  bindings
kindaVim.theapp
Ultimate Vim Mode for macOS
Stars: ✭ 372 (+204.92%)
Mutual labels:  bindings
raylib-physfs
Integrate PhysFS with raylib to load images, audio, and fonts, from .zip files.
Stars: ✭ 21 (-82.79%)
Mutual labels:  raylib
kdb nim
Nim Kdb type-safe bindings
Stars: ✭ 13 (-89.34%)
Mutual labels:  bindings
webgl-raub
WebGL bindings to desktop OpenGL
Stars: ✭ 66 (-45.9%)
Mutual labels:  bindings
pkcs11
OCaml bindings for the PKCS#11 cryptographic API
Stars: ✭ 21 (-82.79%)
Mutual labels:  bindings
libandroidjni
Android JNI bindings library
Stars: ✭ 66 (-45.9%)
Mutual labels:  bindings
vsphere-automation-sdk-.net
[DEPRECATED] Please see README. C# samples, language bindings, and API reference documentation for vSphere, VMC, and NSX-T using the VMware REST API
Stars: ✭ 67 (-45.08%)
Mutual labels:  bindings
interop
Python/C/Go/Rust/Haskell interop examples
Stars: ✭ 24 (-80.33%)
Mutual labels:  bindings

logo

raylib-zig

Manually tweaked, auto generated raylib bindings for zig.

Bindings tested on raylib version 4.0.0-dev and Zig 0.9.0

Thanks to jessrud, mbcrocci, rcorre, Gertkeno and sacredbirdman for their contributions to this binding.

The binding currently only supports a subset of raylib. For more information read here.

Example

We can copy the default example with some minor changes:

const rl = @import("raylib");

pub fn main() anyerror!void {
    // Initialization
    //--------------------------------------------------------------------------------------
    const screenWidth = 800;
    const screenHeight = 450;

    rl.InitWindow(screenWidth, screenHeight, "MyWindow");

    rl.SetTargetFPS(60); // Set our game to run at 60 frames-per-second
    //--------------------------------------------------------------------------------------

    // Main game loop
    while (!rl.WindowShouldClose()) { // Detect window close button or ESC key
        // Update
        //----------------------------------------------------------------------------------
        // TODO: Update your variables here
        //----------------------------------------------------------------------------------

        // Draw
        //----------------------------------------------------------------------------------
        rl.BeginDrawing();

        rl.ClearBackground(rl.WHITE);

        rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY);

        rl.EndDrawing();
        //----------------------------------------------------------------------------------
    }

    // De-Initialization
    //--------------------------------------------------------------------------------------
    rl.CloseWindow(); // Close window and OpenGL context
    //--------------------------------------------------------------------------------------
}

Technical restrictions

Due to zig being a relatively new language it does not have full C ABI support at the moment. For use that mainly means we can't use any functions that return structs that are less than 16 bytes large.

Building the examples

To build all available examples simply zig build examples. To list available examples run zig build --help. If you want to run and examples, say basic_window run zig build basic_window

Building and using

  • (Optional) Install raylib
  • Execute projectSetup.sh project_name, this will create a folder with the name specified
  • You can copy that folder anywhere you want and edit the source
  • Run zig build run at any time to test your project

When is the binding updated?

I plan on updating it every mayor release (2.5, 3.0, etc.). Keep in mind these are technically header files, so any implementation stuff should be updatable with some hacks on your side.

What's to be done?

  • (Done) Set up a proper package build and a build script for the examples
  • Port all the examples
  • Object orientation
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].