mirror of
https://github.com/raysan5/raygui.git
synced 2026-01-29 02:09:17 -05:00
Compare commits
9 Commits
1a74db2ab3
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c2365a20c | |||
| 7f842d85ba | |||
| 0f5f0f7d00 | |||
| 9a1c183d85 | |||
| 51e6bcb393 | |||
| 04282d1763 | |||
| 0b94b80c92 | |||
| 867ca4bf8d | |||
| 367e169ad3 |
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
zlib License
|
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
|
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.
|
will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
|||||||
@ -311,7 +311,6 @@
|
|||||||
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\rshapes.c" />
|
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\rshapes.c" />
|
||||||
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\rtext.c" />
|
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\rtext.c" />
|
||||||
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\rtextures.c" />
|
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\rtextures.c" />
|
||||||
<ClCompile Include="$(ProjectDir)..\..\..\..\raylib\src\utils.c" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\external\cgltf.h" />
|
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\external\cgltf.h" />
|
||||||
@ -331,7 +330,6 @@
|
|||||||
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\raylib.h" />
|
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\raylib.h" />
|
||||||
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\raymath.h" />
|
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\raymath.h" />
|
||||||
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\rlgl.h" />
|
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\rlgl.h" />
|
||||||
<ClInclude Include="$(ProjectDir)..\..\..\..\raylib\src\utils.h" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="..\..\..\..\raylib\src\raylib.dll.rc" />
|
<ResourceCompile Include="..\..\..\..\raylib\src\raylib.dll.rc" />
|
||||||
|
|||||||
30
src/raygui.h
30
src/raygui.h
@ -316,7 +316,7 @@
|
|||||||
*
|
*
|
||||||
* LICENSE: zlib/libpng
|
* 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
|
* 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.
|
* 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
|
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#if defined(BUILD_LIBTYPE_SHARED)
|
#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)
|
#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
|
#endif
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS // disable unsafe warnings on scanf functions in MSVC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Function specifiers definition
|
// Function specifiers definition
|
||||||
@ -369,9 +370,9 @@
|
|||||||
// NOTE: Avoiding those calls, also avoids const strings memory usage
|
// NOTE: Avoiding those calls, also avoids const strings memory usage
|
||||||
#define RAYGUI_SUPPORT_LOG_INFO
|
#define RAYGUI_SUPPORT_LOG_INFO
|
||||||
#if defined(RAYGUI_SUPPORT_LOG_INFO)
|
#if defined(RAYGUI_SUPPORT_LOG_INFO)
|
||||||
#define RAYGUI_LOG(...) printf(__VA_ARGS__)
|
#define RAYGUI_LOG(...) printf(__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define RAYGUI_LOG(...)
|
#define RAYGUI_LOG(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@ -2692,8 +2693,8 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
|
|||||||
{
|
{
|
||||||
int offset = textBoxCursorIndex;
|
int offset = textBoxCursorIndex;
|
||||||
int accCodepointSize = 0;
|
int accCodepointSize = 0;
|
||||||
int prevCodepointSize;
|
int prevCodepointSize = 0;
|
||||||
int prevCodepoint;
|
int prevCodepoint = 0;
|
||||||
|
|
||||||
// Check whitespace to delete (ASCII only)
|
// Check whitespace to delete (ASCII only)
|
||||||
while (offset > 0)
|
while (offset > 0)
|
||||||
@ -2744,8 +2745,8 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
|
|||||||
{
|
{
|
||||||
int offset = textBoxCursorIndex;
|
int offset = textBoxCursorIndex;
|
||||||
//int accCodepointSize = 0;
|
//int accCodepointSize = 0;
|
||||||
int prevCodepointSize;
|
int prevCodepointSize = 0;
|
||||||
int prevCodepoint;
|
int prevCodepoint = 0;
|
||||||
|
|
||||||
// Check whitespace to skip (ASCII only)
|
// Check whitespace to skip (ASCII only)
|
||||||
while (offset > 0)
|
while (offset > 0)
|
||||||
@ -4198,6 +4199,9 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co
|
|||||||
GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment);
|
GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int prevTextBoxAlignment = GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT);
|
||||||
|
GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||||
|
|
||||||
if (secretViewActive != NULL)
|
if (secretViewActive != NULL)
|
||||||
{
|
{
|
||||||
static char stars[] = "****************";
|
static char stars[] = "****************";
|
||||||
@ -4211,6 +4215,8 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co
|
|||||||
if (GuiTextBox(textBoxBounds, text, textMaxSize, textEditMode)) textEditMode = !textEditMode;
|
if (GuiTextBox(textBoxBounds, text, textMaxSize, textEditMode)) textEditMode = !textEditMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, prevTextBoxAlignment);
|
||||||
|
|
||||||
int prevBtnTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
|
int prevBtnTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
|
||||||
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||||
|
|
||||||
@ -4231,7 +4237,7 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co
|
|||||||
// Grid control
|
// Grid control
|
||||||
// NOTE: Returns grid mouse-hover selected cell
|
// NOTE: Returns grid mouse-hover selected cell
|
||||||
// About drawing lines at subpixel spacing, simple put, not easy solution:
|
// About drawing lines at subpixel spacing, simple put, not easy solution:
|
||||||
// Ref: 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)
|
int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell)
|
||||||
{
|
{
|
||||||
// Grid lines alpha amount
|
// Grid lines alpha amount
|
||||||
@ -5076,12 +5082,12 @@ static const char **GetTextLines(const char *text, int *count)
|
|||||||
static const char *lines[RAYGUI_MAX_TEXT_LINES] = { 0 };
|
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
|
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;
|
lines[0] = text;
|
||||||
*count = 1;
|
*count = 1;
|
||||||
|
|
||||||
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')
|
if (text[i] == '\n')
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user