Skip to content

Commit

Permalink
Store secret text as static variable (raysan5#195)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ffreling and Fabien Freling authored Apr 6, 2022
1 parent baf3790 commit c4e121d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/raygui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit c4e121d

Please sign in to comment.