From 7c9472c97ebf65e4e6de685c23a7887e068972f9 Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 9 May 2024 21:00:39 +0200 Subject: [PATCH] Update README.md --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index dd1653b..ea7daee 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,44 @@ - **Icons support**, embedding a complete 1-bit icons pack - Multiple **tools** provided for raygui development +## code sample +```c +#include "raylib.h" + +#define RAYGUI_IMPLEMENTATION +#include "raygui.h" + +int main() +{ + InitWindow(400, 200, "raygui - controls test suite"); + SetTargetFPS(60); + + bool showMessageBox = false; + + while (!WindowShouldClose()) + { + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); + + if (GuiButton((Rectangle){ 24, 24, 120, 30 }, "#191#Show Message")) showMessageBox = true; + + if (showMessageBox) + { + int result = GuiMessageBox((Rectangle){ 85, 70, 250, 100 }, "#191#Message Box", "Hi! This is a message!", "Nice;Cool"); + if (result >= 0) showMessageBox = false; + } + + EndDrawing(); + } + + CloseWindow(); + return 0; +} +``` +![screenshot000](https://github.com/raysan5/raygui/assets/5766837/170e2bce-b7ca-49dc-a263-32b673376546) + ## raygui controls ### basic controls