mirror of
https://github.com/raysan5/raygui.git
synced 2026-01-30 10:49:19 -05:00
Minor tweaks to correct issues
This commit is contained in:
@ -127,11 +127,11 @@ int main()
|
|||||||
|
|
||||||
// Fourth GUI column
|
// Fourth GUI column
|
||||||
GuiLock();
|
GuiLock();
|
||||||
GuiState(0); if (GuiButton((Rectangle){ 600, 25, 125, 30 }, "DISABLE")) { }
|
GuiState(GUI_STATE_NORMAL); if (GuiButton((Rectangle){ 600, 25, 125, 30 }, "NORMAL")) { }
|
||||||
GuiState(1); if (GuiButton((Rectangle){ 600, 65, 125, 30 }, "NORMAL")) { }
|
GuiState(GUI_STATE_FOCUSED); if (GuiButton((Rectangle){ 600, 65, 125, 30 }, "FOCUSED")) { }
|
||||||
GuiState(2); if (GuiButton((Rectangle){ 600, 105, 125, 30 }, "FOCUSED")) { }
|
GuiState(GUI_STATE_PRESSED); if (GuiButton((Rectangle){ 600, 105, 125, 30 }, "PRESSED")) { }
|
||||||
GuiState(3); if (GuiButton((Rectangle){ 600, 145, 125, 30 }, "PRESSED")) { }
|
GuiState(GUI_STATE_DISABLED); if (GuiButton((Rectangle){ 600, 145, 125, 30 }, "DISABLED")) { }
|
||||||
GuiState(1);
|
GuiState(GUI_STATE_NORMAL);
|
||||||
GuiUnlock();
|
GuiUnlock();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
22
src/raygui.h
22
src/raygui.h
@ -181,6 +181,14 @@
|
|||||||
} Rectangle;
|
} Rectangle;
|
||||||
#endif
|
#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
|
// Gui properties enumeration
|
||||||
typedef enum GuiProperty {
|
typedef enum GuiProperty {
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
@ -459,10 +467,10 @@ RAYGUIDEF void GuiUpdateStyleComplete(void); // Updat
|
|||||||
|
|
||||||
// GUI controls state
|
// GUI controls state
|
||||||
typedef enum GuiControlState {
|
typedef enum GuiControlState {
|
||||||
DISABLED = 0,
|
NORMAL = 0,
|
||||||
NORMAL,
|
|
||||||
FOCUSED,
|
FOCUSED,
|
||||||
PRESSED,
|
PRESSED,
|
||||||
|
DISABLED
|
||||||
} GuiControlState;
|
} GuiControlState;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@ -1018,6 +1026,8 @@ RAYGUIDEF void GuiGroupBox(Rectangle bounds, const char *text)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
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, 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));
|
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));
|
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;
|
} break;
|
||||||
case FOCUSED: break; // NOTE: State not used on this control
|
|
||||||
case PRESSED: break; // NOTE: State not used on this control
|
|
||||||
case DISABLED:
|
case DISABLED:
|
||||||
{
|
{
|
||||||
DrawRectangle(bounds.x, bounds.y, GROUPBOX_LINE_THICK, bounds.height, Fade(GetColor(style[DEFAULT_BORDER_COLOR_DISABLED]), guiAlpha));
|
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;
|
} break;
|
||||||
case FOCUSED:
|
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 },
|
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 },
|
(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)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
|
case FOCUSED:
|
||||||
|
case PRESSED:
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[PROGRESSBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
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));
|
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));
|
DrawRectangleRec(progress, Fade(GetColor(style[PROGRESSBAR_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
} break;
|
} break;
|
||||||
case FOCUSED: break; // NOTE: State not used on this control
|
|
||||||
case PRESSED: break; // NOTE: State not used on this control
|
|
||||||
case DISABLED:
|
case DISABLED:
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[PROGRESSBAR_BORDER_COLOR_DISABLED]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[PROGRESSBAR_BORDER_COLOR_DISABLED]), guiAlpha));
|
||||||
|
|||||||
Reference in New Issue
Block a user