GithubHelp home page GithubHelp logo

raysan5 / raygui Goto Github PK

View Code? Open in Web Editor NEW
3.0K 53.0 268.0 11.29 MB

A simple and easy-to-use immediate-mode gui library

License: zlib License

C 99.59% CMake 0.41%
raylib imgui buttons gui ui-design ui-library

raygui's Introduction

raygui is a simple and easy-to-use immediate-mode-gui library.

raygui was originally inspired by Unity IMGUI (immediate mode GUI API).

raygui was designed as an auxiliar module for raylib to create simple GUI interfaces using raylib graphic style (simple colors, plain rectangular shapes, wide borders...) but it can be adapted to other engines/frameworks.

raygui is intended for tools development; it has already been used to develop multiple published tools.


WARNING: Latest raygui from master branch is always aligned with latest raylib from master branch. Make sure to use the appropiate versions.

WARNING: Latest raygui 4.0 is an API-BREAKING redesign from previous versions (3.x), now all functions are more consistent and coherent, you can read the details about this breaking change in issue 283

NOTE: raygui is a single-file header-only library (despite its internal dependency on raylib), so, functions definition AND implementation reside in the same file raygui.h, when including raygui.h in a module, RAYGUI_IMPLEMENTATION must be previously defined to include the implementation part of raygui.h BUT only in one compilation unit, other modules could also include raygui.h but RAYGUI_IMPLEMENTATION must not be defined again.

features

  • Immediate-mode gui, no retained data
  • +25 controls provided (basic and advanced)
  • Powerful styling system for colors, font and metrics
  • Standalone usage mode supported (for other graphic libs)
  • Icons support, embedding a complete 1-bit icons pack
  • Multiple tools provided for raygui development

raygui controls

basic controls

Label       |  Button      |  LabelButton |  Toggle      |  ToggleGroup  |  ToggleSlider
CheckBox    | ComboBox     |  DropdownBox |  TextBox     |  ValueBox     |  Spinner
Slider      |  SliderBar   |  ProgressBar |  StatusBar   |  DummyRec     |  Grid

container/separator controls

WindowBox   |  GroupBox    |  Line        |  Panel       |  ScrollPanel  | TabBar

advanced controls

ListView    |  ColorPicker |  MessageBox  |  TextInputBox

raygui styles

raygui comes with a default style automatically loaded at runtime:

raygui default style

Some additional styles are also provided for convenience, just check styles directory for details:

raygui additional styles

Custom styles can also be created very easily using rGuiStyler tool.

Styles can be loaded at runtime using raygui GuiLoadStyle() function. Simple and easy-to-use.

raygui icons

raygui supports custom icons, by default, a predefined set of icons is provided inside raygui as an array of binary data; it contains 256 possible icons defined as 16x16 pixels each; each pixel is codified using 1-bit. The total size of the array is 2048 bytes.

To use any of those icons just prefix the #iconId# number to any text written within raygui controls:

if (GuiButton(rec, "#05#Open Image")) { /* ACTION */ }

It's also possible to use the provided GuiIconText() function to prefix it automatically, using a clearer identifier (defined in raygui.h).

if (GuiButton(rec, GuiIconText(RICON_FILE_OPEN, "Open Image"))) { /* ACTION */ }

Provided set of icons can be reviewed and customized using rGuiIcons tool.

raygui support tools

  • rGuiStyler - A simple and easy-to-use raygui styles editor.

    rGuiStyler v3.1

  • rGuiIcons - A simple and easy-to-use raygui icons editor.

    rGuiIcons v1.0

  • rGuiLayout - A simple and easy-to-use raygui layouts editor.

    rGuiLayout v2.2

building

raygui is intended to be used as a portable single-file header-only library, to be directly integrated into any C/C++ codebase but some users could require a shared/dynamic version of the library, for example, to create bindings:

  • Windows (MinGW, GCC)
