mirror of
https://github.com/raysan5/raygui.git
synced 2026-08-25 05:38:27 -04:00
Compare commits
14 Commits
88a6fb7515
...
5.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 020a61bebc | |||
| 13896112c9 | |||
| 94758e173f | |||
| d2caa22edd | |||
| fb43fd8299 | |||
| 090728006d | |||
| fa380d83e8 | |||
| 13d85f1023 | |||
| e95df4778d | |||
| 37b864af90 | |||
| 0e1bc2b2ad | |||
| 00f68c3248 | |||
| 437adee05d | |||
| 14cb4c4c05 |
23
README.md
23
README.md
@ -10,9 +10,9 @@
|
||||
|
||||
<br>
|
||||
|
||||
**WARNING: Latest `raygui` from master branch is always aligned with latest `raylib` from master branch. Make sure to use the appropriate versions.**
|
||||
**WARNING: Latest `raygui` from master branch is always aligned with latest `raylib` from master branch and all raylibtech tools. Make sure to use the appropriate 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](https://github.com/raysan5/raygui/issues/283)**
|
||||
**WARNING: Latest `raygui 5.0` introduces some API-BREAKING changes, now all functions return a result value.**
|
||||
|
||||
*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.*
|
||||
|
||||
@ -50,10 +50,11 @@ int main()
|
||||
|
||||
if (showMessageBox)
|
||||
{
|
||||
int result = GuiMessageBox((Rectangle){ 85, 70, 250, 100 },
|
||||
"#191#Message Box", "Hi! This is a message!", "Nice;Cool");
|
||||
int btnActive = -1;
|
||||
GuiMessageBox((Rectangle){ 85, 70, 250, 100 },
|
||||
"#191#Message Box", "Hi! This is a message!", "Nice;Cool", &btnActive);
|
||||
|
||||
if (result >= 0) showMessageBox = false;
|
||||
if (btnActive >= 0) showMessageBox = false;
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
@ -99,9 +100,9 @@ Styles can be loaded at runtime using raygui `GuiLoadStyle()` function. Simple a
|
||||
|
||||
## 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`.
|
||||
`raygui` supports custom icons, by default, a predefined set of icons is provided inside `raygui` as an array of binary data; it contains **512 possible icons** defined as **16x16 pixels** each; each pixel is codified using **1-bit**. The total size of the array is `4096 bytes`.
|
||||
|
||||
<img align="right" src="images/raygui_ricons.png">
|
||||

|
||||
|
||||
To use any of those icons just prefix the *#iconId#* number to **any text** written within `raygui` controls:
|
||||
```c
|
||||
@ -109,7 +110,7 @@ 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`).
|
||||
```c
|
||||
if (GuiButton(rec, GuiIconText(RICON_FILE_OPEN, "Open Image"))) { /* ACTION */ }
|
||||
if (GuiButton(rec, GuiIconText(ICON_FILE_OPEN, "Open Image"))) { /* ACTION */ }
|
||||
```
|
||||
Provided set of icons can be reviewed and customized using [rGuiIcons](https://raylibtech.itch.io/rguiicons) tool.
|
||||
|
||||
@ -117,15 +118,15 @@ Provided set of icons can be reviewed and customized using [rGuiIcons](https://r
|
||||
|
||||
- [**rGuiStyler**](https://raylibtech.itch.io/rguistyler) - A simple and easy-to-use raygui styles editor.
|
||||
|
||||

|
||||

|
||||
|
||||
- [**rGuiIcons**](https://raylibtech.itch.io/rguiicons) - A simple and easy-to-use raygui icons editor.
|
||||
|
||||

|
||||

|
||||
|
||||
- [**rGuiLayout**](https://raylibtech.itch.io/rguilayout) - A simple and easy-to-use raygui layouts editor.
|
||||
|
||||

|
||||

|
||||
|
||||
## building
|
||||
|
||||
|
||||
@ -305,10 +305,12 @@ int main()
|
||||
if (showMessageBox)
|
||||
{
|
||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
|
||||
int result = GuiMessageBox((Rectangle){ (float)GetScreenWidth()/2 - 125, (float)GetScreenHeight()/2 - 50, 250, 100 }, GuiIconText(ICON_EXIT, "Close Window"), "Do you really want to exit?", "Yes;No");
|
||||
int btnActive = -1;
|
||||
GuiMessageBox((Rectangle){ (float)GetScreenWidth()/2 - 125, (float)GetScreenHeight()/2 - 50, 250, 100 },
|
||||
GuiIconText(ICON_EXIT, "Close Window"), "Do you really want to exit?", "Yes;No", &btnActive);
|
||||
|
||||
if ((result == 0) || (result == 2)) showMessageBox = false;
|
||||
else if (result == 1) exitWindow = true;
|
||||
if ((btnActive == 0) || (btnActive == 2)) showMessageBox = false;
|
||||
else if (btnActive == 1) exitWindow = true;
|
||||
}
|
||||
|
||||
if (showTextInputBox)
|
||||
@ -316,16 +318,18 @@ int main()
|
||||
GuiUnlock();
|
||||
|
||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
|
||||
int result = GuiTextInputBox((Rectangle){ (float)GetScreenWidth()/2 - 120, (float)GetScreenHeight()/2 - 60, 240, 140 }, GuiIconText(ICON_FILE_SAVE, "Save file as..."), "Introduce output file name:", "Ok;Cancel", textInput, 255, NULL);
|
||||
int btnActive = -1;
|
||||
GuiTextInputBox((Rectangle){ (float)GetScreenWidth()/2 - 120, (float)GetScreenHeight()/2 - 60, 240, 140 },
|
||||
GuiIconText(ICON_FILE_SAVE, "Save file as..."), "Introduce output file name:", textInput, 255, "Ok;Cancel", &btnActive, NULL);
|
||||
|
||||
if (result == 1)
|
||||
if (btnActive == 1)
|
||||
{
|
||||
// TODO: Validate textInput value and save
|
||||
|
||||
TextCopy(textInputFileName, textInput);
|
||||
}
|
||||
|
||||
if ((result == 0) || (result == 1) || (result == 2))
|
||||
if ((btnActive == 0) || (btnActive == 1) || (btnActive == 2))
|
||||
{
|
||||
showTextInputBox = false;
|
||||
TextCopy(textInput, "\0");
|
||||
|
||||
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
BIN
images/raygui_icons_v5.png
Normal file
BIN
images/raygui_icons_v5.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.8 KiB |
BIN
images/rguiicons_v400.png
Normal file
BIN
images/rguiicons_v400.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
BIN
images/rguilayout_v500.png
Normal file
BIN
images/rguilayout_v500.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
BIN
images/rguistyler_v600.png
Normal file
BIN
images/rguistyler_v600.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
403
src/raygui.h
403
src/raygui.h
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user