raylib-go icon indicating copy to clipboard operation
raylib-go copied to clipboard

Raygui C bindings and example

Open ianling opened this issue 3 years ago • 2 comments

Converting the Go Raygui implementation into a normal C binding so we can get updates and bugfixes from the official raygui.h upstream.

ianling avatar Jun 26 '22 02:06 ianling

Thanks, looks like a nice start. Though raygui is an external project, not part of raylib, it should really be a separate package and not included like this. Similar to how raylib for renamed to just rl, the raygui package should be named rg, I believe that is the shortcut that is used in some places, so e.g. GuiLoadStyle is renamed to rg.LoadStyle.

That, of course, means that some code must be duplicated because raygui needs to link raylib library, and it is not possible to just include raylib-go/raylib and be done (I believe there is an open Go issue about this). So cgo files should include paths like CFLAGS: -I../raylib, C files can be included in the build like this, for example:

rcore.go:

package rg

/*
#include "../raylib/rcore.c"
*/
import "C"

That is why at the start rewriting the raygui.h in Go seemed like a nice idea until it was rewritten (raygui). It is again a nice idea but nobody is willing to rewrite it again, at least I am not.

gen2brain avatar Jun 27 '22 14:06 gen2brain

That is exactly the kind of feedback I was hoping for by posting this early, thanks for taking a look!

ianling avatar Jun 27 '22 20:06 ianling

Hello, In my point of view, after #221 may be closed

Konstantin8105 avatar Nov 26 '22 17:11 Konstantin8105