I don't see a thread for rGuiLayout but I just want to note that the example layouts are not included in the Linux releases - I was confused for a while before I found 'em in the Windows release. Would be nice if they were included in the Linux releases as well.
rGuiLayout generates ScrollPanel code like:
Vector2 ScrollPanel010ScrollOffset = { 0, 0 };
Vector2 ScrollPanel010BoundsOffset = { 0, 0 };
ScrollPanel010ScrollOffset = GuiScrollPanel((Rectangle){ 390, 220, 375 - ScrollPanel010BoundsOffset.x, 570 - ScrollPanel010BoundsOffset.y }, (Rectangle){ 390, 220, 375, 570 }, ScrollPanel010ScrollOffset);
but GuiScrollPanel returns Rectangle. Is this just broken, or is it an intended implicit cast in C? In D it is a compilation error.
Using raylib-d bindings, raygui needs to be built as a shared library - here is a minimal example:
#!/usr/bin/env dub
/+ dub.sdl:
name "example"
dependency "raylib-d" version="~>3.1.0"
libs "raylib" "raygui"
+/
/* @NOTE: On Linux you can chmod +x this file and run it.
You'll need dmd, dub, libphobos, raylib, and raygui (see below) */
/* @NOTE: You'll need raygui v2.6 built as a shared library:
$ git clone -b 2.6 https://github.com/raysan5/raygui.git
$ cd raygui
$ mv src/raygui.h src/raygui.c
$ gcc -shared -fpic -DRAYGUI_SUPPORT_RICONS -DRAYGUI_IMPLEMENTATION \
-lraylib -lGL -lm -lpthread -ldl -lrt -lX11 \
src/raygui.c -o libraygui.so
# mv libraygui.so /usr/local/lib/ */
/* @NOTE: ... and make sure /usr/local/lib is either in $LD_LIBRARY_PATH
or /etc/ld.so.conf */
/* @NOTE: It'd be nice if distro maintainers would package raygui (hint hint) */
void main()
{
InitWindow(800, 600, "Hello, Raylib-D!");
while (!WindowShouldClose())
{
BeginDrawing(); scope(exit) EndDrawing();
ClearBackground(Colors.RAYWHITE);
GuiButton(Rectangle(400-8,300-8,16,16), GuiIconText(RICON_PLAYER_JUMP, ""));
}
}
extern (C) @nogc nothrow //missing bindings
{
enum RICON_PLAYER_JUMP = 150;
}
import raylib, raygui;
I'd be willing to write an initial PKGBUILD for an Arch Linux AUR package of raygui but I'm not interested in maintaining it.