GuiCheckBoxEx and GuiLabelButton review
This commit is contained in:
parent
f4c043f302
commit
70c6eef9d1
@ -52,6 +52,8 @@ int main()
|
||||
|
||||
bool dropDown000EditMode = false;
|
||||
bool dropDown001EditMode = false;
|
||||
|
||||
bool forceSquaredChecked = false;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
Font font = LoadFontEx("fonts/NorthernLights.ttf", 30, 0, 0);
|
||||
@ -89,8 +91,10 @@ int main()
|
||||
|
||||
//GuiScrollPanel((Rectangle){ 325, 225, 225, 125 }, "SAMPLE TEXT");
|
||||
if (GuiDropdownBox((Rectangle){ 25, 75, 125, 30 }, DropdownBox000TextList, 3, &DropdownBox001Active, dropDown001EditMode)) dropDown001EditMode = !dropDown001EditMode;
|
||||
|
||||
//forceSquaredChecked = GuiCheckBoxEx((Rectangle){ 25, 65, 15, 15 }, forceSquaredChecked, "Force Square");
|
||||
GuiDisable();
|
||||
if (GuiDropdownBox((Rectangle){ 25, 25, 125, 30 }, DropdownBox000TextList, 3, &DropdownBox000Active, dropDown000EditMode)) dropDown000EditMode = !dropDown000EditMode;
|
||||
GuiEnable();
|
||||
|
||||
GuiLock();
|
||||
GuiState(0); if (GuiButton((Rectangle){ 25, 400, 125, 30 }, "SAMPLE TEXT")) Button005();
|
||||
|
14
src/raygui.h
14
src/raygui.h
@ -1197,7 +1197,7 @@ RAYGUIDEF bool GuiButton(Rectangle bounds, const char *text)
|
||||
RAYGUIDEF bool GuiLabelButton(Rectangle bounds, const char *text)
|
||||
{
|
||||
GuiControlState state = guiState;
|
||||
bool clicked = false;
|
||||
bool pressed = false;
|
||||
|
||||
int textWidth = GuiTextWidth(text);
|
||||
int textHeight = style[DEFAULT_TEXT_SIZE];
|
||||
@ -1211,12 +1211,13 @@ RAYGUIDEF bool GuiLabelButton(Rectangle bounds, const char *text)
|
||||
{
|
||||
Vector2 mousePoint = GetMousePosition();
|
||||
|
||||
// Check label state
|
||||
// Check checkbox state
|
||||
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||
{
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = PRESSED;
|
||||
else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) clicked = true;
|
||||
else state = FOCUSED;
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
@ -1233,7 +1234,7 @@ RAYGUIDEF bool GuiLabelButton(Rectangle bounds, const char *text)
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
return clicked;
|
||||
return pressed;
|
||||
}
|
||||
|
||||
// Image button control, returns true when clicked
|
||||
@ -1495,8 +1496,9 @@ RAYGUIDEF bool GuiCheckBoxEx(Rectangle bounds, bool checked, const char *text)
|
||||
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||
{
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = PRESSED;
|
||||
else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) checked = !checked;
|
||||
else state = FOCUSED;
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) checked = !checked;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
@ -1755,7 +1757,7 @@ RAYGUIDEF bool GuiDropdownBox(Rectangle bounds, const char **text, int count, in
|
||||
{
|
||||
DrawRectangle(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[DEFAULT_BASE_COLOR_DISABLED]), guiAlpha));
|
||||
DrawRectangleLinesEx(bounds, DROPDOWNBOX_BORDER_WIDTH, Fade(GetColor(style[LISTVIEW_BORDER_COLOR_DISABLED]), guiAlpha));
|
||||
GuiListElement((Rectangle){ bounds.x, bounds.y, bounds.width, bounds.height }, text[activeAux], false, true);
|
||||
GuiListElement((Rectangle){ bounds.x, bounds.y, bounds.width, bounds.height }, text[activeAux], false, false);
|
||||
|
||||
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 },
|
||||
|
Loading…
x
Reference in New Issue
Block a user