Corrected toggle group padding

This commit is contained in:
Ray San
2018-03-05 13:58:46 +01:00
parent 1300e812ce
commit 494e265f4a

View File

@ -1133,8 +1133,8 @@ RAYGUIDEF int GuiToggleGroup(Rectangle bounds, const char **text, int count, int
{ {
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
if (i == active) GuiToggleButton((Rectangle){ bounds.x + i*(bounds.width/count + style[TOGGLEGROUP_PADDING]), bounds.y, bounds.width/count - style[TOGGLEGROUP_PADDING]*(count - 1), bounds.height }, text[i], true); if (i == active) GuiToggleButton((Rectangle){ bounds.x + i*(bounds.width/count + style[TOGGLEGROUP_PADDING]), bounds.y, (bounds.width - style[TOGGLEGROUP_PADDING]*(count -1))/count, bounds.height }, text[i], true);
else if (GuiToggleButton((Rectangle){ bounds.x + i*(bounds.width/count + style[TOGGLEGROUP_PADDING]), bounds.y, bounds.width/count - style[TOGGLEGROUP_PADDING]*(count - 1), bounds.height }, text[i], false) == true) active = i; else if (GuiToggleButton((Rectangle){ bounds.x + i*(bounds.width/count + style[TOGGLEGROUP_PADDING]), bounds.y, (bounds.width - style[TOGGLEGROUP_PADDING]*(count -1))/count, bounds.height }, text[i], false) == true) active = i;
} }
return active; return active;
@ -2484,13 +2484,13 @@ RAYGUIDEF void GuiLoadStyle(const char *fileName)
(signature[2] == 'S') && (signature[2] == 'S') &&
(signature[3] == ' ')) (signature[3] == ' '))
{ {
while (!feof(rgsFile)) for (int i = 0; i < numProperties; i++)
{ {
fread(&id, 1, sizeof(short), rgsFile); fread(&id, 1, sizeof(short), rgsFile);
fread(&value, 1, sizeof(int), rgsFile); fread(&value, 1, sizeof(int), rgsFile);
if (id < NUM_PROPERTIES) style[id] = value; if (id < NUM_PROPERTIES) style[id] = value;
counter++; counter++;
} }
} }
else TraceLog(LOG_WARNING, "[raygui] Invalid style properties file"); else TraceLog(LOG_WARNING, "[raygui] Invalid style properties file");