raygui/README.md

111 lines
4.4 KiB
Markdown
Raw Normal View History

2018-02-12 12:20:15 +01:00
<img align="left" src="logo/raygui_256x256.png" width=256>
2017-07-02 13:37:07 +02:00
2021-10-05 12:47:54 +02:00
**raygui is a simple and easy-to-use immediate-mode-gui library.**
2016-09-07 18:25:06 +02:00
2021-10-05 12:47:54 +02:00
`raygui` was initially inspired by [Unity IMGUI](https://docs.unity3d.com/Manual/GUIScriptingGuide.html) (immediate mode GUI API).
2016-09-07 18:25:06 +02:00
2021-10-05 12:47:54 +02:00
`raygui` was originated as an auxiliar module for [raylib](https://github.com/raysan5/raylib) to create simple GUI interfaces using raylib graphic style (simple colors, plain rectangular shapes, wide borders...).
2017-06-21 01:19:38 +02:00
2022-03-29 18:00:36 +02:00
`raygui` is intended for **tools development**; it has already been used to develop [multiple published tools](https://raylibtech.itch.io).
2017-08-06 10:58:09 +02:00
2018-07-21 13:47:07 +02:00
<br>
2021-10-05 12:47:54 +02:00
## features
2017-06-21 01:19:38 +02:00
2022-02-05 19:08:08 +01:00
- **Immediate-mode gui, no retained data**
- **+25** controls provided (basic and advanced)
2021-10-07 16:12:17 +02:00
- Powerful **styling system** for colors, font and metrics
2021-10-05 12:47:54 +02:00
- Standalone usage mode supported (for other graphic libs)
2021-10-07 16:12:17 +02:00
- **Icons support**, embedding a complete 1-bit icons pack
- Multiple **tools** provided for raygui development
2021-10-05 12:47:54 +02:00
## raygui controls
### basic controls
2019-08-28 12:23:49 +02:00
```
2021-10-12 15:58:46 +02:00
Label | Button | LabelButton | Toggle | ToggleGroup | CheckBox
2022-01-05 21:56:29 +01:00
ComboBox | DropdownBox | TextBox | TextBoxMulti | ValueBox | Spinner
Slider | SliderBar | ProgressBar | StatusBar | DummyRec | Grid
2019-08-28 12:23:49 +02:00
```
2022-01-05 21:56:29 +01:00
### container/separator controls
2019-08-28 12:23:49 +02:00
```
2022-01-05 21:56:29 +01:00
WindowBox | GroupBox | Line | Panel | ScrollPanel
2019-08-28 12:23:49 +02:00
```
2022-03-11 10:40:04 +02:00
### advanced controls
2021-10-05 12:47:54 +02:00
```
2022-01-05 21:56:29 +01:00
ListView | ColorPicker | MessageBox | TextInputBox
2021-10-05 12:47:54 +02:00
```
2018-05-02 21:09:18 +02:00
2022-01-05 21:56:29 +01:00
2019-08-28 11:54:36 +02:00
## raygui styles
2021-10-05 12:47:54 +02:00
`raygui` comes with a [default](styles/default) style automatically loaded at runtime:
2019-08-28 11:54:36 +02:00
![raygui default style](styles/default/style_table.png)
Some additional styles are also provided for convenience, just check [styles directory](styles) for details:
![raygui additional styles](images/raygui_style_table_multi.png)
2021-07-28 12:55:58 +02:00
Custom styles can also be created very easily using [rGuiStyler](https://raylibtech.itch.io/rguistyler) tool.
2019-08-28 11:54:36 +02:00
Styles can be loaded at runtime using raygui `GuiLoadStyle()` function. Simple and easy-to-use.
2019-08-28 12:26:35 +02:00
2020-02-10 16:58:44 +01:00
## raygui icons
2019-08-28 11:54:36 +02:00
2021-10-12 15:13:41 +02:00
`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`.
2019-08-28 11:54:36 +02:00
<img align="right" src="images/raygui_ricons.png">
2021-10-12 15:13:41 +02:00
To use any of those icons just prefix the *#iconId#* number to **any text** written within `raygui` controls:
2019-08-28 11:54:36 +02:00
```c
if (GuiButton(rec, "#05#Open Image")) { /* ACTION */ }
2019-08-28 11:54:36 +02:00
```
2021-10-12 15:13:41 +02:00
It's also possible to use the provided `GuiIconText()` function to prefix it automatically, using a clearer identifier (defined in `raygui.h`).
2019-08-28 11:54:36 +02:00
```c
if (GuiButton(rec, GuiIconText(RICON_FILE_OPEN, "Open Image"))) { /* ACTION */ }
```
2021-10-05 16:00:25 +02:00
Provided set of icons can be reviewed and customized using [rGuiIcons](https://raylibtech.itch.io/rguiicons) tool.
2016-09-07 18:25:06 +02:00
2021-10-05 12:47:54 +02:00
## raygui support tools
2021-10-05 13:45:17 +02:00
- [**rGuiStyler**](https://raylibtech.itch.io/rguistyler) - A simple and easy-to-use raygui styles editor.
2021-10-05 12:47:54 +02:00
2021-10-05 13:45:17 +02:00
![rGuiStyler v3.1](images/rguistyler_v300.png)
2021-10-05 12:47:54 +02:00
2021-10-05 13:45:17 +02:00
- [**rGuiIcons**](https://raylibtech.itch.io/rguiicons) - A simple and easy-to-use raygui icons editor.
2021-10-05 12:47:54 +02:00
2021-10-05 13:45:17 +02:00
![rGuiIcons v1.0](images/rguiicons_v100.png)
2021-10-05 12:47:54 +02:00
2021-10-05 13:45:17 +02:00
- [**rGuiLayout**](https://raylibtech.itch.io/rguilayout) - A simple and easy-to-use raygui layouts editor.
2021-10-05 12:47:54 +02:00
2021-10-05 13:45:17 +02:00
![rGuiLayout v2.2](images/rguilayout_v220.png)
2021-10-05 12:47:54 +02:00
2021-10-05 13:45:17 +02:00
## building
2021-10-05 12:47:54 +02:00
2021-10-12 15:13:41 +02:00
`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:
2021-10-05 12:47:54 +02:00
2021-10-05 13:45:17 +02:00
- **Windows (MinGW, GCC)**
```
copy src/raygui.h src/raygui.c
2021-10-05 13:45:17 +02:00
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
```
2021-10-05 13:45:17 +02:00
- **Linux (GCC)**
```
2021-10-05 13:45:17 +02:00
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
```
2022-03-19 02:58:05 -07:00
- **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)
```
2021-10-05 12:47:54 +02:00
## license
2016-09-07 18:25:06 +02:00
2020-02-28 10:19:21 +01:00
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](LICENSE) for further details.