copy src/raygui.h src/raygui.c
gcc -o src/raygui.dll src/raygui.c -shared -DRAYGUI_IMPLEMENTATION -DBUILD_LIBTYPE_SHARED -static-libgcc -lopengl32 -lgdi32 -lwinmm -Wl,--out-implib,src/librayguidll.a
  • Windows (MSVC)
copy src\raygui.h src\raygui.c
cl /O2 /I../raylib/src/ /D_USRDLL /D_WINDLL /DRAYGUI_IMPLEMENTATION /DBUILD_LIBTYPE_SHARED src/raygui.c /LD /Feraygui.dll /link /LIBPATH ../raylib/build/raylib/Release/raylib.lib /subsystem:windows /machine:x64
  • Linux (GCC)
mv src/raygui.h src/raygui.c
gcc -o raygui.so src/raygui.c -shared -fpic -DRAYGUI_IMPLEMENTATION -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
  • Mac (clang, homebrew installed raylib)
cp src/raygui.h src/raygui.c
brew install raylib
gcc -o raygui.dynlib src/raygui.c -shared -fpic -DRAYGUI_IMPLEMENTATION -framework OpenGL -lm -lpthread -ldl $(pkg-config --libs --cflags raylib)

license

raygui is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check LICENSE for further details.

raygui's People

Contributors

andidy avatar anidealgift avatar chrisdill avatar dajobat avatar demizdor avatar elkantor avatar emoney17 avatar furudbat avatar gulrak avatar hanaxar avatar jdeokkim avatar jeffm2501 avatar julianiolo avatar kamisori avatar lievenpetersen avatar lokeb avatar manuel5975p avatar prop65 avatar radsammyt avatar rainb0wskeppy avatar raysan5 avatar rgfthecoder avatar ricmatsui avatar robloach avatar simonwashere avatar smallcluster avatar ssoher avatar sylvainstak avatar vortetty avatar wirgiliusz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raygui's Issues

