Integrated 4.0-dev branch (#288)

* WARNING: Library redesign to support return result values

REVIEWED: All example projects

* REVIEWED: Cast values to improve Zig interconnection (#286)

* Update version and header info

* REVIEWED: `GuiListView()`, parameter order bug

* Update raygui.h

* REVIEWED: `GuiTabBar()` toggle logic

* Update raygui.h

* Update raygui.h
This commit is contained in:
Ray
2023-05-27 11:34:45 +02:00
committed by GitHub
parent 6e4530330d
commit 1af9a3960a
9 changed files with 340 additions and 270 deletions

View File

@ -43,6 +43,7 @@ int main()
Rectangle panelRec = { 20, 40, 200, 150 };
Rectangle panelContentRec = {0, 0, 340, 340 };
Rectangle panelView = { 0 };
Vector2 panelScroll = { 99, -20 };
bool showContentArea = true;
@ -66,20 +67,20 @@ int main()
DrawText(TextFormat("[%f, %f]", panelScroll.x, panelScroll.y), 4, 4, 20, RED);
Rectangle view = GuiScrollPanel(panelRec, NULL, panelContentRec, &panelScroll);
GuiScrollPanel(panelRec, NULL, panelContentRec, &panelScroll, &panelView);
BeginScissorMode(view.x, view.y, view.width, view.height);
GuiGrid((Rectangle){panelRec.x + panelScroll.x, panelRec.y + panelScroll.y, panelContentRec.width, panelContentRec.height}, NULL, 16, 3);
BeginScissorMode(panelView.x, panelView.y, panelView.width, panelView.height);
GuiGrid((Rectangle){panelRec.x + panelScroll.x, panelRec.y + panelScroll.y, panelContentRec.width, panelContentRec.height}, NULL, 16, 3, NULL);
EndScissorMode();
if (showContentArea) DrawRectangle(panelRec.x + panelScroll.x, panelRec.y + panelScroll.y, panelContentRec.width, panelContentRec.height, Fade(RED, 0.1));
DrawStyleEditControls();
showContentArea = GuiCheckBox((Rectangle){ 565, 80, 20, 20 }, "SHOW CONTENT AREA", showContentArea);
GuiCheckBox((Rectangle){ 565, 80, 20, 20 }, "SHOW CONTENT AREA", &showContentArea);
panelContentRec.width = GuiSliderBar((Rectangle){ 590, 385, 145, 15}, "WIDTH", TextFormat("%i", (int)panelContentRec.width), panelContentRec.width, 1, 600);
panelContentRec.height = GuiSliderBar((Rectangle){ 590, 410, 145, 15 }, "HEIGHT", TextFormat("%i", (int)panelContentRec.height), panelContentRec.height, 1, 400);
GuiSliderBar((Rectangle){ 590, 385, 145, 15}, "WIDTH", TextFormat("%i", (int)panelContentRec.width), &panelContentRec.width, 1, 600);
GuiSliderBar((Rectangle){ 590, 410, 145, 15 }, "HEIGHT", TextFormat("%i", (int)panelContentRec.height), &panelContentRec.height, 1, 400);
EndDrawing();
//----------------------------------------------------------------------------------
@ -115,8 +116,9 @@ static void DrawStyleEditControls(void)
GuiSpinner((Rectangle){ 670, 240, 90, 20 }, NULL, &style, 0, 14, false);
GuiSetStyle(SCROLLBAR, SLIDER_PADDING, style);
style = GuiCheckBox((Rectangle){ 565, 280, 20, 20 }, "ARROWS_VISIBLE", GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE));
GuiSetStyle(SCROLLBAR, ARROWS_VISIBLE, style);
bool scrollBarArrows = GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE);
GuiCheckBox((Rectangle){ 565, 280, 20, 20 }, "ARROWS_VISIBLE", &scrollBarArrows);
GuiSetStyle(SCROLLBAR, ARROWS_VISIBLE, scrollBarArrows);
style = GuiGetStyle(SCROLLBAR, SLIDER_PADDING);
GuiLabel((Rectangle){ 555, 325, 110, 10 }, "SLIDER_PADDING");
@ -129,8 +131,9 @@ static void DrawStyleEditControls(void)
GuiSetStyle(SCROLLBAR, SLIDER_WIDTH, style);
const char *text = GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE? "SCROLLBAR: LEFT" : "SCROLLBAR: RIGHT";
style = GuiToggle((Rectangle){ 560, 110, 200, 35 }, text, GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE));
GuiSetStyle(LISTVIEW, SCROLLBAR_SIDE, style);
bool toggleScrollBarSide = GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE);
GuiToggle((Rectangle){ 560, 110, 200, 35 }, text, &toggleScrollBarSide);
GuiSetStyle(LISTVIEW, SCROLLBAR_SIDE, toggleScrollBarSide);
//----------------------------------------------------------
// ScrollBar style controls