From 511c2254c9eee4970ce9673dc9739a915030c09b Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 3 Jul 2019 01:29:18 +0200 Subject: [PATCH] Update examples --- .../controls_test_suite/controls_test_suite.c | 6 +++++- examples/image_raw_importer/image_raw_importer.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/examples/controls_test_suite/controls_test_suite.c b/examples/controls_test_suite/controls_test_suite.c index 1916507..ddf7de2 100644 --- a/examples/controls_test_suite/controls_test_suite.c +++ b/examples/controls_test_suite/controls_test_suite.c @@ -79,6 +79,8 @@ int main() bool forceSquaredChecked = false; + float alphaValue = 0.5f; + int comboBoxActive = 1; int toggleGroupActive = 0; @@ -174,12 +176,14 @@ int main() sliderBarValue = GuiSliderBar((Rectangle){ 320, 430, 200, 20 }, NULL, sliderBarValue, 0, 100, true); progressValue = GuiProgressBar((Rectangle){ 320, 460, 200, 20 }, NULL, progressValue, 0, 1, true); - Rectangle view = GuiScrollPanel((Rectangle){ 560, 25, 100, 160 }, (Rectangle){ 560, 25, 100, 400 }, &viewScroll); + Rectangle view = GuiScrollPanel((Rectangle){ 560, 25, 100, 160 }, (Rectangle){ 560, 25, 200, 400 }, &viewScroll); GuiSetStyle(DEFAULT, INNER_PADDING, 10); GuiStatusBar((Rectangle){ 0, GetScreenHeight() - 20, GetScreenWidth(), 20 }, "This is a status bar"); GuiSetStyle(DEFAULT, INNER_PADDING, 2); + alphaValue = GuiColorBarAlpha((Rectangle){ 320, 490, 200, 30 }, alphaValue); + if (showMessageBox) { DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f)); diff --git a/examples/image_raw_importer/image_raw_importer.c b/examples/image_raw_importer/image_raw_importer.c index 0528744..14813e1 100644 --- a/examples/image_raw_importer/image_raw_importer.c +++ b/examples/image_raw_importer/image_raw_importer.c @@ -22,7 +22,7 @@ #include // Required for: strcpy() #include // Required for: atoi() - +#include // Required for: round() //------------------------------------------------------------------------------------ // Program main entry point @@ -168,14 +168,14 @@ int main() //---------------------------------------------------------------------------------- BeginDrawing(); - ClearBackground(GetColor(style[DEFAULT_BACKGROUND_COLOR])); + ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); if (texture.id != 0) { DrawTextureEx(texture, (Vector2){ screenWidth/2 - texture.width*imageScale/2, screenHeight/2 - texture.height*imageScale/2 }, 0, imageScale, WHITE); - DrawText(FormatText("SCALE x%.0f", imageScale), 20, screenHeight - 40, 20, GetColor(style[DEFAULT_LINES_COLOR])); + DrawText(FormatText("SCALE x%.0f", imageScale), 20, screenHeight - 40, 20, GetColor(GuiGetStyle(DEFAULT, LINE_COLOR))); } - else DrawText("drag & drop RAW image file", 320, 180, 10, GetColor(style[DEFAULT_LINES_COLOR])); + else DrawText("drag & drop RAW image file", 320, 180, 10, GetColor(GuiGetStyle(DEFAULT, LINE_COLOR))); // raygui: controls drawing //---------------------------------------------------------------------------------- @@ -195,14 +195,14 @@ int main() if (GuiValueBox((Rectangle){ windowOffset.x + 60, windowOffset.y + 130, 80, 25 }, &heightValue, 0, 8192, heightEditMode)) heightEditMode = !heightEditMode; GuiLabel((Rectangle){ windowOffset.x + 145, windowOffset.y + 130, 30, 25 }, "pixels"); GuiGroupBox((Rectangle){ windowOffset.x + 10, windowOffset.y + 180, 180, 160 }, "Pixel Format"); - pixelFormatActive = GuiComboBox((Rectangle){ windowOffset.x + 20, windowOffset.y + 195, 160, 25 }, pixelFormatTextList, 8, pixelFormatActive); - GuiLine((Rectangle){ windowOffset.x + 20, windowOffset.y + 220, 160, 20 }, 1); + pixelFormatActive = GuiComboBox((Rectangle){ windowOffset.x + 20, windowOffset.y + 195, 160, 25 }, TextJoin(pixelFormatTextList, 8, ";"), pixelFormatActive); + GuiLine((Rectangle){ windowOffset.x + 20, windowOffset.y + 220, 160, 20 }, NULL); if (pixelFormatActive != 0) GuiDisable(); GuiLabel((Rectangle){ windowOffset.x + 20, windowOffset.y + 235, 50, 20 }, "Channels:"); - channelsActive = GuiToggleGroup((Rectangle){ windowOffset.x + 20, windowOffset.y + 255, 159, 25 }, channelsTextList, 4, channelsActive); + channelsActive = GuiToggleGroup((Rectangle){ windowOffset.x + 20, windowOffset.y + 255, 156/4, 25 }, TextJoin(channelsTextList, 4, ";"), channelsActive); GuiLabel((Rectangle){ windowOffset.x + 20, windowOffset.y + 285, 50, 20 }, "Bit Depth:"); - bitDepthActive = GuiToggleGroup((Rectangle){ windowOffset.x + 20, windowOffset.y + 305, 159, 25 }, bitDepthTextList, 3, bitDepthActive); + bitDepthActive = GuiToggleGroup((Rectangle){ windowOffset.x + 20, windowOffset.y + 305, 160/3, 25 }, TextJoin(bitDepthTextList, 3, ";"), bitDepthActive); GuiEnable(); GuiGroupBox((Rectangle){ windowOffset.x + 10, windowOffset.y + 355, 180, 50 }, "Header");