undefined reference to `DrawRectangleT'

Having issues compiling rGuiStyler on linux as there is a missing reference to DrawRectangleT using the latest stable version of raylib (1.7.0)

INFO: Initializing raylib (v1.7.0)

/tmp/ccLbFxB1.o: In function `DrawRectangleRecT':
rguistyler.c:(.text+0x3a): undefined reference to `DrawRectangleT'

Looking at the source i see the following implementation of:
static void DrawRectangleRecT(Rectangle rec, Color color) { DrawRectangleT(rec.x, rec.y, rec.width, rec.height, color); }

But there is no implementation of DrawRectangleT anywhere in raygui or raylib.
Am i doing somthing wrong or is raygui experimental?

PS: compilation options
gcc -o test rguistyler.c external/tinyfiledialogs.c -lraylib -lglfw3 -lX11 -lXxf86vm -lXrandr -ldl -lXinerama -lXcursor -lGL -lGLU -lpthread -lm -std=c99 -Wall

Sincerly Axel Sanner

font.recs

When i'm tried to compile i received error
The issued in this project is "font.recs" has no member named

Compiling examples on ubuntu 16.04

While trying to compile examples for ubuntu 16.04 on raygui efe2a42 and raylib f4ca5b3 (today) with raylib statically compiled I get the following:

demo@demo:~/raygui/examples/custom_file_dialog$ gcc custom_file_dialog.c -lraylib -lopengl32 -lgdi32 -std=c99 -I../../src  -I.
In file included from custom_file_dialog.c:27:0:
gui_file_dialog.h: In function ‘GuiFileDialog’:
gui_file_dialog.h:246:56: error: ‘ELEMENTS_HEIGHT’ undeclared (first use in this function); did you mean ‘MAP_HEIGHT’?
         int prevElementsHeight = GuiGetStyle(LISTVIEW, ELEMENTS_HEIGHT);
                                                        ^~~~~~~~~~~~~~~
                                                        MAP_HEIGHT
gui_file_dialog.h:246:56: note: each undeclared identifier is reported only once for each function it appears in
gui_file_dialog.h:251:121: warning: passing argument 2 of ‘GuiListViewEx’ from incompatible pointer type [-Wincompatible-pointer-types]
         state->filesListActive = GuiListViewEx((Rectangle){ state->position.x + 10, state->position.y + 70, 460, 164 }, dirFilesIcon, state->dirFilesCount, NULL, &state->filesListScrollIndex, state->filesListActive);
                                                                                                                         ^~~~~~~~~~~~
In file included from custom_file_dialog.c:22:0:
../../src/raygui.h:2366:5: note: expected ‘const char **’ but argument is of type ‘char **’
 int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active)
     ^~~~~~~~~~~~~
custom_file_dialog.c: In function ‘main’:
custom_file_dialog.c:90:71: error: ‘RICON_FILE_OPEN’ undeclared (first use in this function); did you mean ‘_IO_FILE_plus’?
             if (GuiButton((Rectangle){ 20, 20, 140, 30 }, GuiIconText(RICON_FILE_OPEN, "Open Image"))) fileDialogState.fileDialogActive = true;
                                                                       ^~~~~~~~~~~~~~~
                                                                       _IO_FILE_plus

C++ Header Design

Posting here for clarification, and for anyone else that is trying to overcome this hurdle.

I have a C++ application where the GUI window is launched in main() and then manipulated via other C++ objects via raygui.

Originally, I was getting duplicate definition errors due to the way I was including raygui in all of my code, as seen below:

extern "C" {
#include "raylib.h"

#define RAYGUI_IMPLEMENTATION
#include "raygui.h"
}

The "correct" implementation for this should be to use the above within main(), and then use the following everywhere else:

extern "C" {
#include "raylib.h"

#define RAYGUI_STATIC
#include "raygui.h"
}

Is this "correct" ?

Problem with GuiFont

Problem with Guifont to load my personal font:

Example :

Use GuiFont before all GuiSetStyle :

GuiFont(fonte);

GuiSetStyle(DEFAULT,LINE_COLOR,RGBA(GRAY900)); // DEFAULT_BORDER_COLOR_NORMAL
GuiSetStyle(DEFAULT,BASE_COLOR_NORMAL,RGBA(GRAY800)); // DEFAULT_BASE_COLOR_NORMAL
GuiSetStyle(DEFAULT,TEXT_COLOR_NORMAL,RGBA(GRAY100)); // DEFAULT_TEXT_COLOR_NORMAL

GuiSetStyle(DEFAULT,BORDER_COLOR_FOCUSED,0x5f9aa8ff); // DEFAULT_BORDER_COLOR_FOCUSED
GuiSetStyle(DEFAULT,BASE_COLOR_FOCUSED,0x334e57ff); // DEFAULT_BASE_COLOR_FOCUSED
GuiSetStyle(DEFAULT,TEXT_COLOR_FOCUSED,0x6aa9b8ff); // DEFAULT_TEXT_COLOR_FOCUSED

I get this Before

Use GuiFont after all GuiSetStyle :

GuiSetStyle(DEFAULT,LINE_COLOR,RGBA(GRAY900)); // DEFAULT_BORDER_COLOR_NORMAL
GuiSetStyle(DEFAULT,BASE_COLOR_NORMAL,RGBA(GRAY800)); // DEFAULT_BASE_COLOR_NORMAL
GuiSetStyle(DEFAULT,TEXT_COLOR_NORMAL,RGBA(GRAY100)); // DEFAULT_TEXT_COLOR_NORMAL

GuiSetStyle(DEFAULT,BORDER_COLOR_FOCUSED,0x5f9aa8ff); // DEFAULT_BORDER_COLOR_FOCUSED
GuiSetStyle(DEFAULT,BASE_COLOR_FOCUSED,0x334e57ff); // DEFAULT_BASE_COLOR_FOCUSED
GuiSetStyle(DEFAULT,TEXT_COLOR_FOCUSED,0x6aa9b8ff); // DEFAULT_TEXT_COLOR_FOCUSED

GuiFont(fonte);

I get this After

I think that something reset the font by his font default.

raygui unusable for C++ projects

Hi,

I'm attempting to use raygui with my raylib project, but after generating the project files for VS2019 or Make on OSX, a ton of errors are generated when trying to compile the raygui header.

It looks like there's an issue related to both casting and just the general C vs C++ syntax.

(copied from Visual Studio)
Error C2065 'RICONS_SIZE': undeclared identifier raylib-proj C:\raylib-proj\include\libs\raygui.h 681 Error C2065 'RICONS_SIZE': undeclared identifier raylib-proj C:\raylib-proj\include\libs\raygui.h 717 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 717 Error C3861 'DrawIcon': identifier not found raylib-proj C:\raylib-proj\include\libs\raygui.h 717 Error C2065 'RICONS_SIZE': undeclared identifier raylib-proj C:\raylib-proj\include\libs\raygui.h 721 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 865 Error C2065 'RICON_CROSS_SMALL': undeclared identifier raylib-proj C:\raylib-proj\include\libs\raygui.h 883 Error C2660 'GuiButton': function does not take 1 arguments raylib-proj C:\raylib-proj\include\libs\raygui.h 883 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 909 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 979 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 980 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1156 Error C2397 conversion from 'int' to 'float' requires a narrowing conversion raylib-proj C:\raylib-proj\include\libs\raygui.h 1156 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1187 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1287 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1440 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1444 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1448 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1453 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1460 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1466 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1481 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1488 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1489 Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax raylib-proj C:\raylib-proj\include\libs\raygui.h 1490

Constraint based layout

I don't think raygui has one ?

Facebook as a full CSS flexbox one we could use.

Am thinking if trying to integrate but want to check others thoughts in the usefulness

GuiTextBoxMulti() breaks lines

GuiTextBoxMulti() adds line breaks to input text when it is wider than text box. That's not the right behavior, it shouldn't modify the input text string, just break the lines on drawing.

RayGui doesnt render when BeginMode2D/EndMode2D happens after it

I noticed this when i started using a camera used for rendering textures, where the gui was rendering before everything. Dont really know why this happens, since normal raylib draw calls still work before BeginMode2D

grafik

#include "raylib.h"
#define RAYGUI_IMPLEMENTATION
#include "raygui.h"

int main(void)
{
    const int screenWidth = 800;
    const int screenHeight = 450;

    InitWindow(screenWidth, screenHeight, "raygui");

    SetTargetFPS(60);

	Camera2D camera;
	camera.target = (Vector2) { 0, 0 };
	camera.offset = (Vector2) { 0, 0 };
	camera.zoom = 1.0f;

    while (!WindowShouldClose())
    {
        BeginDrawing();

	    if (GuiButton((Rectangle) { 0, 0, 100, 50 }, "Does not Render")) {
		  printf("still receiving message \n");	
	    }

	    BeginMode2D(camera);
            GuiButton((Rectangle) { 100, 0, 100, 50 }, "Does Render");
            ClearBackground(RAYWHITE);
	    EndMode2D();

         EndDrawing();
    }

    CloseWindow(); 

    return 0;
}

Decouple controls styling from control function

Some controls include styling elements in the control function, those styling parameters should be removed or an additional GuiControlS() function provided for those cases.

Affected controls:

void GuiLine(Rectangle bounds, int thick);
void GuiLabelEx(Rectangle bounds, const char *text, int alignment, int padding);
int GuiToggleGroupEx(Rectangle bounds, const char *text, int active, int padding, int columns);
bool GuiSpinner(Rectangle bounds, int *value, int minValue, int maxValue, int btnWidth, bool editMode);
void GuiStatusBar(Rectangle bounds, const char *text, int offsetX);
Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs);

Need to think carefully about this.

Font error in RGS File

I'm trying to use Jungle RGS Style , and have an error for the font

WARNING: [(null)/"Pixel.otf"] TTF file could not be opened

the problem is the (null)

Debug Raygui.zip

Ctrl + Z does not destroy a newly created control

After creating a new control, pressing Ctrl + Z won't destroy it, but will place it where the last deleted control was.

How to reproduce:
-Open rGuiLayout
-Create a new control (probably any type will do) at any point
-Delete the control (get close with the mouse - it turns red - then press delete)
-Create a new control (probably any type will do) at any different point from the previous one
-Press Ctrl+Z
-Notice the secondly created control has now moved the position where the first control was

GuiListView() text flickering

It seems TextSplit() function does not work properly and causes some text flickering on GuiListView(), that function should be reviewed in raylib...

Default font seems too small

So the default fonts for the tools (rTextPacker, rGuiIcons, rFX, etc.) are too small to see on windows 10 and on linux.

RAYGUI_STANDALONE doesn't seem to actually work?

I was attracted to raygui because it seemed like it would be easier to integrate with my engine than some other imgui implementations, since I could provide the drawing functions myself.

I started off with a simple stub looking like this. (All the seemingly pointless indirections are necessary because the engine isn't written in c.)

However, even that fails to compile, with these errors.

raygui input separate from display

Hello!

So basically, if you use a RenderTexture2D to scale the screen, the controls for raygui remain where they originally were (i.e. rendering the screen x4 larger doesn't make a button's clickable surface 4 times larger).

This is to be expected, but it still might be a good idea to add a function to raygui to scale the positions for the mouse cursor according to scalable values to allow you to resize the screen / GUI elements while still maintaining ability to interact with the raygui elements.

[tool] rGuiLayout: crash due to path length too short

in rguilayout.c line 1767 in ShowSaveLayoutDialog, outFileName is length 64, this causes a crash when saving to path longer than that. Suggest using MAX_PATH or something like that. Also similar issue in ShowExportLayoutDialog

error: unable to find library -lraylib

Hi,

I am trying to compile raygui/examples using gmake all and I am getting the linker error:

/usr/bin/ld: error: unable to find library -lraylib
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What should I do to fix this?

FreeBSD 12.0 64-bit

Provide additional controls

Right now raygui implements following controls:

  • Label
  • Button
  • ImageButton
  • ToggleButton
  • ToggleGroup
  • CheckBox
  • ComboBox
  • GroupBox
  • TextBox
  • Slider
  • SliderBar
  • ProgressBar
  • Spinner
  • ColorPicker (requires some review)

Here it is a possible list of additional controls:

  • LabelButton
  • ListView
  • TreeView
  • ImageBox
  • ScrollPanel
  • Dialog
  • MessageDialog
  • DatePicker

What do you think?

field not found: recs

I have raylib working great. Its awesome!
Want to start using raygui also.
seems the raygui-master folder should be dropped in the raylib folder.. (correct me if im wrong)

when trying to compile an example i get this error.
Thank you

In file included from gui_text_box.c:29:
../../src/raygui.h:1564: error: field not found: recs

How to build?

There appears to be no build system here unlike raylib which I've already compiled into a SHARED library on my Raspberry Pi 3B.

How does one build this library or even just one of the provided examples?

I've tried a very basic gcc -I/home/pi/raylib/src controls_review.c (so it can find raylib.h) and just get a ton of errors. What else do I need to -Define?

GuiTextBoxMulti() missing features

GuiTextBoxMulti() has some missing features that should be added:

  • Cursor movement along text
  • Text selection
  • Text copy & paste

Some of this new functionality has already been added to raylib with DrawTextRec(), maybe current implementation of GuiTextBoxMulti() could be replaced by the new implementation.

Review standalone usage mechanism

Right now raygui is quite tied to raylib, using a specific set of raylib functions.

Despite being possible to hook other library functions to raygui, I feel current mechanism is not easy enough... or at least, has not been properly tested. It should be reviewed.

raygui required functions include:

  • Keyboard and Mouse inputs
  • Basic shapes drawing (lines, rectangles)
  • Textures and text drawing

The idea is to expose and minimize external required hooks to cover the basic raygui needs.

I'm unable to make it work in a C++ project

Hi!

I'm having some trouble with raygui in a cpp project. I'm using the Microsoft Visual Studio Compiler and it complains about a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
In all lines containing object initializations like:
return GuiImageButtonEx(bounds, texture, (Rectangle){ 0, 0, texture.width, texture.height }, NULL);
Am I doing this right?
I tried to run the example code you provide and it runs, as they are ".c" files. But my project is in C++.

Thank you very much :)

Layout System?

Seria bueno agregar un sistema de layout para ahorrar trabajo de calculo.

Estoy trabajando en un proyecto y creo que es incomodo hacer esto manual y creo que con un layout system se podría mejorar mucho.

Esto lo escribí para ahorrar un poco...

void gui_main_toolbar()
{
    int screenWidth = GetScreenWidth();
    Rectangle toolbar_bounds = {0,0, screenWidth, 50};

    GuiPanel(toolbar_bounds);
    gui_layout_row_begin(&toolbar_bounds);
    {
        gui_layout_row_static(80, 30);
        gui_layout_row_offset(5, 10);
        if(gui_button("New")){}
        if(gui_button("Save")){}
        
        gui_space_horizontal();

        if(gui_button("Tile")){}
        if(gui_button("Actor")){}
        if(gui_button("Animate2d")){}
        if(gui_button("Camera")){}
    }
    gui_layout_row_end();
}

Captura de pantalla (34)

Raygui.dll

Can you add the raygui.dll to the releases the way raylib has its dlls in the same section? It would help me use the raylib bindings without having to compile the dlls from the source.

Styling property: INNER_PADDING, really needed?

I've been reviewing several controls and I got some doubts about the usefulness and general implementation of INNER_PADDING property.

This property is used in different ways depending the control, in some controls it's just used as a kind-of text padding, maybe it should be renamed to TEXT_PADDING or just removed from the global properties list.

Usage in the different controls:

  • GuiSlider*(), GuiProgressBar() > Used as top-botton padding for the controls slider/bars. Additional text padding is required.
  • GuiStatusBar()> Used for the text left padding.
  • GuiCheckBox()> Used for text left-right padding to control.
  • GuiTextBoxMulti() > Used as top-left text padding. Note this control does not support a different text alignment than top-left.
  • Other controls > Used on GetTextBounds(), considered on text bounds calculation, usually top-bottom padding does not have much sense...

This property should be reviewed or maybe renamed but using it in different ways could be confusing for the users.

Implement control: GuiTextBoxMulti()

Multiline text box is a requirement for most GUI systems.

Some work has already been done on implementing GuiTextBoxMulti() but it's nor fully functional yet.

Similar to GuiTextBox() proposed implementation would be:

bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode);

Compiler Warnings

Hello,
I've started using raygui and noticed some immediate compile warnings.

In my projects I compile with cmake and set:
set( CMAKE_CXX_FLAGS " -g -Wall -Wextra -fPIC -std=c++17 " )

This will produce quite a few warnings which I think can be fixed pretty easily.

Should this be addressed?

Thanks :)

GuiTextBox() extended should be reviewed

raygui allows defining RAYGUI_TEXTBOX_EXTENDED for an advance GuiTextBox() implementation. Actually, that implementation is a quite complete text editor with cut-copy-paste and advance features. It also implies a bunch of additional usage functions.

I'm considering moving this control to an independent portable module gui_texbox_edit.h, similar to other windows/layouts I use on my tools development. That way, users could choose to add this advance control jut including:

#define GUI_TEXTBOX_EDITOR_IMPLEMENTATION
#include "gui_textbox_editor.h"

Recap on the latest raygui changes

In the past weeks raylib has changed a lot, just open this issue to recap all library changes and open possible discussion points on library improvements.

  • Support rIcons, a custom set of simple pixelart icons: Now all text placed in any raygui control can be prefixed with a custom icon just defining its id number (#027#). This improves a lot raylib visuals for tools development.
  • Support text alignment for every control: Now text alignment for the control can be defined as a new style property TEXT_ALIGNMENT. Text alignment also considers rIcons.
  • Greatly simplified controls drawing code: Most of the drawing code for every control state was the same, the only change was control color, so, drawing has been simplified by directly choosing drawing color in function of state. More than 400 code lines have been removed.
  • Some controls have been redesigned to avoid styling parameters passed directly to the function (#22).
  • Added GuiScrollBar() and implemented it in GuiScrollPanel() and GuiListView(). Thanks to @Demizdor for his work on this improvement.

During this big changes process, some issues have been detected and some questions arise:

  1. GuiImageButton(), do we really need this function? It could seem to be useful but it adds additional dependencies to textures drawing... actually, I never used it. Now with the rIcons addition maybe it could be removed.
    SOL: Keep it for the moment.

  2. GuiCheckBox(), how text alignment support should be applied to this specific control? Now text is just drawn after the control.
    SOL: Use text alignment to place text to left or right of the control.

  3. GuiSlider(), GuiSliderBar(), GuiProgressBar(), On this controls, text is not part of the control bounds, it's just appended before or after the control; how text alignment should work? Also, what about the infamous showValue parameter? I don't like it, it neither gives margin for value formating... Those functions could require some redesign.
    SOL: Functions redesignedm showValue removed, added two text parameter to functions for custom left and right control text.

  4. GuiTextBox(), GuiTextBoxMulti(), those ones need some improvements, as stated in issue #24. Probably they can use directly the new text-rectangle-drawing functionality available on raylib.
    SOL: GuiTextBoxMulti() now uses DrawTextRec().

  5. GuiValueBox(), GuiSpinner(), maybe those functions could use directly GuiTextBox() or some base function common to all text-drawing-in-rectangle functions.
    SOL: They already use GuiTextBox().

  6. GuiListViewEx(), it depends on GuiListElement() and it's ugly... maybe it should be redesigned... Seem quite difficult to accomodate all control possibilities.
    SOL: GuiListElement() has been removed, GuiListViewEx() and GuiComboBox() have been redesigned from scratch.

Those are just some points, I'll update this list as required...

Also, if someone is working/testing/playing with raygui, feedback is very welcomed.

Implement control: GuiFileDialog()

It would be very useful to implement an advance control for file picking (open/save dialog). It could require a lot of work and dealing with OS system calls to read directory contents and info.

Proposed signatures could be:

const char *GuiFileDialog(const char *title, const char *currentPath);

Note that this control could be further customized for Open/Save file modes.

Immediate implementation is not required but just listing it here for future reference.

GuiTextBox bug report

Hi,

On line 2710 when you insert a character into the GuiTextBox string you should also add a null terminator:

text[keyCount] = (char)key;
keyCount++;
text[keyCount] = '\0'; (this line is currently missing in the code)

Otherwise it works fine only if the unused parts of the string buffer are zero.

Thanks for writing this great library.

thanks,

Simon

Implement control: GuiScrollPanel()

It would be very useful to have a panel with scrolling that sizes with its contents and offers scroll bars. This is the proposed implementation:

// Scroll Panel control
Vector2 GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 viewScroll);

Rectangle bounds define the visible area
Rectangle content defines size of internal data and will condition scrolling
Vector2 viewScroll defines the content offset, new offset should be returned in case of scrolling

Note that content.x and content.y could be useless... or just use them as scroll offset.

Check GuiListView() for a temptative implementation of GuiScrollPanel().

Add vendor prefixes: rGuiName

Hello,

First of all, very nice project, and what is the most important (for me), is a beautiful gfx style. :D

However, I have a suggestion. Would it be hard to add a vendor prefix to each public method of the library? That could prevent some name collisions which are theoretically possible right now. Especially for occasions where whole user's project codebase uses "unity builds" approach.

That is a major breaking change in API though. So what do you think about it?
Thank you!

ricons delimiter

The right way to put ricon is

"#120#

if you put #120 it works if it is the last draw.

Ricon doesnt take the last delimiter correctly.

you can put #120 or #120a to show the icon.
or put #120#123 or #120a123 to show the icon + 123 after.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.