mirror of
https://github.com/raysan5/raygui.git
synced 2025-12-25 10:22:33 -05:00
Minor tweaks to correct issues
This commit is contained in:
@ -127,11 +127,11 @@ int main()
|
||||
|
||||
// Fourth GUI column
|
||||
GuiLock();
|
||||
GuiState(0); if (GuiButton((Rectangle){ 600, 25, 125, 30 }, "DISABLE")) { }
|
||||
GuiState(1); if (GuiButton((Rectangle){ 600, 65, 125, 30 }, "NORMAL")) { }
|
||||
GuiState(2); if (GuiButton((Rectangle){ 600, 105, 125, 30 }, "FOCUSED")) { }
|
||||
GuiState(3); if (GuiButton((Rectangle){ 600, 145, 125, 30 }, "PRESSED")) { }
|
||||
GuiState(1);
|
||||
GuiState(GUI_STATE_NORMAL); if (GuiButton((Rectangle){ 600, 25, 125, 30 }, "NORMAL")) { }
|
||||
GuiState(GUI_STATE_FOCUSED); if (GuiButton((Rectangle){ 600, 65, 125, 30 }, "FOCUSED")) { }
|
||||
GuiState(GUI_STATE_PRESSED); if (GuiButton((Rectangle){ 600, 105, 125, 30 }, "PRESSED")) { }
|
||||
GuiState(GUI_STATE_DISABLED); if (GuiButton((Rectangle){ 600, 145, 125, 30 }, "DISABLED")) { }
|
||||
GuiState(GUI_STATE_NORMAL);
|
||||
GuiUnlock();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
22
src/raygui.h
22
src/raygui.h
@ -181,6 +181,14 @@
|
||||
} Rectangle;
|
||||
#endif
|
||||
|
||||
// Gui global state enum
|
||||
typedef enum GuiStateMode {
|
||||
GUI_STATE_NORMAL = 0,
|
||||
GUI_STATE_FOCUSED,
|
||||
GUI_STATE_PRESSED,
|
||||
GUI_STATE_DISABLE,
|
||||
} GuiStateMode;
|
||||
|
||||
// Gui properties enumeration
|
||||
typedef enum GuiProperty {
|
||||
//--------------------------------------------
|
||||
@ -459,10 +467,10 @@ RAYGUIDEF void GuiUpdateStyleComplete(void); // Updat
|
||||
|
||||
// GUI controls state
|
||||
typedef enum GuiControlState {
|
||||
DISABLED = 0,
|
||||
NORMAL,
|
||||
NORMAL = 0,
|
||||
FOCUSED,
|
||||
PRESSED,
|
||||
DISABLED
|
||||
} GuiControlState;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -1018,6 +1026,8 @@ RAYGUIDEF void GuiGroupBox(Rectangle bounds, const char *text)
|
||||
switch (state)
|
||||
{
|
||||
case NORMAL:
|
||||
case FOCUSED:
|
||||
case PRESSED:
|
||||
{
|
||||
DrawRectangle(bounds.x, bounds.y, GROUPBOX_LINE_THICK, bounds.height, Fade(GetColor(style[DEFAULT_LINES_COLOR]), guiAlpha));
|
||||
DrawRectangle(bounds.x, bounds.y + bounds.height - 1, bounds.width, GROUPBOX_LINE_THICK, Fade(GetColor(style[DEFAULT_LINES_COLOR]), guiAlpha));
|
||||
@ -1030,8 +1040,6 @@ RAYGUIDEF void GuiGroupBox(Rectangle bounds, const char *text)
|
||||
GuiDrawText(text, bounds.x + GROUPBOX_TEXT_PADDING + 2*GROUPBOX_PADDING, bounds.y - 2*GROUPBOX_PADDING - GROUPBOX_LINE_THICK, Fade(GetColor(style[LABEL_TEXT_COLOR_NORMAL]), guiAlpha));
|
||||
}
|
||||
} break;
|
||||
case FOCUSED: break; // NOTE: State not used on this control
|
||||
case PRESSED: break; // NOTE: State not used on this control
|
||||
case DISABLED:
|
||||
{
|
||||
DrawRectangle(bounds.x, bounds.y, GROUPBOX_LINE_THICK, bounds.height, Fade(GetColor(style[DEFAULT_BORDER_COLOR_DISABLED]), guiAlpha));
|
||||
@ -1675,7 +1683,7 @@ RAYGUIDEF bool GuiDropdownBox(Rectangle bounds, const char **text, int count, in
|
||||
} break;
|
||||
case FOCUSED:
|
||||
{
|
||||
GuiListElement((Rectangle){ bounds.x, bounds.y, bounds.width, bounds.height }, text[auxActive], false, true);
|
||||
GuiListElement((Rectangle){ bounds.x, bounds.y, bounds.width, bounds.height }, text[auxActive], false, editMode);
|
||||
|
||||
DrawTriangle((Vector2){ bounds.x + bounds.width - DROPDOWNBOX_ARROW_RIGHT_PADDING, bounds.y + bounds.height/2 - 2 },
|
||||
(Vector2){ bounds.x + bounds.width - DROPDOWNBOX_ARROW_RIGHT_PADDING + 5, bounds.y + bounds.height/2 - 2 + 5 },
|
||||
@ -2446,13 +2454,13 @@ RAYGUIDEF float GuiProgressBarEx(Rectangle bounds, float value, float minValue,
|
||||
switch (state)
|
||||
{
|
||||
case NORMAL:
|
||||
case FOCUSED:
|
||||
case PRESSED:
|
||||
{
|
||||
DrawRectangleLinesEx(bounds, style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[PROGRESSBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||
DrawRectangle(bounds.x + style[PROGRESSBAR_BORDER_WIDTH], bounds.y + style[PROGRESSBAR_BORDER_WIDTH], bounds.width - 2*style[PROGRESSBAR_BORDER_WIDTH], bounds.height - 2*style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[DEFAULT_BACKGROUND_COLOR]), guiAlpha));
|
||||
DrawRectangleRec(progress, Fade(GetColor(style[PROGRESSBAR_BASE_COLOR_NORMAL]), guiAlpha));
|
||||
} break;
|
||||
case FOCUSED: break; // NOTE: State not used on this control
|
||||
case PRESSED: break; // NOTE: State not used on this control
|
||||
case DISABLED:
|
||||
{
|
||||
DrawRectangleLinesEx(bounds, style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[PROGRESSBAR_BORDER_COLOR_DISABLED]), guiAlpha));
|
||||
|
||||
Reference in New Issue
Block a user