update zpl
parent
4ea2ba6188
commit
e056395f8f
|
@ -2,6 +2,7 @@
|
|||
#include "zpl.h"
|
||||
#include "platform.h"
|
||||
#ifdef ZPL_SYSTEM_WINDOWS
|
||||
#include <Windows.h>
|
||||
|
||||
static BOOL WINAPI _sighandler_win32_control_handler(DWORD control_type)
|
||||
{
|
||||
|
|
|
@ -496,12 +496,6 @@ extern "C" { // Prevents name mangling of functions
|
|||
#endif
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // Prevents name mangling of functions
|
||||
#endif
|
||||
|
||||
#endif // RAYGUI_H
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
* RAYGUI IMPLEMENTATION
|
||||
|
@ -1684,14 +1678,14 @@ bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
|
|||
bool pressed = false;
|
||||
|
||||
Rectangle textAreaBounds = {
|
||||
bounds.x + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
||||
bounds.y + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
||||
bounds.width - 2*GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
||||
bounds.height - 2*GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)
|
||||
bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
||||
bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
||||
bounds.width - 2 * (GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)),
|
||||
bounds.height - 2 * (GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING))
|
||||
};
|
||||
|
||||
// Cursor position, [x, y] values should be updated
|
||||
Rectangle cursor = { 0, 0, 1, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) + 2 };
|
||||
Rectangle cursor = { 0, 0, (GuiGetStyle(DEFAULT, TEXT_SIZE) < 10) ? 1 : (GuiGetStyle(DEFAULT, TEXT_SIZE) * 0.1f), (float)GuiGetStyle(DEFAULT, TEXT_SIZE) + 2 };
|
||||
|
||||
int textWidth = 0;
|
||||
int currentLine = 0;
|
||||
|
@ -1761,7 +1755,7 @@ bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
|
|||
|
||||
if (text[i] == ' ' || text[i] == '\n') lastBreakingPos = i;
|
||||
|
||||
if ( text[i] == '\n' || textWidth >= textAreaBounds.width)
|
||||
if ( text[i] == '\n' || textWidth + 1 >= textAreaBounds.width)
|
||||
{
|
||||
currentLine++;
|
||||
textWidth = 0;
|
||||
|
@ -1773,8 +1767,8 @@ bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
|
|||
}
|
||||
}
|
||||
|
||||
cursor.x = bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING) + textWidth - GuiGetStyle(DEFAULT, TEXT_SPACING);
|
||||
cursor.y = bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)/2 + ((GuiGetStyle(DEFAULT, TEXT_SIZE) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING))*currentLine);
|
||||
cursor.x = textAreaBounds.x + textWidth - GuiGetStyle(DEFAULT, TEXT_SPACING);
|
||||
cursor.y = textAreaBounds.y + ((GuiGetStyle(DEFAULT, TEXT_SIZE) + GuiGetStyle(DEFAULT, TEXT_SIZE)/2)*currentLine);
|
||||
|
||||
// Exit edit mode
|
||||
if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
||||
|
@ -2531,11 +2525,11 @@ Color GuiColorPicker(Rectangle bounds, Color color)
|
|||
color = GuiColorPanel(bounds, color);
|
||||
|
||||
Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height };
|
||||
Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), bounds.width, GuiGetStyle(COLORPICKER, HUEBAR_WIDTH) };
|
||||
//Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, BARS_PADDING), bounds.width, GuiGetStyle(COLORPICKER, BARS_THICK) };
|
||||
|
||||
Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ color.r/255.0f, color.g/255.0f, color.b/255.0f });
|
||||
hsv.x = GuiColorBarHue(boundsHue, hsv.x);
|
||||
color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f);
|
||||
//color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f);
|
||||
Vector3 rgb = ConvertHSVtoRGB(hsv);
|
||||
color = RAYGUI_CLITERAL(Color){ (unsigned char)roundf(rgb.x*255.0f), (unsigned char)roundf(rgb.y*255.0f), (unsigned char)roundf(rgb.z*255.0f), color.a };
|
||||
|
||||
|
@ -3679,3 +3673,9 @@ static const char *CodepointToUtf8(int codepoint, int *byteLength)
|
|||
#endif // RAYGUI_STANDALONE
|
||||
|
||||
#endif // RAYGUI_IMPLEMENTATION
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // Prevents name mangling of functions
|
||||
#endif
|
||||
|
||||
#endif // RAYGUI_H
|
||||
|
|
|
@ -364,7 +364,7 @@ License:
|
|||
|
||||
#define ZPL_VERSION_MAJOR 14
|
||||
#define ZPL_VERSION_MINOR 1
|
||||
#define ZPL_VERSION_PATCH 5
|
||||
#define ZPL_VERSION_PATCH 6
|
||||
#define ZPL_VERSION_PRE ""
|
||||
|
||||
// file: zpl_hedley.h
|
||||
|
@ -3893,7 +3893,7 @@ zpl_array_header *zpl__ah =
|
|||
cast(zpl_array_header *) zpl_alloc(allocator_, zpl_size_of(zpl_array_header) + zpl_size_of(*(x)) * (cap)); \
|
||||
zpl__ah->allocator = allocator_; \
|
||||
zpl__ah->count = 0; \
|
||||
zpl__ah->data = (char *)(zpl__ah + 1); \
|
||||
zpl__ah->data = (char *)x; \
|
||||
zpl__ah->capacity = cap; \
|
||||
*zpl__array_ = cast(void *)(zpl__ah + 1); \
|
||||
} while (0)
|
||||
|
@ -3935,8 +3935,7 @@ if (zpl_array_capacity(x) < zpl_array_count(x) + 1) zpl_array_grow(x, 0);
|
|||
do { \
|
||||
if (ind >= zpl_array_count(x)) { zpl_array_append(x, item); break; } \
|
||||
if (zpl_array_capacity(x) < zpl_array_count(x) + 1) zpl_array_grow(x, 0); \
|
||||
zpl_printf("OK\n");\
|
||||
zpl_memmove(&(x)[ind + 1], &(x)[ind], zpl_size_of(x[0]) * (zpl_array_count(x) - ind)); \
|
||||
zpl_memmove(&(x)[ind + 1], (x + ind), zpl_size_of(x[0]) * (zpl_array_count(x) - ind)); \
|
||||
x[ind] = item; \
|
||||
zpl_array_count(x)++; \
|
||||
} while (0)
|
||||
|
@ -7309,25 +7308,6 @@ ZPL_END_C_DECLS
|
|||
# include <pthread.h>
|
||||
# endif
|
||||
|
||||
# if defined(ZPL_SYSTEM_WINDOWS)
|
||||
# if !defined(ZPL_NO_WINDOWS_H)
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define NOMINMAX
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_MEAN_AND_LEAN
|
||||
# define VC_EXTRALEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# undef NOMINMAX
|
||||
# undef WIN32_LEAN_AND_MEAN
|
||||
# undef WIN32_MEAN_AND_LEAN
|
||||
# undef VC_EXTRALEAN
|
||||
|
||||
/* prevent it from including later */
|
||||
# define ZPL_NO_WINDOWS_H
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(zpl_thread_local)
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
# define zpl_thread_local __declspec(thread)
|
||||
|
@ -8664,7 +8644,7 @@ ZPL_NEVER_INLINE void *zpl__array_set_capacity(void *array, zpl_isize capacity,
|
|||
zpl_memmove(nh, h, zpl_size_of(zpl_array_header) + element_size * h->count);
|
||||
nh->allocator = h->allocator;
|
||||
nh->count = h->count;
|
||||
nh->data = (char *)(nh + 1);
|
||||
nh->data = (char *)nh + 1;
|
||||
nh->capacity = capacity;
|
||||
zpl_free(h->allocator, h);
|
||||
return nh + 1;
|
||||
|
|
Loading…
Reference in New Issue