mirror of
https://github.com/raysan5/raygui.git
synced 2026-01-29 18:29:18 -05:00
Compare commits
17 Commits
d4ebcdc2be
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| fd8d0f1b17 | |||
| 1c2365a20c | |||
| 7f842d85ba | |||
| 0f5f0f7d00 | |||
| 9a1c183d85 | |||
| 51e6bcb393 | |||
| 04282d1763 | |||
| 0b94b80c92 | |||
| 867ca4bf8d | |||
| 367e169ad3 | |||
| 1a74db2ab3 | |||
| 715baf250d | |||
| 3aea427fc8 | |||
| 773d1ec52b | |||
| ff4dbd0712 | |||
| aed63cedd1 | |||
| 4436a897f9 |
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
zlib License
|
||||
|
||||
Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
|
||||
Copyright (c) 2014-2026 Ramon Santamaria (@raysan5)
|
||||
|
||||
This software is provided "as-is", without any express or implied warranty. In no event
|
||||
will the authors be held liable for any damages arising from the use of this software.
|
||||
|
||||
@ -6,10 +6,10 @@ PRODUCTVERSION 4,0,0,0
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
//BLOCK "080904E4" // English UK
|
||||
BLOCK "040904E4" // English US
|
||||
//BLOCK "080904E4" // English UK
|
||||
BLOCK "040904E4" // English US
|
||||
BEGIN
|
||||
//VALUE "CompanyName", "raylib technologies"
|
||||
//VALUE "CompanyName", "raylib technologies"
|
||||
VALUE "FileDescription", "raygui application (www.raylib.com)"
|
||||
VALUE "FileVersion", "4.0.0"
|
||||
VALUE "InternalName", "raygui app"
|
||||
@ -21,7 +21,7 @@ BEGIN
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
//VALUE "Translation", 0x809, 1252 // English UK
|
||||
VALUE "Translation", 0x409, 1252 // English US
|
||||
//VALUE "Translation", 0x809, 1252 // English UK
|
||||
VALUE "Translation", 0x409, 1252 // English US
|
||||
END
|
||||
END
|
||||
|
||||
@ -311,7 +311,6 @@
|
||||
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\rshapes.c" />
|
||||
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\rtext.c" />
|
||||
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\rtextures.c" />
|
||||
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\utils.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\external\cgltf.h" />
|
||||
@ -331,7 +330,6 @@
|
||||
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\raylib.h" />
|
||||
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\raymath.h" />
|
||||
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\rlgl.h" />
|
||||
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\utils.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\..\..\raylib\src\raylib.dll.rc" />
|
||||
|
||||
162
src/raygui.h
162
src/raygui.h
@ -77,7 +77,7 @@
|
||||
*
|
||||
* static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)];
|
||||
*
|
||||
* guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB
|
||||
* guiStyle size is by default: 16*(16 + 8) = 384 int = 384*4 bytes = 1536 bytes = 1.5 KB
|
||||
*
|
||||
* Note that the first set of BASE properties (by default guiStyle[0..15]) belong to the generic style
|
||||
* used for all controls, when any of those base values is set, it is automatically populated to all
|
||||
@ -141,7 +141,7 @@
|
||||
* Draw text bounds rectangles for debug
|
||||
*
|
||||
* VERSIONS HISTORY:
|
||||
* 5.0-dev (2025) Current dev version...
|
||||
* 5.0 (xx-Nov-2025) ADDED: Support up to 32 controls (v500)
|
||||
* ADDED: guiControlExclusiveMode and guiControlExclusiveRec for exclusive modes
|
||||
* ADDED: GuiValueBoxFloat()
|
||||
* ADDED: GuiDropdonwBox() properties: DROPDOWN_ARROW_HIDDEN, DROPDOWN_ROLL_UP
|
||||
@ -271,7 +271,7 @@
|
||||
* 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* raylib 5.0 - Inputs reading (keyboard/mouse), shapes drawing, font loading and text drawing
|
||||
* raylib 5.6-dev - Inputs reading (keyboard/mouse), shapes drawing, font loading and text drawing
|
||||
*
|
||||
* STANDALONE MODE:
|
||||
* By default raygui depends on raylib mostly for the inputs and the drawing functionality but that dependency can be disabled
|
||||
@ -316,7 +316,7 @@
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2014-2026 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
@ -351,10 +351,11 @@
|
||||
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
|
||||
#if defined(_WIN32)
|
||||
#if defined(BUILD_LIBTYPE_SHARED)
|
||||
#define RAYGUIAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll)
|
||||
#define RAYGUIAPI __declspec(dllexport) // Building the library as a Win32 shared library (.dll)
|
||||
#elif defined(USE_LIBTYPE_SHARED)
|
||||
#define RAYGUIAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll)
|
||||
#define RAYGUIAPI __declspec(dllimport) // Using the library as a Win32 shared library (.dll)
|
||||
#endif
|
||||
#define _CRT_SECURE_NO_WARNINGS // disable unsafe warnings on scanf functions in MSVC
|
||||
#endif
|
||||
|
||||
// Function specifiers definition
|
||||
@ -369,9 +370,9 @@
|
||||
// NOTE: Avoiding those calls, also avoids const strings memory usage
|
||||
#define RAYGUI_SUPPORT_LOG_INFO
|
||||
#if defined(RAYGUI_SUPPORT_LOG_INFO)
|
||||
#define RAYGUI_LOG(...) printf(__VA_ARGS__)
|
||||
#define RAYGUI_LOG(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define RAYGUI_LOG(...)
|
||||
#define RAYGUI_LOG(...)
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -1010,28 +1011,28 @@ typedef enum {
|
||||
ICON_SLICING = 231,
|
||||
ICON_MANUAL_CONTROL = 232,
|
||||
ICON_COLLISION = 233,
|
||||
ICON_234 = 234,
|
||||
ICON_235 = 235,
|
||||
ICON_236 = 236,
|
||||
ICON_237 = 237,
|
||||
ICON_238 = 238,
|
||||
ICON_239 = 239,
|
||||
ICON_240 = 240,
|
||||
ICON_241 = 241,
|
||||
ICON_242 = 242,
|
||||
ICON_243 = 243,
|
||||
ICON_244 = 244,
|
||||
ICON_245 = 245,
|
||||
ICON_246 = 246,
|
||||
ICON_247 = 247,
|
||||
ICON_248 = 248,
|
||||
ICON_249 = 249,
|
||||
ICON_CIRCLE_ADD = 234,
|
||||
ICON_CIRCLE_ADD_FILL = 235,
|
||||
ICON_CIRCLE_WARNING = 236,
|
||||
ICON_CIRCLE_WARNING_FILL = 237,
|
||||
ICON_BOX_MORE = 238,
|
||||
ICON_BOX_MORE_FILL = 239,
|
||||
ICON_BOX_MINUS = 240,
|
||||
ICON_BOX_MINUS_FILL = 241,
|
||||
ICON_UNION = 242,
|
||||
ICON_INTERSECTION = 243,
|
||||
ICON_DIFFERENCE = 244,
|
||||
ICON_SPHERE = 245,
|
||||
ICON_CYLINDER = 246,
|
||||
ICON_CONE = 247,
|
||||
ICON_ELLIPSOID = 248,
|
||||
ICON_CAPSULE = 249,
|
||||
ICON_250 = 250,
|
||||
ICON_251 = 251,
|
||||
ICON_252 = 252,
|
||||
ICON_253 = 253,
|
||||
ICON_254 = 254,
|
||||
ICON_255 = 255,
|
||||
ICON_255 = 255
|
||||
} GuiIconName;
|
||||
#endif
|
||||
|
||||
@ -1078,7 +1079,7 @@ typedef enum {
|
||||
|
||||
// Check if two rectangles are equal, used to validate a slider bounds as an id
|
||||
#ifndef CHECK_BOUNDS_ID
|
||||
#define CHECK_BOUNDS_ID(src, dst) ((src.x == dst.x) && (src.y == dst.y) && (src.width == dst.width) && (src.height == dst.height))
|
||||
#define CHECK_BOUNDS_ID(src, dst) (((int)src.x == (int)dst.x) && ((int)src.y == (int)dst.y) && ((int)src.width == (int)dst.width) && ((int)src.height == (int)dst.height))
|
||||
#endif
|
||||
|
||||
#if !defined(RAYGUI_NO_ICONS) && !defined(RAYGUI_CUSTOM_ICONS)
|
||||
@ -1091,7 +1092,7 @@ typedef enum {
|
||||
// Icons data is defined by bit array (every bit represents one pixel)
|
||||
// Those arrays are stored as unsigned int data arrays, so,
|
||||
// every array element defines 32 pixels (bits) of information
|
||||
// One icon is defined by 8 int, (8 int * 32 bit = 256 bit = 16*16 pixels)
|
||||
// One icon is defined by 8 int, (8 int*32 bit = 256 bit = 16*16 pixels)
|
||||
// NOTE: Number of elemens depend on RAYGUI_ICON_SIZE (by default 16x16 pixels)
|
||||
#define RAYGUI_ICON_DATA_ELEMENTS (RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32)
|
||||
|
||||
@ -1341,22 +1342,22 @@ static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] =
|
||||
0x7fe00000, 0x402e4020, 0x43ce5e0a, 0x40504078, 0x438e4078, 0x402e5e0a, 0x7fe04020, 0x00000000, // ICON_SLICING
|
||||
0x00000000, 0x40027ffe, 0x47c24002, 0x55425d42, 0x55725542, 0x50125552, 0x10105016, 0x00001ff0, // ICON_MANUAL_CONTROL
|
||||
0x7ffe0000, 0x43c24002, 0x48124422, 0x500a500a, 0x500a500a, 0x44224812, 0x400243c2, 0x00007ffe, // ICON_COLLISION
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_234
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_235
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_236
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_237
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_238
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_239
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_240
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_241
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_242
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_243
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_244
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_245
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_246
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_247
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_248
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_249
|
||||
0x03c00000, 0x10080c30, 0x21842184, 0x4ff24182, 0x41824ff2, 0x21842184, 0x0c301008, 0x000003c0, // ICON_CIRCLE_ADD
|
||||
0x03c00000, 0x1ff80ff0, 0x3e7c3e7c, 0x700e7e7e, 0x7e7e700e, 0x3e7c3e7c, 0x0ff01ff8, 0x000003c0, // ICON_CIRCLE_ADD_FILL
|
||||
0x03c00000, 0x10080c30, 0x21842184, 0x41824182, 0x40024182, 0x21842184, 0x0c301008, 0x000003c0, // ICON_CIRCLE_WARNING
|
||||
0x03c00000, 0x1ff80ff0, 0x3e7c3e7c, 0x7e7e7e7e, 0x7ffe7e7e, 0x3e7c3e7c, 0x0ff01ff8, 0x000003c0, // ICON_CIRCLE_WARNING_FILL
|
||||
0x00000000, 0x10041ffc, 0x10841004, 0x13e41084, 0x10841084, 0x10041004, 0x00001ffc, 0x00000000, // ICON_BOX_MORE
|
||||
0x00000000, 0x1ffc1ffc, 0x1f7c1ffc, 0x1c1c1f7c, 0x1f7c1f7c, 0x1ffc1ffc, 0x00001ffc, 0x00000000, // ICON_BOX_MORE_FILL
|
||||
0x00000000, 0x1ffc1ffc, 0x1ffc1ffc, 0x1c1c1ffc, 0x1ffc1ffc, 0x1ffc1ffc, 0x00001ffc, 0x00000000, // ICON_BOX_MINUS
|
||||
0x00000000, 0x10041ffc, 0x10041004, 0x13e41004, 0x10041004, 0x10041004, 0x00001ffc, 0x00000000, // ICON_BOX_MINUS_FILL
|
||||
0x07fe0000, 0x055606aa, 0x7ff606aa, 0x55766eba, 0x55766eaa, 0x55606ffe, 0x55606aa0, 0x00007fe0, // ICON_UNION
|
||||
0x07fe0000, 0x04020402, 0x7fe20402, 0x456246a2, 0x456246a2, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_INTERSECTION
|
||||
0x07fe0000, 0x055606aa, 0x7ff606aa, 0x4436442a, 0x4436442a, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_DIFFERENCE
|
||||
0x03c00000, 0x10080c30, 0x20042004, 0x60064002, 0x47e2581a, 0x20042004, 0x0c301008, 0x000003c0, // ICON_SPHERE
|
||||
0x03e00000, 0x08080410, 0x0c180808, 0x08080be8, 0x08080808, 0x08080808, 0x04100808, 0x000003e0, // ICON_CYLINDER
|
||||
0x00800000, 0x01400140, 0x02200220, 0x04100410, 0x08080808, 0x1c1c13e4, 0x08081004, 0x000007f0, // ICON_CONE
|
||||
0x00000000, 0x07e00000, 0x20841918, 0x40824082, 0x40824082, 0x19182084, 0x000007e0, 0x00000000, // ICON_ELLIPSOID
|
||||
0x00000000, 0x00000000, 0x20041ff8, 0x40024002, 0x40024002, 0x1ff82004, 0x00000000, 0x00000000, // ICON_CAPSULE
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_250
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_251
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_252
|
||||
@ -1743,7 +1744,7 @@ int GuiPanel(Rectangle bounds, const char *text)
|
||||
// NOTE: Using GuiToggle() for the TABS
|
||||
int GuiTabBar(Rectangle bounds, const char **text, int count, int *active)
|
||||
{
|
||||
#define RAYGUI_TABBAR_ITEM_WIDTH 160
|
||||
#define RAYGUI_TABBAR_ITEM_WIDTH 148
|
||||
|
||||
int result = -1;
|
||||
//GuiState state = guiState;
|
||||
@ -1776,12 +1777,12 @@ int GuiTabBar(Rectangle bounds, const char **text, int count, int *active)
|
||||
if (i == (*active))
|
||||
{
|
||||
toggle = true;
|
||||
GuiToggle(tabBounds, GuiIconText(12, text[i]), &toggle);
|
||||
GuiToggle(tabBounds, text[i], &toggle);
|
||||
}
|
||||
else
|
||||
{
|
||||
toggle = false;
|
||||
GuiToggle(tabBounds, GuiIconText(12, text[i]), &toggle);
|
||||
GuiToggle(tabBounds, text[i], &toggle);
|
||||
if (toggle) *active = i;
|
||||
}
|
||||
|
||||
@ -2506,7 +2507,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
|
||||
int result = 0;
|
||||
GuiState state = guiState;
|
||||
|
||||
bool multiline = false; // TODO: Consider multiline text input
|
||||
bool multiline = false; // TODO: Consider multiline text input
|
||||
int wrapMode = GuiGetStyle(DEFAULT, TEXT_WRAP_MODE);
|
||||
|
||||
Rectangle textBounds = GetTextBounds(TEXTBOX, bounds);
|
||||
@ -2514,7 +2515,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
|
||||
int thisCursorIndex = textBoxCursorIndex;
|
||||
if (thisCursorIndex > textLength) thisCursorIndex = textLength;
|
||||
int textWidth = GuiGetTextWidth(text) - GuiGetTextWidth(text + thisCursorIndex);
|
||||
int textIndexOffset = 0; // Text index offset to start drawing in the box
|
||||
int textIndexOffset = 0; // Text index offset to start drawing in the box
|
||||
|
||||
// Cursor rectangle
|
||||
// NOTE: Position X value should be updated
|
||||
@ -2692,8 +2693,8 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
|
||||
{
|
||||
int offset = textBoxCursorIndex;
|
||||
int accCodepointSize = 0;
|
||||
int prevCodepointSize;
|
||||
int prevCodepoint;
|
||||
int prevCodepointSize = 0;
|
||||
int prevCodepoint = 0;
|
||||
|
||||
// Check whitespace to delete (ASCII only)
|
||||
while (offset > 0)
|
||||
@ -2744,8 +2745,8 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
|
||||
{
|
||||
int offset = textBoxCursorIndex;
|
||||
//int accCodepointSize = 0;
|
||||
int prevCodepointSize;
|
||||
int prevCodepoint;
|
||||
int prevCodepointSize = 0;
|
||||
int prevCodepoint = 0;
|
||||
|
||||
// Check whitespace to skip (ASCII only)
|
||||
while (offset > 0)
|
||||
@ -3033,7 +3034,7 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
|
||||
int result = 0;
|
||||
GuiState state = guiState;
|
||||
|
||||
char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = "\0";
|
||||
char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = { 0 };
|
||||
snprintf(textValue, RAYGUI_VALUEBOX_MAX_CHARS + 1, "%i", *value);
|
||||
|
||||
Rectangle textBounds = { 0 };
|
||||
@ -3051,7 +3052,6 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
|
||||
if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode)
|
||||
{
|
||||
Vector2 mousePoint = GetMousePosition();
|
||||
|
||||
bool valueHasChanged = false;
|
||||
|
||||
if (editMode)
|
||||
@ -3070,7 +3070,7 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
|
||||
keyCount--;
|
||||
valueHasChanged = true;
|
||||
}
|
||||
else if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS -1)
|
||||
else if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS)
|
||||
{
|
||||
if (keyCount == 0)
|
||||
{
|
||||
@ -3087,30 +3087,26 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
|
||||
}
|
||||
}
|
||||
|
||||
// Only allow keys in range [48..57]
|
||||
if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS)
|
||||
// Add new digit to text value
|
||||
if ((keyCount >= 0) && (keyCount < RAYGUI_VALUEBOX_MAX_CHARS) && (GuiGetTextWidth(textValue) < bounds.width))
|
||||
{
|
||||
if (GuiGetTextWidth(textValue) < bounds.width)
|
||||
int key = GetCharPressed();
|
||||
|
||||
// Only allow keys in range [48..57]
|
||||
if ((key >= 48) && (key <= 57))
|
||||
{
|
||||
int key = GetCharPressed();
|
||||
if ((key >= 48) && (key <= 57))
|
||||
{
|
||||
textValue[keyCount] = (char)key;
|
||||
keyCount++;
|
||||
valueHasChanged = true;
|
||||
}
|
||||
textValue[keyCount] = (char)key;
|
||||
keyCount++;
|
||||
valueHasChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete text
|
||||
if (keyCount > 0)
|
||||
if ((keyCount > 0) && IsKeyPressed(KEY_BACKSPACE))
|
||||
{
|
||||
if (IsKeyPressed(KEY_BACKSPACE))
|
||||
{
|
||||
keyCount--;
|
||||
textValue[keyCount] = '\0';
|
||||
valueHasChanged = true;
|
||||
}
|
||||
keyCount--;
|
||||
textValue[keyCount] = '\0';
|
||||
valueHasChanged = true;
|
||||
}
|
||||
|
||||
if (valueHasChanged) *value = TextToInteger(textValue);
|
||||
@ -4203,6 +4199,9 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co
|
||||
GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment);
|
||||
}
|
||||
|
||||
int prevTextBoxAlignment = GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT);
|
||||
GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
|
||||
if (secretViewActive != NULL)
|
||||
{
|
||||
static char stars[] = "****************";
|
||||
@ -4216,6 +4215,8 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co
|
||||
if (GuiTextBox(textBoxBounds, text, textMaxSize, textEditMode)) textEditMode = !textEditMode;
|
||||
}
|
||||
|
||||
GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, prevTextBoxAlignment);
|
||||
|
||||
int prevBtnTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
|
||||
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||
|
||||
@ -4236,7 +4237,7 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co
|
||||
// Grid control
|
||||
// NOTE: Returns grid mouse-hover selected cell
|
||||
// About drawing lines at subpixel spacing, simple put, not easy solution:
|
||||
// https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster
|
||||
// REF: https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster
|
||||
int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell)
|
||||
{
|
||||
// Grid lines alpha amount
|
||||
@ -5081,28 +5082,21 @@ static const char **GetTextLines(const char *text, int *count)
|
||||
static const char *lines[RAYGUI_MAX_TEXT_LINES] = { 0 };
|
||||
for (int i = 0; i < RAYGUI_MAX_TEXT_LINES; i++) lines[i] = NULL; // Init NULL pointers to substrings
|
||||
|
||||
int textSize = (int)strlen(text);
|
||||
int textLength = (int)strlen(text);
|
||||
|
||||
lines[0] = text;
|
||||
int len = 0;
|
||||
*count = 1;
|
||||
//int lineSize = 0; // Stores current line size, not returned
|
||||
|
||||
for (int i = 0, k = 0; (i < textSize) && (*count < RAYGUI_MAX_TEXT_LINES); i++)
|
||||
for (int i = 0, k = 0; (i < textLength) && (*count < RAYGUI_MAX_TEXT_LINES); i++)
|
||||
{
|
||||
if (text[i] == '\n')
|
||||
{
|
||||
//lineSize = len;
|
||||
k++;
|
||||
lines[k] = &text[i + 1]; // WARNING: next value is valid?
|
||||
len = 0;
|
||||
lines[k] = &text[i + 1]; // WARNING: next value is valid?
|
||||
*count += 1;
|
||||
}
|
||||
else len++;
|
||||
}
|
||||
|
||||
//lines[*count - 1].size = len;
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
@ -5878,7 +5872,7 @@ static int TextToInteger(const char *text)
|
||||
text++;
|
||||
}
|
||||
|
||||
for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); ++i) value = value*10 + (int)(text[i] - '0');
|
||||
for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10 + (int)(text[i] - '0');
|
||||
|
||||
return value*sign;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ static const GuiStyleProp amberStyleProps[AMBER_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 16, (int)0x00000010 }, // DEFAULT_TEXT_SIZE
|
||||
{ 0, 18, (int)0xef922aff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0x333333ff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000018 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000008 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 1, 8, (int)0xe7e0d4ff }, // LABEL_TEXT_COLOR_PRESSED
|
||||
{ 4, 8, (int)0xf1cf9dff }, // SLIDER_TEXT_COLOR_PRESSED
|
||||
};
|
||||
|
||||
@ -30,7 +30,7 @@ static const GuiStyleProp ashesStyleProps[ASHES_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 16, (int)0x00000010 }, // DEFAULT_TEXT_SIZE
|
||||
{ 0, 18, (int)0x9dadb1ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0x6b6b6bff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000018 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000008 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: "v5loxical.ttf" (size: 16, spacing: 1)
|
||||
|
||||
@ -31,7 +31,7 @@ static const GuiStyleProp candyStyleProps[CANDY_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 17, (int)0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, (int)0xd77575ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0xfff5e1ff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000016 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000007 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: "v5easter.ttf" (size: 15, spacing: 0)
|
||||
|
||||
@ -31,7 +31,7 @@ static const GuiStyleProp cherryStyleProps[CHERRY_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 17, (int)0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, (int)0xfb8170ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0x3a1720ff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000016 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000007 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: "Westington.ttf" (size: 15, spacing: 0)
|
||||
|
||||
@ -31,7 +31,7 @@ static const GuiStyleProp cyberStyleProps[CYBER_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 17, (int)0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, (int)0x81c0d0ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0x00222bff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000015 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000007 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: "Kyrou7Wide.ttf" (size: 14, spacing: 0)
|
||||
|
||||
@ -31,7 +31,7 @@ static const GuiStyleProp darkStyleProps[DARK_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 17, (int)0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, (int)0x9d9d9dff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0x3c3c3cff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000018 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000008 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 1, 5, (int)0xf7f7f7ff }, // LABEL_TEXT_COLOR_FOCUSED
|
||||
{ 1, 8, (int)0x898989ff }, // LABEL_TEXT_COLOR_PRESSED
|
||||
{ 4, 5, (int)0xb0b0b0ff }, // SLIDER_TEXT_COLOR_FOCUSED
|
||||
|
||||
@ -31,7 +31,7 @@ static const GuiStyleProp enefeteStyleProps[ENEFETE_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 17, (int)0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, (int)0x1d3f6cff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0x29c9e5ff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000018 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000008 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: "GMSN.ttf" (size: 16, spacing: 0)
|
||||
|
||||
@ -31,7 +31,7 @@ static const GuiStyleProp genesisStyleProps[GENESIS_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 17, (int)0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, (int)0x96a3b4ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0x292c33ff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000018 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000008 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 1, 5, (int)0x97a9aeff }, // LABEL_TEXT_COLOR_FOCUSED
|
||||
{ 4, 5, (int)0xa69a9aff }, // SLIDER_TEXT_COLOR_FOCUSED
|
||||
{ 4, 6, (int)0xc3ccd5ff }, // SLIDER_BORDER_COLOR_PRESSED
|
||||
|
||||
@ -31,7 +31,7 @@ static const GuiStyleProp jungleStyleProps[JUNGLE_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 17, (int)0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, (int)0x638465ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0x2b3a3aff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000012 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000006 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: "PixelIntv.otf" (size: 12, spacing: 0)
|
||||
|
||||
@ -30,7 +30,7 @@ static const GuiStyleProp lavandaStyleProps[LAVANDA_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 16, (int)0x00000010 }, // DEFAULT_TEXT_SIZE
|
||||
{ 0, 18, (int)0x84adb7ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0x5b5b81ff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000018 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000008 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: "Cartridge.ttf" (size: 16, spacing: 1)
|
||||
|
||||
@ -29,7 +29,7 @@ static const GuiStyleProp rltechStyleProps[RLTECH_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 11, (int)0xb3b3b3ff }, // DEFAULT_TEXT_COLOR_DISABLED
|
||||
{ 0, 16, (int)0x00000010 }, // DEFAULT_TEXT_SIZE
|
||||
{ 0, 18, (int)0x352c2cff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 20, (int)0x00000018 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000008 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: "2a03.ttf" (size: 16, spacing: 1)
|
||||
|
||||
@ -31,7 +31,7 @@ static const GuiStyleProp sunnyStyleProps[SUNNY_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 17, (int)0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, (int)0x725706ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0xf0be4bff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000018 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000008 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 1, 2, (int)0x504506ff }, // LABEL_TEXT_COLOR_NORMAL
|
||||
{ 1, 5, (int)0xfdeb9bff }, // LABEL_TEXT_COLOR_FOCUSED
|
||||
{ 1, 8, (int)0xf5e8a4ff }, // LABEL_TEXT_COLOR_PRESSED
|
||||
|
||||
@ -31,7 +31,7 @@ static const GuiStyleProp terminalStyleProps[TERMINAL_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 17, (int)0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, (int)0xe6fce3ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, (int)0x0c1505ff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 0, 20, (int)0x00000018 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
{ 0, 20, (int)0x00000008 }, // DEFAULT_TEXT_LINE_SPACING
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: "Mecha.ttf" (size: 16, spacing: 0)
|
||||
|
||||
Reference in New Issue
Block a user