Skip to content

Commit

Permalink
Propagate DEFAULT properties on loading
Browse files Browse the repository at this point in the history
  • Loading branch information
raysan5 committed Jun 17, 2019
1 parent 7c580ff commit 14670bc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/raygui.h
Original file line number Diff line number Diff line change
Expand Up @@ -3923,7 +3923,11 @@ RAYGUIDEF int GuiMessageBox(Rectangle bounds, const char *windowTitle, const cha
// Text Input Box control, ask for text
RAYGUIDEF int GuiTextInputBox(Rectangle bounds, const char *windowTitle, const char *message, char *text, const char *buttons)
{
int btnIndex = -1;

// TODO.

return btnIndex;
}

// Grid control
Expand Down Expand Up @@ -4009,7 +4013,14 @@ RAYGUIDEF void GuiLoadStyle(const char *fileName)
{
sscanf(buffer, "p %d %d %d", &controlId, &propertyId, &propertyValue);

GuiSetStyle(controlId, propertyId, propertyValue);
if (controlId == 0) // DEFAULT control
{
// If a DEFAULT property is loaded, it is propagated to all controls,
// all DEFAULT properties should be defined first in the file
GuiSetStyle(0, propertyId, propertyValue);
for (int i = 1; i < NUM_CONTROLS; i++) GuiSetStyle(i, propertyId, propertyValue);
}
else GuiSetStyle(controlId, propertyId, propertyValue);

} break;
default: break;
Expand Down

0 comments on commit 14670bc

Please sign in to comment.