raylib»Forums
Ray
61 posts / 1 project
I love videogames development.
raygui - a simple and easy-to-use IMGUI module for raylib
Edited by Ray on
Some years ago I started developing a simple IMGUI module for raylib, inspired by Unity IMGUI, it was raygui. Despite the efforts invested and getting a functional implementation, it was stopped for almost a year... my main concern was style, I didn't get a consitent style (controls states, colors...).

Lately, I started developing some tools for raylib (with raylib and raygui) and I decided to completely review raygui module and its styling system. Two default styles have been defined and library has been completely rewritten from scratch with better consistency. Old styling system has been improved and simplified, now it only requires a basic set of values to define a complete new style (specially in color theming).

Here there are two proposed default styles (light and dark) and the available controls:





Here there are some screenshots of rFXGen tool using those styles:





Despite doing several style tests, I'm not completely happy with default styles, specially with slider/sliderbar colors.

If anyone can give me some feedback it would be very appreciated. Thanks! :)
Andrew Chronister
194 posts / 2 projects
Developer, administrator, and style wrangler
raygui - a simple and easy-to-use IMGUI module for raylib
That default font is a little too thin and blocky IMO, for a default style you might want to go with a generic sans-serif (there are several free-as-in-freedom ones you can probably distribute with your lib like Open Sans) for better readability (especially at small sizes).

The colors seem pretty good, although the dark green style reminds me of old VST plugins or something, I can't quite put my finger on it...
Jeroen van Rijn
247 posts / 1 project
A big ball of Wibbly-Wobbly, Timey-Wimey _stuff_
raygui - a simple and easy-to-use IMGUI module for raylib
Nice to see that raylib's joining the imgui bandwagon :)

I really enjoy the dark theme's choice of colours as well. This looks like a really promising addition to the project.
Ray
61 posts / 1 project
I love videogames development.
raygui - a simple and easy-to-use IMGUI module for raylib
Thank you very much for your feedback! :D

About the font, I use the default font that comes embedded with raylib, that way I don't need any external resource but you're right, it's not the most legible one.

About the dark theme, I like that retro VST plugin feeling but I'm still playing with colors in both styles. In light style I don't like colors for slider and in dark style background color is confused with buttons base color...

As said, I'm using raygui to develop some simple tools. :)
Neo Ar
143 posts / 1 project
riscy.tv host
raygui - a simple and easy-to-use IMGUI module for raylib

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.