Raylib language bindings

The thread below was about raylib, but it was really meant to be questions about Clang vs CBindingGen with raylib as the concrete example.

I thought it might be useful to start a raylib binding specific thread, that would be this thread.

This library for raylib currently exists:

https://github.com/olynch/Raylib.jl

However it appears to have been created as a proof of concept and has not been touched since it was dropped into github about 4 months ago.

I noticed is that, for example, it does not contain the code to create the bindings which seems important.

Also, much to my surprise, there already exists a Raylib_jll, but i have no idea how it was created, or ended up in the set of package available for Julia ! lol

Just for my own education i managed to generate a raylib library, and created some (very) simple example code. it was really easy, the C code for raylib is really clean, so it seems like a really nice library to provide useful low level 3D graphics drawing capability (which is, of course, what i’m lookin for).

Just trying to find one or two people who might be interested in pushing this forward. I have time available and an interest in working on it, but I’m not really sure what should happen to make this a useful library.

I was hoping to find someone who could help figure out what sort of things should be prioritized in terms of making it useful.

And there is the added complication that if olynch cannot spend time to process PRs, then another github project would probably need to be started (I think).

Looking for advice and comments.

Thank you !

1 Like

About the Raylib_jll package, it is a jll package, those are generated using GitHub - JuliaPackaging/BinaryBuilder.jl: Binary Dependency Builder for Julia . They are used to distribute the binaries of libraries build in other languages like C, Fortran or Rust. There is also GitHub - JuliaPackaging/Yggdrasil: Collection of builder repositories for BinaryBuilder.jl which is a repository that hosts build scripts for a bunch of libraries including raylib, which is where Raylib_jll comes from and is probably the best way to distribute the library.

1 Like

I would love to help out and might actually contribute, but for the next few months at least I have too many things on my list that have a much higher priority.

Creating(Generating) Julia bindings for raylib is easy. The hard part is to design a set of high-level Julian wrappers.

Well, i thought that might be the case, which is why i was hoping to have someone provide some guidance.

certainly i can look at other libraries which are available for examples of how to go about this, but it’s certainly to handy to have someone who already has a good idea how that should work to help out.

here’s a simple example

void DrawLineV(Vector2 startPos, Vector2 endPos, Color color);
// Vector2, 2 components
typedef struct Vector2 {
    float x;                // Vector x component
    float y;                // Vector y component
} Vector2;

what i would think is that what i really want is (we’ll ignore color for now)

DrawLineV(startpos::Array{Float32,1}, endPos::Array{Float32,1}, Color color)

The key of course, is that there is no marshalling from Array{Float32,1} to Vector2. There is, of course, the added complication of not handing over a vector of length != 2. So maybe having a dedicated struct, but defined in Julia, does make sense, e.g.

struct Vector2
  x::Float32
  y::Float32
end

And of course, same idea applies, we would want to avoid Julia to C conversions.

Is this an example of what you are talking about ?

For those finding this thread, there is a usable Raylib package on Github: Raylib.jl

There doesn’t seem to be a lot of activity but at least it seems to work.