Skip to content

Commit c4e121d

Browse files
ffrelingFabien Freling
and
Fabien Freling
authored
Store secret text as static variable (raysan5#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 <[email protected]>
1 parent baf3790 commit c4e121d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/raygui.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3151,8 +3151,9 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co
31513151

31523152
if (secretViewActive != NULL)
31533153
{
3154+
static char stars[] = "****************";
31543155
if (GuiTextBox(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x, textBoxBounds.y, textBoxBounds.width - 4 - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.height },
3155-
((*secretViewActive == 1) || textEditMode)? text : (char *) "****************", textMaxSize, textEditMode)) textEditMode = !textEditMode;
3156+
((*secretViewActive == 1) || textEditMode)? text : stars, textMaxSize, textEditMode)) textEditMode = !textEditMode;
31563157

31573158
*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);
31583159
}

0 commit comments

Comments
 (0)