From c4e121d5486cc38ff0ce17e5b3113356a7785962 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 6 Apr 2022 16:02:00 +0200 Subject: [PATCH] Store secret text as static variable (#195) When compiling with Zig, the old implementation raises this error: ``` error: expected type '[*c]u8', found '*const [16:0]u8' note: cast discards const qualifier ``` As it does not allow casting away the const qualifier, we need to store the "********" placeholder in a writable variable. Co-authored-by: Fabien Freling --- src/raygui.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/raygui.h b/src/raygui.h index aa5be93..ba5e1e0 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -3151,8 +3151,9 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co if (secretViewActive != NULL) { + static char stars[] = "****************"; if (GuiTextBox(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x, textBoxBounds.y, textBoxBounds.width - 4 - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.height }, - ((*secretViewActive == 1) || textEditMode)? text : (char *) "****************", textMaxSize, textEditMode)) textEditMode = !textEditMode; + ((*secretViewActive == 1) || textEditMode)? text : stars, textMaxSize, textEditMode)) textEditMode = !textEditMode; *secretViewActive = GuiToggle(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x + textBoxBounds.width - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.y, RAYGUI_TEXTINPUTBOX_HEIGHT, RAYGUI_TEXTINPUTBOX_HEIGHT }, (*secretViewActive == 1)? "#44#" : "#45#", *secretViewActive); }