greenfork / raylib-pony

Raylib bindings for Pony

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I stopped developing this library but if you want to continue, you are welcome to.

The current state is unworkable. All the obvious reasons: garbage collection, not a single thread execution -- were ruled out. There are some problems in rendering the font for the simplest example, can be reproduced by following the instructions in the Develop section. There are two likely problems with the current implementation:

  • The commands must be run from the literal main thread which is impossible to do in Pony runtime. Many graphics toolkits assume that commands are at least run from a single thread, many assume that from the main thread which is the very first thread when the program is run.
  • There's some other subtle bug between the interaction of Pony with Raylib. Here honestly no idea what might be happening.

Current problems manifest in the following examples:

  • example_core_basic_window_no_actors -- this example runs fine because it never yields control once it starts. This may contradict the assumption that the problem is because commands need to run on the main thread.
  • example_core_basic_window_game_actor -- same version with an actor running behaviors in a loop. It runs fine except for the font rendering: rendered font has double spaces, which is very weird.
  • example_core_basic_window_timer -- same version but using Timers for looping. Font is rendered as garbage bytes.

Raylib-Pony

Raylib bindings for Pony.

Develop

  • Install Pony
  • Install corral
  • Install Zig and make it available in path, used for building the Raylib C library

Do the following to run examples:

$ git clone --recurse-submodules https://github.com/greenfork/raylib-pony.git
$ cd raylib-pony
$ corral fetch
$ make
# Press Esc to exit the window

Bindings are partially auto-generated in raylib/generated.pony and src/shims.c; and partially hand-written in raylib/api.pony. In order to generate bindings run make generate. Warning: current src/shims.c file is modified for core_basic_window example to never rely on the Pony GC for debugging purposes, it is fine that there will be a diff for this file when bindings are re-generated.

To do

  • Raylib uses column-major matrices, linal only provides row-major. The description from raylib.h: "Matrix, 4x4 components, column major, OpenGL style, right-handed".

About

Raylib bindings for Pony

License:Mozilla Public License 2.0


Languages

Language:C 65.0%Language:Pony 33.6%Language:Zig 0.9%Language:Makefile 0.5%