diff --git a/examples/gui/basic_controls/cyber.png b/examples/gui/basic_controls/cyber.png deleted file mode 100644 index 219a009..0000000 Binary files a/examples/gui/basic_controls/cyber.png and /dev/null differ diff --git a/examples/gui/basic_controls/lavanda.png b/examples/gui/basic_controls/lavanda.png deleted file mode 100644 index d3a53c8..0000000 Binary files a/examples/gui/basic_controls/lavanda.png and /dev/null differ diff --git a/examples/gui/basic_controls/main.go b/examples/gui/basic_controls/main.go deleted file mode 100644 index b51838f..0000000 --- a/examples/gui/basic_controls/main.go +++ /dev/null @@ -1,90 +0,0 @@ -package main - -import ( - "fmt" - "strings" - - gui "github.com/gen2brain/raylib-go/raygui" - rl "github.com/gen2brain/raylib-go/raylib" -) - -func main() { - screenWidth := int32(800) - screenHeight := int32(450) - - rl.SetConfigFlags(rl.FlagVsyncHint) - - rl.InitWindow(screenWidth, screenHeight, "raylib [gui] example - basic controls") - - buttonToggle := true - buttonClicked := false - checkboxChecked := false - - spinnerValue := int32(5) - sliderValue := float32(10) - sliderBarValue := float32(70) - progressValue := float32(0.5) - - comboActive := int32(0) - comboLastActive := int32(0) - toggleActive := int32(0) - - toggleText := "Item 1;Item 2;Item 3" - comboText := []string{ - "ashes", "bluish", "candy", "cherry", "cyber", "dark", - "default", "enefete", "jungle", "lavanda", "sunny", "terminal", - } - comboList := strings.Join(comboText, ";") - - rl.SetTargetFPS(60) - - for !rl.WindowShouldClose() { - if buttonClicked { - progressValue += 0.1 - if progressValue >= 1.1 { - progressValue = 0.0 - } - } - - rl.BeginDrawing() - - rl.ClearBackground(rl.Beige) - - gui.Label(rl.NewRectangle(50, 50, 80, 20), "Label") - - buttonClicked = gui.Button(rl.NewRectangle(50, 70, 80, 40), "Button") - - checkboxChecked = gui.CheckBox(rl.NewRectangle(50, 140, 20, 20), "Checkbox", checkboxChecked) - - gui.ProgressBar(rl.NewRectangle(50, 210, 200, 20), - fmt.Sprintf("%.1f", progressValue), - "ProgressBar", - progressValue, 0, 1) - - sliderValue = gui.Slider(rl.NewRectangle(50, 280, 200, 20), "Slider", "", sliderValue, 0, 100) - gui.Label(rl.NewRectangle(200+50+5, 280, 20, 20), fmt.Sprintf("%.0f", sliderValue)) - - buttonToggle = gui.Toggle(rl.NewRectangle(50, 350, 100, 40), "ButtonToggle", buttonToggle) - - toggleActive = gui.ToggleGroup(rl.NewRectangle(500, 70, 60, 30), toggleText, toggleActive) - - sliderBarValue = gui.SliderBar(rl.NewRectangle(500, 140, 200, 20), "SliderBar", "", sliderBarValue, 0, 100) - gui.Label(rl.NewRectangle(500+200+5, 140, 20, 20), fmt.Sprintf("%.0f", sliderBarValue)) - - _ = gui.Spinner(rl.NewRectangle(500, 210, 200, 20), "Spinner", &spinnerValue, 0, 100, true) - - gui.Label(rl.NewRectangle(500, 260, 200, 20), "ComboBox") - comboActive = gui.ComboBox(rl.NewRectangle(500, 280, 200, 20), comboList, comboActive) - - if comboLastActive != comboActive { - ch := comboText[comboActive] // choosed name - filename := fmt.Sprintf("styles/%s/%s.rgs", ch, ch) - gui.LoadStyle(filename) - comboLastActive = comboActive - } - - rl.EndDrawing() - } - - rl.CloseWindow() -} diff --git a/examples/gui/basic_controls/styles/README.md b/examples/gui/basic_controls/styles/README.md deleted file mode 100644 index b78e6f3..0000000 --- a/examples/gui/basic_controls/styles/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# raygui styles - -`raygui` comes with **12 custom styles** carefully designed for the best visual experience. Those styles have been created using [rGuiStyler](https://raylibtech.itch.io/rguistyler) tool and they complement internal [default style](default), always available by `raygui`. - -## styles usage - -To use those styles with your `raygui` development, you need to call `GuiLoadStyle()` function at initialization, passing the `.rgs` file to load. Note that `.rgs` is by default a binary file containing the style required font data (glyphs data + glyph atlas image data). - -Styles can also be embedded in the code if desired, `.h` files are provided with every style containing all the required style data, including the font data. To embed those fonts just add the `.h` to your project and call the required function as specified in the header info. - -Here it is a quick overview of those styles, you can navigate to each directory for additional information. - -#### 1. style: [default](default) -![default style](default/style_table.png) - -#### 2. style: [dark](dark) -![dark style](dark/style_table.png) - -#### 3. style: [bluish](bluish) -![bluish style](bluish/style_table.png) - -#### 4. style: [candy](candy) -![candy style](candy/style_table.png) - -#### 5. style: [cherry](cherry) -![cherry style](cherry/style_table.png) - -#### 6. style: [cyber](cyber) -![cyber style](cyber/style_table.png) - -#### 7. style: [jungle](jungle) -![jungle style](jungle/style_table.png) - -#### 8. style: [lavanda](lavanda) -![lavanda style](lavanda/style_table.png) - -#### 9. style: [terminal](terminal) -![terminal style](terminal/style_table.png) - -#### 10. style: [sunny](sunny) -![sunny style](sunny/style_table.png) - -#### 11. style: [ashes](ashes) -![ashes style](ashes/style_table.png) - -#### 12. enefete: [enefete](enefete) -![enefete style](enefete/style_table.png) - - -*NOTE: Those styles require raylib 4.0 and raygui 3.1.* diff --git a/examples/gui/basic_controls/styles/ashes/README.md b/examples/gui/basic_controls/styles/ashes/README.md deleted file mode 100644 index dc8adc0..0000000 --- a/examples/gui/basic_controls/styles/ashes/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: ashes -------------- -What once was life now is ashes, just as slight reminiscense covers the ground, a gray sequence of tones that reminds to a distant past. - -![ashes style table](style_table.png) - -screenshot ------------ - -![ashes style screen](screenshot.png) - -about font ------------ -"V5 Loxica Lixera" font by vFive Digital (Roberto Christen). - -100% free font, downloaded from dafont.com: [v5loxica-lixera](https://www.dafont.com/v5loxica-lixera.font) diff --git a/examples/gui/basic_controls/styles/ashes/ashes.h b/examples/gui/basic_controls/styles/ashes/ashes.h deleted file mode 100644 index f301ff2..0000000 --- a/examples/gui/basic_controls/styles/ashes/ashes.h +++ /dev/null @@ -1,338 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleAshes(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define ASHES_STYLE_PROPS_COUNT 15 - -// Custom style name: ashes -static const GuiStyleProp ashesStyleProps[ASHES_STYLE_PROPS_COUNT] = { - { 0, 0, 0xf0f0f0ff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0x868686ff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0xe6e6e6ff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0x929999ff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0xeaeaeaff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0x98a1a8ff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0x3f3f3fff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0xf6f6f6ff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0x414141ff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0x8b8b8bff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0x777777ff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0x959595ff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 16, 0x00000010 }, // DEFAULT_TEXT_SIZE - { 0, 18, 0x9dadb1ff }, // DEFAULT_LINE_COLOR - { 0, 19, 0x6b6b6bff }, // DEFAULT_BACKGROUND_COLOR -}; - -// WARNING: This style uses a custom font: (size: 16, spacing: 1) - -#define ASHES_COMPRESSED_DATA_SIZE 999 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char ashesFontData[ASHES_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0x4b, 0x96, 0x9b, 0x30, 0x10, 0x05, 0x50, 0xed, 0x7f, 0xd3, 0x95, 0x51, 0x4e, 0x3e, 0xa7, 0x31, 0x54, 0xa9, 0x64, - 0x7e, 0x37, 0x77, 0xd6, 0xed, 0x60, 0x9a, 0x87, 0xc0, 0x36, 0x0f, 0x39, 0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00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x5b, 0xfa, 0x05 }; - -// Font characters rectangles data -static const Rectangle ashesFontRecs[95] = { - { 4, 4, 4 , 16 }, - { 16, 4, 1 , 10 }, - { 25, 4, 3 , 3 }, - { 36, 4, 6 , 8 }, - { 50, 4, 5 , 11 }, - { 63, 4, 7 , 8 }, - { 78, 4, 6 , 9 }, - { 92, 4, 1 , 3 }, - { 101, 4, 3 , 12 }, - { 112, 4, 3 , 12 }, - { 123, 4, 5 , 5 }, - { 136, 4, 5 , 5 }, - { 149, 4, 2 , 2 }, - { 159, 4, 4 , 1 }, - { 171, 4, 1 , 1 }, - { 180, 4, 5 , 10 }, - { 193, 4, 4 , 8 }, - { 205, 4, 2 , 8 }, - { 215, 4, 4 , 8 }, - { 227, 4, 4 , 8 }, - { 239, 4, 6 , 8 }, - { 4, 28, 4 , 8 }, - { 16, 28, 4 , 8 }, - { 28, 28, 4 , 8 }, - { 40, 28, 4 , 8 }, - { 52, 28, 4 , 8 }, - { 64, 28, 1 , 5 }, - { 73, 28, 2 , 6 }, - { 83, 28, 4 , 7 }, - { 95, 28, 4 , 4 }, - { 107, 28, 4 , 7 }, - { 119, 28, 4 , 10 }, - { 131, 28, 8 , 7 }, - { 147, 28, 4 , 10 }, - { 159, 28, 4 , 10 }, - { 171, 28, 4 , 10 }, - { 183, 28, 4 , 10 }, - { 195, 28, 4 , 10 }, - { 207, 28, 5 , 10 }, - { 220, 28, 4 , 10 }, - { 232, 28, 4 , 10 }, - { 4, 52, 1 , 10 }, - { 13, 52, 3 , 10 }, - { 24, 52, 4 , 10 }, - { 36, 52, 4 , 10 }, - { 48, 52, 7 , 10 }, - { 63, 52, 4 , 10 }, - { 75, 52, 4 , 10 }, - { 87, 52, 4 , 10 }, - { 99, 52, 5 , 11 }, - { 112, 52, 4 , 10 }, - { 124, 52, 4 , 10 }, - { 136, 52, 5 , 10 }, - { 149, 52, 4 , 10 }, - { 161, 52, 4 , 10 }, - { 173, 52, 7 , 10 }, - { 188, 52, 4 , 10 }, - { 200, 52, 4 , 10 }, - { 212, 52, 4 , 10 }, - { 224, 52, 2 , 12 }, - { 234, 52, 5 , 10 }, - { 4, 76, 2 , 12 }, - { 14, 76, 5 , 3 }, - { 27, 76, 5 , 1 }, - { 40, 76, 2 , 2 }, - { 50, 76, 4 , 8 }, - { 62, 76, 4 , 10 }, - { 74, 76, 3 , 8 }, - { 85, 76, 4 , 10 }, - { 97, 76, 4 , 8 }, - { 109, 76, 3 , 10 }, - { 120, 76, 5 , 11 }, - { 133, 76, 4 , 10 }, - { 145, 76, 1 , 10 }, - { 154, 76, 3 , 13 }, - { 165, 76, 4 , 10 }, - { 177, 76, 2 , 10 }, - { 187, 76, 7 , 8 }, - { 202, 76, 4 , 8 }, - { 214, 76, 4 , 8 }, - { 226, 76, 4 , 11 }, - { 238, 76, 4 , 11 }, - { 4, 100, 3 , 8 }, - { 15, 100, 4 , 8 }, - { 27, 100, 3 , 10 }, - { 38, 100, 4 , 8 }, - { 50, 100, 5 , 8 }, - { 63, 100, 7 , 8 }, - { 78, 100, 4 , 8 }, - { 90, 100, 4 , 11 }, - { 102, 100, 4 , 8 }, - { 114, 100, 4 , 12 }, - { 126, 100, 1 , 10 }, - { 135, 100, 4 , 12 }, - { 147, 100, 4 , 2 }, -}; - -// Font characters info data -// NOTE: No chars.image data provided -static const GlyphInfo ashesFontChars[95] = { - { 32, 0, 13, 4, { 0 }}, - { 33, 0, 3, 4, { 0 }}, - { 34, 0, 1, 5, { 0 }}, - { 35, 0, 4, 8, { 0 }}, - { 36, 0, 2, 7, { 0 }}, - { 37, 0, 5, 9, { 0 }}, - { 38, 0, 4, 8, { 0 }}, - { 39, 0, 1, 3, { 0 }}, - { 40, 0, 2, 5, { 0 }}, - { 41, 0, 2, 5, { 0 }}, - { 42, 0, 3, 7, { 0 }}, - { 43, 0, 6, 7, { 0 }}, - { 44, 0, 12, 4, { 0 }}, - { 45, 0, 9, 5, { 0 }}, - { 46, 0, 12, 3, { 0 }}, - { 47, 0, 3, 7, { 0 }}, - { 48, 0, 5, 6, { 0 }}, - { 49, 0, 5, 4, { 0 }}, - { 50, 0, 5, 6, { 0 }}, - { 51, 0, 5, 6, { 0 }}, - { 52, 0, 5, 8, { 0 }}, - { 53, 0, 5, 6, { 0 }}, - { 54, 0, 5, 6, { 0 }}, - { 55, 0, 5, 6, { 0 }}, - { 56, 0, 5, 6, { 0 }}, - { 57, 0, 5, 6, { 0 }}, - { 58, 0, 8, 3, { 0 }}, - { 59, 0, 8, 4, { 0 }}, - { 60, 0, 5, 6, { 0 }}, - { 61, 0, 7, 7, { 0 }}, - { 62, 0, 5, 6, { 0 }}, - { 63, 1, 3, 7, { 0 }}, - { 64, 0, 5, 10, { 0 }}, - { 65, 0, 3, 6, { 0 }}, - { 66, 0, 3, 6, { 0 }}, - { 67, 0, 3, 6, { 0 }}, - { 68, 0, 3, 6, { 0 }}, - { 69, 0, 3, 6, { 0 }}, - { 70, 0, 3, 6, { 0 }}, - { 71, 0, 3, 6, { 0 }}, - { 72, 0, 3, 6, { 0 }}, - { 73, 0, 3, 3, { 0 }}, - { 74, 0, 3, 5, { 0 }}, - { 75, 0, 3, 6, { 0 }}, - { 76, 0, 3, 6, { 0 }}, - { 77, 0, 3, 9, { 0 }}, - { 78, 0, 3, 6, { 0 }}, - { 79, 0, 3, 6, { 0 }}, - { 80, 0, 3, 6, { 0 }}, - { 81, 0, 3, 7, { 0 }}, - { 82, 0, 3, 6, { 0 }}, - { 83, 0, 3, 6, { 0 }}, - { 84, 0, 3, 6, { 0 }}, - { 85, 0, 3, 6, { 0 }}, - { 86, 0, 3, 6, { 0 }}, - { 87, 0, 3, 9, { 0 }}, - { 88, 0, 3, 6, { 0 }}, - { 89, 0, 3, 6, { 0 }}, - { 90, 0, 3, 6, { 0 }}, - { 91, 0, 2, 4, { 0 }}, - { 92, 0, 3, 7, { 0 }}, - { 93, 0, 2, 4, { 0 }}, - { 94, 0, 3, 7, { 0 }}, - { 95, 0, 12, 7, { 0 }}, - { 96, 0, 1, 4, { 0 }}, - { 97, 0, 5, 6, { 0 }}, - { 98, 0, 3, 6, { 0 }}, - { 99, 0, 5, 5, { 0 }}, - { 100, 0, 3, 6, { 0 }}, - { 101, 0, 5, 6, { 0 }}, - { 102, 0, 3, 5, { 0 }}, - { 103, 0, 5, 6, { 0 }}, - { 104, 0, 3, 6, { 0 }}, - { 105, 0, 3, 3, { 0 }}, - { 106, 0, 3, 5, { 0 }}, - { 107, 0, 3, 6, { 0 }}, - { 108, 0, 3, 4, { 0 }}, - { 109, 0, 5, 9, { 0 }}, - { 110, 0, 5, 6, { 0 }}, - { 111, 0, 5, 6, { 0 }}, - { 112, 0, 5, 6, { 0 }}, - { 113, 0, 5, 6, { 0 }}, - { 114, 0, 5, 5, { 0 }}, - { 115, 0, 5, 6, { 0 }}, - { 116, 0, 3, 5, { 0 }}, - { 117, 0, 5, 6, { 0 }}, - { 118, 0, 5, 7, { 0 }}, - { 119, 0, 5, 9, { 0 }}, - { 120, 0, 5, 6, { 0 }}, - { 121, 0, 5, 6, { 0 }}, - { 122, 0, 5, 6, { 0 }}, - { 123, 0, 2, 6, { 0 }}, - { 124, 0, 3, 3, { 0 }}, - { 125, 0, 2, 6, { 0 }}, - { 126, 0, 1, 6, { 0 }}, -}; - -// Style loading function: ashes -static void GuiLoadStyleAshes(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < ASHES_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(ashesStyleProps[i].controlId, ashesStyleProps[i].propertyId, ashesStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int ashesFontDataSize = 0; - unsigned char *data = DecompressData(ashesFontData, ASHES_COMPRESSED_DATA_SIZE, &ashesFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 16; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, ashesFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, ashesFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - Rectangle whiteChar = { 37, 6, 1, 1 }; - SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/ashes/ashes.rgs b/examples/gui/basic_controls/styles/ashes/ashes.rgs deleted file mode 100644 index f491d68..0000000 Binary files a/examples/gui/basic_controls/styles/ashes/ashes.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/ashes/ashes.txt.rgs b/examples/gui/basic_controls/styles/ashes/ashes.txt.rgs deleted file mode 100644 index 45ab7bd..0000000 --- a/examples/gui/basic_controls/styles/ashes/ashes.txt.rgs +++ /dev/null @@ -1,24 +0,0 @@ -# -# rgs style text file (v3.1) - raygui style file generated using rGuiStyler -# -# Style properties: -# f -# p -# -f 16 0 v5loxical.ttf -p 00 00 0xf0f0f0ff DEFAULT_BORDER_COLOR_NORMAL -p 00 01 0x868686ff DEFAULT_BASE_COLOR_NORMAL -p 00 02 0xe6e6e6ff DEFAULT_TEXT_COLOR_NORMAL -p 00 03 0x929999ff DEFAULT_BORDER_COLOR_FOCUSED -p 00 04 0xeaeaeaff DEFAULT_BASE_COLOR_FOCUSED -p 00 05 0x98a1a8ff DEFAULT_TEXT_COLOR_FOCUSED -p 00 06 0x3f3f3fff DEFAULT_BORDER_COLOR_PRESSED -p 00 07 0xf6f6f6ff DEFAULT_BASE_COLOR_PRESSED -p 00 08 0x414141ff DEFAULT_TEXT_COLOR_PRESSED -p 00 09 0x8b8b8bff DEFAULT_BORDER_COLOR_DISABLED -p 00 10 0x777777ff DEFAULT_BASE_COLOR_DISABLED -p 00 11 0x959595ff DEFAULT_TEXT_COLOR_DISABLED -p 00 16 0x00000010 TEXT_SIZE -p 00 17 0x00000001 TEXT_SPACING -p 00 18 0x9dadb1ff DEFAULT_LINE_COLOR -p 00 19 0x6b6b6bff DEFAULT_BACKGROUND_COLOR diff --git a/examples/gui/basic_controls/styles/ashes/font_readme.txt b/examples/gui/basic_controls/styles/ashes/font_readme.txt deleted file mode 100644 index 1a6b338..0000000 --- a/examples/gui/basic_controls/styles/ashes/font_readme.txt +++ /dev/null @@ -1,51 +0,0 @@ - -V5 Loxica ---------------- -Instructions: - - -++ Loxica (LIXERA) ++ - -For screen use, set at 16pt. Turn -antialiasing off. Set tracking to zero -for best results. - -++ Loxica (ROBUSTA) ++ - -For screen use, set at 18pt. Turn -antialiasing off. Set tracking to zero -for best results. - - -Notes: - -1. These faces do not contain any hinting -information since they were built for use -at the sizes listed above. Naturally, for -print use you are free to experiment. - -2. Although the intended size for _lixera_ -is 16pt (vs. 18pt for _robusta_), they share -the same optical size (where lixera is the -regular weight, and robusta is the bold). - -3. Pronounciation: "lo-hee-ka lee-he-ra", and -"lo-hee-ka ro-bus-ta." - - - ---------------- -Usage: This is a free font--you may use -this and other V5 fonts at will. It may not -be sold, altered, or improperly credited, -however. All I ask is that you kindly inform -me if you find this font useful, and where -you've used it. - -Enjoy, - -©2000 -Roberto Christen -rob@vfive.com - - diff --git a/examples/gui/basic_controls/styles/ashes/screenshot.png b/examples/gui/basic_controls/styles/ashes/screenshot.png deleted file mode 100644 index f86859a..0000000 Binary files a/examples/gui/basic_controls/styles/ashes/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/ashes/style_table.png b/examples/gui/basic_controls/styles/ashes/style_table.png deleted file mode 100644 index 8fcee09..0000000 Binary files a/examples/gui/basic_controls/styles/ashes/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/ashes/v5loxical.ttf b/examples/gui/basic_controls/styles/ashes/v5loxical.ttf deleted file mode 100644 index 61501cb..0000000 Binary files a/examples/gui/basic_controls/styles/ashes/v5loxical.ttf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/bluish/README.md b/examples/gui/basic_controls/styles/bluish/README.md deleted file mode 100644 index 1057dde..0000000 --- a/examples/gui/basic_controls/styles/bluish/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: bluish --------------- -Like a breeze, a slight touch of color cover the clear sky, a spacious and relaxing feeling. - -![bluish style table](style_table.png) - -screenshot ------------ - -![bluish style screen](screenshot.png) - -about font ------------ -"Homespun BRK" font by AEnigma (Brian Kent). - -100% free font, downloaded from dafont.com: [homespun-brk](https://www.dafont.com/homespun-brk.font) diff --git a/examples/gui/basic_controls/styles/bluish/bluish.h b/examples/gui/basic_controls/styles/bluish/bluish.h deleted file mode 100644 index 6020210..0000000 --- a/examples/gui/basic_controls/styles/bluish/bluish.h +++ /dev/null @@ -1,359 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleBluish(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define BLUISH_STYLE_PROPS_COUNT 14 - -// Custom style name: bluish -static const GuiStyleProp bluishStyleProps[BLUISH_STYLE_PROPS_COUNT] = { - { 0, 0, 0x5ca6a6ff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0xb4e8f3ff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0x447e77ff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0x5f8792ff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0xcdeff7ff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0x4c6c74ff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0x3b5b5fff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0xeaffffff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0x275057ff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0x96aaacff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0xc8d7d9ff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0x8c9c9eff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 18, 0x84adb7ff }, // DEFAULT_LINE_COLOR - { 0, 19, 0xe8eef1ff }, // DEFAULT_BACKGROUND_COLOR -}; - -// WARNING: This style uses a custom font: (size: 10, spacing: 1) - -#define BLUISH_COMPRESSED_DATA_SIZE 1423 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char bluishFontData[BLUISH_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0xd1, 0x72, 0x9b, 0x3a, 0x10, 0x00, 0x50, 0xc4, 0xff, 0x7f, 0x72, 0x41, 0x77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0xa3, 0xb7, - 0x42, 0x48, 0x4f, 0x6e, 0x4f, 0x79, 0x48, 0x8d, 0x8d, 0x6c, 0x85, 0x90, 0xf3, 0xf7, 0xff, 0xe7, 0xee, 0x54, 0xdf, 0x53, - 0x67, 0xa3, 0x27, 0x4f, 0xe7, 0xaa, 0x9d, 0xf9, 0xfc, 0xee, 0x7c, 0x26, 0xb7, 0x52, 0x65, 0x97, 0x51, 0x79, 0x3a, 0x4f, - 0xf2, 0x94, 0x67, 0x9e, 0xf1, 0xa4, 0x73, 0xda, 0x1a, 0xfc, 0xdb, 0x59, 0x5e, 0xd6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x2f, - 0xf0, 0x1f }; - -// Font characters rectangles data -static const Rectangle bluishFontRecs[95] = { - { 4, 4, 5 , 10 }, - { 17, 4, 2 , 8 }, - { 27, 4, 4 , 3 }, - { 39, 4, 6 , 8 }, - { 53, 4, 5 , 10 }, - { 66, 4, 6 , 8 }, - { 80, 4, 5 , 10 }, - { 93, 4, 2 , 3 }, - { 103, 4, 3 , 8 }, - { 114, 4, 3 , 8 }, - { 125, 4, 6 , 6 }, - { 139, 4, 6 , 6 }, - { 153, 4, 2 , 3 }, - { 163, 4, 5 , 2 }, - { 176, 4, 2 , 2 }, - { 186, 4, 6 , 8 }, - { 200, 4, 5 , 8 }, - { 213, 4, 3 , 8 }, - { 224, 4, 5 , 8 }, - { 237, 4, 5 , 8 }, - { 4, 22, 5 , 8 }, - { 17, 22, 5 , 8 }, - { 30, 22, 5 , 8 }, - { 43, 22, 5 , 8 }, - { 56, 22, 5 , 8 }, - { 69, 22, 5 , 8 }, - { 82, 22, 2 , 8 }, - { 92, 22, 2 , 9 }, - { 102, 22, 4 , 6 }, - { 114, 22, 5 , 4 }, - { 127, 22, 4 , 6 }, - { 139, 22, 5 , 8 }, - { 152, 22, 6 , 8 }, - { 166, 22, 5 , 8 }, - { 179, 22, 5 , 8 }, - { 192, 22, 5 , 8 }, - { 205, 22, 5 , 8 }, - { 218, 22, 5 , 8 }, - { 231, 22, 5 , 8 }, - { 4, 40, 5 , 8 }, - { 17, 40, 5 , 8 }, - { 30, 40, 4 , 8 }, - { 42, 40, 5 , 8 }, - { 55, 40, 5 , 8 }, - { 68, 40, 5 , 8 }, - { 81, 40, 8 , 8 }, - { 97, 40, 5 , 8 }, - { 110, 40, 5 , 8 }, - { 123, 40, 5 , 8 }, - { 136, 40, 5 , 9 }, - { 149, 40, 5 , 8 }, - { 162, 40, 5 , 8 }, - { 175, 40, 6 , 8 }, - { 189, 40, 5 , 8 }, - { 202, 40, 5 , 8 }, - { 215, 40, 8 , 8 }, - { 231, 40, 5 , 8 }, - { 4, 58, 5 , 8 }, - { 17, 58, 5 , 8 }, - { 30, 58, 3 , 8 }, - { 41, 58, 6 , 8 }, - { 55, 58, 3 , 8 }, - { 66, 58, 6 , 4 }, - { 80, 58, 5 , 1 }, - { 93, 58, 2 , 3 }, - { 103, 58, 5 , 6 }, - { 116, 58, 5 , 8 }, - { 129, 58, 5 , 6 }, - { 142, 58, 5 , 8 }, - { 155, 58, 5 , 6 }, - { 168, 58, 5 , 8 }, - { 181, 58, 5 , 7 }, - { 194, 58, 5 , 8 }, - { 207, 58, 2 , 8 }, - { 217, 58, 3 , 9 }, - { 228, 58, 5 , 8 }, - { 241, 58, 2 , 8 }, - { 4, 76, 8 , 6 }, - { 20, 76, 5 , 6 }, - { 33, 76, 5 , 6 }, - { 46, 76, 5 , 7 }, - { 59, 76, 5 , 7 }, - { 72, 76, 5 , 6 }, - { 85, 76, 5 , 6 }, - { 98, 76, 5 , 8 }, - { 111, 76, 5 , 6 }, - { 124, 76, 5 , 6 }, - { 137, 76, 8 , 6 }, - { 153, 76, 5 , 6 }, - { 166, 76, 5 , 7 }, - { 179, 76, 5 , 6 }, - { 192, 76, 4 , 8 }, - { 204, 76, 2 , 10 }, - { 214, 76, 4 , 8 }, - { 226, 76, 6 , 4 }, -}; - -// Font characters info data -// NOTE: No chars.image data provided -static const GlyphInfo bluishFontChars[95] = { - { 32, 0, 9, 5, { 0 }}, - { 33, 0, 1, 2, { 0 }}, - { 34, 0, 1, 4, { 0 }}, - { 35, 0, 1, 6, { 0 }}, - { 36, 0, 0, 5, { 0 }}, - { 37, 0, 1, 6, { 0 }}, - { 38, 0, 0, 5, { 0 }}, - { 39, 0, 1, 2, { 0 }}, - { 40, 0, 1, 3, { 0 }}, - { 41, 0, 1, 3, { 0 }}, - { 42, 0, 1, 6, { 0 }}, - { 43, 0, 2, 6, { 0 }}, - { 44, 0, 7, 2, { 0 }}, - { 45, 0, 4, 5, { 0 }}, - { 46, 0, 7, 2, { 0 }}, - { 47, 0, 1, 6, { 0 }}, - { 48, 0, 1, 5, { 0 }}, - { 49, 0, 1, 3, { 0 }}, - { 50, 0, 1, 5, { 0 }}, - { 51, 0, 1, 5, { 0 }}, - { 52, 0, 1, 5, { 0 }}, - { 53, 0, 1, 5, { 0 }}, - { 54, 0, 1, 5, { 0 }}, - { 55, 0, 1, 5, { 0 }}, - { 56, 0, 1, 5, { 0 }}, - { 57, 0, 1, 5, { 0 }}, - { 58, 0, 1, 2, { 0 }}, - { 59, 0, 1, 2, { 0 }}, - { 60, 0, 2, 4, { 0 }}, - { 61, 0, 3, 5, { 0 }}, - { 62, 0, 2, 4, { 0 }}, - { 63, 0, 1, 5, { 0 }}, - { 64, 0, 1, 6, { 0 }}, - { 65, 0, 1, 5, { 0 }}, - { 66, 0, 1, 5, { 0 }}, - { 67, 0, 1, 5, { 0 }}, - { 68, 0, 1, 5, { 0 }}, - { 69, 0, 1, 5, { 0 }}, - { 70, 0, 1, 5, { 0 }}, - { 71, 0, 1, 5, { 0 }}, - { 72, 0, 1, 5, { 0 }}, - { 73, 0, 1, 4, { 0 }}, - { 74, 0, 1, 5, { 0 }}, - { 75, 0, 1, 5, { 0 }}, - { 76, 0, 1, 5, { 0 }}, - { 77, 0, 1, 8, { 0 }}, - { 78, 0, 1, 5, { 0 }}, - { 79, 0, 1, 5, { 0 }}, - { 80, 0, 1, 5, { 0 }}, - { 81, 0, 1, 5, { 0 }}, - { 82, 0, 1, 5, { 0 }}, - { 83, 0, 1, 5, { 0 }}, - { 84, 0, 1, 6, { 0 }}, - { 85, 0, 1, 5, { 0 }}, - { 86, 0, 1, 5, { 0 }}, - { 87, 0, 1, 8, { 0 }}, - { 88, 0, 1, 5, { 0 }}, - { 89, 0, 1, 5, { 0 }}, - { 90, 0, 1, 5, { 0 }}, - { 91, 0, 1, 3, { 0 }}, - { 92, 0, 1, 6, { 0 }}, - { 93, 0, 1, 3, { 0 }}, - { 94, 0, 1, 6, { 0 }}, - { 95, 0, 9, 5, { 0 }}, - { 96, 0, 1, 2, { 0 }}, - { 97, 0, 3, 5, { 0 }}, - { 98, 0, 1, 5, { 0 }}, - { 99, 0, 3, 5, { 0 }}, - { 100, 0, 1, 5, { 0 }}, - { 101, 0, 3, 5, { 0 }}, - { 102, 0, 1, 5, { 0 }}, - { 103, 0, 3, 5, { 0 }}, - { 104, 0, 1, 5, { 0 }}, - { 105, 0, 1, 2, { 0 }}, - { 106, 0, 1, 3, { 0 }}, - { 107, 0, 1, 5, { 0 }}, - { 108, 0, 1, 2, { 0 }}, - { 109, 0, 3, 8, { 0 }}, - { 110, 0, 3, 5, { 0 }}, - { 111, 0, 3, 5, { 0 }}, - { 112, 0, 3, 5, { 0 }}, - { 113, 0, 3, 5, { 0 }}, - { 114, 0, 3, 5, { 0 }}, - { 115, 0, 3, 5, { 0 }}, - { 116, 0, 1, 5, { 0 }}, - { 117, 0, 3, 5, { 0 }}, - { 118, 0, 3, 5, { 0 }}, - { 119, 0, 3, 8, { 0 }}, - { 120, 0, 3, 5, { 0 }}, - { 121, 0, 3, 5, { 0 }}, - { 122, 0, 3, 5, { 0 }}, - { 123, 0, 1, 4, { 0 }}, - { 124, 0, 0, 2, { 0 }}, - { 125, 0, 1, 4, { 0 }}, - { 126, 0, 3, 6, { 0 }}, -}; - -// Style loading function: bluish -static void GuiLoadStyleBluish(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < BLUISH_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(bluishStyleProps[i].controlId, bluishStyleProps[i].propertyId, bluishStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int bluishFontDataSize = 0; - unsigned char *data = DecompressData(bluishFontData, BLUISH_COMPRESSED_DATA_SIZE, &bluishFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 10; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, bluishFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, bluishFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - Rectangle whiteChar = { 66, 5, 2, 2 }; - SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/bluish/bluish.rgs b/examples/gui/basic_controls/styles/bluish/bluish.rgs deleted file mode 100644 index d3d21ff..0000000 Binary files a/examples/gui/basic_controls/styles/bluish/bluish.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/bluish/bluish.txt.rgs b/examples/gui/basic_controls/styles/bluish/bluish.txt.rgs deleted file mode 100644 index 9a2b7c4..0000000 --- a/examples/gui/basic_controls/styles/bluish/bluish.txt.rgs +++ /dev/null @@ -1,24 +0,0 @@ -# -# rgs style text file (v3.1) - raygui style file generated using rGuiStyler -# -# Style properties: -# f -# p -# -f 10 0 homespun.ttf -p 00 00 0x5ca6a6ff DEFAULT_BORDER_COLOR_NORMAL -p 00 01 0xb4e8f3ff DEFAULT_BASE_COLOR_NORMAL -p 00 02 0x447e77ff DEFAULT_TEXT_COLOR_NORMAL -p 00 03 0x5f8792ff DEFAULT_BORDER_COLOR_FOCUSED -p 00 04 0xcdeff7ff DEFAULT_BASE_COLOR_FOCUSED -p 00 05 0x4c6c74ff DEFAULT_TEXT_COLOR_FOCUSED -p 00 06 0x3b5b5fff DEFAULT_BORDER_COLOR_PRESSED -p 00 07 0xeaffffff DEFAULT_BASE_COLOR_PRESSED -p 00 08 0x275057ff DEFAULT_TEXT_COLOR_PRESSED -p 00 09 0x96aaacff DEFAULT_BORDER_COLOR_DISABLED -p 00 10 0xc8d7d9ff DEFAULT_BASE_COLOR_DISABLED -p 00 11 0x8c9c9eff DEFAULT_TEXT_COLOR_DISABLED -p 00 16 0x0000000a TEXT_SIZE -p 00 17 0x00000001 TEXT_SPACING -p 00 18 0x84adb7ff DEFAULT_LINE_COLOR -p 00 19 0xe8eef1ff DEFAULT_BACKGROUND_COLOR diff --git a/examples/gui/basic_controls/styles/bluish/font_readme.txt b/examples/gui/basic_controls/styles/bluish/font_readme.txt deleted file mode 100644 index 8dd9bdc..0000000 --- a/examples/gui/basic_controls/styles/bluish/font_readme.txt +++ /dev/null @@ -1,76 +0,0 @@ -_______________________________ -Homespun Created by Brian Kent -¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -Thanks for Downloading Homespun. - -Homespun TT [.ttf] -Homespun [8pt] [.fon] - - - 'homespun.fon' is a Windows Bitmap Font (.fon). This font is best -used at 8pt. To use it at larger point sizes (for images), try using -a graphics program like Photoshop, Paint Shop Pro, or the Paint -program that comes with Windows. Type out your text at the recommended -point size [8pt], then resize the image. Set the color mode to 256 -or 2 colors so the edges don't get blured when resizing, then after you -have the text to the size that you want, then change back to a higher -color mode and edit the image. - - For programs that don't show Bitmap Fonts in the Font Selector, you -may be able to get the font to work by typing in: -homespun brk - - When using the TTF version, try using it with anti-aliasing off. - - -If you have any questions or comments, you can e-mail me at -kentpw@norwich.net - -You can visit my Webpage <ÆNIGMA GAMES & FONTS> at -http://www.aenigmafonts.com/ - -________________ -INSTALLING FONTS -¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ - There's a couple of ways to install Fonts. The 'easy' way to -install fonts is to just Unzip/place the font file [.ttf] into your -Windows\Fonts directory (I always use this method). If you're unable -to do it the 'easy' way, then try to do it this way (for Windows -95/98/NT): - -1] Unzip the Font(s) to a folder (or somewhere, just remember where -you unzipped it) on your Computer. - -2] Next, click on the START button, then select SETTINGS then -CONTROL PANEL. - -3] When the Control Panel Window pops up, Double Click on FONTS. - -4] When the FONTS window pops up, select File then Install New Font... - -5] A Add Fonts window will pop up, just go to the folder that you -unzipped the Font(s) to, select the Font(s) and then click on OK. -Now the Font(s) are installed. - - Now you can use the Font(s) in programs that utilize Fonts. Make -sure that you install the font(s) first, then open up your apps -(so the app will recognize the font). Sometimes you'll have to -wait until your computer 'auto-refreshes' for programs to recognize -fonts (Windows is sometimes slow to do that). You can refresh your -computer quicker by going into Windows Explorer -or- My Computer and -press F5 (or in the menubar select VIEW then REFRESH). - - -__________ -DISCLAIMER -¯¯¯¯¯¯¯¯¯¯ --The font(s) in this zip file were created by me (Brian Kent). All -of my Fonts are Freeware, you can use them any way you want to -(Personal use, Commercial use, or whatever). - --If you have a Font related site and would like to offer my fonts on -your site, go right ahead. All I ask is that you keep this text file -intact with the Font. - --You may not Sell or Distribute my Fonts for profit or alter them in -any way without asking me first. [e-mail - kentpw@norwich.net] diff --git a/examples/gui/basic_controls/styles/bluish/homespun.ttf b/examples/gui/basic_controls/styles/bluish/homespun.ttf deleted file mode 100644 index 45c23e0..0000000 Binary files a/examples/gui/basic_controls/styles/bluish/homespun.ttf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/bluish/screenshot.png b/examples/gui/basic_controls/styles/bluish/screenshot.png deleted file mode 100644 index 3255fdc..0000000 Binary files a/examples/gui/basic_controls/styles/bluish/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/bluish/style_table.png b/examples/gui/basic_controls/styles/bluish/style_table.png deleted file mode 100644 index 6889f6c..0000000 Binary files a/examples/gui/basic_controls/styles/bluish/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/candy/README.md b/examples/gui/basic_controls/styles/candy/README.md deleted file mode 100644 index 3442189..0000000 --- a/examples/gui/basic_controls/styles/candy/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: candy -------------- -Sweet, colorful, tasty! Enjoy this funfair ride and be careful with the witch of the candy house! - -![candy style table](style_table.png) - -screenshot ------------ - -![candy style screen](screenshot.png) - -about font ------------ -"V5 Eastergothic" font by vFive Digital (Roberto Christen). - -100% free font, downloaded from dafont.com: [v5eastergothic](https://www.dafont.com/v5eastergothic.font) diff --git a/examples/gui/basic_controls/styles/candy/candy.h b/examples/gui/basic_controls/styles/candy/candy.h deleted file mode 100644 index ef5d5e6..0000000 --- a/examples/gui/basic_controls/styles/candy/candy.h +++ /dev/null @@ -1,346 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleCandy(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define CANDY_STYLE_PROPS_COUNT 16 - -// Custom style name: candy -static const GuiStyleProp candyStyleProps[CANDY_STYLE_PROPS_COUNT] = { - { 0, 0, 0xe58b68ff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0xfeda96ff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0xe59b5fff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0xee813fff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0xfcd85bff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0xfc6955ff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0xb34848ff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0xeb7272ff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0xbd4a4aff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0x94795dff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0xc2a37aff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0x9c8369ff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 16, 0x0000000f }, // DEFAULT_TEXT_SIZE - { 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING - { 0, 18, 0xd77575ff }, // DEFAULT_LINE_COLOR - { 0, 19, 0xfff5e1ff }, // DEFAULT_BACKGROUND_COLOR -}; - -// WARNING: This style uses a custom font: (size: 15, spacing: 0) - -#define CANDY_COMPRESSED_DATA_SIZE 1129 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char candyFontData[CANDY_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0xe1, 0x6e, 0xab, 0x38, 0x10, 0x06, 0x50, 0xbf, 0xff, 0x4b, 0x7b, 0xb5, 0xd2, 0x4a, 0x55, 0xef, 0xde, 0x80, 0x3d, - 0x9e, 0x31, 0x4e, 0x72, 0x7a, 0xfe, 0x95, 0x36, 0x09, 0x0c, 0x36, 0x10, 0x3e, 0x9b, 0xde, 0x00, 0x00, 0x7e, 0xf9, 0xf7, - 0xe7, 0xff, 0xbf, 0x6b, 0x7f, 0xf9, 0xed, 0xcf, 0xdf, 0xf6, 0xbf, 0x2e, 0xbd, 0x5a, 0x12, 0xff, 0xcf, 0xeb, 0x4f, 0x32, - 0xf6, 0x0a, 0xed, 0x62, 0xc9, 0xfd, 0x67, 0xfe, 0xf3, 0x77, 0x3d, 0xe5, 0xdd, 0x5f, 0xbd, 0xce, 0xdd, 0x27, 0xea, 0x97, - 0xeb, 0x52, 0x59, 0xff, 0x3f, 0x7f, 0x32, 0xeb, 0x7f, 0xfd, 0x9a, 0x2b, 0x15, 0xfb, 0x59, 0x9b, 0x9e, 0x50, 0xff, 0xf9, - 0xbd, 0xe8, 0x7a, 0x0d, 0x5e, 0xef, 0x63, 0x91, 0x36, 0x94, 0x55, 0xff, 0xbb, 0xbf, 0x9d, 0xaf, 0x62, 0xff, 0xaf, 0x02, - 0xd1, 0xde, 0x61, 0xb4, 0x35, 0x5f, 0x7d, 0xae, 0xab, 0x4f, 0xfc, 0x7a, 0xcf, 0xc9, 0xd8, 0xc2, 0xb3, 0x6b, 0x7c, 0xbd, - 0x2f, 0x9d, 0x5a, 0xff, 0xf5, 0xa3, 0xc3, 0xca, 0x16, 0xbd, 0x6a, 0x69, 0xb1, 0x3e, 0x2b, 0x6f, 0x0b, 0x67,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 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x37, 0xf7, 0x0f }; - -// Font characters rectangles data -static const Rectangle candyFontRecs[95] = { - { 4, 4, 3 , 15 }, - { 15, 4, 2 , 9 }, - { 25, 4, 3 , 2 }, - { 36, 4, 8 , 9 }, - { 52, 4, 6 , 11 }, - { 66, 4, 7 , 9 }, - { 81, 4, 7 , 9 }, - { 96, 4, 1 , 2 }, - { 105, 4, 3 , 11 }, - { 116, 4, 3 , 11 }, - { 127, 4, 7 , 7 }, - { 142, 4, 6 , 5 }, - { 156, 4, 2 , 3 }, - { 166, 4, 5 , 1 }, - { 179, 4, 2 , 2 }, - { 189, 4, 5 , 10 }, - { 202, 4, 6 , 9 }, - { 216, 4, 4 , 9 }, - { 228, 4, 6 , 9 }, - { 4, 27, 6 , 9 }, - { 18, 27, 7 , 9 }, - { 33, 27, 6 , 9 }, - { 47, 27, 6 , 9 }, - { 61, 27, 6 , 9 }, - { 75, 27, 6 , 9 }, - { 89, 27, 6 , 9 }, - { 103, 27, 2 , 6 }, - { 113, 27, 2 , 7 }, - { 123, 27, 4 , 6 }, - { 135, 27, 5 , 3 }, - { 148, 27, 4 , 6 }, - { 160, 27, 6 , 9 }, - { 174, 27, 8 , 7 }, - { 190, 27, 6 , 9 }, - { 204, 27, 6 , 9 }, - { 218, 27, 6 , 9 }, - { 232, 27, 6 , 9 }, - { 4, 50, 6 , 9 }, - { 18, 50, 6 , 9 }, - { 32, 50, 6 , 9 }, - { 46, 50, 6 , 9 }, - { 60, 50, 2 , 9 }, - { 70, 50, 6 , 9 }, - { 84, 50, 6 , 9 }, - { 98, 50, 6 , 9 }, - { 112, 50, 8 , 9 }, - { 128, 50, 6 , 9 }, - { 142, 50, 6 , 9 }, - { 156, 50, 6 , 9 }, - { 170, 50, 6 , 9 }, - { 184, 50, 6 , 9 }, - { 198, 50, 6 , 9 }, - { 212, 50, 6 , 9 }, - { 226, 50, 6 , 9 }, - { 240, 50, 6 , 9 }, - { 4, 73, 8 , 9 }, - { 20, 73, 6 , 9 }, - { 34, 73, 6 , 9 }, - { 48, 73, 6 , 9 }, - { 62, 73, 3 , 11 }, - { 73, 73, 5 , 10 }, - { 86, 73, 3 , 11 }, - { 97, 73, 6 , 4 }, - { 111, 73, 6 , 1 }, - { 125, 73, 3 , 2 }, - { 136, 73, 6 , 7 }, - { 150, 73, 6 , 10 }, - { 164, 73, 6 , 7 }, - { 178, 73, 6 , 10 }, - { 192, 73, 6 , 7 }, - { 206, 73, 5 , 10 }, - { 219, 73, 7 , 10 }, - { 234, 73, 6 , 10 }, - { 4, 96, 2 , 10 }, - { 14, 96, 2 , 12 }, - { 24, 96, 6 , 10 }, - { 38, 96, 3 , 10 }, - { 49, 96, 8 , 7 }, - { 65, 96, 6 , 7 }, - { 79, 96, 6 , 7 }, - { 93, 96, 6 , 10 }, - { 107, 96, 6 , 10 }, - { 121, 96, 6 , 7 }, - { 135, 96, 6 , 7 }, - { 149, 96, 3 , 10 }, - { 160, 96, 6 , 7 }, - { 174, 96, 6 , 7 }, - { 188, 96, 8 , 7 }, - { 204, 96, 6 , 7 }, - { 218, 96, 6 , 10 }, - { 232, 96, 6 , 7 }, - { 4, 119, 4 , 11 }, - { 16, 119, 1 , 11 }, - { 25, 119, 4 , 11 }, - { 37, 119, 6 , 2 }, -}; - -// Font characters info data -// NOTE: No chars.image data provided -static const GlyphInfo candyFontChars[95] = { - { 32, 0, 12, 3, { 0 }}, - { 33, 0, 3, 3, { 0 }}, - { 34, 0, 2, 4, { 0 }}, - { 35, 0, 3, 9, { 0 }}, - { 36, 0, 2, 7, { 0 }}, - { 37, 0, 3, 8, { 0 }}, - { 38, 0, 3, 8, { 0 }}, - { 39, 0, 2, 2, { 0 }}, - { 40, 1, 2, 5, { 0 }}, - { 41, 1, 2, 5, { 0 }}, - { 42, 0, 4, 8, { 0 }}, - { 43, 0, 6, 7, { 0 }}, - { 44, 0, 10, 3, { 0 }}, - { 45, 0, 7, 6, { 0 }}, - { 46, 0, 10, 3, { 0 }}, - { 47, 1, 3, 7, { 0 }}, - { 48, 0, 3, 7, { 0 }}, - { 49, 0, 3, 5, { 0 }}, - { 50, 0, 3, 7, { 0 }}, - { 51, 0, 3, 7, { 0 }}, - { 52, 0, 3, 8, { 0 }}, - { 53, 0, 3, 7, { 0 }}, - { 54, 0, 3, 7, { 0 }}, - { 55, 0, 3, 7, { 0 }}, - { 56, 0, 3, 7, { 0 }}, - { 57, 0, 3, 7, { 0 }}, - { 58, 0, 6, 3, { 0 }}, - { 59, 0, 6, 3, { 0 }}, - { 60, 1, 5, 6, { 0 }}, - { 61, 1, 7, 7, { 0 }}, - { 62, 1, 5, 6, { 0 }}, - { 63, 0, 3, 7, { 0 }}, - { 64, 0, 4, 9, { 0 }}, - { 65, 0, 3, 7, { 0 }}, - { 66, 0, 3, 7, { 0 }}, - { 67, 0, 3, 7, { 0 }}, - { 68, 0, 3, 7, { 0 }}, - { 69, 0, 3, 7, { 0 }}, - { 70, 0, 3, 7, { 0 }}, - { 71, 0, 3, 7, { 0 }}, - { 72, 0, 3, 7, { 0 }}, - { 73, 0, 3, 3, { 0 }}, - { 74, 0, 3, 7, { 0 }}, - { 75, 0, 3, 7, { 0 }}, - { 76, 0, 3, 7, { 0 }}, - { 77, 0, 3, 9, { 0 }}, - { 78, 0, 3, 7, { 0 }}, - { 79, 0, 3, 7, { 0 }}, - { 80, 0, 3, 7, { 0 }}, - { 81, 0, 3, 7, { 0 }}, - { 82, 0, 3, 7, { 0 }}, - { 83, 0, 3, 7, { 0 }}, - { 84, 0, 3, 7, { 0 }}, - { 85, 0, 3, 7, { 0 }}, - { 86, 0, 3, 7, { 0 }}, - { 87, 0, 3, 9, { 0 }}, - { 88, 0, 3, 7, { 0 }}, - { 89, 0, 3, 7, { 0 }}, - { 90, 0, 3, 7, { 0 }}, - { 91, 1, 2, 5, { 0 }}, - { 92, 1, 3, 7, { 0 }}, - { 93, 1, 2, 5, { 0 }}, - { 94, 0, 3, 7, { 0 }}, - { 95, 0, 11, 7, { 0 }}, - { 96, 0, 0, 4, { 0 }}, - { 97, 0, 5, 7, { 0 }}, - { 98, 0, 2, 7, { 0 }}, - { 99, 0, 5, 7, { 0 }}, - { 100, 0, 2, 7, { 0 }}, - { 101, 0, 5, 7, { 0 }}, - { 102, 0, 2, 6, { 0 }}, - { 103, 0, 5, 7, { 0 }}, - { 104, 0, 2, 7, { 0 }}, - { 105, 0, 2, 3, { 0 }}, - { 106, 0, 2, 3, { 0 }}, - { 107, 0, 2, 7, { 0 }}, - { 108, 0, 2, 4, { 0 }}, - { 109, 0, 5, 9, { 0 }}, - { 110, 0, 5, 7, { 0 }}, - { 111, 0, 5, 7, { 0 }}, - { 112, 0, 5, 7, { 0 }}, - { 113, 0, 5, 7, { 0 }}, - { 114, 0, 5, 7, { 0 }}, - { 115, 0, 5, 7, { 0 }}, - { 116, 0, 2, 4, { 0 }}, - { 117, 0, 5, 7, { 0 }}, - { 118, 0, 5, 7, { 0 }}, - { 119, 0, 5, 9, { 0 }}, - { 120, 0, 5, 7, { 0 }}, - { 121, 0, 5, 7, { 0 }}, - { 122, 0, 5, 7, { 0 }}, - { 123, 1, 2, 6, { 0 }}, - { 124, 1, 2, 3, { 0 }}, - { 125, 1, 2, 6, { 0 }}, - { 126, 0, 0, 7, { 0 }}, -}; - -// Style loading function: candy -static void GuiLoadStyleCandy(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < CANDY_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(candyStyleProps[i].controlId, candyStyleProps[i].propertyId, candyStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int candyFontDataSize = 0; - unsigned char *data = DecompressData(candyFontData, CANDY_COMPRESSED_DATA_SIZE, &candyFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 15; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, candyFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, candyFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - Rectangle whiteChar = { 129, 6, 3, 3 }; - SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/candy/candy.rgs b/examples/gui/basic_controls/styles/candy/candy.rgs deleted file mode 100644 index 65c000f..0000000 Binary files a/examples/gui/basic_controls/styles/candy/candy.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/candy/candy.txt.rgs b/examples/gui/basic_controls/styles/candy/candy.txt.rgs deleted file mode 100644 index fe43d10..0000000 --- a/examples/gui/basic_controls/styles/candy/candy.txt.rgs +++ /dev/null @@ -1,24 +0,0 @@ -# -# rgs style text file (v3.1) - raygui style file generated using rGuiStyler -# -# Style properties: -# f -# p -# -f 15 0 v5easter.ttf -p 00 00 0xe58b68ff DEFAULT_BORDER_COLOR_NORMAL -p 00 01 0xfeda96ff DEFAULT_BASE_COLOR_NORMAL -p 00 02 0xe59b5fff DEFAULT_TEXT_COLOR_NORMAL -p 00 03 0xee813fff DEFAULT_BORDER_COLOR_FOCUSED -p 00 04 0xfcd85bff DEFAULT_BASE_COLOR_FOCUSED -p 00 05 0xfc6955ff DEFAULT_TEXT_COLOR_FOCUSED -p 00 06 0xb34848ff DEFAULT_BORDER_COLOR_PRESSED -p 00 07 0xeb7272ff DEFAULT_BASE_COLOR_PRESSED -p 00 08 0xbd4a4aff DEFAULT_TEXT_COLOR_PRESSED -p 00 09 0x94795dff DEFAULT_BORDER_COLOR_DISABLED -p 00 10 0xc2a37aff DEFAULT_BASE_COLOR_DISABLED -p 00 11 0x9c8369ff DEFAULT_TEXT_COLOR_DISABLED -p 00 16 0x0000000f TEXT_SIZE -p 00 17 0x00000000 TEXT_SPACING -p 00 18 0xd77575ff DEFAULT_LINE_COLOR -p 00 19 0xfff5e1ff DEFAULT_BACKGROUND_COLOR diff --git a/examples/gui/basic_controls/styles/candy/font_readme.txt b/examples/gui/basic_controls/styles/candy/font_readme.txt deleted file mode 100644 index cfd8cb2..0000000 --- a/examples/gui/basic_controls/styles/candy/font_readme.txt +++ /dev/null @@ -1,27 +0,0 @@ - -V5 Easter Gothic ----------------- -Instructions: - - -++ Easter Gothic ++ - -For screen use, set at 15pt or any multiple -of 15 (display). Turn antialiasing off. Set -tracking to 100 for best results. - ---------------- -Usage: This is a free font--you may use -this and other V5 fonts at will. It may not -be sold, altered, or improperly credited, -however. All I ask is that you kindly inform -me if you find this font useful, and where -you've used it. - -Enjoy, - -©2000 -Roberto Christen -rob@vfive.com - - diff --git a/examples/gui/basic_controls/styles/candy/screenshot.png b/examples/gui/basic_controls/styles/candy/screenshot.png deleted file mode 100644 index e84aef3..0000000 Binary files a/examples/gui/basic_controls/styles/candy/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/candy/style_table.png b/examples/gui/basic_controls/styles/candy/style_table.png deleted file mode 100644 index fcbf972..0000000 Binary files a/examples/gui/basic_controls/styles/candy/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/candy/v5easter.ttf b/examples/gui/basic_controls/styles/candy/v5easter.ttf deleted file mode 100644 index 77a911a..0000000 Binary files a/examples/gui/basic_controls/styles/candy/v5easter.ttf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/cherry/README.md b/examples/gui/basic_controls/styles/cherry/README.md deleted file mode 100644 index eb9f3d1..0000000 --- a/examples/gui/basic_controls/styles/cherry/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: cherry --------------- -Sweet with a touch of liquour, covered in chocolate, just give it a try! Not suitable for every palate, only the most demanding. - -![cherry style table](style_table.png) - -screenshot ------------ - -![cherry style screen](screenshot.png) - -about font ------------ -"Westington" font by Hazel Abbiati. - -100% free font, downloaded from dafont.com: [westington](https://www.dafont.com/westington.font) diff --git a/examples/gui/basic_controls/styles/cherry/Westington.ttf b/examples/gui/basic_controls/styles/cherry/Westington.ttf deleted file mode 100644 index 68efae8..0000000 Binary files a/examples/gui/basic_controls/styles/cherry/Westington.ttf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/cherry/cherry.h b/examples/gui/basic_controls/styles/cherry/cherry.h deleted file mode 100644 index 93d8335..0000000 --- a/examples/gui/basic_controls/styles/cherry/cherry.h +++ /dev/null @@ -1,360 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleCherry(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define CHERRY_STYLE_PROPS_COUNT 16 - -// Custom style name: cherry -static const GuiStyleProp cherryStyleProps[CHERRY_STYLE_PROPS_COUNT] = { - { 0, 0, 0xda5757ff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0x753233ff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0xe17373ff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0xfaaa97ff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0xe06262ff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0xfdb4aaff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0xe03c46ff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0x5b1e20ff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0xc2474fff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0xa19292ff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0x706060ff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0x9e8585ff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 16, 0x0000000f }, // DEFAULT_TEXT_SIZE - { 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING - { 0, 18, 0xfb8170ff }, // DEFAULT_LINE_COLOR - { 0, 19, 0x3a1720ff }, // DEFAULT_BACKGROUND_COLOR -}; - -// WARNING: This style uses a custom font: (size: 15, spacing: 0) - -#define CHERRY_COMPRESSED_DATA_SIZE 1406 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char cherryFontData[CHERRY_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0x4b, 0x76, 0xe3, 0x36, 0x10, 0x05, 0x50, 0xed, 0x7f, 0xd3, 0x2f, 0x27, 0x93, 0xa4, 0x4f, 0x3a, 0x26, 0x50, 0x85, - 0xa2, 0xc4, 0xb6, 0xaf, 0xef, 0xcc, 0xb2, 0x28, 0x0a, 0x45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, 0xdb, 0x05, - 0x4f, 0x38, 0x07, 0xa8, 0x26, 0xaf, 0xa7, 0xe7, 0xf9, 0xe5, 0x19, 0xc7, 0x81, 0xfd, 0xf3, 0x3f, 0xfb, 0xff, 0xcf, 0x38, - 0xfe, 0xeb, 0xff, 0xe5, 0x56, 0x2b, 0x89, 0xe7, 0x94, 0x92, 0xe1, 0x7c, 0xb7, 0x2d, 0xe7, 0x49, 0xb3, 0x72, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x5f, 0xfa, 0x0b }; - -// Font characters rectangles data -static const Rectangle cherryFontRecs[95] = { - { 4, 4, 5 , 15 }, - { 17, 4, 3 , 10 }, - { 28, 4, 5 , 2 }, - { 41, 4, 10 , 10 }, - { 59, 4, 7 , 11 }, - { 74, 4, 7 , 10 }, - { 89, 4, 8 , 10 }, - { 105, 4, 1 , 2 }, - { 114, 4, 3 , 10 }, - { 125, 4, 3 , 10 }, - { 136, 4, 3 , 3 }, - { 147, 4, 7 , 7 }, - { 162, 4, 2 , 2 }, - { 172, 4, 6 , 3 }, - { 186, 4, 1 , 1 }, - { 195, 4, 4 , 10 }, - { 207, 4, 5 , 8 }, - { 220, 4, 5 , 8 }, - { 233, 4, 5 , 8 }, - { 4, 27, 5 , 8 }, - { 17, 27, 5 , 8 }, - { 30, 27, 5 , 8 }, - { 43, 27, 5 , 8 }, - { 56, 27, 5 , 8 }, - { 69, 27, 5 , 8 }, - { 82, 27, 5 , 8 }, - { 95, 27, 3 , 10 }, - { 106, 27, 3 , 12 }, - { 117, 27, 6 , 7 }, - { 131, 27, 6 , 4 }, - { 145, 27, 6 , 7 }, - { 159, 27, 5 , 10 }, - { 172, 27, 8 , 10 }, - { 188, 27, 7 , 9 }, - { 203, 27, 7 , 9 }, - { 218, 27, 6 , 9 }, - { 232, 27, 6 , 9 }, - { 4, 50, 7 , 9 }, - { 19, 50, 6 , 9 }, - { 33, 50, 6 , 9 }, - { 47, 50, 7 , 9 }, - { 62, 50, 3 , 9 }, - { 73, 50, 6 , 9 }, - { 87, 50, 7 , 9 }, - { 102, 50, 7 , 9 }, - { 117, 50, 11 , 9 }, - { 136, 50, 8 , 9 }, - { 152, 50, 6 , 9 }, - { 166, 50, 6 , 9 }, - { 180, 50, 7 , 9 }, - { 195, 50, 7 , 9 }, - { 210, 50, 6 , 9 }, - { 224, 50, 7 , 9 }, - { 239, 50, 8 , 9 }, - { 4, 73, 9 , 9 }, - { 21, 73, 11 , 9 }, - { 40, 73, 7 , 9 }, - { 55, 73, 7 , 9 }, - { 70, 73, 7 , 9 }, - { 85, 73, 3 , 9 }, - { 96, 73, 4 , 10 }, - { 108, 73, 3 , 9 }, - { 119, 73, 3 , 3 }, - { 130, 73, 7 , 2 }, - { 145, 73, 2 , 2 }, - { 155, 73, 6 , 6 }, - { 169, 73, 6 , 9 }, - { 183, 73, 6 , 6 }, - { 197, 73, 6 , 9 }, - { 211, 73, 6 , 6 }, - { 225, 73, 5 , 9 }, - { 238, 73, 5 , 9 }, - { 4, 96, 7 , 9 }, - { 19, 96, 3 , 7 }, - { 30, 96, 3 , 8 }, - { 41, 96, 6 , 9 }, - { 55, 96, 4 , 9 }, - { 67, 96, 11 , 6 }, - { 86, 96, 7 , 6 }, - { 101, 96, 5 , 6 }, - { 114, 96, 6 , 8 }, - { 128, 96, 6 , 8 }, - { 142, 96, 5 , 6 }, - { 155, 96, 5 , 6 }, - { 168, 96, 5 , 9 }, - { 181, 96, 7 , 6 }, - { 196, 96, 7 , 6 }, - { 211, 96, 11 , 6 }, - { 230, 96, 7 , 6 }, - { 4, 119, 7 , 8 }, - { 19, 119, 6 , 6 }, - { 33, 119, 5 , 9 }, - { 46, 119, 1 , 9 }, - { 55, 119, 5 , 9 }, - { 68, 119, 7 , 3 }, -}; - -// Font characters info data -// NOTE: No chars.image data provided -static const GlyphInfo cherryFontChars[95] = { - { 32, 0, 12, 5, { 0 }}, - { 33, 0, 2, 4, { 0 }}, - { 34, 0, 2, 6, { 0 }}, - { 35, 0, 2, 11, { 0 }}, - { 36, 0, 2, 8, { 0 }}, - { 37, 0, 2, 8, { 0 }}, - { 38, 0, 2, 9, { 0 }}, - { 39, 0, 2, 2, { 0 }}, - { 40, 0, 2, 4, { 0 }}, - { 41, 0, 2, 4, { 0 }}, - { 42, 0, 2, 4, { 0 }}, - { 43, 0, 4, 8, { 0 }}, - { 44, 0, 11, 3, { 0 }}, - { 45, 0, 6, 7, { 0 }}, - { 46, 0, 11, 2, { 0 }}, - { 47, 0, 2, 5, { 0 }}, - { 48, 0, 4, 6, { 0 }}, - { 49, 0, 4, 6, { 0 }}, - { 50, 0, 4, 6, { 0 }}, - { 51, 0, 4, 6, { 0 }}, - { 52, 0, 4, 6, { 0 }}, - { 53, 0, 4, 6, { 0 }}, - { 54, 0, 4, 6, { 0 }}, - { 55, 0, 4, 6, { 0 }}, - { 56, 0, 4, 6, { 0 }}, - { 57, 0, 4, 6, { 0 }}, - { 58, 0, 2, 4, { 0 }}, - { 59, 0, 2, 4, { 0 }}, - { 60, 0, 4, 7, { 0 }}, - { 61, 0, 5, 7, { 0 }}, - { 62, 0, 4, 7, { 0 }}, - { 63, 0, 2, 6, { 0 }}, - { 64, 0, 2, 9, { 0 }}, - { 65, 0, 3, 8, { 0 }}, - { 66, 0, 3, 8, { 0 }}, - { 67, 0, 3, 7, { 0 }}, - { 68, 0, 3, 7, { 0 }}, - { 69, 0, 3, 8, { 0 }}, - { 70, 0, 3, 7, { 0 }}, - { 71, 0, 3, 7, { 0 }}, - { 72, 0, 3, 8, { 0 }}, - { 73, 0, 3, 4, { 0 }}, - { 74, 0, 3, 7, { 0 }}, - { 75, 0, 3, 8, { 0 }}, - { 76, 0, 3, 8, { 0 }}, - { 77, 0, 3, 12, { 0 }}, - { 78, 0, 3, 9, { 0 }}, - { 79, 0, 3, 7, { 0 }}, - { 80, 0, 3, 7, { 0 }}, - { 81, 0, 3, 8, { 0 }}, - { 82, 0, 3, 8, { 0 }}, - { 83, 0, 3, 7, { 0 }}, - { 84, 0, 3, 8, { 0 }}, - { 85, 0, 3, 9, { 0 }}, - { 86, 0, 3, 10, { 0 }}, - { 87, 0, 3, 12, { 0 }}, - { 88, 0, 3, 8, { 0 }}, - { 89, 0, 3, 8, { 0 }}, - { 90, 0, 3, 8, { 0 }}, - { 91, 0, 3, 4, { 0 }}, - { 92, 0, 2, 5, { 0 }}, - { 93, 0, 3, 4, { 0 }}, - { 94, 0, 3, 4, { 0 }}, - { 95, 0, 10, 8, { 0 }}, - { 96, 0, 2, 3, { 0 }}, - { 97, 0, 6, 7, { 0 }}, - { 98, 0, 3, 7, { 0 }}, - { 99, 0, 6, 7, { 0 }}, - { 100, 0, 3, 7, { 0 }}, - { 101, 0, 6, 7, { 0 }}, - { 102, 0, 3, 6, { 0 }}, - { 103, 0, 5, 6, { 0 }}, - { 104, 0, 3, 8, { 0 }}, - { 105, 0, 5, 4, { 0 }}, - { 106, 0, 5, 4, { 0 }}, - { 107, 0, 3, 7, { 0 }}, - { 108, 0, 3, 5, { 0 }}, - { 109, 0, 6, 12, { 0 }}, - { 110, 0, 6, 8, { 0 }}, - { 111, 0, 6, 6, { 0 }}, - { 112, 0, 6, 7, { 0 }}, - { 113, 0, 6, 7, { 0 }}, - { 114, 0, 6, 6, { 0 }}, - { 115, 0, 6, 6, { 0 }}, - { 116, 0, 3, 6, { 0 }}, - { 117, 0, 6, 8, { 0 }}, - { 118, 0, 6, 8, { 0 }}, - { 119, 0, 6, 12, { 0 }}, - { 120, 0, 6, 8, { 0 }}, - { 121, 0, 6, 8, { 0 }}, - { 122, 0, 6, 7, { 0 }}, - { 123, 0, 3, 6, { 0 }}, - { 124, 0, 3, 2, { 0 }}, - { 125, 0, 3, 6, { 0 }}, - { 126, 0, 6, 8, { 0 }}, -}; - -// Style loading function: cherry -static void GuiLoadStyleCherry(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < CHERRY_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(cherryStyleProps[i].controlId, cherryStyleProps[i].propertyId, cherryStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int cherryFontDataSize = 0; - unsigned char *data = DecompressData(cherryFontData, CHERRY_COMPRESSED_DATA_SIZE, &cherryFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 15; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, cherryFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, cherryFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - Rectangle whiteChar = { 17, 30, 2, 2 }; - SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/cherry/cherry.rgs b/examples/gui/basic_controls/styles/cherry/cherry.rgs deleted file mode 100644 index 83b341b..0000000 Binary files a/examples/gui/basic_controls/styles/cherry/cherry.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/cherry/cherry.txt.rgs b/examples/gui/basic_controls/styles/cherry/cherry.txt.rgs deleted file mode 100644 index a830816..0000000 --- a/examples/gui/basic_controls/styles/cherry/cherry.txt.rgs +++ /dev/null @@ -1,24 +0,0 @@ -# -# rgs style text file (v3.1) - raygui style file generated using rGuiStyler -# -# Style properties: -# f -# p -# -f 15 0 Westington.ttf -p 00 00 0xda5757ff DEFAULT_BORDER_COLOR_NORMAL -p 00 01 0x753233ff DEFAULT_BASE_COLOR_NORMAL -p 00 02 0xe17373ff DEFAULT_TEXT_COLOR_NORMAL -p 00 03 0xfaaa97ff DEFAULT_BORDER_COLOR_FOCUSED -p 00 04 0xe06262ff DEFAULT_BASE_COLOR_FOCUSED -p 00 05 0xfdb4aaff DEFAULT_TEXT_COLOR_FOCUSED -p 00 06 0xe03c46ff DEFAULT_BORDER_COLOR_PRESSED -p 00 07 0x5b1e20ff DEFAULT_BASE_COLOR_PRESSED -p 00 08 0xc2474fff DEFAULT_TEXT_COLOR_PRESSED -p 00 09 0xa19292ff DEFAULT_BORDER_COLOR_DISABLED -p 00 10 0x706060ff DEFAULT_BASE_COLOR_DISABLED -p 00 11 0x9e8585ff DEFAULT_TEXT_COLOR_DISABLED -p 00 16 0x0000000f TEXT_SIZE -p 00 17 0x00000000 TEXT_SPACING -p 00 18 0xfb8170ff DEFAULT_LINE_COLOR -p 00 19 0x3a1720ff DEFAULT_BACKGROUND_COLOR diff --git a/examples/gui/basic_controls/styles/cherry/screenshot.png b/examples/gui/basic_controls/styles/cherry/screenshot.png deleted file mode 100644 index 669a40b..0000000 Binary files a/examples/gui/basic_controls/styles/cherry/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/cherry/style_table.png b/examples/gui/basic_controls/styles/cherry/style_table.png deleted file mode 100644 index b556206..0000000 Binary files a/examples/gui/basic_controls/styles/cherry/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/cyber/Kyrou 7 Wide.ttf b/examples/gui/basic_controls/styles/cyber/Kyrou 7 Wide.ttf deleted file mode 100644 index 165c3e7..0000000 Binary files a/examples/gui/basic_controls/styles/cyber/Kyrou 7 Wide.ttf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/cyber/README.md b/examples/gui/basic_controls/styles/cyber/README.md deleted file mode 100644 index 10de60b..0000000 --- a/examples/gui/basic_controls/styles/cyber/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: cyber -------------- -Future is now! Neons and shadows, city never sleeps! Robots waiting in the corners and expensive vending machines! You got the style! - -![cyber style table](style_table.png) - -screenshot ------------ - -![cyber style screen](screenshot.png) - -about font ------------ -"Grixel Kyrou 7 Wide" font by [Nikos Giannakopoulos](http://www.grixel.gr/). - -100% free font, downloaded from dafont.com: [grixel-kyrou-7-wide](https://www.dafont.com/grixel-kyrou-7-wide.font) diff --git a/examples/gui/basic_controls/styles/cyber/cyber.h b/examples/gui/basic_controls/styles/cyber/cyber.h deleted file mode 100644 index 627131c..0000000 --- a/examples/gui/basic_controls/styles/cyber/cyber.h +++ /dev/null @@ -1,345 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleCyber(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define CYBER_STYLE_PROPS_COUNT 16 - -// Custom style name: cyber -static const GuiStyleProp cyberStyleProps[CYBER_STYLE_PROPS_COUNT] = { - { 0, 0, 0x2f7486ff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0x024658ff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0x51bfd3ff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0x82cde0ff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0x3299b4ff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0xb6e1eaff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0xeb7630ff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0xffbc51ff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0xd86f36ff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0x134b5aff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0x02313dff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0x17505fff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 16, 0x0000000e }, // DEFAULT_TEXT_SIZE - { 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING - { 0, 18, 0x81c0d0ff }, // DEFAULT_LINE_COLOR - { 0, 19, 0x00222bff }, // DEFAULT_BACKGROUND_COLOR -}; - -// WARNING: This style uses a custom font: (size: 14, spacing: 0) - -#define CYBER_COMPRESSED_DATA_SIZE 1104 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char cyberFontData[CYBER_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0xe1, 0x6e, 0x9b, 0x30, 0x14, 0x05, 0x60, 0xb4, 0xf7, 0x7f, 0xe3, 0x8d, 0x9d, 0x49, 0x95, 0xb6, 0xa9, 0x9b, 0x02, - 0xf6, 0xb5, 0x4d, 0x48, 0xfa, 0xed, 0xfb, 0xd7, 0x94, 0x05, 0x7c, 0xb1, 0x81, 0xfa, 0xc4, 0xc9, 0x06, 0x00, 0xb0, 0x58, - 0x2e, 0x7e, 0xb7, 0x34, 0xff, 0x74, 0xde, 0x11, 0xfd, 0xfe, 0xf7, 0xdc, 0x63, 0x5f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, 0xc3, 0xb4, 0xaa, 0xfe, 0x47, 0xdf, 0x54, 0xdc, 0x9e, 0x50, 0xcb, 0x92, 0x9f, 0xaa, 0xfd, 0x15, 0xf5, 0xdf, - 0x9a, 0x92, 0x6b, 0x99, 0x96, 0x7b, 0xbd, 0x53, 0x1e, 0xec, 0x7d, 0xce, 0x80, 0xfa, 0xea, 0x9d, 0xf5, 0xfe, 0x3f, 0x73, - 0x3d, 0x67, 0xf5, 0x5f, 0x93, 0xbf, 0x68, 0x5f, 0xbd, 0xb1, 0xb2, 0x4a, 0xed, 0xcc, 0x75, 0xdb, 0x9d, 0x01, 0xef, 0x96, - 0xef, 0xd2, 0xff, 0xbf, 0xea, 0xa7, 0x0b, 0xd5, 0x1f, 0xf5, 0x67, 0xfc, 0xf9, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x0f, 0xbf, 0x00 }; - -// Font characters rectangles data -static const Rectangle cyberFontRecs[95] = { - { 4, 4, 4 , 14 }, - { 16, 4, 1 , 8 }, - { 25, 4, 4 , 3 }, - { 37, 4, 8 , 8 }, - { 53, 4, 8 , 9 }, - { 69, 4, 8 , 8 }, - { 85, 4, 8 , 8 }, - { 101, 4, 1 , 3 }, - { 110, 4, 4 , 9 }, - { 122, 4, 4 , 9 }, - { 134, 4, 5 , 6 }, - { 147, 4, 5 , 6 }, - { 160, 4, 2 , 2 }, - { 170, 4, 4 , 1 }, - { 182, 4, 1 , 1 }, - { 191, 4, 8 , 8 }, - { 207, 4, 8 , 8 }, - { 223, 4, 2 , 8 }, - { 233, 4, 8 , 8 }, - { 4, 26, 8 , 8 }, - { 20, 26, 8 , 8 }, - { 36, 26, 8 , 8 }, - { 52, 26, 8 , 8 }, - { 68, 26, 7 , 8 }, - { 83, 26, 8 , 8 }, - { 99, 26, 8 , 8 }, - { 115, 26, 1 , 4 }, - { 124, 26, 2 , 5 }, - { 134, 26, 4 , 8 }, - { 146, 26, 5 , 3 }, - { 159, 26, 4 , 8 }, - { 171, 26, 7 , 8 }, - { 186, 26, 8 , 8 }, - { 202, 26, 8 , 8 }, - { 218, 26, 8 , 8 }, - { 234, 26, 8 , 8 }, - { 4, 48, 8 , 8 }, - { 20, 48, 7 , 8 }, - { 35, 48, 7 , 8 }, - { 50, 48, 8 , 8 }, - { 66, 48, 8 , 8 }, - { 82, 48, 5 , 8 }, - { 95, 48, 7 , 8 }, - { 110, 48, 8 , 8 }, - { 126, 48, 7 , 8 }, - { 141, 48, 8 , 8 }, - { 157, 48, 8 , 8 }, - { 173, 48, 8 , 8 }, - { 189, 48, 8 , 8 }, - { 205, 48, 8 , 9 }, - { 221, 48, 8 , 8 }, - { 237, 48, 8 , 8 }, - { 4, 70, 8 , 8 }, - { 20, 70, 8 , 8 }, - { 36, 70, 8 , 8 }, - { 52, 70, 9 , 8 }, - { 69, 70, 8 , 8 }, - { 85, 70, 8 , 8 }, - { 101, 70, 8 , 8 }, - { 117, 70, 4 , 9 }, - { 129, 70, 8 , 8 }, - { 145, 70, 4 , 9 }, - { 157, 70, 4 , 3 }, - { 169, 70, 7 , 1 }, - { 184, 70, 2 , 3 }, - { 194, 70, 7 , 5 }, - { 209, 70, 7 , 8 }, - { 224, 70, 7 , 5 }, - { 239, 70, 7 , 8 }, - { 4, 92, 7 , 5 }, - { 19, 92, 4 , 8 }, - { 31, 92, 7 , 7 }, - { 46, 92, 7 , 8 }, - { 61, 92, 1 , 8 }, - { 70, 92, 3 , 10 }, - { 81, 92, 7 , 8 }, - { 96, 92, 4 , 8 }, - { 108, 92, 9 , 5 }, - { 125, 92, 7 , 5 }, - { 140, 92, 7 , 5 }, - { 155, 92, 7 , 7 }, - { 170, 92, 7 , 7 }, - { 185, 92, 5 , 5 }, - { 198, 92, 7 , 5 }, - { 213, 92, 5 , 8 }, - { 226, 92, 7 , 5 }, - { 4, 114, 7 , 5 }, - { 19, 114, 9 , 5 }, - { 36, 114, 7 , 5 }, - { 51, 114, 7 , 7 }, - { 66, 114, 7 , 5 }, - { 81, 114, 4 , 9 }, - { 93, 114, 1 , 9 }, - { 102, 114, 4 , 9 }, - { 114, 114, 8 , 2 }, -}; - -// Font characters info data -// NOTE: No chars.image data provided -static const GlyphInfo cyberFontChars[95] = { - { 32, 0, 11, 4, { 0 }}, - { 33, 0, 3, 2, { 0 }}, - { 34, 0, 3, 4, { 0 }}, - { 35, 0, 3, 8, { 0 }}, - { 36, 0, 3, 8, { 0 }}, - { 37, 0, 3, 8, { 0 }}, - { 38, 0, 3, 8, { 0 }}, - { 39, 0, 3, 2, { 0 }}, - { 40, 0, 3, 4, { 0 }}, - { 41, 0, 3, 4, { 0 }}, - { 42, 0, 4, 6, { 0 }}, - { 43, 0, 4, 6, { 0 }}, - { 44, 0, 10, 3, { 0 }}, - { 45, 0, 7, 5, { 0 }}, - { 46, 0, 10, 2, { 0 }}, - { 47, 0, 3, 8, { 0 }}, - { 48, 0, 3, 8, { 0 }}, - { 49, 0, 3, 3, { 0 }}, - { 50, 0, 3, 8, { 0 }}, - { 51, 0, 3, 8, { 0 }}, - { 52, 0, 3, 8, { 0 }}, - { 53, 0, 3, 8, { 0 }}, - { 54, 0, 3, 8, { 0 }}, - { 55, 0, 3, 7, { 0 }}, - { 56, 0, 3, 8, { 0 }}, - { 57, 0, 3, 8, { 0 }}, - { 58, 0, 6, 2, { 0 }}, - { 59, 0, 6, 3, { 0 }}, - { 60, 0, 3, 5, { 0 }}, - { 61, 0, 6, 6, { 0 }}, - { 62, 0, 3, 5, { 0 }}, - { 63, 0, 3, 7, { 0 }}, - { 64, 0, 3, 8, { 0 }}, - { 65, 0, 3, 8, { 0 }}, - { 66, 0, 3, 8, { 0 }}, - { 67, 0, 3, 8, { 0 }}, - { 68, 0, 3, 8, { 0 }}, - { 69, 0, 3, 7, { 0 }}, - { 70, 0, 3, 7, { 0 }}, - { 71, 0, 3, 8, { 0 }}, - { 72, 0, 3, 8, { 0 }}, - { 73, 0, 3, 6, { 0 }}, - { 74, 0, 3, 7, { 0 }}, - { 75, 0, 3, 8, { 0 }}, - { 76, 0, 3, 7, { 0 }}, - { 77, 0, 3, 9, { 0 }}, - { 78, 0, 3, 8, { 0 }}, - { 79, 0, 3, 8, { 0 }}, - { 80, 0, 3, 8, { 0 }}, - { 81, 0, 3, 8, { 0 }}, - { 82, 0, 3, 8, { 0 }}, - { 83, 0, 3, 8, { 0 }}, - { 84, 0, 3, 8, { 0 }}, - { 85, 0, 3, 8, { 0 }}, - { 86, 0, 3, 8, { 0 }}, - { 87, 0, 3, 10, { 0 }}, - { 88, 0, 3, 8, { 0 }}, - { 89, 0, 3, 8, { 0 }}, - { 90, 0, 3, 8, { 0 }}, - { 91, 0, 3, 4, { 0 }}, - { 92, 0, 3, 8, { 0 }}, - { 93, 0, 3, 4, { 0 }}, - { 94, 0, 3, 4, { 0 }}, - { 95, 0, 11, 7, { 0 }}, - { 96, 0, 3, 3, { 0 }}, - { 97, 0, 6, 7, { 0 }}, - { 98, 0, 3, 7, { 0 }}, - { 99, 0, 6, 7, { 0 }}, - { 100, 0, 3, 7, { 0 }}, - { 101, 0, 6, 7, { 0 }}, - { 102, 0, 3, 5, { 0 }}, - { 103, 0, 6, 7, { 0 }}, - { 104, 0, 3, 7, { 0 }}, - { 105, 0, 3, 2, { 0 }}, - { 106, -2, 3, 2, { 0 }}, - { 107, 0, 3, 7, { 0 }}, - { 108, 0, 3, 4, { 0 }}, - { 109, 0, 6, 10, { 0 }}, - { 110, 0, 6, 7, { 0 }}, - { 111, 0, 6, 7, { 0 }}, - { 112, 0, 6, 7, { 0 }}, - { 113, 0, 6, 7, { 0 }}, - { 114, 0, 6, 6, { 0 }}, - { 115, 0, 6, 7, { 0 }}, - { 116, 0, 3, 6, { 0 }}, - { 117, 0, 6, 7, { 0 }}, - { 118, 0, 6, 7, { 0 }}, - { 119, 0, 6, 10, { 0 }}, - { 120, 0, 6, 7, { 0 }}, - { 121, 0, 6, 7, { 0 }}, - { 122, 0, 6, 7, { 0 }}, - { 123, 0, 3, 5, { 0 }}, - { 124, 0, 3, 2, { 0 }}, - { 125, 0, 3, 5, { 0 }}, - { 126, 0, 6, 8, { 0 }}, -}; - -// Style loading function: cyber -static void GuiLoadStyleCyber(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < CYBER_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(cyberStyleProps[i].controlId, cyberStyleProps[i].propertyId, cyberStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int cyberFontDataSize = 0; - unsigned char *data = DecompressData(cyberFontData, CYBER_COMPRESSED_DATA_SIZE, &cyberFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 14; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, cyberFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, cyberFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - Rectangle whiteChar = { 89, 9, 2, 2 }; - SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/cyber/cyber.rgs b/examples/gui/basic_controls/styles/cyber/cyber.rgs deleted file mode 100644 index 577a195..0000000 Binary files a/examples/gui/basic_controls/styles/cyber/cyber.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/cyber/cyber.txt.rgs b/examples/gui/basic_controls/styles/cyber/cyber.txt.rgs deleted file mode 100644 index 7d4d346..0000000 --- a/examples/gui/basic_controls/styles/cyber/cyber.txt.rgs +++ /dev/null @@ -1,24 +0,0 @@ -# -# rgs style text file (v3.1) - raygui style file generated using rGuiStyler -# -# Style properties: -# f -# p -# -f 14 0 Kyrou 7 Wide.ttf -p 00 00 0x2f7486ff DEFAULT_BORDER_COLOR_NORMAL -p 00 01 0x024658ff DEFAULT_BASE_COLOR_NORMAL -p 00 02 0x51bfd3ff DEFAULT_TEXT_COLOR_NORMAL -p 00 03 0x82cde0ff DEFAULT_BORDER_COLOR_FOCUSED -p 00 04 0x3299b4ff DEFAULT_BASE_COLOR_FOCUSED -p 00 05 0xb6e1eaff DEFAULT_TEXT_COLOR_FOCUSED -p 00 06 0xeb7630ff DEFAULT_BORDER_COLOR_PRESSED -p 00 07 0xffbc51ff DEFAULT_BASE_COLOR_PRESSED -p 00 08 0xd86f36ff DEFAULT_TEXT_COLOR_PRESSED -p 00 09 0x134b5aff DEFAULT_BORDER_COLOR_DISABLED -p 00 10 0x02313dff DEFAULT_BASE_COLOR_DISABLED -p 00 11 0x17505fff DEFAULT_TEXT_COLOR_DISABLED -p 00 16 0x0000000e DEFAULT_TEXT_SIZE -p 00 17 0x00000000 DEFAULT_TEXT_SPACING -p 00 18 0x81c0d0ff DEFAULT_LINE_COLOR -p 00 19 0x00222bff DEFAULT_BACKGROUND_COLOR diff --git a/examples/gui/basic_controls/styles/cyber/font_readme.txt b/examples/gui/basic_controls/styles/cyber/font_readme.txt deleted file mode 100644 index 45def0a..0000000 --- a/examples/gui/basic_controls/styles/cyber/font_readme.txt +++ /dev/null @@ -1,36 +0,0 @@ -Thank you for downloading the free Grixel fonts. You can use them in your personal and commercial projects too. They include Western European, Central European, Turkish and Greek characters. They are Unicode TrueType fonts and are optimized to work in both Windows XP and Mac OS X platforms using Adobe Photoshop CS2 and Macromedia Flash 8. - - -Grixel fonts are under Creative Commons Attribution-NoDerivs 2.5 License which can be found here: - -http://creativecommons.org/licenses/by-nd/2.5/ - -=============================================================== -Attribution-NoDerivs 2.5 - -You are free: - - * to copy, distribute, display, and perform the work - * to make commercial use of the work - -Under the following conditions: - -by -Attribution. You must attribute the work in the manner specified by the author or licensor. - -nd -No Derivative Works. You may not alter, transform, or build upon this work. - - * For any reuse or distribution, you must make clear to others the license terms of this work. - * Any of these conditions can be waived if you get permission from the copyright holder. - -Your fair use and other rights are in no way affected by the above. -=============================================================== - - -In no event shall Nikos Giannakopoulos be held liable to you for any consequential or incidental damages, including any lost revenue, profits, goodwill or savings, or for any claim by any third party caused by using these fonts. - -Please read the UsageGuides.pdf before you use them. - - -Grixel - Greek pixel fonts | Nikos Giannakopoulos | www.grixel.gr \ No newline at end of file diff --git a/examples/gui/basic_controls/styles/cyber/screenshot.png b/examples/gui/basic_controls/styles/cyber/screenshot.png deleted file mode 100644 index 5f0b4b7..0000000 Binary files a/examples/gui/basic_controls/styles/cyber/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/cyber/style_table.png b/examples/gui/basic_controls/styles/cyber/style_table.png deleted file mode 100644 index b16d320..0000000 Binary files a/examples/gui/basic_controls/styles/cyber/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/dark/PixelOperator.ttf b/examples/gui/basic_controls/styles/dark/PixelOperator.ttf deleted file mode 100644 index 34fe947..0000000 Binary files a/examples/gui/basic_controls/styles/dark/PixelOperator.ttf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/dark/README.md b/examples/gui/basic_controls/styles/dark/README.md deleted file mode 100644 index f9377c4..0000000 --- a/examples/gui/basic_controls/styles/dark/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: dark --------------- -Classical dark style with an extra high-def colour touch! Elegant and professional, perfect for the expensive tools! - -![dark style table](dark_table.png) - -screenshot ------------ - -![dark style screen](screenshot.png) - -about font ------------ -"Pixel Operator" font by de Jayvee Enaguas. - -CC0 1.0 Universal, downloaded from dafont.com: [pixel-operator](https://www.dafont.com/pixel-operator.font) diff --git a/examples/gui/basic_controls/styles/dark/dark.h b/examples/gui/basic_controls/styles/dark/dark.h deleted file mode 100644 index 17d6f13..0000000 --- a/examples/gui/basic_controls/styles/dark/dark.h +++ /dev/null @@ -1,347 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleDark(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define DARK_STYLE_PROPS_COUNT 22 - -// Custom style name: dark -static const GuiStyleProp darkStyleProps[DARK_STYLE_PROPS_COUNT] = { - { 0, 0, 0x878787ff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0x2c2c2cff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0xc3c3c3ff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0xe1e1e1ff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0x848484ff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0x181818ff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0x000000ff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0xefefefff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0x202020ff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0x6a6a6aff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0x818181ff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0x606060ff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 16, 0x00000010 }, // DEFAULT_TEXT_SIZE - { 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING - { 0, 18, 0x9d9d9dff }, // DEFAULT_LINE_COLOR - { 0, 19, 0x3c3c3cff }, // DEFAULT_BACKGROUND_COLOR - { 1, 5, 0xf7f7f7ff }, // LABEL_TEXT_COLOR_FOCUSED - { 1, 8, 0x898989ff }, // LABEL_TEXT_COLOR_PRESSED - { 4, 5, 0xb0b0b0ff }, // SLIDER_TEXT_COLOR_FOCUSED - { 5, 5, 0x848484ff }, // PROGRESSBAR_TEXT_COLOR_FOCUSED - { 9, 5, 0xf5f5f5ff }, // TEXTBOX_TEXT_COLOR_FOCUSED - { 10, 5, 0xf6f6f6ff }, // VALUEBOX_TEXT_COLOR_FOCUSED -}; - -// WARNING: This style uses a custom font: PixelOperator.ttf (size: 16, spacing: 0) - -#define DARK_COMPRESSED_DATA_SIZE 1031 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char darkFontData[DARK_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0xd1, 0x76, 0x9b, 0x30, 0x0c, 0x00, 0x50, 0xff, 0xff, 0x4f, 0x6b, 0x4f, 0x3b, 0xeb, 0xb6, 0x16, 0x90, 0x90, 0x8d, - 0x93, 0xdc, 0xdd, 0x97, 0x9d, 0x36, 0x25, 0xc4, 0xc2, 0xc6, 0x04, 0xc9, 0xc4, 0x00, 0x00, 0xf8, 0x47, 0x7c, 0xfb, 0x93, - 0xf8, 0xf1, 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5e, 0xae, 0xf8, 0x7f, 0x7a, 0x5e, 0xee, 0xdd, 0xeb, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x46, 0xbf, 0x00 }; - -// Font characters rectangles data -static const Rectangle darkFontRecs[95] = { - { 4, 4, 4 , 16 }, - { 16, 4, 1 , 9 }, - { 25, 4, 3 , 3 }, - { 36, 4, 6 , 9 }, - { 50, 4, 5 , 13 }, - { 63, 4, 7 , 9 }, - { 78, 4, 5 , 9 }, - { 91, 4, 1 , 3 }, - { 100, 4, 3 , 9 }, - { 111, 4, 3 , 9 }, - { 122, 4, 5 , 5 }, - { 135, 4, 5 , 5 }, - { 148, 4, 2 , 3 }, - { 158, 4, 4 , 1 }, - { 170, 4, 1 , 1 }, - { 179, 4, 3 , 9 }, - { 190, 4, 5 , 9 }, - { 203, 4, 3 , 9 }, - { 214, 4, 5 , 9 }, - { 227, 4, 5 , 9 }, - { 240, 4, 5 , 9 }, - { 4, 28, 5 , 9 }, - { 17, 28, 5 , 9 }, - { 30, 28, 5 , 9 }, - { 43, 28, 5 , 9 }, - { 56, 28, 5 , 9 }, - { 69, 28, 1 , 7 }, - { 78, 28, 2 , 9 }, - { 88, 28, 3 , 5 }, - { 99, 28, 4 , 3 }, - { 111, 28, 3 , 5 }, - { 122, 28, 5 , 9 }, - { 135, 28, 7 , 9 }, - { 150, 28, 5 , 9 }, - { 163, 28, 5 , 9 }, - { 176, 28, 5 , 9 }, - { 189, 28, 5 , 9 }, - { 202, 28, 5 , 9 }, - { 215, 28, 5 , 9 }, - { 228, 28, 5 , 9 }, - { 241, 28, 5 , 9 }, - { 4, 52, 1 , 9 }, - { 13, 52, 5 , 9 }, - { 26, 52, 5 , 9 }, - { 39, 52, 5 , 9 }, - { 52, 52, 7 , 9 }, - { 67, 52, 5 , 9 }, - { 80, 52, 5 , 9 }, - { 93, 52, 5 , 9 }, - { 106, 52, 5 , 9 }, - { 119, 52, 5 , 9 }, - { 132, 52, 5 , 9 }, - { 145, 52, 5 , 9 }, - { 158, 52, 5 , 9 }, - { 171, 52, 5 , 9 }, - { 184, 52, 7 , 9 }, - { 199, 52, 5 , 9 }, - { 212, 52, 5 , 9 }, - { 225, 52, 5 , 9 }, - { 238, 52, 3 , 9 }, - { 4, 76, 3 , 9 }, - { 15, 76, 3 , 9 }, - { 26, 76, 5 , 3 }, - { 39, 76, 5 , 1 }, - { 52, 76, 2 , 2 }, - { 62, 76, 5 , 7 }, - { 75, 76, 5 , 9 }, - { 88, 76, 5 , 7 }, - { 101, 76, 5 , 9 }, - { 114, 76, 5 , 7 }, - { 127, 76, 4 , 9 }, - { 139, 76, 5 , 9 }, - { 152, 76, 5 , 9 }, - { 165, 76, 1 , 9 }, - { 174, 76, 5 , 11 }, - { 187, 76, 5 , 9 }, - { 200, 76, 2 , 9 }, - { 210, 76, 7 , 7 }, - { 225, 76, 5 , 7 }, - { 238, 76, 5 , 7 }, - { 4, 100, 5 , 9 }, - { 17, 100, 5 , 9 }, - { 30, 100, 5 , 7 }, - { 43, 100, 5 , 7 }, - { 56, 100, 4 , 8 }, - { 68, 100, 5 , 7 }, - { 81, 100, 5 , 7 }, - { 94, 100, 7 , 7 }, - { 109, 100, 5 , 7 }, - { 122, 100, 5 , 9 }, - { 135, 100, 5 , 7 }, - { 148, 100, 4 , 9 }, - { 160, 100, 1 , 9 }, - { 169, 100, 4 , 9 }, - { 181, 100, 6 , 2 }, -}; - -// Font glyphs info data -// NOTE: No glyphs.image data provided -static const GlyphInfo darkFontChars[95] = { - { 32, 0, 13, 4, { 0 }}, - { 33, 2, 4, 5, { 0 }}, - { 34, 2, 4, 7, { 0 }}, - { 35, 1, 4, 8, { 0 }}, - { 36, 1, 2, 7, { 0 }}, - { 37, 1, 4, 9, { 0 }}, - { 38, 1, 4, 7, { 0 }}, - { 39, 2, 4, 5, { 0 }}, - { 40, 3, 4, 7, { 0 }}, - { 41, 1, 4, 7, { 0 }}, - { 42, 1, 4, 7, { 0 }}, - { 43, 1, 6, 7, { 0 }}, - { 44, 1, 12, 5, { 0 }}, - { 45, 1, 8, 6, { 0 }}, - { 46, 2, 12, 5, { 0 }}, - { 47, 1, 4, 5, { 0 }}, - { 48, 1, 4, 7, { 0 }}, - { 49, 2, 4, 7, { 0 }}, - { 50, 1, 4, 7, { 0 }}, - { 51, 1, 4, 7, { 0 }}, - { 52, 1, 4, 7, { 0 }}, - { 53, 1, 4, 7, { 0 }}, - { 54, 1, 4, 7, { 0 }}, - { 55, 1, 4, 7, { 0 }}, - { 56, 1, 4, 7, { 0 }}, - { 57, 1, 4, 7, { 0 }}, - { 58, 2, 6, 5, { 0 }}, - { 59, 1, 6, 5, { 0 }}, - { 60, 1, 6, 5, { 0 }}, - { 61, 1, 7, 6, { 0 }}, - { 62, 1, 6, 5, { 0 }}, - { 63, 1, 4, 7, { 0 }}, - { 64, 1, 4, 9, { 0 }}, - { 65, 1, 4, 7, { 0 }}, - { 66, 1, 4, 7, { 0 }}, - { 67, 1, 4, 7, { 0 }}, - { 68, 1, 4, 7, { 0 }}, - { 69, 1, 4, 7, { 0 }}, - { 70, 1, 4, 7, { 0 }}, - { 71, 1, 4, 7, { 0 }}, - { 72, 1, 4, 7, { 0 }}, - { 73, 2, 4, 5, { 0 }}, - { 74, 1, 4, 7, { 0 }}, - { 75, 1, 4, 7, { 0 }}, - { 76, 1, 4, 7, { 0 }}, - { 77, 1, 4, 9, { 0 }}, - { 78, 1, 4, 7, { 0 }}, - { 79, 1, 4, 7, { 0 }}, - { 80, 1, 4, 7, { 0 }}, - { 81, 1, 4, 7, { 0 }}, - { 82, 1, 4, 7, { 0 }}, - { 83, 1, 4, 7, { 0 }}, - { 84, 1, 4, 7, { 0 }}, - { 85, 1, 4, 7, { 0 }}, - { 86, 1, 4, 7, { 0 }}, - { 87, 1, 4, 9, { 0 }}, - { 88, 1, 4, 7, { 0 }}, - { 89, 1, 4, 7, { 0 }}, - { 90, 1, 4, 7, { 0 }}, - { 91, 3, 4, 7, { 0 }}, - { 92, 1, 4, 5, { 0 }}, - { 93, 1, 4, 7, { 0 }}, - { 94, 1, 4, 7, { 0 }}, - { 95, 0, 14, 5, { 0 }}, - { 96, 1, 4, 5, { 0 }}, - { 97, 1, 6, 7, { 0 }}, - { 98, 1, 4, 7, { 0 }}, - { 99, 1, 6, 7, { 0 }}, - { 100, 1, 4, 7, { 0 }}, - { 101, 1, 6, 7, { 0 }}, - { 102, 1, 4, 6, { 0 }}, - { 103, 1, 6, 7, { 0 }}, - { 104, 1, 4, 7, { 0 }}, - { 105, 2, 4, 5, { 0 }}, - { 106, 1, 4, 7, { 0 }}, - { 107, 1, 4, 7, { 0 }}, - { 108, 2, 4, 5, { 0 }}, - { 109, 1, 6, 9, { 0 }}, - { 110, 1, 6, 7, { 0 }}, - { 111, 1, 6, 7, { 0 }}, - { 112, 1, 6, 7, { 0 }}, - { 113, 1, 6, 7, { 0 }}, - { 114, 1, 6, 7, { 0 }}, - { 115, 1, 6, 7, { 0 }}, - { 116, 1, 5, 6, { 0 }}, - { 117, 1, 6, 7, { 0 }}, - { 118, 1, 6, 7, { 0 }}, - { 119, 1, 6, 9, { 0 }}, - { 120, 1, 6, 7, { 0 }}, - { 121, 1, 6, 7, { 0 }}, - { 122, 1, 6, 7, { 0 }}, - { 123, 2, 4, 7, { 0 }}, - { 124, 2, 4, 5, { 0 }}, - { 125, 1, 4, 7, { 0 }}, - { 126, 1, 4, 8, { 0 }}, -}; - -// Style loading function: dark -static void GuiLoadStyleDark(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < DARK_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(darkStyleProps[i].controlId, darkStyleProps[i].propertyId, darkStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int darkFontDataSize = 0; - unsigned char *data = DecompressData(darkFontData, DARK_COMPRESSED_DATA_SIZE, &darkFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 16; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, darkFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, darkFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // TODO: Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - Rectangle whiteChar = { 124, 6, 1, 1 }; - SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/dark/dark.rgs b/examples/gui/basic_controls/styles/dark/dark.rgs deleted file mode 100644 index 9021402..0000000 Binary files a/examples/gui/basic_controls/styles/dark/dark.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/dark/font_LICENSE.txt b/examples/gui/basic_controls/styles/dark/font_LICENSE.txt deleted file mode 100644 index 0e259d4..0000000 --- a/examples/gui/basic_controls/styles/dark/font_LICENSE.txt +++ /dev/null @@ -1,121 +0,0 @@ -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. diff --git a/examples/gui/basic_controls/styles/dark/screenshot.png b/examples/gui/basic_controls/styles/dark/screenshot.png deleted file mode 100644 index febb132..0000000 Binary files a/examples/gui/basic_controls/styles/dark/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/dark/style_table.png b/examples/gui/basic_controls/styles/dark/style_table.png deleted file mode 100644 index 2a3cd55..0000000 Binary files a/examples/gui/basic_controls/styles/dark/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/default/README.md b/examples/gui/basic_controls/styles/default/README.md deleted file mode 100644 index e1f15d0..0000000 --- a/examples/gui/basic_controls/styles/default/README.md +++ /dev/null @@ -1,14 +0,0 @@ -style: default ---------------- -raylib style, simple and easy-to-use. Light colors, wide borders, a sophisticated touch. - -![default style table](style_table.png) - -screenshot ------------ - -![default style screen](screenshot.png) - -about font ------------ -raylib font by Ramon Santamaria ([@raysan5](https://twitter.com/raysan5)). diff --git a/examples/gui/basic_controls/styles/default/default.txt.rgs b/examples/gui/basic_controls/styles/default/default.txt.rgs deleted file mode 100644 index fa325a6..0000000 --- a/examples/gui/basic_controls/styles/default/default.txt.rgs +++ /dev/null @@ -1,69 +0,0 @@ -# -# rgs style text file (v3.1) - raygui style file generated using rGuiStyler -# -# Style properties: -# f -# p -# -p 00 00 0x838383ff DEFAULT_BORDER_COLOR_NORMAL -p 00 01 0xc9c9c9ff DEFAULT_BASE_COLOR_NORMAL -p 00 02 0x686868ff DEFAULT_TEXT_COLOR_NORMAL -p 00 03 0x5bb2d9ff DEFAULT_BORDER_COLOR_FOCUSED -p 00 04 0xc9effeff DEFAULT_BASE_COLOR_FOCUSED -p 00 05 0x6c9bbcff DEFAULT_TEXT_COLOR_FOCUSED -p 00 06 0x0492c7ff DEFAULT_BORDER_COLOR_PRESSED -p 00 07 0x97e8ffff DEFAULT_BASE_COLOR_PRESSED -p 00 08 0x368bafff DEFAULT_TEXT_COLOR_PRESSED -p 00 09 0xb5c1c2ff DEFAULT_BORDER_COLOR_DISABLED -p 00 10 0xe6e9e9ff DEFAULT_BASE_COLOR_DISABLED -p 00 11 0xaeb7b8ff DEFAULT_TEXT_COLOR_DISABLED -p 00 12 0x1 DEFAULT_BORDER_WIDTH -p 00 13 0x0 DEFAULT_TEXT_PADDING -p 00 14 0x1 DEFAULT_TEXT_ALIGNMENT -p 00 15 0x0 DEFAULT_RESERVED -p 00 16 0xa DEFAULT_TEXT_SIZE -p 00 17 0x1 DEFAULT_TEXT_SPACING -p 00 18 0x90abb5ff DEFAULT_LINE_COLOR -p 00 19 0xf5f5f5ff DEFAULT_BACKGROUND_COLOR -p 01 14 0x0 LABEL_TEXT_ALIGNMENT -p 02 12 0x2 BUTTON_BORDER_WIDTH -p 03 16 0x2 TOGGLE_GROUP_PADDING -p 04 16 0xf SLIDER_SLIDER_WIDTH -p 04 13 0x5 SLIDER_TEXT_PADDING -p 05 16 0x1 PROGRESSBAR_PROGRESS_PADDING -p 06 13 0x5 CHECKBOX_TEXT_PADDING -p 06 14 0x2 CHECKBOX_TEXT_ALIGNMENT -p 06 16 0x1 CHECKBOX_CHECK_PADDING -p 07 16 0x1e COMBOBOX_COMBO_BUTTON_WIDTH -p 07 17 0x2 COMBOBOX_COMBO_BUTTON_PADDING -p 08 16 0x10 DROPDOWNBOX_ARROW_PADDING -p 08 17 0x2 DROPDOWNBOX_DROPDOWN_ITEMS_PADDING -p 09 13 0x5 TEXTBOX_TEXT_PADDING -p 09 14 0x0 TEXTBOX_TEXT_ALIGNMENT -p 09 16 0x5 TEXTBOX_TEXT_LINES_PADDING -p 09 17 0xf0fffeff TEXTBOX_COLOR_SELECTED_FG -p 09 18 0x839affe0 TEXTBOX_COLOR_SELECTED_BG -p 10 13 0x4 VALUEBOX_TEXT_PADDING -p 10 14 0x0 VALUEBOX_TEXT_ALIGNMENT -p 11 13 0x4 SPINNER_TEXT_PADDING -p 11 14 0x0 SPINNER_TEXT_ALIGNMENT -p 11 16 0x14 SPINNER_SPIN_BUTTON_WIDTH -p 11 17 0x2 SPINNER_SPIN_BUTTON_PADDING -p 12 16 0x1e LISTVIEW_LIST_ITEMS_HEIGHT -p 12 17 0x2 LISTVIEW_LIST_ITEMS_PADDING -p 12 18 0xa LISTVIEW_SCROLLBAR_WIDTH -p 12 19 0x2 LISTVIEW_SCROLLBAR_SIDE -p 13 16 0x6 COLORPICKER_COLOR_SELECTOR_SIZE -p 13 17 0x14 COLORPICKER_HUEBAR_WIDTH -p 13 18 0xa COLORPICKER_HUEBAR_PADDING -p 13 19 0x6 COLORPICKER_HUEBAR_SELECTOR_HEIGHT -p 13 20 0x2 COLORPICKER_HUEBAR_SELECTOR_OVERFLOW -p 14 12 0x0 SCROLLBAR_BORDER_WIDTH -p 14 16 0x6 SCROLLBAR_ARROWS_SIZE -p 14 17 0x0 SCROLLBAR_ARROWS_VISIBLE -p 14 18 0x0 SCROLLBAR_SCROLL_SLIDER_PADDING -p 14 19 0x10 SCROLLBAR_SCROLL_SLIDER_SIZE -p 14 20 0x0 SCROLLBAR_SCROLL_PADDING -p 14 21 0xa SCROLLBAR_SCROLL_SPEED -p 15 13 0xa STATUSBAR_TEXT_PADDING -p 15 14 0x0 STATUSBAR_TEXT_ALIGNMENT diff --git a/examples/gui/basic_controls/styles/default/screenshot.png b/examples/gui/basic_controls/styles/default/screenshot.png deleted file mode 100644 index c3b750a..0000000 Binary files a/examples/gui/basic_controls/styles/default/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/default/style_table.png b/examples/gui/basic_controls/styles/default/style_table.png deleted file mode 100644 index 191a14f..0000000 Binary files a/examples/gui/basic_controls/styles/default/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/enefete/GenericMobileSystemNuevo.ttf b/examples/gui/basic_controls/styles/enefete/GenericMobileSystemNuevo.ttf deleted file mode 100644 index 777a528..0000000 Binary files a/examples/gui/basic_controls/styles/enefete/GenericMobileSystemNuevo.ttf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/enefete/README.md b/examples/gui/basic_controls/styles/enefete/README.md deleted file mode 100644 index c7359f2..0000000 --- a/examples/gui/basic_controls/styles/enefete/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: enefete --------------- -Inspired by money and pain, a desperate jump into the trendings train, a train to nowhere. Don't stare at it for too long! - -![enefete style table](enefete_table.png) - -screenshot ------------ - -![enefete style screen](screenshot.png) - -about font ------------ -"Generic Mobile System" font by de Jayvee Enaguas. - -CC0 1.0 Universal, downloaded from dafont.com: [generic-mobile-system](https://www.dafont.com/generic-mobile-system.font) diff --git a/examples/gui/basic_controls/styles/enefete/enefete.h b/examples/gui/basic_controls/styles/enefete/enefete.h deleted file mode 100644 index 7fb4b87..0000000 --- a/examples/gui/basic_controls/styles/enefete/enefete.h +++ /dev/null @@ -1,353 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleEnefete(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define ENEFETE_STYLE_PROPS_COUNT 16 - -// Custom style name: enefete -static const GuiStyleProp enefeteStyleProps[ENEFETE_STYLE_PROPS_COUNT] = { - { 0, 0, 0x1980d5ff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0x4df3ebff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0x103e60ff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0xe7e2f7ff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0x23d4ddff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0xf1f1f1ff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0x6413a6ff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0xea66d9ff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0x9f00bbff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0x4b909eff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0x73c7d0ff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0x448894ff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 16, 0x00000010 }, // DEFAULT_TEXT_SIZE - { 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING - { 0, 18, 0x1d3f6cff }, // DEFAULT_LINE_COLOR - { 0, 19, 0x29c9e5ff }, // DEFAULT_BACKGROUND_COLOR -}; - -// WARNING: This style uses a custom font: GenericMobileSystemNuevo.ttf (size: 16, spacing: 0) - -#define ENEFETE_COMPRESSED_DATA_SIZE 1270 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char enefeteFontData[ENEFETE_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0x51, 0x96, 0xe3, 0x26, 0x10, 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0x75, 0xb6, 0xe1, 0xf3, 0xc7, 0xff, 0x93, 0xd5, 0xa3, 0x95, 0xfb, 0x73, 0x4e, 0xe5, 0xe1, - 0x67, 0xf5, 0xff, 0xf2, 0x3f, 0xa3, 0x72, 0xb6, 0x3d, 0xfc, 0x1d, 0x1d, 0xdf, 0x59, 0xaf, 0xfe, 0xc9, 0xaf, 0x54, 0xad, - 0xf5, 0xb7, 0xd7, 0xe6, 0x6b, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x93, 0x47, 0x73, 0x62, 0x72, 0x75, 0xd7, 0xd9, - 0xfa, 0x9f, 0xf8, 0x65, 0x74, 0x58, 0x9b, 0x7f, 0xce, 0x08, 0x76, 0xcd, 0xaa, 0x8e, 0xd1, 0x7d, 0x97, 0x71, 0x66, 0xfd, - 0x42, 0x55, 0xfe, 0xdf, 0x56, 0x25, 0xf1, 0x96, 0xea, 0x95, 0xda, 0x55, 0x5d, 0x79, 0xcb, 0x0c, 0x40, 0xf9, 0x9b, 0xff, - 0xf9, 0xed, 0x95, 0x70, 0xdf, 0x70, 0xfd, 0xef, 0xf8, 0xf7, 0xee, 0x90, 0xbf, 0xfc, 0xe5, 0x2f, 0x7f, 0xf9, 0xcb, 0x5f, - 0xfe, 0xaa, 0xfd, 0x73, 0xf3, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8f, 0xf3, 0x17 }; - -// Font characters rectangles data -static const Rectangle enefeteFontRecs[95] = { - { 4, 4, 4 , 16 }, - { 16, 4, 2 , 10 }, - { 26, 4, 5 , 3 }, - { 39, 4, 7 , 10 }, - { 54, 4, 7 , 13 }, - { 69, 4, 7 , 10 }, - { 84, 4, 7 , 10 }, - { 99, 4, 2 , 3 }, - { 109, 4, 3 , 12 }, - { 120, 4, 3 , 12 }, - { 131, 4, 5 , 6 }, - { 144, 4, 6 , 5 }, - { 158, 4, 2 , 4 }, - { 168, 4, 5 , 1 }, - { 181, 4, 2 , 2 }, - { 191, 4, 4 , 10 }, - { 203, 4, 6 , 10 }, - { 217, 4, 4 , 10 }, - { 229, 4, 6 , 10 }, - { 4, 28, 6 , 10 }, - { 18, 28, 6 , 10 }, - { 32, 28, 6 , 10 }, - { 46, 28, 6 , 10 }, - { 60, 28, 6 , 10 }, - { 74, 28, 6 , 10 }, - { 88, 28, 6 , 10 }, - { 102, 28, 2 , 6 }, - { 112, 28, 2 , 8 }, - { 122, 28, 7 , 7 }, - { 137, 28, 5 , 3 }, - { 150, 28, 7 , 7 }, - { 165, 28, 6 , 10 }, - { 179, 28, 7 , 12 }, - { 194, 28, 7 , 10 }, - { 209, 28, 7 , 10 }, - { 224, 28, 7 , 10 }, - { 239, 28, 7 , 10 }, - { 4, 52, 7 , 10 }, - { 19, 52, 7 , 10 }, - { 34, 52, 7 , 10 }, - { 49, 52, 7 , 10 }, - { 64, 52, 2 , 10 }, - { 74, 52, 5 , 10 }, - { 87, 52, 7 , 10 }, - { 102, 52, 6 , 10 }, - { 116, 52, 9 , 10 }, - { 133, 52, 7 , 10 }, - { 148, 52, 7 , 10 }, - { 163, 52, 7 , 10 }, - { 178, 52, 7 , 12 }, - { 193, 52, 7 , 10 }, - { 208, 52, 7 , 10 }, - { 223, 52, 6 , 10 }, - { 237, 52, 7 , 10 }, - { 4, 76, 7 , 10 }, - { 19, 76, 8 , 10 }, - { 35, 76, 7 , 10 }, - { 50, 76, 6 , 10 }, - { 64, 76, 7 , 10 }, - { 79, 76, 4 , 12 }, - { 91, 76, 4 , 10 }, - { 103, 76, 4 , 12 }, - { 115, 76, 6 , 3 }, - { 129, 76, 7 , 1 }, - { 144, 76, 4 , 3 }, - { 156, 76, 6 , 7 }, - { 170, 76, 6 , 10 }, - { 184, 76, 6 , 7 }, - { 198, 76, 6 , 10 }, - { 212, 76, 6 , 7 }, - { 226, 76, 4 , 10 }, - { 238, 76, 6 , 9 }, - { 4, 100, 6 , 10 }, - { 18, 100, 2 , 10 }, - { 28, 100, 5 , 12 }, - { 41, 100, 6 , 10 }, - { 55, 100, 3 , 10 }, - { 66, 100, 8 , 7 }, - { 82, 100, 6 , 7 }, - { 96, 100, 6 , 7 }, - { 110, 100, 6 , 9 }, - { 124, 100, 6 , 9 }, - { 138, 100, 5 , 7 }, - { 151, 100, 6 , 7 }, - { 165, 100, 4 , 10 }, - { 177, 100, 6 , 7 }, - { 191, 100, 6 , 7 }, - { 205, 100, 8 , 7 }, - { 221, 100, 6 , 7 }, - { 235, 100, 6 , 9 }, - { 4, 124, 6 , 7 }, - { 18, 124, 5 , 12 }, - { 31, 124, 2 , 12 }, - { 41, 124, 5 , 12 }, - { 54, 124, 7 , 3 }, -}; - -// Font glyphs info data -// NOTE: No glyphs.image data provided -static const GlyphInfo enefeteFontChars[95] = { - { 32, 0, 12, 4, { 0 }}, - { 33, 0, 2, 3, { 0 }}, - { 34, 0, 2, 6, { 0 }}, - { 35, 0, 2, 8, { 0 }}, - { 36, 0, 1, 8, { 0 }}, - { 37, 0, 2, 8, { 0 }}, - { 38, 0, 2, 8, { 0 }}, - { 39, 0, 2, 3, { 0 }}, - { 40, 0, 2, 4, { 0 }}, - { 41, 0, 2, 4, { 0 }}, - { 42, 0, 4, 6, { 0 }}, - { 43, 0, 6, 7, { 0 }}, - { 44, 0, 10, 3, { 0 }}, - { 45, 0, 8, 6, { 0 }}, - { 46, 0, 10, 3, { 0 }}, - { 47, 0, 2, 5, { 0 }}, - { 48, 0, 2, 7, { 0 }}, - { 49, 0, 2, 7, { 0 }}, - { 50, 0, 2, 7, { 0 }}, - { 51, 0, 2, 7, { 0 }}, - { 52, 0, 2, 7, { 0 }}, - { 53, 0, 2, 7, { 0 }}, - { 54, 0, 2, 7, { 0 }}, - { 55, 0, 2, 7, { 0 }}, - { 56, 0, 2, 7, { 0 }}, - { 57, 0, 2, 7, { 0 }}, - { 58, 0, 4, 3, { 0 }}, - { 59, 0, 4, 3, { 0 }}, - { 60, 0, 4, 8, { 0 }}, - { 61, 0, 6, 6, { 0 }}, - { 62, 0, 4, 8, { 0 }}, - { 63, 0, 2, 7, { 0 }}, - { 64, 0, 2, 8, { 0 }}, - { 65, 0, 2, 8, { 0 }}, - { 66, 0, 2, 8, { 0 }}, - { 67, 0, 2, 8, { 0 }}, - { 68, 0, 2, 8, { 0 }}, - { 69, 0, 2, 8, { 0 }}, - { 70, 0, 2, 8, { 0 }}, - { 71, 0, 2, 8, { 0 }}, - { 72, 0, 2, 8, { 0 }}, - { 73, 0, 2, 3, { 0 }}, - { 74, 0, 2, 6, { 0 }}, - { 75, 0, 2, 8, { 0 }}, - { 76, 0, 2, 7, { 0 }}, - { 77, 0, 2, 10, { 0 }}, - { 78, 0, 2, 8, { 0 }}, - { 79, 0, 2, 8, { 0 }}, - { 80, 0, 2, 8, { 0 }}, - { 81, 0, 2, 8, { 0 }}, - { 82, 0, 2, 8, { 0 }}, - { 83, 0, 2, 8, { 0 }}, - { 84, 0, 2, 7, { 0 }}, - { 85, 0, 2, 8, { 0 }}, - { 86, 0, 2, 8, { 0 }}, - { 87, 0, 2, 9, { 0 }}, - { 88, 0, 2, 8, { 0 }}, - { 89, 0, 2, 7, { 0 }}, - { 90, 0, 2, 8, { 0 }}, - { 91, 0, 2, 5, { 0 }}, - { 92, 0, 2, 5, { 0 }}, - { 93, 0, 2, 5, { 0 }}, - { 94, 0, 2, 7, { 0 }}, - { 95, 0, 14, 8, { 0 }}, - { 96, 0, 2, 5, { 0 }}, - { 97, 0, 5, 7, { 0 }}, - { 98, 0, 2, 7, { 0 }}, - { 99, 0, 5, 7, { 0 }}, - { 100, 0, 2, 7, { 0 }}, - { 101, 0, 5, 7, { 0 }}, - { 102, 0, 2, 5, { 0 }}, - { 103, 0, 5, 7, { 0 }}, - { 104, 0, 2, 7, { 0 }}, - { 105, 0, 2, 3, { 0 }}, - { 106, 0, 2, 6, { 0 }}, - { 107, 0, 2, 7, { 0 }}, - { 108, 0, 2, 4, { 0 }}, - { 109, 0, 5, 9, { 0 }}, - { 110, 0, 5, 7, { 0 }}, - { 111, 0, 5, 7, { 0 }}, - { 112, 0, 5, 7, { 0 }}, - { 113, 0, 5, 7, { 0 }}, - { 114, 0, 5, 6, { 0 }}, - { 115, 0, 5, 7, { 0 }}, - { 116, 0, 2, 5, { 0 }}, - { 117, 0, 5, 7, { 0 }}, - { 118, 0, 5, 7, { 0 }}, - { 119, 0, 5, 9, { 0 }}, - { 120, 0, 5, 7, { 0 }}, - { 121, 0, 5, 7, { 0 }}, - { 122, 0, 5, 7, { 0 }}, - { 123, 0, 2, 6, { 0 }}, - { 124, 0, 2, 3, { 0 }}, - { 125, 0, 2, 6, { 0 }}, - { 126, 0, 6, 8, { 0 }}, -}; - -// Style loading function: enefete -static void GuiLoadStyleEnefete(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < ENEFETE_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(enefeteStyleProps[i].controlId, enefeteStyleProps[i].propertyId, enefeteStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int enefeteFontDataSize = 0; - unsigned char *data = DecompressData(enefeteFontData, ENEFETE_COMPRESSED_DATA_SIZE, &enefeteFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 16; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, enefeteFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, enefeteFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // TODO: Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - Rectangle whiteChar = { 99, 4, 2, 2 }; - SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/enefete/enefete.rgs b/examples/gui/basic_controls/styles/enefete/enefete.rgs deleted file mode 100644 index 25ed8f8..0000000 Binary files a/examples/gui/basic_controls/styles/enefete/enefete.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/enefete/font_LICENSE.txt b/examples/gui/basic_controls/styles/enefete/font_LICENSE.txt deleted file mode 100644 index 0e259d4..0000000 --- a/examples/gui/basic_controls/styles/enefete/font_LICENSE.txt +++ /dev/null @@ -1,121 +0,0 @@ -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. diff --git a/examples/gui/basic_controls/styles/enefete/screenshot.png b/examples/gui/basic_controls/styles/enefete/screenshot.png deleted file mode 100644 index 6135a5d..0000000 Binary files a/examples/gui/basic_controls/styles/enefete/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/enefete/style_table.png b/examples/gui/basic_controls/styles/enefete/style_table.png deleted file mode 100644 index 1bc5bf3..0000000 Binary files a/examples/gui/basic_controls/styles/enefete/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/jungle/Pixel Intv.otf b/examples/gui/basic_controls/styles/jungle/Pixel Intv.otf deleted file mode 100644 index e8c54a7..0000000 Binary files a/examples/gui/basic_controls/styles/jungle/Pixel Intv.otf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/jungle/README.md b/examples/gui/basic_controls/styles/jungle/README.md deleted file mode 100644 index a08b6fc..0000000 --- a/examples/gui/basic_controls/styles/jungle/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: jungle --------------- -Sunset in the jungle, trees do not let to see the last rays of sun on the horizon, small creek in the path, mug on the shoes, a touch of danger and the adventure feeling, get into your jeep and drive with this style. - -![jungle style table](style_table.png) - -screenshot ------------ - -![jungle style screen](screenshot.png) - -about font ------------ -"Pixel Intv" font by [Pixel Sagas](http://www.pixelsagas.com) (Neale and Shayna Davidson). - -100% free font, downloaded from dafont.com: [pixel-intv](https://www.dafont.com/pixel-intv.font) diff --git a/examples/gui/basic_controls/styles/jungle/font_readme.txt b/examples/gui/basic_controls/styles/jungle/font_readme.txt deleted file mode 100644 index b4e6c6e..0000000 --- a/examples/gui/basic_controls/styles/jungle/font_readme.txt +++ /dev/null @@ -1,47 +0,0 @@ -Shareware/ Font License - -Pixel Sagas Freeware Fonts EULA (End User License Agreement) and Software Inclusion Agreement - -"Purchaser" and "User" may be used interchangeably in this agreement. - -"Pixel Sagas" and "Neale Davidson" may be used interchangeably in this agreement. These all refer to the intellectual and legal property of Neale Davidson. - -Usage - -Pixel Saga's Shareware Fonts are free to use for personal, non-commercial purposes. No payment is necessary to use Pixel Saga's Freeware Fonts for personal use, and there is no limit to the amount of prints, pages, or other medium to be produced using them. However, you cannot offer the font for commercial sale, or offer for direct download. The inclusion othe font name and/or site URL in the credits or documentation when it is used is appreciated, but this is not mandatory. - -Payment - -Payment is not required for the use of Pixel Saga's Shareware Fonts. Commercial use requires a modest fee which can be paid through the pixelsagas.com web site through Paypal.com's services. The transaction receipt for any shareware "commercial license" purchase will suffice as proof of license. - -Support - -Font installation help is available at http://www.pixelsagas.com. If you experience problems with any Pixel Saga's Freeware font (such as spacing issues or missing characters), please verify that you have the correct and current version of the fonts. In the case of Freeware fonts, downloading the font directly from the Pixel Sagas site will ensure that the font files have not been altered. - -Software Inclusion Agreement - -Pixel Saga's software products are protected by copyright laws and International copyright treaties, as well as other intellectual property laws and treaties. All Pixel Saga's software products are licensed, not sold. - -1) GRANT OF LICENSE - -This document grants the user the following rights: - -Installation and Use. The user may install and use an unlimited number of copies of the software product. The user may not offer Pixel Sagas freeware fonts for direct download unless the user has received explicit, written permission from Neale Davidson. Otherwise please direct users to the http://www.pixelsagas.com website. Pixel Sagas freeware fonts may, however, be embedded for web, publication, or general software use. - -2) WARRANTIES - -None - -Pixel Sagas expressly disclaims any warranty for the software product. The software product and any related documentation is provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability, fitness for a particular purpose, or non-infringement. The entire risk arising out of use or performance of the software product remains with the user. - -No Liability For Consequential Damages. - -In no event shall Neale Davidson or Pixel Sagas be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use this product, even if Pixel Sagas has been advised of the possibility of such damages. - -3) MISCELLANEOUS - -Should the user have any questions concerning this document or you desire to contact Neale Davidson for any reason, please email jaynz@pixelsagas.com . - -Governing Law - -This agreement is governed by and subject to the laws of the United States of America. diff --git a/examples/gui/basic_controls/styles/jungle/jungle.h b/examples/gui/basic_controls/styles/jungle/jungle.h deleted file mode 100644 index f506dc1..0000000 --- a/examples/gui/basic_controls/styles/jungle/jungle.h +++ /dev/null @@ -1,342 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleJungle(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define JUNGLE_STYLE_PROPS_COUNT 16 - -// Custom style name: jungle -static const GuiStyleProp jungleStyleProps[JUNGLE_STYLE_PROPS_COUNT] = { - { 0, 0, 0x60827dff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0x2c3334ff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0x82a29fff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0x5f9aa8ff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0x334e57ff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0x6aa9b8ff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0xa9cb8dff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0x3b6357ff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0x97af81ff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0x5b6462ff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0x2c3334ff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0x666b69ff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 16, 0x0000000c }, // DEFAULT_TEXT_SIZE - { 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING - { 0, 18, 0x638465ff }, // DEFAULT_LINE_COLOR - { 0, 19, 0x2b3a3aff }, // DEFAULT_BACKGROUND_COLOR -}; - -// WARNING: This style uses a custom font: (size: 12, spacing: 0) - -#define JUNGLE_COMPRESSED_DATA_SIZE 1059 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char jungleFontData[JUNGLE_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0xe1, 0x6e, 0xdb, 0x20, 0x14, 0x06, 0x50, 0x84, 0xfa, 0xfe, 0xaf, 0xcc, 0xd4, 0x6d, 0xdd, 0xb4, 0x35, 0xc6, 0xdc, - 0x0b, 0xd8, 0x69, 0x7a, 0x7a, 0xd4, 0x3f, 0x71, 0xeb, 0xd8, 0x5c, 0x83, 0x53, 0xf1, 0x15, 0xb7, 0x02, 0x00, 0xf0, 0xc9, - 0xfb, 0xd7, 0xe3, 0xd7, 0x1e, 0x6d, 0x29, 0xbf, 0xb7, 0x8c, 0xef, 0xeb, 0xe3, 0xf5, 0x5f, 0x5b, 0xea, 0xe1, 0x4f, 0x3c, - 0xde, 0x63, 0x3d, 0x38, 0x86, 0xa3, 0xa3, 0x3e, 0x3e, 0xb2, 0x12, 0xda, 0x72, 0xbc, 0xff, 0xe3, 0xf6, 0x2a, 0x81, 0x73, - 0xf8, 0xf7, 0xab, 0x04, 0xce, 0xa5, 0xff, 0x7b, 0xbb, 0xeb, 0xdf, 0x6f, 0x83, 0xe3, 0x6d, 0xbf, 0xbe, 0xdf, 0x5b, 0xa2, - 0x06, 0xf6, 0x79, 0xfc, 0xf3, 0x25, 0x74, 0x05, 0xc6, 0xaf, 0x8c, 0x58, 0xeb, 0xf6, 0x7e, 0xfa, 0xec, 0x1c, 0x5a, 0xf0, - 0x08, 0x3e, 0x5e, 0xdf, 0x59, 0xff, 0xf2, 0xe7, 0x3d, 0xc6, 0xfb, 0xff, 0x59, 0x55, 0x5a, 0x7b, 0x7b, 0xd8, 0x12, 0xa5, - 0x5b, 0x9b,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e, 0x73, 0x79, 0xf9, 0xeb, 0xfa, 0x7f, 0xfe, 0x1d, 0xcb, 0x96, 0x27, 0xa3, 0xcf, 0xf6, - 0xd6, 0xd8, 0x4a, 0x8d, 0x77, 0x24, 0xb5, 0xd6, 0xe7, 0xe5, 0x76, 0x25, 0xbb, 0xee, 0x4d, 0x2f, 0xae, 0xca, 0xaf, 0xce, - 0xae, 0xfe, 0x7d, 0x47, 0xfd, 0x65, 0xc7, 0x5e, 0xfb, 0x2a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x6e, 0xf3, 0x38, - 0xeb, 0x9e, 0x47, 0x15, 0x5d, 0xd5, 0xad, 0x85, 0x57, 0x68, 0x63, 0xd7, 0x0c, 0x70, 0xe9, 0x54, 0x69, 0x2e, 0xfd, 0x72, - 0xf4, 0x6a, 0xed, 0x26, 0x45, 0xb8, 0xbb, 0xfe, 0x35, 0xbc, 0x56, 0x5b, 0x7c, 0x45, 0x33, 0x9e, 0xb5, 0xfe, 0xf9, 0x14, - 0x97, 0x2b, 0xe0, 0x15, 0x92, 0x1c, 0x99, 0x9c, 0x9b, 0xfe, 0xff, 0x9a, 0xff, 0x07, 0xa2, 0xfe, 0x92, 0x5c, 0xea, 0xcf, - 0xca, 0xbf, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x29, 0x3f, 0x00 }; - -// Font characters rectangles data -static const Rectangle jungleFontRecs[95] = { - { 4, 4, 5 , 12 }, - { 17, 4, 2 , 7 }, - { 27, 4, 5 , 3 }, - { 40, 4, 5 , 5 }, - { 53, 4, 6 , 7 }, - { 67, 4, 7 , 7 }, - { 82, 4, 5 , 7 }, - { 95, 4, 3 , 3 }, - { 106, 4, 4 , 8 }, - { 118, 4, 4 , 8 }, - { 130, 4, 5 , 5 }, - { 143, 4, 5 , 5 }, - { 156, 4, 2 , 3 }, - { 166, 4, 5 , 1 }, - { 179, 4, 2 , 2 }, - { 189, 4, 7 , 7 }, - { 204, 4, 7 , 6 }, - { 219, 4, 6 , 6 }, - { 233, 4, 6 , 6 }, - { 4, 24, 6 , 6 }, - { 18, 24, 6 , 6 }, - { 32, 24, 6 , 6 }, - { 46, 24, 6 , 6 }, - { 60, 24, 6 , 6 }, - { 74, 24, 6 , 6 }, - { 88, 24, 6 , 6 }, - { 102, 24, 2 , 5 }, - { 112, 24, 2 , 6 }, - { 122, 24, 3 , 5 }, - { 133, 24, 5 , 3 }, - { 146, 24, 3 , 5 }, - { 157, 24, 6 , 7 }, - { 171, 24, 7 , 7 }, - { 186, 24, 6 , 7 }, - { 200, 24, 6 , 7 }, - { 214, 24, 6 , 7 }, - { 228, 24, 6 , 7 }, - { 4, 44, 6 , 7 }, - { 18, 44, 6 , 7 }, - { 32, 44, 6 , 7 }, - { 46, 44, 6 , 7 }, - { 60, 44, 6 , 7 }, - { 74, 44, 6 , 7 }, - { 88, 44, 6 , 7 }, - { 102, 44, 6 , 7 }, - { 116, 44, 7 , 7 }, - { 131, 44, 6 , 7 }, - { 145, 44, 6 , 7 }, - { 159, 44, 6 , 7 }, - { 173, 44, 7 , 8 }, - { 188, 44, 6 , 7 }, - { 202, 44, 6 , 7 }, - { 216, 44, 6 , 7 }, - { 230, 44, 6 , 7 }, - { 4, 64, 6 , 7 }, - { 18, 64, 7 , 7 }, - { 33, 64, 6 , 7 }, - { 47, 64, 6 , 7 }, - { 61, 64, 6 , 7 }, - { 75, 64, 4 , 8 }, - { 87, 64, 7 , 7 }, - { 102, 64, 4 , 8 }, - { 114, 64, 4 , 2 }, - { 126, 64, 6 , 1 }, - { 140, 64, 2 , 2 }, - { 150, 64, 6 , 5 }, - { 164, 64, 6 , 7 }, - { 178, 64, 6 , 5 }, - { 192, 64, 6 , 7 }, - { 206, 64, 6 , 5 }, - { 220, 64, 6 , 7 }, - { 234, 64, 6 , 7 }, - { 4, 84, 6 , 7 }, - { 18, 84, 6 , 7 }, - { 32, 84, 5 , 8 }, - { 45, 84, 6 , 7 }, - { 59, 84, 6 , 7 }, - { 73, 84, 7 , 5 }, - { 88, 84, 6 , 5 }, - { 102, 84, 6 , 5 }, - { 116, 84, 6 , 7 }, - { 130, 84, 6 , 7 }, - { 144, 84, 6 , 5 }, - { 158, 84, 6 , 5 }, - { 172, 84, 6 , 6 }, - { 186, 84, 6 , 5 }, - { 200, 84, 6 , 5 }, - { 214, 84, 7 , 5 }, - { 229, 84, 6 , 5 }, - { 4, 104, 6 , 7 }, - { 18, 104, 6 , 5 }, - { 32, 104, 4 , 8 }, - { 44, 104, 2 , 8 }, - { 54, 104, 4 , 8 }, - { 66, 104, 5 , 2 }, -}; - -// Font characters info data -// NOTE: No chars.image data provided -static const GlyphInfo jungleFontChars[95] = { - { 32, 0, 9, 5, { 0 }}, - { 33, 0, 2, 3, { 0 }}, - { 34, 0, 2, 6, { 0 }}, - { 35, 0, 3, 6, { 0 }}, - { 36, 0, 2, 7, { 0 }}, - { 37, 0, 2, 8, { 0 }}, - { 38, 0, 2, 6, { 0 }}, - { 39, 0, 2, 4, { 0 }}, - { 40, 0, 2, 5, { 0 }}, - { 41, 0, 2, 5, { 0 }}, - { 42, 0, 2, 6, { 0 }}, - { 43, 0, 3, 6, { 0 }}, - { 44, 0, 7, 3, { 0 }}, - { 45, 0, 5, 6, { 0 }}, - { 46, 0, 7, 3, { 0 }}, - { 47, 0, 2, 8, { 0 }}, - { 48, 0, 3, 8, { 0 }}, - { 49, 0, 3, 7, { 0 }}, - { 50, 0, 3, 7, { 0 }}, - { 51, 0, 3, 7, { 0 }}, - { 52, 0, 3, 7, { 0 }}, - { 53, 0, 3, 7, { 0 }}, - { 54, 0, 3, 7, { 0 }}, - { 55, 0, 3, 7, { 0 }}, - { 56, 0, 3, 7, { 0 }}, - { 57, 0, 3, 7, { 0 }}, - { 58, 0, 4, 3, { 0 }}, - { 59, 0, 4, 3, { 0 }}, - { 60, 0, 3, 4, { 0 }}, - { 61, 0, 4, 6, { 0 }}, - { 62, 0, 3, 4, { 0 }}, - { 63, 0, 2, 7, { 0 }}, - { 64, 0, 2, 8, { 0 }}, - { 65, 0, 2, 7, { 0 }}, - { 66, 0, 2, 7, { 0 }}, - { 67, 0, 2, 7, { 0 }}, - { 68, 0, 2, 7, { 0 }}, - { 69, 0, 2, 7, { 0 }}, - { 70, 0, 2, 7, { 0 }}, - { 71, 0, 2, 7, { 0 }}, - { 72, 0, 2, 7, { 0 }}, - { 73, 0, 2, 7, { 0 }}, - { 74, 0, 2, 7, { 0 }}, - { 75, 0, 2, 7, { 0 }}, - { 76, 0, 2, 7, { 0 }}, - { 77, 0, 2, 8, { 0 }}, - { 78, 0, 2, 7, { 0 }}, - { 79, 0, 2, 7, { 0 }}, - { 80, 0, 2, 7, { 0 }}, - { 81, 0, 2, 7, { 0 }}, - { 82, 0, 2, 7, { 0 }}, - { 83, 0, 2, 7, { 0 }}, - { 84, 0, 2, 7, { 0 }}, - { 85, 0, 2, 7, { 0 }}, - { 86, 0, 2, 7, { 0 }}, - { 87, 0, 2, 8, { 0 }}, - { 88, 0, 2, 7, { 0 }}, - { 89, 0, 2, 7, { 0 }}, - { 90, 0, 2, 7, { 0 }}, - { 91, 0, 2, 5, { 0 }}, - { 92, 0, 2, 8, { 0 }}, - { 93, 0, 2, 5, { 0 }}, - { 94, 0, -1, 5, { 0 }}, - { 95, 0, 10, 7, { 0 }}, - { 96, 0, -1, 3, { 0 }}, - { 97, 0, 4, 7, { 0 }}, - { 98, 0, 2, 7, { 0 }}, - { 99, 0, 4, 7, { 0 }}, - { 100, 0, 2, 7, { 0 }}, - { 101, 0, 4, 7, { 0 }}, - { 102, 0, 2, 7, { 0 }}, - { 103, 0, 4, 7, { 0 }}, - { 104, 0, 2, 7, { 0 }}, - { 105, 0, 2, 7, { 0 }}, - { 106, 0, 2, 6, { 0 }}, - { 107, 0, 2, 7, { 0 }}, - { 108, 0, 2, 7, { 0 }}, - { 109, 0, 4, 8, { 0 }}, - { 110, 0, 4, 7, { 0 }}, - { 111, 0, 4, 7, { 0 }}, - { 112, 0, 4, 7, { 0 }}, - { 113, 0, 4, 7, { 0 }}, - { 114, 0, 4, 7, { 0 }}, - { 115, 0, 4, 7, { 0 }}, - { 116, 0, 3, 7, { 0 }}, - { 117, 0, 4, 7, { 0 }}, - { 118, 0, 4, 7, { 0 }}, - { 119, 0, 4, 8, { 0 }}, - { 120, 0, 4, 7, { 0 }}, - { 121, 0, 4, 7, { 0 }}, - { 122, 0, 4, 7, { 0 }}, - { 123, 0, 2, 5, { 0 }}, - { 124, 0, 2, 3, { 0 }}, - { 125, 0, 2, 5, { 0 }}, - { 126, 0, -1, 6, { 0 }}, -}; - -// Style loading function: jungle -static void GuiLoadStyleJungle(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < JUNGLE_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(jungleStyleProps[i].controlId, jungleStyleProps[i].propertyId, jungleStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int jungleFontDataSize = 0; - unsigned char *data = DecompressData(jungleFontData, JUNGLE_COMPRESSED_DATA_SIZE, &jungleFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 12; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, jungleFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, jungleFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - Rectangle whiteChar = { 27, 4, 2, 2 }; - SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/jungle/jungle.rgs b/examples/gui/basic_controls/styles/jungle/jungle.rgs deleted file mode 100644 index b767af3..0000000 Binary files a/examples/gui/basic_controls/styles/jungle/jungle.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/jungle/jungle.txt.rgs b/examples/gui/basic_controls/styles/jungle/jungle.txt.rgs deleted file mode 100644 index 1852268..0000000 --- a/examples/gui/basic_controls/styles/jungle/jungle.txt.rgs +++ /dev/null @@ -1,24 +0,0 @@ -# -# rgs style text file (v3.1) - raygui style file generated using rGuiStyler -# -# Style properties: -# f -# p -# -f 12 0 Pixel Intv.otf -p 00 00 0x60827dff DEFAULT_BORDER_COLOR_NORMAL -p 00 01 0x2c3334ff DEFAULT_BASE_COLOR_NORMAL -p 00 02 0x82a29fff DEFAULT_TEXT_COLOR_NORMAL -p 00 03 0x5f9aa8ff DEFAULT_BORDER_COLOR_FOCUSED -p 00 04 0x334e57ff DEFAULT_BASE_COLOR_FOCUSED -p 00 05 0x6aa9b8ff DEFAULT_TEXT_COLOR_FOCUSED -p 00 06 0xa9cb8dff DEFAULT_BORDER_COLOR_PRESSED -p 00 07 0x3b6357ff DEFAULT_BASE_COLOR_PRESSED -p 00 08 0x97af81ff DEFAULT_TEXT_COLOR_PRESSED -p 00 09 0x5b6462ff DEFAULT_BORDER_COLOR_DISABLED -p 00 10 0x2c3334ff DEFAULT_BASE_COLOR_DISABLED -p 00 11 0x666b69ff DEFAULT_TEXT_COLOR_DISABLED -p 00 16 0x0000000c TEXT_SIZE -p 00 17 0x00000000 TEXT_SPACING -p 00 18 0x638465ff DEFAULT_LINE_COLOR -p 00 19 0x2b3a3aff DEFAULT_BACKGROUND_COLOR diff --git a/examples/gui/basic_controls/styles/jungle/screenshot.png b/examples/gui/basic_controls/styles/jungle/screenshot.png deleted file mode 100644 index bc6afef..0000000 Binary files a/examples/gui/basic_controls/styles/jungle/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/jungle/style_table.png b/examples/gui/basic_controls/styles/jungle/style_table.png deleted file mode 100644 index 17d5f96..0000000 Binary files a/examples/gui/basic_controls/styles/jungle/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/lavanda/Cartridge.ttf b/examples/gui/basic_controls/styles/lavanda/Cartridge.ttf deleted file mode 100644 index 19d7280..0000000 Binary files a/examples/gui/basic_controls/styles/lavanda/Cartridge.ttf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/lavanda/README.md b/examples/gui/basic_controls/styles/lavanda/README.md deleted file mode 100644 index 396dfc5..0000000 --- a/examples/gui/basic_controls/styles/lavanda/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: lavanda ---------------- -Walk thought the fields full of lavanda, feels like a dream, a touch of fantasy, just relax and close your eyes, could you feel it? - -![lavanda style table](style_table.png) - -screenshot ------------ - -![lavanda style screen](screenshot.png) - -about font ------------ -"Cartridge" font by [jeti](https://fontenddev.com/) - -Licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), downloaded from dafont.com: [cartridge](https://www.dafont.com/cartridge.font) diff --git a/examples/gui/basic_controls/styles/lavanda/font_readme.txt b/examples/gui/basic_controls/styles/lavanda/font_readme.txt deleted file mode 100644 index c9ff454..0000000 --- a/examples/gui/basic_controls/styles/lavanda/font_readme.txt +++ /dev/null @@ -1,6 +0,0 @@ -Cartridge by jeti: A decorative, Art Nouveau-inspired font with a dainty, fantastical hand-lettered feel. - -You are free to use this font for personal or commercial projects, all I ask is that you include credit. - -Licensed under CC BY 4.0: https://creativecommons.org/licenses/by/4.0/ -More info: https://fontenddev.com/fonts/cartridge/ diff --git a/examples/gui/basic_controls/styles/lavanda/lavanda.h b/examples/gui/basic_controls/styles/lavanda/lavanda.h deleted file mode 100644 index 7d8c7fb..0000000 --- a/examples/gui/basic_controls/styles/lavanda/lavanda.h +++ /dev/null @@ -1,354 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleLavanda(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define LAVANDA_STYLE_PROPS_COUNT 15 - -// Custom style name: lavanda -static const GuiStyleProp lavandaStyleProps[LAVANDA_STYLE_PROPS_COUNT] = { - { 0, 0, 0xab9bd3ff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0x3e4350ff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0xdadaf4ff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0xee84a0ff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0xf4b7c7ff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0xb7657bff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0xd5c8dbff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0x966ec0ff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0xd7ccf7ff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0x8fa2bdff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0x6b798dff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0x8292a9ff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 16, 0x00000010 }, // DEFAULT_TEXT_SIZE - { 0, 18, 0x84adb7ff }, // DEFAULT_LINE_COLOR - { 0, 19, 0x5b5b81ff }, // DEFAULT_BACKGROUND_COLOR -}; - -// WARNING: This style uses a custom font: (size: 16, spacing: 1) - -#define LAVANDA_COMPRESSED_DATA_SIZE 1317 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char lavandaFontData[LAVANDA_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0x4b, 0x96, 0xa3, 0x48, 0x0c, 0x05, 0x50, 0xf6, 0xbf, 0xe9, 0xd7, 0xa3, 0x3a, 0xdd, 0x7d, 0xaa, 0x0c, 0x21, 0x85, - 0xc0, 0x76, 0xd6, 0xcd, 0x3b, 0x4b, 0xff, 0x00, 0x11, 0x80, 0xcd, 0x13, 0xe4, 0x00, 0x00, 0xf8, 0x4d, 0xfe, 0xf8, 0x9f, - 0x9c, 0x3c, 0x37, 0xcb, 0xef, 0xf4, 0xeb, 0xff, 0xb9, 0x78, 0xc6, 0xff, 0x9f, 0xb5, 0xf6, 0xbe, 0x59, 0xfe, 0xfc, 0xce, - 0x23, 0xf9, 0xe3, 0xf4, 0x65, 0xe3, 0xf5, 0xaf, 0xde, 0xa1, 0xfe, 0xfc, 0x7f, 0xff, 0xbe, 0xa1, 0xfe, 0x59, 0x78, 0xe5, - 0xf9, 0xe3, 0xd9, 0x58, 0x27, 0xae, 0x96, 0x56, 0xca, 0x6b, 0xcc, 0xce, 0x52, 0x3d, 0x9b, 0xc6, 0xca, 0xf3, 0x27, 0xa6, - 0xb0, 0x5e, 0x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4, 0x3f, 0x3d, 0xfe, 0xe7, 0x33, 0xaa, 0x79, 0x2c, 0x83, 0x7a, 0x47, 0xcf, - 0x70, 0xef, 0x1a, 0xf2, 0x53, 0xd3, 0xfe, 0xde, 0xfa, 0x3f, 0x93, 0x50, 0xce, 0x1b, 0xeb, 0x3f, 0xff, 0x59, 0x69, 0xf7, - 0x15, 0xfc, 0xdc, 0xcc, 0x74, 0x3e, 0xa8, 0x6e, 0xdf, 0xb5, 0x8c, 0x64, 0xe6, 0xd5, 0x5f, 0xfd, 0xff, 0xde, 0x3c, 0x7f, - 0xa4, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xed, 0x1f }; - -// Font characters rectangles data -static const Rectangle lavandaFontRecs[95] = { - { 4, 4, 5 , 16 }, - { 17, 4, 1 , 9 }, - { 26, 4, 3 , 3 }, - { 37, 4, 7 , 8 }, - { 52, 4, 5 , 11 }, - { 65, 4, 10 , 8 }, - { 83, 4, 7 , 9 }, - { 98, 4, 1 , 3 }, - { 107, 4, 3 , 12 }, - { 118, 4, 3 , 12 }, - { 129, 4, 5 , 4 }, - { 142, 4, 5 , 5 }, - { 155, 4, 2 , 3 }, - { 165, 4, 3 , 1 }, - { 176, 4, 1 , 1 }, - { 185, 4, 4 , 12 }, - { 197, 4, 5 , 9 }, - { 210, 4, 3 , 9 }, - { 221, 4, 5 , 9 }, - { 234, 4, 5 , 9 }, - { 4, 28, 5 , 9 }, - { 17, 28, 5 , 9 }, - { 30, 28, 5 , 9 }, - { 43, 28, 5 , 9 }, - { 56, 28, 5 , 9 }, - { 69, 28, 5 , 9 }, - { 82, 28, 1 , 4 }, - { 91, 28, 2 , 6 }, - { 101, 28, 4 , 5 }, - { 113, 28, 4 , 3 }, - { 125, 28, 4 , 5 }, - { 137, 28, 5 , 9 }, - { 150, 28, 7 , 10 }, - { 165, 28, 7 , 9 }, - { 180, 28, 6 , 9 }, - { 194, 28, 5 , 9 }, - { 207, 28, 6 , 9 }, - { 221, 28, 5 , 9 }, - { 234, 28, 5 , 9 }, - { 4, 52, 6 , 9 }, - { 18, 52, 5 , 10 }, - { 31, 52, 1 , 9 }, - { 40, 52, 6 , 9 }, - { 54, 52, 6 , 9 }, - { 68, 52, 5 , 9 }, - { 81, 52, 8 , 11 }, - { 97, 52, 6 , 10 }, - { 111, 52, 7 , 9 }, - { 126, 52, 5 , 9 }, - { 139, 52, 7 , 11 }, - { 154, 52, 5 , 9 }, - { 167, 52, 6 , 9 }, - { 181, 52, 7 , 9 }, - { 196, 52, 6 , 9 }, - { 210, 52, 6 , 10 }, - { 224, 52, 9 , 10 }, - { 4, 76, 6 , 11 }, - { 18, 76, 5 , 10 }, - { 31, 76, 5 , 9 }, - { 44, 76, 3 , 12 }, - { 55, 76, 4 , 12 }, - { 67, 76, 3 , 12 }, - { 78, 76, 5 , 4 }, - { 91, 76, 6 , 1 }, - { 105, 76, 3 , 3 }, - { 116, 76, 6 , 7 }, - { 130, 76, 5 , 9 }, - { 143, 76, 4 , 7 }, - { 155, 76, 5 , 10 }, - { 168, 76, 4 , 7 }, - { 180, 76, 3 , 10 }, - { 191, 76, 4 , 11 }, - { 203, 76, 5 , 11 }, - { 216, 76, 1 , 9 }, - { 225, 76, 5 , 12 }, - { 238, 76, 5 , 9 }, - { 4, 100, 1 , 9 }, - { 13, 100, 8 , 9 }, - { 29, 100, 5 , 9 }, - { 42, 100, 4 , 7 }, - { 54, 100, 5 , 10 }, - { 67, 100, 5 , 10 }, - { 80, 100, 5 , 7 }, - { 93, 100, 5 , 7 }, - { 106, 100, 3 , 9 }, - { 117, 100, 5 , 7 }, - { 130, 100, 5 , 8 }, - { 143, 100, 9 , 8 }, - { 160, 100, 5 , 9 }, - { 173, 100, 6 , 9 }, - { 187, 100, 4 , 7 }, - { 199, 100, 5 , 12 }, - { 212, 100, 1 , 12 }, - { 221, 100, 5 , 12 }, - { 234, 100, 6 , 2 }, -}; - -// Font characters info data -// NOTE: No chars.image data provided -static const GlyphInfo lavandaFontChars[95] = { - { 32, 0, 12, 5, { 0 }}, - { 33, 0, 3, 2, { 0 }}, - { 34, 0, 3, 4, { 0 }}, - { 35, 0, 3, 8, { 0 }}, - { 36, 0, 2, 6, { 0 }}, - { 37, 0, 4, 11, { 0 }}, - { 38, 0, 3, 8, { 0 }}, - { 39, 0, 3, 2, { 0 }}, - { 40, 0, 2, 4, { 0 }}, - { 41, 0, 2, 4, { 0 }}, - { 42, 0, 3, 6, { 0 }}, - { 43, 0, 5, 6, { 0 }}, - { 44, 0, 10, 3, { 0 }}, - { 45, 0, 7, 4, { 0 }}, - { 46, 0, 11, 2, { 0 }}, - { 47, 0, 2, 5, { 0 }}, - { 48, 0, 3, 6, { 0 }}, - { 49, 0, 3, 4, { 0 }}, - { 50, 0, 3, 6, { 0 }}, - { 51, 0, 3, 6, { 0 }}, - { 52, 0, 3, 6, { 0 }}, - { 53, 0, 3, 6, { 0 }}, - { 54, 0, 3, 6, { 0 }}, - { 55, 0, 3, 6, { 0 }}, - { 56, 0, 3, 6, { 0 }}, - { 57, 0, 3, 6, { 0 }}, - { 58, 0, 7, 2, { 0 }}, - { 59, 0, 7, 3, { 0 }}, - { 60, 0, 5, 5, { 0 }}, - { 61, 0, 6, 5, { 0 }}, - { 62, 0, 5, 5, { 0 }}, - { 63, 0, 3, 6, { 0 }}, - { 64, 0, 4, 8, { 0 }}, - { 65, 0, 3, 8, { 0 }}, - { 66, 0, 3, 7, { 0 }}, - { 67, 0, 3, 6, { 0 }}, - { 68, 0, 3, 7, { 0 }}, - { 69, 0, 3, 6, { 0 }}, - { 70, 0, 3, 6, { 0 }}, - { 71, 0, 3, 7, { 0 }}, - { 72, 0, 2, 6, { 0 }}, - { 73, 0, 3, 2, { 0 }}, - { 74, 0, 3, 7, { 0 }}, - { 75, 0, 3, 7, { 0 }}, - { 76, 0, 3, 6, { 0 }}, - { 77, 0, 3, 9, { 0 }}, - { 78, 0, 2, 7, { 0 }}, - { 79, 0, 3, 8, { 0 }}, - { 80, 0, 3, 6, { 0 }}, - { 81, 0, 3, 8, { 0 }}, - { 82, 0, 3, 6, { 0 }}, - { 83, 0, 3, 7, { 0 }}, - { 84, 0, 3, 8, { 0 }}, - { 85, 0, 3, 7, { 0 }}, - { 86, 0, 2, 7, { 0 }}, - { 87, 0, 2, 10, { 0 }}, - { 88, 0, 3, 7, { 0 }}, - { 89, 0, 3, 6, { 0 }}, - { 90, 0, 3, 6, { 0 }}, - { 91, 0, 2, 4, { 0 }}, - { 92, 0, 2, 5, { 0 }}, - { 93, 0, 2, 4, { 0 }}, - { 94, 0, 3, 6, { 0 }}, - { 95, 0, 13, 7, { 0 }}, - { 96, 0, 3, 4, { 0 }}, - { 97, 0, 5, 7, { 0 }}, - { 98, 0, 3, 6, { 0 }}, - { 99, 0, 5, 5, { 0 }}, - { 100, 0, 2, 6, { 0 }}, - { 101, 0, 5, 5, { 0 }}, - { 102, 0, 2, 4, { 0 }}, - { 103, 0, 4, 5, { 0 }}, - { 104, 0, 3, 6, { 0 }}, - { 105, 0, 3, 2, { 0 }}, - { 106, -1, 3, 5, { 0 }}, - { 107, 0, 3, 6, { 0 }}, - { 108, 0, 3, 2, { 0 }}, - { 109, 0, 5, 9, { 0 }}, - { 110, 0, 5, 6, { 0 }}, - { 111, 0, 5, 5, { 0 }}, - { 112, 0, 5, 6, { 0 }}, - { 113, 0, 5, 6, { 0 }}, - { 114, 0, 5, 6, { 0 }}, - { 115, 0, 5, 6, { 0 }}, - { 116, 0, 3, 4, { 0 }}, - { 117, 0, 5, 6, { 0 }}, - { 118, 0, 4, 6, { 0 }}, - { 119, 0, 4, 10, { 0 }}, - { 120, 0, 5, 6, { 0 }}, - { 121, -1, 5, 6, { 0 }}, - { 122, 0, 5, 5, { 0 }}, - { 123, 0, 2, 6, { 0 }}, - { 124, 0, 2, 2, { 0 }}, - { 125, 0, 2, 6, { 0 }}, - { 126, 0, 7, 7, { 0 }}, -}; - -// Style loading function: lavanda -static void GuiLoadStyleLavanda(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < LAVANDA_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(lavandaStyleProps[i].controlId, lavandaStyleProps[i].propertyId, lavandaStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int lavandaFontDataSize = 0; - unsigned char *data = DecompressData(lavandaFontData, LAVANDA_COMPRESSED_DATA_SIZE, &lavandaFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 16; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, lavandaFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, lavandaFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - Rectangle whiteChar = { 130, 5, 2, 2 }; - SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/lavanda/lavanda.rgs b/examples/gui/basic_controls/styles/lavanda/lavanda.rgs deleted file mode 100644 index 3aa3e6f..0000000 Binary files a/examples/gui/basic_controls/styles/lavanda/lavanda.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/lavanda/lavanda.txt.rgs b/examples/gui/basic_controls/styles/lavanda/lavanda.txt.rgs deleted file mode 100644 index 23de947..0000000 --- a/examples/gui/basic_controls/styles/lavanda/lavanda.txt.rgs +++ /dev/null @@ -1,24 +0,0 @@ -# -# rgs style text file (v3.1) - raygui style file generated using rGuiStyler -# -# Style properties: -# f -# p -# -f 16 0 Cartridge.ttf -p 00 00 0xab9bd3ff DEFAULT_BORDER_COLOR_NORMAL -p 00 01 0x3e4350ff DEFAULT_BASE_COLOR_NORMAL -p 00 02 0xdadaf4ff DEFAULT_TEXT_COLOR_NORMAL -p 00 03 0xee84a0ff DEFAULT_BORDER_COLOR_FOCUSED -p 00 04 0xf4b7c7ff DEFAULT_BASE_COLOR_FOCUSED -p 00 05 0xb7657bff DEFAULT_TEXT_COLOR_FOCUSED -p 00 06 0xd5c8dbff DEFAULT_BORDER_COLOR_PRESSED -p 00 07 0x966ec0ff DEFAULT_BASE_COLOR_PRESSED -p 00 08 0xd7ccf7ff DEFAULT_TEXT_COLOR_PRESSED -p 00 09 0x8fa2bdff DEFAULT_BORDER_COLOR_DISABLED -p 00 10 0x6b798dff DEFAULT_BASE_COLOR_DISABLED -p 00 11 0x8292a9ff DEFAULT_TEXT_COLOR_DISABLED -p 00 16 0x00000010 TEXT_SIZE -p 00 17 0x00000001 TEXT_SPACING -p 00 18 0x84adb7ff DEFAULT_LINE_COLOR -p 00 19 0x5b5b81ff DEFAULT_BACKGROUND_COLOR diff --git a/examples/gui/basic_controls/styles/lavanda/screenshot.png b/examples/gui/basic_controls/styles/lavanda/screenshot.png deleted file mode 100644 index d6b621c..0000000 Binary files a/examples/gui/basic_controls/styles/lavanda/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/lavanda/style_table.png b/examples/gui/basic_controls/styles/lavanda/style_table.png deleted file mode 100644 index c067fe1..0000000 Binary files a/examples/gui/basic_controls/styles/lavanda/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/sunny/GenericMobileSystemNuevo.ttf b/examples/gui/basic_controls/styles/sunny/GenericMobileSystemNuevo.ttf deleted file mode 100644 index 777a528..0000000 Binary files a/examples/gui/basic_controls/styles/sunny/GenericMobileSystemNuevo.ttf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/sunny/README.md b/examples/gui/basic_controls/styles/sunny/README.md deleted file mode 100644 index 8da6659..0000000 --- a/examples/gui/basic_controls/styles/sunny/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: sunny -------------- -Sweet, colorful, sunny! Inspired by the [Playdate](https://play.date/) console and its [pulp](https://play.date/pulp/) editor! - -![sunny style table](style_table.png) - -screenshot ------------ - -![sunny style screen](screenshot.png) - -about font ------------ -"Generic Mobile System" font by Jayvee Enaguas (HarvettFox96). - -CC0 free font, downloaded from dafont.com: [generic-mobile-system](https://www.dafont.com/es/generic-mobile-system.font) diff --git a/examples/gui/basic_controls/styles/sunny/font_LICENSE.txt b/examples/gui/basic_controls/styles/sunny/font_LICENSE.txt deleted file mode 100644 index 60f42f6..0000000 --- a/examples/gui/basic_controls/styles/sunny/font_LICENSE.txt +++ /dev/null @@ -1,160 +0,0 @@ -===| Description |=== - -Generic Mobile System is a raster proportional sans serif typeface, extracted from various generic/knockoff mobile devices, created with libre/free font editor software FontForge. - -Source files: https://notabug.org/HarvettFox96/ttf-genericmobile/ - -===| Update log |=== - -Version 20190323.02: - -- OS/2 and TeX metric fixes. -- Updated Panose. - -Version 20190323.01: - -- Added outline variant. -- Minor fixes. - -Version 20190103.03: - -- Minor bearing tweaks. (Clásico only) -- Minor fixes. - -Version 20190103.02: - -- Bearing tweaks from the different generic mobile phone as Cherry Mobile S5. (Clásico only) -- Minor fixes. - -Version 20190103.01: - -- Initial public release. - -===| Copyright/attribution notice |=== - -© 2009-2019 Jayvee Enaguas (HarvettFox96). Released under a libre/free public domain licence as Creative Commons Zero (CC0) 1.0. Applies worldwide countries including the Philippines, Spain, etc. - - -------------------------------------------------------------------------------- - -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. diff --git a/examples/gui/basic_controls/styles/sunny/screenshot.png b/examples/gui/basic_controls/styles/sunny/screenshot.png deleted file mode 100644 index 643f7a9..0000000 Binary files a/examples/gui/basic_controls/styles/sunny/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/sunny/style_table.png b/examples/gui/basic_controls/styles/sunny/style_table.png deleted file mode 100644 index f429989..0000000 Binary files a/examples/gui/basic_controls/styles/sunny/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/sunny/sunny.h b/examples/gui/basic_controls/styles/sunny/sunny.h deleted file mode 100644 index ec10ca9..0000000 --- a/examples/gui/basic_controls/styles/sunny/sunny.h +++ /dev/null @@ -1,369 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleSunny(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define SUNNY_STYLE_PROPS_COUNT 32 - -// Custom style name: sunny -static const GuiStyleProp sunnyStyleProps[SUNNY_STYLE_PROPS_COUNT] = { - { 0, 0, 0x9c760aff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0x594006ff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0xf6d519ff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0xf6ee89ff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0xf5f3d1ff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0xf4cd19ff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0xf7e580ff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0xf7f2c1ff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0x52470aff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0xc0be92ff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0xd3d3a1ff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0xbcbc89ff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 16, 0x00000010 }, // DEFAULT_TEXT_SIZE - { 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING - { 0, 18, 0x725706ff }, // DEFAULT_LINE_COLOR - { 0, 19, 0xf0be4bff }, // DEFAULT_BACKGROUND_COLOR - { 1, 2, 0x504506ff }, // LABEL_TEXT_COLOR_NORMAL - { 1, 5, 0xfdeb9bff }, // LABEL_TEXT_COLOR_FOCUSED - { 1, 8, 0xf5e8a4ff }, // LABEL_TEXT_COLOR_PRESSED - { 2, 2, 0xebc21fff }, // BUTTON_TEXT_COLOR_NORMAL - { 3, 2, 0xebc21fff }, // TOGGLE_TEXT_COLOR_NORMAL - { 4, 2, 0x81700fff }, // SLIDER_TEXT_COLOR_NORMAL - { 4, 5, 0xf4e49aff }, // SLIDER_TEXT_COLOR_FOCUSED - { 7, 2, 0xebc21fff }, // COMBOBOX_TEXT_COLOR_NORMAL - { 8, 2, 0xefd87bff }, // DROPDOWNBOX_TEXT_COLOR_NORMAL - { 8, 5, 0xd4b219ff }, // DROPDOWNBOX_TEXT_COLOR_FOCUSED - { 9, 2, 0x7a680bff }, // TEXTBOX_TEXT_COLOR_NORMAL - { 9, 5, 0xad931fff }, // TEXTBOX_TEXT_COLOR_FOCUSED - { 10, 2, 0x62570eff }, // VALUEBOX_TEXT_COLOR_NORMAL - { 10, 5, 0xf2df88ff }, // VALUEBOX_TEXT_COLOR_FOCUSED - { 12, 2, 0xf4e798ff }, // LISTVIEW_TEXT_COLOR_NORMAL - { 15, 2, 0xebc21fff }, // STATUSBAR_TEXT_COLOR_NORMAL -}; - -// WARNING: This style uses a custom font: (size: 16, spacing: 0) - -#define SUNNY_COMPRESSED_DATA_SIZE 1270 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char sunnyFontData[SUNNY_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0x51, 0x96, 0xe3, 0x26, 0x10, 0x05, 0x50, 0xf6, 0xbf, 0xe9, 0xca, 0xc9, 0x47, 0x72, 0x26, 0x93, 0x69, 0x01, 0x45, - 0x21, 0x61, 0xf9, 0xf6, 0xfd, 0xb3, 0xda, 0xdd, 0x32, 0xcf, 0x12, 0x92, 0x29, 0x70, 0x34, 0x00, 0x80, 0xdf, 0xfc, 0xfd, - 0xf3, 0xe7, 0xc7, 0xfe, 0xb4, 0xe5, 0x7a, 0xdb, 0x3f, 0xbf, 0xd1, 0xdb, 0x12, 0x3f, 0x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 0x47, 0x73, 0x62, 0x72, 0x75, 0xd7, 0xd9, - 0xfa, 0x9f, 0xf8, 0x65, 0x74, 0x58, 0x9b, 0x7f, 0xce, 0x08, 0x76, 0xcd, 0xaa, 0x8e, 0xd1, 0x7d, 0x97, 0x71, 0x66, 0xfd, - 0x42, 0x55, 0xfe, 0xdf, 0x56, 0x25, 0xf1, 0x96, 0xea, 0x95, 0xda, 0x55, 0x5d, 0x79, 0xcb, 0x0c, 0x40, 0xf9, 0x9b, 0xff, - 0xf9, 0xed, 0x95, 0x70, 0xdf, 0x70, 0xfd, 0xef, 0xf8, 0xf7, 0xee, 0x90, 0xbf, 0xfc, 0xe5, 0x2f, 0x7f, 0xf9, 0xcb, 0x5f, - 0xfe, 0xaa, 0xfd, 0x73, 0xf3, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8f, 0xf3, 0x17 }; - -// Font characters rectangles data -static const Rectangle sunnyFontRecs[95] = { - { 4, 4, 4 , 16 }, - { 16, 4, 2 , 10 }, - { 26, 4, 5 , 3 }, - { 39, 4, 7 , 10 }, - { 54, 4, 7 , 13 }, - { 69, 4, 7 , 10 }, - { 84, 4, 7 , 10 }, - { 99, 4, 2 , 3 }, - { 109, 4, 3 , 12 }, - { 120, 4, 3 , 12 }, - { 131, 4, 5 , 6 }, - { 144, 4, 6 , 5 }, - { 158, 4, 2 , 4 }, - { 168, 4, 5 , 1 }, - { 181, 4, 2 , 2 }, - { 191, 4, 4 , 10 }, - { 203, 4, 6 , 10 }, - { 217, 4, 4 , 10 }, - { 229, 4, 6 , 10 }, - { 4, 28, 6 , 10 }, - { 18, 28, 6 , 10 }, - { 32, 28, 6 , 10 }, - { 46, 28, 6 , 10 }, - { 60, 28, 6 , 10 }, - { 74, 28, 6 , 10 }, - { 88, 28, 6 , 10 }, - { 102, 28, 2 , 6 }, - { 112, 28, 2 , 8 }, - { 122, 28, 7 , 7 }, - { 137, 28, 5 , 3 }, - { 150, 28, 7 , 7 }, - { 165, 28, 6 , 10 }, - { 179, 28, 7 , 12 }, - { 194, 28, 7 , 10 }, - { 209, 28, 7 , 10 }, - { 224, 28, 7 , 10 }, - { 239, 28, 7 , 10 }, - { 4, 52, 7 , 10 }, - { 19, 52, 7 , 10 }, - { 34, 52, 7 , 10 }, - { 49, 52, 7 , 10 }, - { 64, 52, 2 , 10 }, - { 74, 52, 5 , 10 }, - { 87, 52, 7 , 10 }, - { 102, 52, 6 , 10 }, - { 116, 52, 9 , 10 }, - { 133, 52, 7 , 10 }, - { 148, 52, 7 , 10 }, - { 163, 52, 7 , 10 }, - { 178, 52, 7 , 12 }, - { 193, 52, 7 , 10 }, - { 208, 52, 7 , 10 }, - { 223, 52, 6 , 10 }, - { 237, 52, 7 , 10 }, - { 4, 76, 7 , 10 }, - { 19, 76, 8 , 10 }, - { 35, 76, 7 , 10 }, - { 50, 76, 6 , 10 }, - { 64, 76, 7 , 10 }, - { 79, 76, 4 , 12 }, - { 91, 76, 4 , 10 }, - { 103, 76, 4 , 12 }, - { 115, 76, 6 , 3 }, - { 129, 76, 7 , 1 }, - { 144, 76, 4 , 3 }, - { 156, 76, 6 , 7 }, - { 170, 76, 6 , 10 }, - { 184, 76, 6 , 7 }, - { 198, 76, 6 , 10 }, - { 212, 76, 6 , 7 }, - { 226, 76, 4 , 10 }, - { 238, 76, 6 , 9 }, - { 4, 100, 6 , 10 }, - { 18, 100, 2 , 10 }, - { 28, 100, 5 , 12 }, - { 41, 100, 6 , 10 }, - { 55, 100, 3 , 10 }, - { 66, 100, 8 , 7 }, - { 82, 100, 6 , 7 }, - { 96, 100, 6 , 7 }, - { 110, 100, 6 , 9 }, - { 124, 100, 6 , 9 }, - { 138, 100, 5 , 7 }, - { 151, 100, 6 , 7 }, - { 165, 100, 4 , 10 }, - { 177, 100, 6 , 7 }, - { 191, 100, 6 , 7 }, - { 205, 100, 8 , 7 }, - { 221, 100, 6 , 7 }, - { 235, 100, 6 , 9 }, - { 4, 124, 6 , 7 }, - { 18, 124, 5 , 12 }, - { 31, 124, 2 , 12 }, - { 41, 124, 5 , 12 }, - { 54, 124, 7 , 3 }, -}; - -// Font characters info data -// NOTE: No chars.image data provided -static const GlyphInfo sunnyFontChars[95] = { - { 32, 0, 12, 4, { 0 }}, - { 33, 0, 2, 3, { 0 }}, - { 34, 0, 2, 6, { 0 }}, - { 35, 0, 2, 8, { 0 }}, - { 36, 0, 1, 8, { 0 }}, - { 37, 0, 2, 8, { 0 }}, - { 38, 0, 2, 8, { 0 }}, - { 39, 0, 2, 3, { 0 }}, - { 40, 0, 2, 4, { 0 }}, - { 41, 0, 2, 4, { 0 }}, - { 42, 0, 4, 6, { 0 }}, - { 43, 0, 6, 7, { 0 }}, - { 44, 0, 10, 3, { 0 }}, - { 45, 0, 8, 6, { 0 }}, - { 46, 0, 10, 3, { 0 }}, - { 47, 0, 2, 5, { 0 }}, - { 48, 0, 2, 7, { 0 }}, - { 49, 0, 2, 7, { 0 }}, - { 50, 0, 2, 7, { 0 }}, - { 51, 0, 2, 7, { 0 }}, - { 52, 0, 2, 7, { 0 }}, - { 53, 0, 2, 7, { 0 }}, - { 54, 0, 2, 7, { 0 }}, - { 55, 0, 2, 7, { 0 }}, - { 56, 0, 2, 7, { 0 }}, - { 57, 0, 2, 7, { 0 }}, - { 58, 0, 4, 3, { 0 }}, - { 59, 0, 4, 3, { 0 }}, - { 60, 0, 4, 8, { 0 }}, - { 61, 0, 6, 6, { 0 }}, - { 62, 0, 4, 8, { 0 }}, - { 63, 0, 2, 7, { 0 }}, - { 64, 0, 2, 8, { 0 }}, - { 65, 0, 2, 8, { 0 }}, - { 66, 0, 2, 8, { 0 }}, - { 67, 0, 2, 8, { 0 }}, - { 68, 0, 2, 8, { 0 }}, - { 69, 0, 2, 8, { 0 }}, - { 70, 0, 2, 8, { 0 }}, - { 71, 0, 2, 8, { 0 }}, - { 72, 0, 2, 8, { 0 }}, - { 73, 0, 2, 3, { 0 }}, - { 74, 0, 2, 6, { 0 }}, - { 75, 0, 2, 8, { 0 }}, - { 76, 0, 2, 7, { 0 }}, - { 77, 0, 2, 10, { 0 }}, - { 78, 0, 2, 8, { 0 }}, - { 79, 0, 2, 8, { 0 }}, - { 80, 0, 2, 8, { 0 }}, - { 81, 0, 2, 8, { 0 }}, - { 82, 0, 2, 8, { 0 }}, - { 83, 0, 2, 8, { 0 }}, - { 84, 0, 2, 7, { 0 }}, - { 85, 0, 2, 8, { 0 }}, - { 86, 0, 2, 8, { 0 }}, - { 87, 0, 2, 9, { 0 }}, - { 88, 0, 2, 8, { 0 }}, - { 89, 0, 2, 7, { 0 }}, - { 90, 0, 2, 8, { 0 }}, - { 91, 0, 2, 5, { 0 }}, - { 92, 0, 2, 5, { 0 }}, - { 93, 0, 2, 5, { 0 }}, - { 94, 0, 2, 7, { 0 }}, - { 95, 0, 14, 8, { 0 }}, - { 96, 0, 2, 5, { 0 }}, - { 97, 0, 5, 7, { 0 }}, - { 98, 0, 2, 7, { 0 }}, - { 99, 0, 5, 7, { 0 }}, - { 100, 0, 2, 7, { 0 }}, - { 101, 0, 5, 7, { 0 }}, - { 102, 0, 2, 5, { 0 }}, - { 103, 0, 5, 7, { 0 }}, - { 104, 0, 2, 7, { 0 }}, - { 105, 0, 2, 3, { 0 }}, - { 106, 0, 2, 6, { 0 }}, - { 107, 0, 2, 7, { 0 }}, - { 108, 0, 2, 4, { 0 }}, - { 109, 0, 5, 9, { 0 }}, - { 110, 0, 5, 7, { 0 }}, - { 111, 0, 5, 7, { 0 }}, - { 112, 0, 5, 7, { 0 }}, - { 113, 0, 5, 7, { 0 }}, - { 114, 0, 5, 6, { 0 }}, - { 115, 0, 5, 7, { 0 }}, - { 116, 0, 2, 5, { 0 }}, - { 117, 0, 5, 7, { 0 }}, - { 118, 0, 5, 7, { 0 }}, - { 119, 0, 5, 9, { 0 }}, - { 120, 0, 5, 7, { 0 }}, - { 121, 0, 5, 7, { 0 }}, - { 122, 0, 5, 7, { 0 }}, - { 123, 0, 2, 6, { 0 }}, - { 124, 0, 2, 3, { 0 }}, - { 125, 0, 2, 6, { 0 }}, - { 126, 0, 6, 8, { 0 }}, -}; - -// Style loading function: sunny -static void GuiLoadStyleSunny(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < SUNNY_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(sunnyStyleProps[i].controlId, sunnyStyleProps[i].propertyId, sunnyStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int sunnyFontDataSize = 0; - unsigned char *data = DecompressData(sunnyFontData, SUNNY_COMPRESSED_DATA_SIZE, &sunnyFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 16; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, sunnyFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, sunnyFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // TODO: Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - //Rectangle whiteChar = { 0, 0, 0, 0 }; - //SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/sunny/sunny.rgs b/examples/gui/basic_controls/styles/sunny/sunny.rgs deleted file mode 100644 index 62b6241..0000000 Binary files a/examples/gui/basic_controls/styles/sunny/sunny.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/terminal/Mecha.ttf b/examples/gui/basic_controls/styles/terminal/Mecha.ttf deleted file mode 100644 index 928f63a..0000000 Binary files a/examples/gui/basic_controls/styles/terminal/Mecha.ttf and /dev/null differ diff --git a/examples/gui/basic_controls/styles/terminal/README.md b/examples/gui/basic_controls/styles/terminal/README.md deleted file mode 100644 index 6b10d2d..0000000 --- a/examples/gui/basic_controls/styles/terminal/README.md +++ /dev/null @@ -1,16 +0,0 @@ -style: terminal ----------------- -Start your terminal and type your commands! Feel the connection the data flow, that's your style! - -![terminal style table](style_table.png) - -screenshot ------------ - -![terminal style screen](screenshot.png) - -about font ------------ -"Mecha" font by Captain Falcon. - -100% free font, downloaded from dafont.com: [mecha-cf](https://www.dafont.com/mecha-cf.font) diff --git a/examples/gui/basic_controls/styles/terminal/screenshot.png b/examples/gui/basic_controls/styles/terminal/screenshot.png deleted file mode 100644 index 7b8562b..0000000 Binary files a/examples/gui/basic_controls/styles/terminal/screenshot.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/terminal/style_table.png b/examples/gui/basic_controls/styles/terminal/style_table.png deleted file mode 100644 index 7b527b2..0000000 Binary files a/examples/gui/basic_controls/styles/terminal/style_table.png and /dev/null differ diff --git a/examples/gui/basic_controls/styles/terminal/terminal.h b/examples/gui/basic_controls/styles/terminal/terminal.h deleted file mode 100644 index 096fa43..0000000 --- a/examples/gui/basic_controls/styles/terminal/terminal.h +++ /dev/null @@ -1,338 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// // -// StyleAsCode exporter v1.2 - Style data exported as a values array // -// // -// USAGE: On init call: GuiLoadStyleTerminal(); // -// // -// more info and bugs-report: github.com/raysan5/raygui // -// feedback and support: ray[at]raylibtech.com // -// // -// Copyright (c) 2020-2022 raylib technologies (@raylibtech) // -// // -////////////////////////////////////////////////////////////////////////////////// - -#define TERMINAL_STYLE_PROPS_COUNT 16 - -// Custom style name: terminal -static const GuiStyleProp terminalStyleProps[TERMINAL_STYLE_PROPS_COUNT] = { - { 0, 0, 0x1c8d00ff }, // DEFAULT_BORDER_COLOR_NORMAL - { 0, 1, 0x161313ff }, // DEFAULT_BASE_COLOR_NORMAL - { 0, 2, 0x38f620ff }, // DEFAULT_TEXT_COLOR_NORMAL - { 0, 3, 0xc3fbc6ff }, // DEFAULT_BORDER_COLOR_FOCUSED - { 0, 4, 0x43bf2eff }, // DEFAULT_BASE_COLOR_FOCUSED - { 0, 5, 0xdcfadcff }, // DEFAULT_TEXT_COLOR_FOCUSED - { 0, 6, 0x1f5b19ff }, // DEFAULT_BORDER_COLOR_PRESSED - { 0, 7, 0x43ff28ff }, // DEFAULT_BASE_COLOR_PRESSED - { 0, 8, 0x1e6f15ff }, // DEFAULT_TEXT_COLOR_PRESSED - { 0, 9, 0x223b22ff }, // DEFAULT_BORDER_COLOR_DISABLED - { 0, 10, 0x182c18ff }, // DEFAULT_BASE_COLOR_DISABLED - { 0, 11, 0x244125ff }, // DEFAULT_TEXT_COLOR_DISABLED - { 0, 16, 0x00000010 }, // DEFAULT_TEXT_SIZE - { 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING - { 0, 18, 0xe6fce3ff }, // DEFAULT_LINE_COLOR - { 0, 19, 0x0c1505ff }, // DEFAULT_BACKGROUND_COLOR -}; - -// WARNING: This style uses a custom font: (size: 16, spacing: 0) - -#define TERMINAL_COMPRESSED_DATA_SIZE 964 - -// Font image pixels data compressed (DEFLATE) -// NOTE: Original pixel data simplified to GRAYSCALE -static unsigned char terminalFontData[TERMINAL_COMPRESSED_DATA_SIZE] = { 0xed, - 0xdd, 0x41, 0xb6, 0x9b, 0x30, 0x0c, 0x05, 0x50, 0xf6, 0xbf, 0x69, 0x75, 0xd0, 0xd3, 0x41, 0x7b, 0x9a, 0x0f, 0x92, 0x65, - 0xc7, 0xc0, 0xed, 0x9d, 0xa5, 0x09, 0x9f, 0xf0, 0x02, 0x38, 0xb6, 0xec, 0xc4, 0x01, 0x00, 0xf0, 0x8f, 0xf8, 0xef, 0x23, - 0xf1, 0xf1, 0x99, 0x71, 0x79, 0x3b, 0xbf, 0x1f, 0x8d, 0x8f, 0x7f, 0xe5, 0xcf, 0xbf, 0x2b, 0x5b, 0xba, 0xfe, 0xac, 0x48, - 0xed, 0xdd, 0xd8, 0x5e, 0xd5, 0xb6, 0x93, 0x7d, 0xf6, 0xcf, 0xfb, 0x13, 0x1b, 0xe4, 0x7f, 0xfe, 0x6e, 0x33, 0xc7, 0x33, - 0xca, 0xe9, 0xe5, 0x3f, 0x9d, 0x33, 0xcf, 0xa1, 0xec, 0x3e, 0xd6, 0x8e, 0xc9, 0x1e, 0xf9, 0x67, 0xff, 0x46, 0x6e, 0xbf, - 0x63, 0x68, 0xcf, 0x6b, 0xe7, 0xf4, 0xd8, 0xde, 0xdd, 0x39, 0xff, 0xe3, 0xe3, 0x95, 0xbc, 0x7a, 0x1c, 0x57, 0xe5, 0x3f, - 0xfe, 0x2e, 0xe5, 0x7f, 0xf6, 0xcc, 0x7c, 0x96, 0x3f, 0xa7, 0x17, 0x37, 0xcf, 0x3f, 0xdb, 0xee, 0x79, 0x66, 0xfe, 0x9f, - 0xae, 0x0c, 0x3f, 0xdf, 0x93, 0x3f, 0xbf, 0x66, 0xe5, 0xdd, 0x7b, 0x4e, 0xfe, 0x67, 0xf7, 0xd1, 0xeb, 0xc7, 0x22, 0xdb, - 0x32, 0x5c, 0x9f, 0xff, 0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, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0d, 0x7e, 0x01 }; - -// Font characters rectangles data -static const Rectangle terminalFontRecs[95] = { - { 4, 4, 4 , 16 }, - { 16, 4, 1 , 11 }, - { 25, 4, 3 , 3 }, - { 36, 4, 6 , 11 }, - { 50, 4, 5 , 11 }, - { 63, 4, 5 , 11 }, - { 76, 4, 5 , 11 }, - { 89, 4, 1 , 2 }, - { 98, 4, 2 , 13 }, - { 108, 4, 2 , 13 }, - { 118, 4, 3 , 3 }, - { 129, 4, 5 , 5 }, - { 142, 4, 1 , 3 }, - { 151, 4, 5 , 1 }, - { 164, 4, 1 , 1 }, - { 173, 4, 6 , 12 }, - { 187, 4, 5 , 11 }, - { 200, 4, 2 , 11 }, - { 210, 4, 5 , 11 }, - { 223, 4, 5 , 11 }, - { 236, 4, 5 , 11 }, - { 4, 28, 5 , 11 }, - { 17, 28, 5 , 11 }, - { 30, 28, 5 , 11 }, - { 43, 28, 5 , 11 }, - { 56, 28, 5 , 11 }, - { 69, 28, 1 , 8 }, - { 78, 28, 1 , 10 }, - { 87, 28, 4 , 5 }, - { 99, 28, 5 , 3 }, - { 112, 28, 4 , 5 }, - { 124, 28, 5 , 11 }, - { 137, 28, 11 , 11 }, - { 156, 28, 5 , 11 }, - { 169, 28, 5 , 11 }, - { 182, 28, 5 , 11 }, - { 195, 28, 5 , 11 }, - { 208, 28, 5 , 11 }, - { 221, 28, 5 , 11 }, - { 234, 28, 5 , 11 }, - { 4, 52, 5 , 11 }, - { 17, 52, 1 , 11 }, - { 26, 52, 5 , 11 }, - { 39, 52, 5 , 11 }, - { 52, 52, 5 , 11 }, - { 65, 52, 7 , 11 }, - { 80, 52, 5 , 11 }, - { 93, 52, 5 , 11 }, - { 106, 52, 5 , 11 }, - { 119, 52, 5 , 13 }, - { 132, 52, 5 , 11 }, - { 145, 52, 5 , 11 }, - { 158, 52, 5 , 11 }, - { 171, 52, 5 , 11 }, - { 184, 52, 5 , 11 }, - { 197, 52, 7 , 11 }, - { 212, 52, 5 , 11 }, - { 225, 52, 5 , 11 }, - { 238, 52, 5 , 11 }, - { 4, 76, 2 , 13 }, - { 14, 76, 6 , 12 }, - { 28, 76, 2 , 13 }, - { 38, 76, 5 , 4 }, - { 51, 76, 5 , 1 }, - { 64, 76, 2 , 2 }, - { 74, 76, 5 , 8 }, - { 87, 76, 5 , 11 }, - { 100, 76, 5 , 8 }, - { 113, 76, 5 , 11 }, - { 126, 76, 5 , 8 }, - { 139, 76, 4 , 11 }, - { 151, 76, 5 , 10 }, - { 164, 76, 5 , 11 }, - { 177, 76, 1 , 11 }, - { 186, 76, 1 , 13 }, - { 195, 76, 5 , 11 }, - { 208, 76, 1 , 11 }, - { 217, 76, 7 , 8 }, - { 232, 76, 5 , 8 }, - { 4, 100, 5 , 8 }, - { 17, 100, 5 , 10 }, - { 30, 100, 5 , 10 }, - { 43, 100, 4 , 8 }, - { 55, 100, 5 , 8 }, - { 68, 100, 3 , 11 }, - { 79, 100, 5 , 8 }, - { 92, 100, 5 , 8 }, - { 105, 100, 7 , 8 }, - { 120, 100, 5 , 8 }, - { 133, 100, 5 , 10 }, - { 146, 100, 5 , 8 }, - { 159, 100, 3 , 13 }, - { 170, 100, 1 , 15 }, - { 179, 100, 3 , 13 }, - { 190, 100, 5 , 3 }, -}; - -// Font characters info data -// NOTE: No chars.image data provided -static const GlyphInfo terminalFontChars[95] = { - { 32, 0, 14, 4, { 0 }}, - { 33, 1, 3, 3, { 0 }}, - { 34, 1, 3, 5, { 0 }}, - { 35, 1, 3, 8, { 0 }}, - { 36, 1, 3, 7, { 0 }}, - { 37, 1, 3, 7, { 0 }}, - { 38, 1, 3, 7, { 0 }}, - { 39, 1, 3, 3, { 0 }}, - { 40, 1, 2, 4, { 0 }}, - { 41, 1, 2, 4, { 0 }}, - { 42, 1, 3, 5, { 0 }}, - { 43, 1, 7, 7, { 0 }}, - { 44, 1, 13, 3, { 0 }}, - { 45, 1, 9, 7, { 0 }}, - { 46, 1, 13, 3, { 0 }}, - { 47, 1, 2, 8, { 0 }}, - { 48, 1, 3, 7, { 0 }}, - { 49, 1, 3, 4, { 0 }}, - { 50, 1, 3, 7, { 0 }}, - { 51, 1, 3, 7, { 0 }}, - { 52, 1, 3, 7, { 0 }}, - { 53, 1, 3, 7, { 0 }}, - { 54, 1, 3, 7, { 0 }}, - { 55, 1, 3, 7, { 0 }}, - { 56, 1, 3, 7, { 0 }}, - { 57, 1, 3, 7, { 0 }}, - { 58, 1, 6, 3, { 0 }}, - { 59, 1, 6, 3, { 0 }}, - { 60, 1, 7, 6, { 0 }}, - { 61, 1, 8, 7, { 0 }}, - { 62, 1, 7, 6, { 0 }}, - { 63, 1, 3, 7, { 0 }}, - { 64, 2, 3, 15, { 0 }}, - { 65, 1, 3, 7, { 0 }}, - { 66, 1, 3, 7, { 0 }}, - { 67, 1, 3, 7, { 0 }}, - { 68, 1, 3, 7, { 0 }}, - { 69, 1, 3, 7, { 0 }}, - { 70, 1, 3, 7, { 0 }}, - { 71, 1, 3, 7, { 0 }}, - { 72, 1, 3, 7, { 0 }}, - { 73, 1, 3, 3, { 0 }}, - { 74, 1, 3, 7, { 0 }}, - { 75, 1, 3, 7, { 0 }}, - { 76, 1, 3, 7, { 0 }}, - { 77, 1, 3, 9, { 0 }}, - { 78, 1, 3, 7, { 0 }}, - { 79, 1, 3, 7, { 0 }}, - { 80, 1, 3, 7, { 0 }}, - { 81, 1, 3, 7, { 0 }}, - { 82, 1, 3, 7, { 0 }}, - { 83, 1, 3, 7, { 0 }}, - { 84, 1, 3, 7, { 0 }}, - { 85, 1, 3, 7, { 0 }}, - { 86, 1, 3, 7, { 0 }}, - { 87, 1, 3, 9, { 0 }}, - { 88, 1, 3, 7, { 0 }}, - { 89, 1, 3, 7, { 0 }}, - { 90, 1, 3, 7, { 0 }}, - { 91, 1, 2, 4, { 0 }}, - { 92, 1, 2, 8, { 0 }}, - { 93, 1, 2, 4, { 0 }}, - { 94, 1, 3, 7, { 0 }}, - { 95, 1, 15, 7, { 0 }}, - { 96, 1, 0, 4, { 0 }}, - { 97, 1, 6, 7, { 0 }}, - { 98, 1, 3, 7, { 0 }}, - { 99, 1, 6, 7, { 0 }}, - { 100, 1, 3, 7, { 0 }}, - { 101, 1, 6, 7, { 0 }}, - { 102, 1, 3, 6, { 0 }}, - { 103, 1, 6, 7, { 0 }}, - { 104, 1, 3, 7, { 0 }}, - { 105, 1, 3, 3, { 0 }}, - { 106, 1, 3, 3, { 0 }}, - { 107, 1, 3, 7, { 0 }}, - { 108, 1, 3, 3, { 0 }}, - { 109, 1, 6, 9, { 0 }}, - { 110, 1, 6, 7, { 0 }}, - { 111, 1, 6, 7, { 0 }}, - { 112, 1, 6, 7, { 0 }}, - { 113, 1, 6, 7, { 0 }}, - { 114, 1, 6, 6, { 0 }}, - { 115, 1, 6, 7, { 0 }}, - { 116, 1, 3, 5, { 0 }}, - { 117, 1, 6, 7, { 0 }}, - { 118, 1, 6, 7, { 0 }}, - { 119, 1, 6, 9, { 0 }}, - { 120, 1, 6, 7, { 0 }}, - { 121, 1, 6, 7, { 0 }}, - { 122, 1, 6, 7, { 0 }}, - { 123, 1, 2, 5, { 0 }}, - { 124, 1, 1, 3, { 0 }}, - { 125, 1, 2, 5, { 0 }}, - { 126, 1, 8, 7, { 0 }}, -}; - -// Style loading function: terminal -static void GuiLoadStyleTerminal(void) -{ - // Load style properties provided - // NOTE: Default properties are propagated - for (int i = 0; i < TERMINAL_STYLE_PROPS_COUNT; i++) - { - GuiSetStyle(terminalStyleProps[i].controlId, terminalStyleProps[i].propertyId, terminalStyleProps[i].propertyValue); - } - - // Custom font loading - // NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function - int terminalFontDataSize = 0; - unsigned char *data = DecompressData(terminalFontData, TERMINAL_COMPRESSED_DATA_SIZE, &terminalFontDataSize); - Image imFont = { data, 256, 256, 1, 2 }; - - Font font = { 0 }; - font.baseSize = 16; - font.glyphCount = 95; - - // Load texture from image - font.texture = LoadTextureFromImage(imFont); - UnloadImage(imFont); // Uncompressed data can be unloaded from memory - - // Copy char recs data from global fontRecs - // NOTE: Required to avoid issues if trying to free font - font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle)); - memcpy(font.recs, terminalFontRecs, font.glyphCount*sizeof(Rectangle)); - - // Copy font char info data from global fontChars - // NOTE: Required to avoid issues if trying to free font - font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo)); - memcpy(font.glyphs, terminalFontChars, font.glyphCount*sizeof(GlyphInfo)); - - GuiSetFont(font); - - // TODO: Setup a white rectangle on the font to be used on shapes drawing, - // this way we make sure all gui can be drawn on a single pass because no texture change is required - // NOTE: Setting up this rectangle is a manual process (for the moment) - Rectangle whiteChar = { 63, 4, 2, 2 }; - SetShapesTexture(font.texture, whiteChar); - - //----------------------------------------------------------------- - - // TODO: Custom user style setup: Set specific properties here (if required) - // i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT -} diff --git a/examples/gui/basic_controls/styles/terminal/terminal.rgs b/examples/gui/basic_controls/styles/terminal/terminal.rgs deleted file mode 100644 index 5ce1b80..0000000 Binary files a/examples/gui/basic_controls/styles/terminal/terminal.rgs and /dev/null differ diff --git a/examples/gui/basic_controls/styles/terminal/terminal.txt.rgs b/examples/gui/basic_controls/styles/terminal/terminal.txt.rgs deleted file mode 100644 index a75caa3..0000000 --- a/examples/gui/basic_controls/styles/terminal/terminal.txt.rgs +++ /dev/null @@ -1,24 +0,0 @@ -# -# rgs style text file (v3.1) - raygui style file generated using rGuiStyler -# -# Style properties: -# f -# p -# -f 16 0 Mecha.ttf -p 00 00 0x1c8d00ff DEFAULT_BORDER_COLOR_NORMAL -p 00 01 0x161313ff DEFAULT_BASE_COLOR_NORMAL -p 00 02 0x38f620ff DEFAULT_TEXT_COLOR_NORMAL -p 00 03 0xc3fbc6ff DEFAULT_BORDER_COLOR_FOCUSED -p 00 04 0x43bf2eff DEFAULT_BASE_COLOR_FOCUSED -p 00 05 0xdcfadcff DEFAULT_TEXT_COLOR_FOCUSED -p 00 06 0x1f5b19ff DEFAULT_BORDER_COLOR_PRESSED -p 00 07 0x43ff28ff DEFAULT_BASE_COLOR_PRESSED -p 00 08 0x1e6f15ff DEFAULT_TEXT_COLOR_PRESSED -p 00 09 0x223b22ff DEFAULT_BORDER_COLOR_DISABLED -p 00 10 0x182c18ff DEFAULT_BASE_COLOR_DISABLED -p 00 11 0x244125ff DEFAULT_TEXT_COLOR_DISABLED -p 00 16 0x00000010 TEXT_SIZE -p 00 17 0x00000000 TEXT_SPACING -p 00 18 0xe6fce3ff DEFAULT_LINE_COLOR -p 00 19 0x0c1505ff DEFAULT_BACKGROUND_COLOR diff --git a/examples/gui/controls_test_suite/controls_test_suite.go b/examples/gui/controls_test_suite/controls_test_suite.go index 237cce9..995093a 100644 --- a/examples/gui/controls_test_suite/controls_test_suite.go +++ b/examples/gui/controls_test_suite/controls_test_suite.go @@ -21,7 +21,6 @@ import ( * - gui.ComboBox() * - gui.ListView() * - gui.ToggleGroup() -* - gui.TextBoxMulti() * - gui.ColorPicker() * - gui.Slider() * - gui.SliderBar() @@ -86,9 +85,7 @@ func main() { listViewExFocus int32 = -1 listViewExList = []string{"This", "is", "a", "list view", "with", "disable", "elements", "amazing!"} - multiTextBoxText = "Multi text box" - multiTextBoxEditMode bool = false - colorPickerValue = rl.Red + colorPickerValue = rl.Red sliderValue float32 = 50 sliderBarValue float32 = 60 @@ -102,7 +99,7 @@ func main() { toggleGroupActive int32 = 0 - // TODO viewScroll = rl.Vector2{0, 0} + viewScroll = rl.Vector2{0, 0} //---------------------------------------------------------------------------------- @@ -166,9 +163,8 @@ func main() { gui.SetStyle(gui.TEXTBOX, gui.TEXT_ALIGNMENT, gui.TEXT_ALIGN_CENTER) //GuiSetStyle(VALUEBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); - if gui.Spinner(rl.Rectangle{25, 135, 125, 30}, "", &spinner001Value, 0, 100, spinnerEditMode) { - spinnerEditMode = !spinnerEditMode - } + gui.Spinner(rl.Rectangle{25, 135, 125, 30}, "", &spinner001Value, 0, 100, spinnerEditMode) + if gui.ValueBox(rl.Rectangle{25, 175, 125, 30}, "", &valueBox002Value, 0, 100, valueBoxEditMode) { valueBoxEditMode = !valueBoxEditMode } @@ -220,28 +216,26 @@ func main() { toggleGroupActive = gui.ToggleGroup(rl.Rectangle{165, 400, 140, 25}, "#1#ONE\n#3#TWO\n#8#THREE\n#23#", toggleGroupActive) // Third GUI column - if gui.TextBoxMulti(rl.Rectangle{320, 25, 225, 140}, &multiTextBoxText, 256, multiTextBoxEditMode) { - multiTextBoxEditMode = !multiTextBoxEditMode - } + gui.Panel(rl.NewRectangle(320, 25, 225, 140), "Panel Info") colorPickerValue = gui.ColorPicker(rl.Rectangle{320, 185, 196, 192}, "", colorPickerValue) sliderValue = gui.Slider(rl.Rectangle{355, 400, 165, 20}, "TEST", fmt.Sprintf("%2.2f", sliderValue), sliderValue, -50, 100) sliderBarValue = gui.SliderBar(rl.Rectangle{320, 430, 200, 20}, "", - fmt.Sprint("%d", sliderBarValue), sliderBarValue, 0, 100) + fmt.Sprintf("%2.2f", sliderBarValue), sliderBarValue, 0, 100) progressValue = gui.ProgressBar(rl.Rectangle{320, 460, 200, 20}, "", "", progressValue, 0, 1) // NOTE: View rectangle could be used to perform some scissor test - //var view rl.Rectangle = gui.ScrollPanel(rl.Rectangle{560, 25, 100, 160}, "", rl.Rectangle{560, 25, 200, 400}, &viewScroll) + var view rl.Rectangle + gui.ScrollPanel(rl.Rectangle{560, 25, 102, 354}, "", rl.Rectangle{560, 25, 300, 1200}, &viewScroll, &view) - gui.Panel(rl.Rectangle{560, 25 + 180, 100, 160}, "Panel Info") - - gui.Grid(rl.Rectangle{560, 25 + 180 + 180, 100, 120}, "", 20, 2) - - gui.StatusBar(rl.Rectangle{0, float32(rl.GetScreenHeight()) - 20, float32(rl.GetScreenWidth()), 20}, "This is a status bar") + var mouseCell rl.Vector2 + gui.Grid(rl.Rectangle{560, 25 + 180 + 195, 100, 120}, "", 20, 3, &mouseCell) alphaValue = gui.ColorBarAlpha(rl.Rectangle{320, 490, 200, 30}, "", alphaValue) + gui.StatusBar(rl.Rectangle{0, float32(rl.GetScreenHeight()) - 20, float32(rl.GetScreenWidth()), 20}, "This is a status bar") + if showMessageBox { rl.DrawRectangle(0, 0, int32(rl.GetScreenWidth()), int32(rl.GetScreenHeight()), rl.Fade(rl.RayWhite, 0.8)) var result int32 = gui.MessageBox(rl.Rectangle{float32(rl.GetScreenWidth())/2 - 125, float32(rl.GetScreenHeight())/2 - 50, 250, 100}, gui.IconText(gui.ICON_EXIT, "Close Window"), "Do you really want to exit?", "Yes;No") @@ -255,12 +249,13 @@ func main() { if showTextInputBox { rl.DrawRectangle(0, 0, int32(rl.GetScreenWidth()), int32(rl.GetScreenHeight()), rl.Fade(rl.RayWhite, 0.8)) + var secretViewActive bool var result int32 = gui.TextInputBox( rl.Rectangle{float32(rl.GetScreenWidth())/2 - 120, float32(rl.GetScreenHeight())/2 - 60, 240, 140}, "Save", gui.IconText(gui.ICON_FILE_SAVE, "Save file as..."), "Ok;Cancel", - &textInput, 255, nil) + &textInput, 255, &secretViewActive) if result == 1 { // TODO: Validate textInput value and save diff --git a/examples/gui/portable_window/portable_window.png b/examples/gui/portable_window/portable_window.png deleted file mode 100644 index bc6e34e..0000000 Binary files a/examples/gui/portable_window/portable_window.png and /dev/null differ diff --git a/examples/gui/scroll_panel/scroll_panel.go b/examples/gui/scroll_panel/scroll_panel.go index 53fcb57..6f7ee77 100644 --- a/examples/gui/scroll_panel/scroll_panel.go +++ b/examples/gui/scroll_panel/scroll_panel.go @@ -47,7 +47,9 @@ func main() { var ( panelRec = rl.Rectangle{20, 40, 200, 150} panelContentRec = rl.Rectangle{0, 0, 340, 340} + panelView = rl.Rectangle{0, 0, 0, 0} panelScroll = rl.Vector2{99, -20} + mouseCell = rl.Vector2{0, 0} showContentArea = true ) @@ -72,15 +74,15 @@ func main() { rl.DrawText(fmt.Sprintf("[%.1f, %.1f]", panelScroll.X, panelScroll.Y), 4, 4, 20, rl.Red) - view := gui.ScrollPanel(panelRec, "", panelContentRec, &panelScroll) + gui.ScrollPanel(panelRec, "", panelContentRec, &panelScroll, &panelView) - rl.BeginScissorMode(int32(view.X), int32(view.Y), int32(view.Width), int32(view.Height)) + rl.BeginScissorMode(int32(panelView.X), int32(panelView.Y), int32(panelView.Width), int32(panelView.Height)) gui.Grid(rl.Rectangle{ float32(panelRec.X + panelScroll.X), float32(panelRec.Y + panelScroll.Y), float32(panelContentRec.Width), float32(panelContentRec.Height), - }, "", 16, 3) + }, "", 16, 3, &mouseCell) rl.EndScissorMode() if showContentArea { diff --git a/raygui/README.md b/raygui/README.md index b9d8589..42c543c 100644 --- a/raygui/README.md +++ b/raygui/README.md @@ -3,11 +3,6 @@ raygui is simple and easy-to-use IMGUI (immediate mode GUI API) library. -### basic_controls - -![Demo](../examples/gui/basic_controls/cyber.png) - - ### controls_test_suite ![Demo](../examples/gui/controls_test_suite/controls_test_suite.png) diff --git a/raygui/cgo.go b/raygui/cgo.go new file mode 100644 index 0000000..4198945 --- /dev/null +++ b/raygui/cgo.go @@ -0,0 +1,6 @@ +package raygui + +/* +#cgo CFLAGS: -std=gnu99 -Wno-unused-result +*/ +import "C" diff --git a/raygui/raygui.go b/raygui/raygui.go index 6b2af7f..f2b40e8 100644 --- a/raygui/raygui.go +++ b/raygui/raygui.go @@ -1,7 +1,7 @@ package raygui /* -#cgo CFLAGS: -DRAYGUI_IMPLEMENTATION -Wno-unused-result +#define RAYGUI_IMPLEMENTATION #include "raygui.h" #include */ @@ -26,7 +26,7 @@ type GuiStyleProp struct { propertyValue uint32 } -// STATE_NORMAL - Gui control state +// Gui control state const ( STATE_NORMAL int32 = 0 STATE_FOCUSED = 1 @@ -37,7 +37,7 @@ const ( // GuiState . type GuiState = int32 -// TEXT_ALIGN_LEFT - Gui control text alignment +// Gui control text alignment const ( TEXT_ALIGN_LEFT int32 = 0 TEXT_ALIGN_CENTER = 1 @@ -47,6 +47,27 @@ const ( // GuiTextAlignment . type GuiTextAlignment = int32 +// Gui control text alignment vertical +const ( + TEXT_ALIGN_TOP int32 = 0 + TEXT_ALIGN_MIDDLE = 1 + TEXT_ALIGN_BOTTOM = 2 +) + +// GuiTextWrapMode . +type GuiTextWrapMode = int32 + +// Gui control text wrap mode +// NOTE: Useful for multiline text +const ( + TEXT_WRAP_NONE int32 = 0 + TEXT_WRAP_CHAR = 1 + TEXT_WRAP_WORD = 2 +) + +// GuiTextAlignmentVertical . +type GuiTextAlignmentVertical = int32 + // DEFAULT - Gui controls const ( DEFAULT int32 = 0 @@ -88,7 +109,6 @@ const ( BORDER_WIDTH = 12 TEXT_PADDING = 13 TEXT_ALIGNMENT = 14 - RESERVED = 15 ) // GuiControlProperty . @@ -97,10 +117,13 @@ type GuiControlProperty = int32 // DEFAULT extended properties // NOTE: Those properties are common to all controls or global const ( - TEXT_SIZE int32 = 16 - TEXT_SPACING = 17 - LINE_COLOR = 18 - BACKGROUND_COLOR = 19 + TEXT_SIZE int32 = 16 + TEXT_SPACING = 17 + LINE_COLOR = 18 + BACKGROUND_COLOR = 19 + TEXT_LINE_SPACING = 20 + TEXT_ALIGNMENT_VERTICAL = 21 + TEXT_WRAP_MODE = 22 ) // GuiDefaultProperty . @@ -246,9 +269,10 @@ func IsLocked() bool { } // GuiFade - Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f -func Fade(alpha float32) { +func Fade(color rl.Color, alpha float32) { + ccolor := (*C.Color)(unsafe.Pointer(&color)) calpha := C.float(alpha) - C.GuiFade(calpha) + C.GuiFade(*ccolor, calpha) } // GuiSetState - Set gui state (global state) @@ -286,7 +310,7 @@ func WindowBox(bounds rl.Rectangle, title string) bool { cbounds.width = C.float(bounds.Width) ctitle := C.CString(title) defer C.free(unsafe.Pointer(ctitle)) - return bool(C.GuiWindowBox(cbounds, ctitle)) + return C.GuiWindowBox(cbounds, ctitle) != 0 } // GuiGroupBox - Group Box control with text name @@ -313,7 +337,7 @@ func Line(bounds rl.Rectangle, text string) { C.GuiLine(cbounds, ctext) } -// GuiPanel - Panel control, useful to group controls +// Panel - Panel control, useful to group controls func Panel(bounds rl.Rectangle, text string) { var cbounds C.struct_Rectangle cbounds.width = C.float(bounds.Width) @@ -325,8 +349,8 @@ func Panel(bounds rl.Rectangle, text string) { C.GuiPanel(cbounds, ctext) } -// ScrollPanel control -func ScrollPanel(bounds rl.Rectangle, text string, content rl.Rectangle, scroll *rl.Vector2) rl.Rectangle { +// ScrollPanel control - Scroll Panel control +func ScrollPanel(bounds rl.Rectangle, text string, content rl.Rectangle, scroll *rl.Vector2, view *rl.Rectangle) int32 { var cbounds C.struct_Rectangle cbounds.x = C.float(bounds.X) cbounds.y = C.float(bounds.Y) @@ -346,17 +370,15 @@ func ScrollPanel(bounds rl.Rectangle, text string, content rl.Rectangle, scroll scroll.X = float32(cscroll.x) scroll.Y = float32(cscroll.y) }() + var cview C.struct_Rectangle + cview.x = C.float(view.X) + cview.y = C.float(view.Y) + cview.width = C.float(view.Width) + cview.height = C.float(view.Height) - var res C.struct_Rectangle - res = C.GuiScrollPanel(cbounds, ctext, ccontent, &cscroll) + res := C.GuiScrollPanel(cbounds, ctext, ccontent, &cscroll, &cview) - var goRes rl.Rectangle - goRes.X = float32(res.x) - goRes.Y = float32(res.y) - goRes.Width = float32(res.width) - goRes.Height = float32(res.height) - - return goRes + return int32(res) } // ScrollBar control (used by GuiScrollPanel()) @@ -395,7 +417,7 @@ func Button(bounds rl.Rectangle, text string) bool { cbounds.height = C.float(bounds.Height) ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) - return bool(C.GuiButton(cbounds, ctext)) + return C.GuiButton(cbounds, ctext) != 0 } // LabelButton control, show true when clicked @@ -407,7 +429,7 @@ func LabelButton(bounds rl.Rectangle, text string) bool { cbounds.height = C.float(bounds.Height) ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) - return bool(C.GuiLabelButton(cbounds, ctext)) + return C.GuiLabelButton(cbounds, ctext) != 0 } // Toggle control, returns true when active @@ -420,7 +442,8 @@ func Toggle(bounds rl.Rectangle, text string, active bool) bool { ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) cactive := C.bool(active) - return bool(C.GuiToggle(cbounds, ctext, cactive)) + C.GuiToggle(cbounds, ctext, &cactive) + return bool(cactive) } // ToggleGroup control, returns active toggle index @@ -433,7 +456,22 @@ func ToggleGroup(bounds rl.Rectangle, text string, active int32) int32 { ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) cactive := C.int(active) - return int32(C.GuiToggleGroup(cbounds, ctext, cactive)) + C.GuiToggleGroup(cbounds, ctext, &cactive) + return int32(cactive) +} + +// ToggleSlider control, returns true when clicked +func ToggleSlider(bounds rl.Rectangle, text string, active int32) int32 { + var cbounds C.struct_Rectangle + cbounds.x = C.float(bounds.X) + cbounds.y = C.float(bounds.Y) + cbounds.width = C.float(bounds.Width) + cbounds.height = C.float(bounds.Height) + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + cactive := C.int(active) + C.GuiToggleSlider(cbounds, ctext, &cactive) + return int32(cactive) } // CheckBox control, returns true when active @@ -446,7 +484,8 @@ func CheckBox(bounds rl.Rectangle, text string, checked bool) bool { ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) cchecked := C.bool(checked) - return bool(C.GuiCheckBox(cbounds, ctext, cchecked)) + C.GuiCheckBox(cbounds, ctext, &cchecked) + return bool(cchecked) } // ComboBox control, returns selected item index @@ -459,11 +498,12 @@ func ComboBox(bounds rl.Rectangle, text string, active int32) int32 { ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) cactive := C.int(active) - return int32(C.GuiComboBox(cbounds, ctext, cactive)) + C.GuiComboBox(cbounds, ctext, &cactive) + return int32(cactive) } // Spinner control, returns selected value -func Spinner(bounds rl.Rectangle, text string, value *int32, minValue, maxValue int, editMode bool) bool { +func Spinner(bounds rl.Rectangle, text string, value *int32, minValue, maxValue int, editMode bool) int32 { var cbounds C.struct_Rectangle cbounds.x = C.float(bounds.X) cbounds.y = C.float(bounds.Y) @@ -484,7 +524,8 @@ func Spinner(bounds rl.Rectangle, text string, value *int32, minValue, maxValue cmaxValue := C.int(maxValue) ceditMode := C.bool(editMode) - return bool(C.GuiSpinner(cbounds, ctext, &cvalue, cminValue, cmaxValue, ceditMode)) + C.GuiSpinner(cbounds, ctext, &cvalue, cminValue, cmaxValue, ceditMode) + return int32(cvalue) } // Slider control @@ -501,7 +542,8 @@ func Slider(bounds rl.Rectangle, textLeft string, textRight string, value float3 cvalue := C.float(value) cminValue := C.float(minValue) cmaxValue := C.float(maxValue) - return float32(C.GuiSlider(cbounds, ctextLeft, ctextRight, cvalue, cminValue, cmaxValue)) + C.GuiSlider(cbounds, ctextLeft, ctextRight, &cvalue, cminValue, cmaxValue) + return float32(cvalue) } // SliderBar control, returns selected value @@ -518,7 +560,8 @@ func SliderBar(bounds rl.Rectangle, textLeft string, textRight string, value flo cvalue := C.float(value) cminValue := C.float(minValue) cmaxValue := C.float(maxValue) - return float32(C.GuiSliderBar(cbounds, ctextLeft, ctextRight, cvalue, cminValue, cmaxValue)) + C.GuiSliderBar(cbounds, ctextLeft, ctextRight, &cvalue, cminValue, cmaxValue) + return float32(cvalue) } // ProgressBar control, shows current progress value @@ -535,7 +578,8 @@ func ProgressBar(bounds rl.Rectangle, textLeft string, textRight string, value f cvalue := C.float(value) cminValue := C.float(minValue) cmaxValue := C.float(maxValue) - return float32(C.GuiProgressBar(cbounds, ctextLeft, ctextRight, cvalue, cminValue, cmaxValue)) + C.GuiProgressBar(cbounds, ctextLeft, ctextRight, &cvalue, cminValue, cmaxValue) + return float32(cvalue) } // StatusBar control, shows info text @@ -563,7 +607,7 @@ func DummyRec(bounds rl.Rectangle, text string) { } // Grid control, returns mouse cell position -func Grid(bounds rl.Rectangle, text string, spacing float32, subdivs int32) rl.Vector2 { +func Grid(bounds rl.Rectangle, text string, spacing float32, subdivs int32, mouseCell *rl.Vector2) int32 { var cbounds C.struct_Rectangle cbounds.y = C.float(bounds.Y) cbounds.width = C.float(bounds.Width) @@ -573,11 +617,11 @@ func Grid(bounds rl.Rectangle, text string, spacing float32, subdivs int32) rl.V defer C.free(unsafe.Pointer(ctext)) cspacing := C.float(spacing) csubdivs := C.int(subdivs) - cResult := C.GuiGrid(cbounds, ctext, cspacing, csubdivs) - var goRes rl.Vector2 - goRes.Y = float32(cResult.y) - goRes.X = float32(cResult.x) - return goRes + var cmouseCell C.struct_Vector2 + cmouseCell.x = C.float(mouseCell.X) + cmouseCell.y = C.float(mouseCell.Y) + res := C.GuiGrid(cbounds, ctext, cspacing, csubdivs, &cmouseCell) + return int32(res) } // ListView control, returns selected list item index @@ -600,7 +644,8 @@ func ListView(bounds rl.Rectangle, text string, scrollIndex *int32, active int32 cactive := C.int(active) - return int32(C.GuiListView(cbounds, ctext, &cscrollIndex, cactive)) + C.GuiListView(cbounds, ctext, &cscrollIndex, &cactive) + return int32(cactive) } // MessageBox control, displays a message @@ -633,12 +678,12 @@ func ColorPicker(bounds rl.Rectangle, text string, color rl.Color) rl.Color { ccolor.g = C.uchar(color.G) ccolor.b = C.uchar(color.B) ccolor.a = C.uchar(color.A) - cResult := C.GuiColorPicker(cbounds, ctext, ccolor) + C.GuiColorPicker(cbounds, ctext, &ccolor) var goRes rl.Color - goRes.A = byte(cResult.a) - goRes.R = byte(cResult.r) - goRes.G = byte(cResult.g) - goRes.B = byte(cResult.b) + goRes.A = byte(ccolor.a) + goRes.R = byte(ccolor.r) + goRes.G = byte(ccolor.g) + goRes.B = byte(ccolor.b) return goRes } @@ -656,12 +701,12 @@ func ColorPanel(bounds rl.Rectangle, text string, color rl.Color) rl.Color { ccolor.a = C.uchar(color.A) ccolor.r = C.uchar(color.R) ccolor.g = C.uchar(color.G) - cResult := C.GuiColorPanel(cbounds, ctext, ccolor) + C.GuiColorPanel(cbounds, ctext, &ccolor) var goRes rl.Color - goRes.A = byte(cResult.a) - goRes.R = byte(cResult.r) - goRes.G = byte(cResult.g) - goRes.B = byte(cResult.b) + goRes.A = byte(ccolor.a) + goRes.R = byte(ccolor.r) + goRes.G = byte(ccolor.g) + goRes.B = byte(ccolor.b) return goRes } @@ -675,7 +720,8 @@ func ColorBarAlpha(bounds rl.Rectangle, text string, alpha float32) float32 { ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) calpha := C.float(alpha) - return float32(C.GuiColorBarAlpha(cbounds, ctext, calpha)) + C.GuiColorBarAlpha(cbounds, ctext, &calpha) + return float32(calpha) } // ColorBarHue control @@ -688,7 +734,56 @@ func ColorBarHue(bounds rl.Rectangle, text string, value float32) float32 { ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) cvalue := C.float(value) - return float32(C.GuiColorBarHue(cbounds, ctext, cvalue)) + C.GuiColorBarHue(cbounds, ctext, &cvalue) + return float32(cvalue) +} + +// ColorPickerHSV - Color Picker control that avoids conversion to RGB on each call (multiple color controls) +func ColorPickerHSV(bounds rl.Rectangle, text string, colorHSV *rl.Vector3) int32 { + var cbounds C.struct_Rectangle + cbounds.width = C.float(bounds.Width) + cbounds.height = C.float(bounds.Height) + cbounds.x = C.float(bounds.X) + cbounds.y = C.float(bounds.Y) + + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + + var ccolorHSV C.struct_Vector3 + ccolorHSV.x = C.float(colorHSV.X) + ccolorHSV.y = C.float(colorHSV.Y) + ccolorHSV.z = C.float(colorHSV.Z) + defer func() { + colorHSV.X = float32(ccolorHSV.x) + colorHSV.Y = float32(ccolorHSV.y) + colorHSV.Z = float32(ccolorHSV.z) + }() + + return int32(C.GuiColorPickerHSV(cbounds, ctext, &ccolorHSV)) +} + +// ColorPanelHSV - Color Panel control that returns HSV color value, used by GuiColorPickerHSV() +func ColorPanelHSV(bounds rl.Rectangle, text string, colorHSV *rl.Vector3) int32 { + var cbounds C.struct_Rectangle + cbounds.width = C.float(bounds.Width) + cbounds.height = C.float(bounds.Height) + cbounds.x = C.float(bounds.X) + cbounds.y = C.float(bounds.Y) + + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + + var ccolorHSV C.struct_Vector3 + ccolorHSV.x = C.float(colorHSV.X) + ccolorHSV.y = C.float(colorHSV.Y) + ccolorHSV.z = C.float(colorHSV.Z) + defer func() { + colorHSV.X = float32(ccolorHSV.x) + colorHSV.Y = float32(ccolorHSV.y) + colorHSV.Z = float32(ccolorHSV.z) + }() + + return int32(C.GuiColorPanelHSV(cbounds, ctext, &ccolorHSV)) } // DropdownBox control @@ -711,7 +806,7 @@ func DropdownBox(bounds rl.Rectangle, text string, active *int32, editMode bool) ceditMode := C.bool(editMode) - return bool(C.GuiDropdownBox(cbounds, ctext, &cactive, ceditMode)) + return C.GuiDropdownBox(cbounds, ctext, &cactive, ceditMode) != 0 } // ValueBox control, updates input text with numbers @@ -736,7 +831,7 @@ func ValueBox(bounds rl.Rectangle, text string, value *int32, minValue, maxValue cmaxValue := C.int(maxValue) ceditMode := C.bool(editMode) - return bool(C.GuiValueBox(cbounds, ctext, &cvalue, cminValue, cmaxValue, ceditMode)) + return C.GuiValueBox(cbounds, ctext, &cvalue, cminValue, cmaxValue, ceditMode) != 0 } // TextBox control, updates input text @@ -763,7 +858,7 @@ func TextBox(bounds rl.Rectangle, text *string, textSize int, editMode bool) boo ctextSize := C.int(textSize) ceditMode := C.bool(editMode) - return bool(C.GuiTextBox(cbounds, ctext, ctextSize, ceditMode)) + return C.GuiTextBox(cbounds, ctext, ctextSize, ceditMode) != 0 } // LoadStyle file over global style variable (.rgs) @@ -778,6 +873,11 @@ func LoadStyleDefault() { C.GuiLoadStyleDefault() } +// LoadStyleFromMemory - Load style from memory (binary only) +func LoadStyleFromMemory(data []byte) { + C.GuiLoadStyleFromMemory((*C.uchar)(unsafe.Pointer(&data[0])), C.int(len(data))) +} + // IconText gets text with icon id prepended (if supported) func IconText(iconId int32, text string) string { ciconId := C.int(iconId) @@ -788,266 +888,266 @@ func IconText(iconId int32, text string) string { // Icons enumeration const ( - ICON_NONE int32 = 0 - ICON_FOLDER_FILE_OPEN = 1 - ICON_FILE_SAVE_CLASSIC = 2 - ICON_FOLDER_OPEN = 3 - ICON_FOLDER_SAVE = 4 - ICON_FILE_OPEN = 5 - ICON_FILE_SAVE = 6 - ICON_FILE_EXPORT = 7 - ICON_FILE_ADD = 8 - ICON_FILE_DELETE = 9 - ICON_FILETYPE_TEXT = 10 - ICON_FILETYPE_AUDIO = 11 - ICON_FILETYPE_IMAGE = 12 - ICON_FILETYPE_PLAY = 13 - ICON_FILETYPE_VIDEO = 14 - ICON_FILETYPE_INFO = 15 - ICON_FILE_COPY = 16 - ICON_FILE_CUT = 17 - ICON_FILE_PASTE = 18 - ICON_CURSOR_HAND = 19 - ICON_CURSOR_POINTER = 20 - ICON_CURSOR_CLASSIC = 21 - ICON_PENCIL = 22 - ICON_PENCIL_BIG = 23 - ICON_BRUSH_CLASSIC = 24 - ICON_BRUSH_PAINTER = 25 - ICON_WATER_DROP = 26 - ICON_COLOR_PICKER = 27 - ICON_RUBBER = 28 - ICON_COLOR_BUCKET = 29 - ICON_TEXT_T = 30 - ICON_TEXT_A = 31 - ICON_SCALE = 32 - ICON_RESIZE = 33 - ICON_FILTER_POINT = 34 - ICON_FILTER_BILINEAR = 35 - ICON_CROP = 36 - ICON_CROP_ALPHA = 37 - ICON_SQUARE_TOGGLE = 38 - ICON_SYMMETRY = 39 - ICON_SYMMETRY_HORIZONTAL = 40 - ICON_SYMMETRY_VERTICAL = 41 - ICON_LENS = 42 - ICON_LENS_BIG = 43 - ICON_EYE_ON = 44 - ICON_EYE_OFF = 45 - ICON_FILTER_TOP = 46 - ICON_FILTER = 47 - ICON_TARGET_POINT = 48 - ICON_TARGET_SMALL = 49 - ICON_TARGET_BIG = 50 - ICON_TARGET_MOVE = 51 - ICON_CURSOR_MOVE = 52 - ICON_CURSOR_SCALE = 53 - ICON_CURSOR_SCALE_RIGHT = 54 - ICON_CURSOR_SCALE_LEFT = 55 - ICON_UNDO = 56 - ICON_REDO = 57 - ICON_REREDO = 58 - ICON_MUTATE = 59 - ICON_ROTATE = 60 - ICON_REPEAT = 61 - ICON_SHUFFLE = 62 - ICON_EMPTYBOX = 63 - ICON_TARGET = 64 - ICON_TARGET_SMALL_FILL = 65 - ICON_TARGET_BIG_FILL = 66 - ICON_TARGET_MOVE_FILL = 67 - ICON_CURSOR_MOVE_FILL = 68 - ICON_CURSOR_SCALE_FILL = 69 - ICON_CURSOR_SCALE_RIGHT_FILL = 70 - ICON_CURSOR_SCALE_LEFT_FILL = 71 - ICON_UNDO_FILL = 72 - ICON_REDO_FILL = 73 - ICON_REREDO_FILL = 74 - ICON_MUTATE_FILL = 75 - ICON_ROTATE_FILL = 76 - ICON_REPEAT_FILL = 77 - ICON_SHUFFLE_FILL = 78 - ICON_EMPTYBOX_SMALL = 79 - ICON_BOX = 80 - ICON_BOX_TOP = 81 - ICON_BOX_TOP_RIGHT = 82 - ICON_BOX_RIGHT = 83 - ICON_BOX_BOTTOM_RIGHT = 84 - ICON_BOX_BOTTOM = 85 - ICON_BOX_BOTTOM_LEFT = 86 - ICON_BOX_LEFT = 87 - ICON_BOX_TOP_LEFT = 88 - ICON_BOX_CENTER = 89 - ICON_BOX_CIRCLE_MASK = 90 - ICON_POT = 91 - ICON_ALPHA_MULTIPLY = 92 - ICON_ALPHA_CLEAR = 93 - ICON_DITHERING = 94 - ICON_MIPMAPS = 95 - ICON_BOX_GRID = 96 - ICON_GRID = 97 - ICON_BOX_CORNERS_SMALL = 98 - ICON_BOX_CORNERS_BIG = 99 - ICON_FOUR_BOXES = 100 - ICON_GRID_FILL = 101 - ICON_BOX_MULTISIZE = 102 - ICON_ZOOM_SMALL = 103 - ICON_ZOOM_MEDIUM = 104 - ICON_ZOOM_BIG = 105 - ICON_ZOOM_ALL = 106 - ICON_ZOOM_CENTER = 107 - ICON_BOX_DOTS_SMALL = 108 - ICON_BOX_DOTS_BIG = 109 - ICON_BOX_CONCENTRIC = 110 - ICON_BOX_GRID_BIG = 111 - ICON_OK_TICK = 112 - ICON_CROSS = 113 - ICON_ARROW_LEFT = 114 - ICON_ARROW_RIGHT = 115 - ICON_ARROW_DOWN = 116 - ICON_ARROW_UP = 117 - ICON_ARROW_LEFT_FILL = 118 - ICON_ARROW_RIGHT_FILL = 119 - ICON_ARROW_DOWN_FILL = 120 - ICON_ARROW_UP_FILL = 121 - ICON_AUDIO = 122 - ICON_FX = 123 - ICON_WAVE = 124 - ICON_WAVE_SINUS = 125 - ICON_WAVE_SQUARE = 126 - ICON_WAVE_TRIANGULAR = 127 - ICON_CROSS_SMALL = 128 - ICON_PLAYER_PREVIOUS = 129 - ICON_PLAYER_PLAY_BACK = 130 - ICON_PLAYER_PLAY = 131 - ICON_PLAYER_PAUSE = 132 - ICON_PLAYER_STOP = 133 - ICON_PLAYER_NEXT = 134 - ICON_PLAYER_RECORD = 135 - ICON_MAGNET = 136 - ICON_LOCK_CLOSE = 137 - ICON_LOCK_OPEN = 138 - ICON_CLOCK = 139 - ICON_TOOLS = 140 - ICON_GEAR = 141 - ICON_GEAR_BIG = 142 - ICON_BIN = 143 - ICON_HAND_POINTER = 144 - ICON_LASER = 145 - ICON_COIN = 146 - ICON_EXPLOSION = 147 - ICON_1UP = 148 - ICON_PLAYER = 149 - ICON_PLAYER_JUMP = 150 - ICON_KEY = 151 - ICON_DEMON = 152 - ICON_TEXT_POPUP = 153 - ICON_GEAR_EX = 154 - ICON_CRACK = 155 - ICON_CRACK_POINTS = 156 - ICON_STAR = 157 - ICON_DOOR = 158 - ICON_EXIT = 159 - ICON_MODE_2D = 160 - ICON_MODE_3D = 161 - ICON_CUBE = 162 - ICON_CUBE_FACE_TOP = 163 - ICON_CUBE_FACE_LEFT = 164 - ICON_CUBE_FACE_FRONT = 165 - ICON_CUBE_FACE_BOTTOM = 166 - ICON_CUBE_FACE_RIGHT = 167 - ICON_CUBE_FACE_BACK = 168 - ICON_CAMERA = 169 - ICON_SPECIAL = 170 - ICON_LINK_NET = 171 - ICON_LINK_BOXES = 172 - ICON_LINK_MULTI = 173 - ICON_LINK = 174 - ICON_LINK_BROKE = 175 - ICON_TEXT_NOTES = 176 - ICON_NOTEBOOK = 177 - ICON_SUITCASE = 178 - ICON_SUITCASE_ZIP = 179 - ICON_MAILBOX = 180 - ICON_MONITOR = 181 - ICON_PRINTER = 182 - ICON_PHOTO_CAMERA = 183 - ICON_PHOTO_CAMERA_FLASH = 184 - ICON_HOUSE = 185 - ICON_HEART = 186 - ICON_CORNER = 187 - ICON_VERTICAL_BARS = 188 - ICON_VERTICAL_BARS_FILL = 189 - ICON_LIFE_BARS = 190 - ICON_INFO = 191 - ICON_CROSSLINE = 192 - ICON_HELP = 193 - ICON_FILETYPE_ALPHA = 194 - ICON_FILETYPE_HOME = 195 - ICON_LAYERS_VISIBLE = 196 - ICON_LAYERS = 197 - ICON_WINDOW = 198 - ICON_HIDPI = 199 - ICON_FILETYPE_BINARY = 200 - ICON_HEX = 201 - ICON_SHIELD = 202 - ICON_FILE_NEW = 203 - ICON_FOLDER_ADD = 204 - ICON_ALARM = 205 - ICON_CPU = 206 - ICON_ROM = 207 - ICON_STEP_OVER = 208 - ICON_STEP_INTO = 209 - ICON_STEP_OUT = 210 - ICON_RESTART = 211 - ICON_BREAKPOINT_ON = 212 - ICON_BREAKPOINT_OFF = 213 - ICON_BURGER_MENU = 214 - ICON_CASE_SENSITIVE = 215 - ICON_REG_EXP = 216 - ICON_FOLDER = 217 - ICON_FILE = 218 - ICON_219 = 219 - ICON_220 = 220 - ICON_221 = 221 - ICON_222 = 222 - ICON_223 = 223 - ICON_224 = 224 - ICON_225 = 225 - ICON_226 = 226 - ICON_227 = 227 - ICON_228 = 228 - ICON_229 = 229 - ICON_230 = 230 - ICON_231 = 231 - ICON_232 = 232 - ICON_233 = 233 - ICON_234 = 234 - ICON_235 = 235 - ICON_236 = 236 - ICON_237 = 237 - ICON_238 = 238 - ICON_239 = 239 - ICON_240 = 240 - ICON_241 = 241 - ICON_242 = 242 - ICON_243 = 243 - ICON_244 = 244 - ICON_245 = 245 - ICON_246 = 246 - ICON_247 = 247 - ICON_248 = 248 - ICON_249 = 249 - ICON_250 = 250 - ICON_251 = 251 - ICON_252 = 252 - ICON_253 = 253 - ICON_254 = 254 - ICON_255 = 255 + ICON_NONE int32 = iota + ICON_FOLDER_FILE_OPEN + ICON_FILE_SAVE_CLASSIC + ICON_FOLDER_OPEN + ICON_FOLDER_SAVE + ICON_FILE_OPEN + ICON_FILE_SAVE + ICON_FILE_EXPORT + ICON_FILE_ADD + ICON_FILE_DELETE + ICON_FILETYPE_TEXT + ICON_FILETYPE_AUDIO + ICON_FILETYPE_IMAGE + ICON_FILETYPE_PLAY + ICON_FILETYPE_VIDEO + ICON_FILETYPE_INFO + ICON_FILE_COPY + ICON_FILE_CUT + ICON_FILE_PASTE + ICON_CURSOR_HAND + ICON_CURSOR_POINTER + ICON_CURSOR_CLASSIC + ICON_PENCIL + ICON_PENCIL_BIG + ICON_BRUSH_CLASSIC + ICON_BRUSH_PAINTER + ICON_WATER_DROP + ICON_COLOR_PICKER + ICON_RUBBER + ICON_COLOR_BUCKET + ICON_TEXT_T + ICON_TEXT_A + ICON_SCALE + ICON_RESIZE + ICON_FILTER_POINT + ICON_FILTER_BILINEAR + ICON_CROP + ICON_CROP_ALPHA + ICON_SQUARE_TOGGLE + ICON_SYMMETRY + ICON_SYMMETRY_HORIZONTAL + ICON_SYMMETRY_VERTICAL + ICON_LENS + ICON_LENS_BIG + ICON_EYE_ON + ICON_EYE_OFF + ICON_FILTER_TOP + ICON_FILTER + ICON_TARGET_POINT + ICON_TARGET_SMALL + ICON_TARGET_BIG + ICON_TARGET_MOVE + ICON_CURSOR_MOVE + ICON_CURSOR_SCALE + ICON_CURSOR_SCALE_RIGHT + ICON_CURSOR_SCALE_LEFT + ICON_UNDO + ICON_REDO + ICON_REREDO + ICON_MUTATE + ICON_ROTATE + ICON_REPEAT + ICON_SHUFFLE + ICON_EMPTYBOX + ICON_TARGET + ICON_TARGET_SMALL_FILL + ICON_TARGET_BIG_FILL + ICON_TARGET_MOVE_FILL + ICON_CURSOR_MOVE_FILL + ICON_CURSOR_SCALE_FILL + ICON_CURSOR_SCALE_RIGHT_FILL + ICON_CURSOR_SCALE_LEFT_FILL + ICON_UNDO_FILL + ICON_REDO_FILL + ICON_REREDO_FILL + ICON_MUTATE_FILL + ICON_ROTATE_FILL + ICON_REPEAT_FILL + ICON_SHUFFLE_FILL + ICON_EMPTYBOX_SMALL + ICON_BOX + ICON_BOX_TOP + ICON_BOX_TOP_RIGHT + ICON_BOX_RIGHT + ICON_BOX_BOTTOM_RIGHT + ICON_BOX_BOTTOM + ICON_BOX_BOTTOM_LEFT + ICON_BOX_LEFT + ICON_BOX_TOP_LEFT + ICON_BOX_CENTER + ICON_BOX_CIRCLE_MASK + ICON_POT + ICON_ALPHA_MULTIPLY + ICON_ALPHA_CLEAR + ICON_DITHERING + ICON_MIPMAPS + ICON_BOX_GRID + ICON_GRID + ICON_BOX_CORNERS_SMALL + ICON_BOX_CORNERS_BIG + ICON_FOUR_BOXES + ICON_GRID_FILL + ICON_BOX_MULTISIZE + ICON_ZOOM_SMALL + ICON_ZOOM_MEDIUM + ICON_ZOOM_BIG + ICON_ZOOM_ALL + ICON_ZOOM_CENTER + ICON_BOX_DOTS_SMALL + ICON_BOX_DOTS_BIG + ICON_BOX_CONCENTRIC + ICON_BOX_GRID_BIG + ICON_OK_TICK + ICON_CROSS + ICON_ARROW_LEFT + ICON_ARROW_RIGHT + ICON_ARROW_DOWN + ICON_ARROW_UP + ICON_ARROW_LEFT_FILL + ICON_ARROW_RIGHT_FILL + ICON_ARROW_DOWN_FILL + ICON_ARROW_UP_FILL + ICON_AUDIO + ICON_FX + ICON_WAVE + ICON_WAVE_SINUS + ICON_WAVE_SQUARE + ICON_WAVE_TRIANGULAR + ICON_CROSS_SMALL + ICON_PLAYER_PREVIOUS + ICON_PLAYER_PLAY_BACK + ICON_PLAYER_PLAY + ICON_PLAYER_PAUSE + ICON_PLAYER_STOP + ICON_PLAYER_NEXT + ICON_PLAYER_RECORD + ICON_MAGNET + ICON_LOCK_CLOSE + ICON_LOCK_OPEN + ICON_CLOCK + ICON_TOOLS + ICON_GEAR + ICON_GEAR_BIG + ICON_BIN + ICON_HAND_POINTER + ICON_LASER + ICON_COIN + ICON_EXPLOSION + ICON_1UP + ICON_PLAYER + ICON_PLAYER_JUMP + ICON_KEY + ICON_DEMON + ICON_TEXT_POPUP + ICON_GEAR_EX + ICON_CRACK + ICON_CRACK_POINTS + ICON_STAR + ICON_DOOR + ICON_EXIT + ICON_MODE_2D + ICON_MODE_3D + ICON_CUBE + ICON_CUBE_FACE_TOP + ICON_CUBE_FACE_LEFT + ICON_CUBE_FACE_FRONT + ICON_CUBE_FACE_BOTTOM + ICON_CUBE_FACE_RIGHT + ICON_CUBE_FACE_BACK + ICON_CAMERA + ICON_SPECIAL + ICON_LINK_NET + ICON_LINK_BOXES + ICON_LINK_MULTI + ICON_LINK + ICON_LINK_BROKE + ICON_TEXT_NOTES + ICON_NOTEBOOK + ICON_SUITCASE + ICON_SUITCASE_ZIP + ICON_MAILBOX + ICON_MONITOR + ICON_PRINTER + ICON_PHOTO_CAMERA + ICON_PHOTO_CAMERA_FLASH + ICON_HOUSE + ICON_HEART + ICON_CORNER + ICON_VERTICAL_BARS + ICON_VERTICAL_BARS_FILL + ICON_LIFE_BARS + ICON_INFO + ICON_CROSSLINE + ICON_HELP + ICON_FILETYPE_ALPHA + ICON_FILETYPE_HOME + ICON_LAYERS_VISIBLE + ICON_LAYERS + ICON_WINDOW + ICON_HIDPI + ICON_FILETYPE_BINARY + ICON_HEX + ICON_SHIELD + ICON_FILE_NEW + ICON_FOLDER_ADD + ICON_ALARM + ICON_CPU + ICON_ROM + ICON_STEP_OVER + ICON_STEP_INTO + ICON_STEP_OUT + ICON_RESTART + ICON_BREAKPOINT_ON + ICON_BREAKPOINT_OFF + ICON_BURGER_MENU + ICON_CASE_SENSITIVE + ICON_REG_EXP + ICON_FOLDER + ICON_FILE + ICON_SAND_TIMER + ICON_220 + ICON_221 + ICON_222 + ICON_223 + ICON_224 + ICON_225 + ICON_226 + ICON_227 + ICON_228 + ICON_229 + ICON_230 + ICON_231 + ICON_232 + ICON_233 + ICON_234 + ICON_235 + ICON_236 + ICON_237 + ICON_238 + ICON_239 + ICON_240 + ICON_241 + ICON_242 + ICON_243 + ICON_244 + ICON_245 + ICON_246 + ICON_247 + ICON_248 + ICON_249 + ICON_250 + ICON_251 + ICON_252 + ICON_253 + ICON_254 + ICON_255 ) // TextInputBox control, ask for text -func TextInputBox(bounds rl.Rectangle, title, message, buttons string, text *string, textMaxSize int32, secretViewActive *int32) int32 { +func TextInputBox(bounds rl.Rectangle, title, message, buttons string, text *string, textMaxSize int32, secretViewActive *bool) int32 { var cbounds C.struct_Rectangle cbounds.x = C.float(bounds.X) cbounds.y = C.float(bounds.Y) @@ -1078,48 +1178,16 @@ func TextInputBox(bounds rl.Rectangle, title, message, buttons string, text *str ctextMaxSize := C.int(textMaxSize) - if secretViewActive == nil { - secretViewActive = new(int32) - } - csecretViewActive := C.int(*secretViewActive) + csecretViewActive := C.bool(*secretViewActive) defer func() { - *secretViewActive = int32(csecretViewActive) + *secretViewActive = bool(csecretViewActive) }() return int32(C.GuiTextInputBox(cbounds, ctitle, cmessage, cbuttons, ctext, ctextMaxSize, &csecretViewActive)) } -// TextBoxMulti control with multiple lines -func TextBoxMulti(bounds rl.Rectangle, text *string, textSize int32, editMode bool) bool { - var cbounds C.struct_Rectangle - cbounds.x = C.float(bounds.X) - cbounds.y = C.float(bounds.Y) - cbounds.width = C.float(bounds.Width) - cbounds.height = C.float(bounds.Height) - - bs := []byte(*text) - if len(bs) == 0 { - bs = []byte{byte(0)} - } - if 0 < len(bs) && bs[len(bs)-1] != byte(0) { // minimalize allocation - bs = append(bs, byte(0)) // for next input symbols - } - ctext := (*C.char)(unsafe.Pointer(&bs[0])) - defer func() { - *text = strings.TrimSpace(strings.Trim(string(bs), "\x00")) - // no need : C.free(unsafe.Pointer(ctext)) - }() - - ctextSize := (C.int)(textSize) - ceditMode := (C.bool)(editMode) - - return bool(C.GuiTextBoxMulti(cbounds, ctext, ctextSize, ceditMode)) -} - // ListViewEx control with extended parameters func ListViewEx(bounds rl.Rectangle, text []string, focus, scrollIndex *int32, active int32) int32 { - // int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active) - var cbounds C.struct_Rectangle cbounds.x = C.float(bounds.X) cbounds.y = C.float(bounds.Y) @@ -1149,7 +1217,8 @@ func ListViewEx(bounds rl.Rectangle, text []string, focus, scrollIndex *int32, a cactive := C.int(active) - return int32(C.GuiListViewEx(cbounds, (**C.char)(ctext.Pointer), count, &cfocus, &cscrollIndex, cactive)) + C.GuiListViewEx(cbounds, (**C.char)(ctext.Pointer), count, &cfocus, &cscrollIndex, &cactive) + return int32(cactive) } // TabBar control diff --git a/raygui/raygui.h b/raygui/raygui.h index 2325cd4..9127710 100644 --- a/raygui/raygui.h +++ b/raygui/raygui.h @@ -1,32 +1,55 @@ /******************************************************************************************* * -* raygui v3.5-dev - A simple and easy-to-use immediate-mode gui library +* raygui v4.0 - A simple and easy-to-use immediate-mode gui library * * DESCRIPTION: +* raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also +* available as a standalone library, as long as input and drawing functions are provided. * -* raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also -* available as a standalone library, as long as input and drawing functions are provided. +* FEATURES: +* - Immediate-mode gui, minimal retained data +* - +25 controls provided (basic and advanced) +* - Styling system for colors, font and metrics +* - Icons supported, embedded as a 1-bit icons pack +* - Standalone mode option (custom input/graphics backend) +* - Multiple support tools provided for raygui development * -* Controls provided: +* POSSIBLE IMPROVEMENTS: +* - Better standalone mode API for easy plug of custom backends +* - Externalize required inputs, allow user easier customization * -* # Container/separators Controls +* LIMITATIONS: +* - No editable multi-line word-wraped text box supported +* - No auto-layout mechanism, up to the user to define controls position and size +* - Standalone mode requires library modification and some user work to plug another backend +* +* NOTES: +* - WARNING: GuiLoadStyle() and GuiLoadStyle{Custom}() functions, allocate memory for +* font atlas recs and glyphs, freeing that memory is (usually) up to the user, +* no unload function is explicitly provided... but note that GuiLoadStyleDefaulf() unloads +* by default any previously loaded font (texture, recs, glyphs). +* - Global UI alpha (guiAlpha) is applied inside GuiDrawRectangle() and GuiDrawText() functions +* +* CONTROLS PROVIDED: +* # Container/separators Controls * - WindowBox --> StatusBar, Panel * - GroupBox --> Line * - Line * - Panel --> StatusBar * - ScrollPanel --> StatusBar +* - TabBar --> Button * -* # Basic Controls +* # Basic Controls * - Label -* - Button * - LabelButton --> Label +* - Button * - Toggle * - ToggleGroup --> Toggle +* - ToggleSlider * - CheckBox * - ComboBox * - DropdownBox * - TextBox -* - TextBoxMulti * - ValueBox --> TextBox * - Spinner --> Button, ValueBox * - Slider @@ -36,88 +59,141 @@ * - DummyRec * - Grid * -* # Advance Controls +* # Advance Controls * - ListView * - ColorPicker --> ColorPanel, ColorBarHue * - MessageBox --> Window, Label, Button * - TextInputBox --> Window, Label, TextBox, Button * -* It also provides a set of functions for styling the controls based on its properties (size, color). +* It also provides a set of functions for styling the controls based on its properties (size, color). * * * RAYGUI STYLE (guiStyle): +* raygui uses a global data array for all gui style properties (allocated on data segment by default), +* when a new style is loaded, it is loaded over the global style... but a default gui style could always be +* recovered with GuiLoadStyleDefault() function, that overwrites the current style to the default one * -* raygui uses a global data array for all gui style properties (allocated on data segment by default), -* when a new style is loaded, it is loaded over the global style... but a default gui style could always be -* recovered with GuiLoadStyleDefault() function, that overwrites the current style to the default one +* The global style array size is fixed and depends on the number of controls and properties: * -* The global style array size is fixed and depends on the number of controls and properties: +* static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)]; * -* static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)]; +* guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB * -* guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB +* Note that the first set of BASE properties (by default guiStyle[0..15]) belong to the generic style +* used for all controls, when any of those base values is set, it is automatically populated to all +* controls, so, specific control values overwriting generic style should be set after base values. * -* Note that the first set of BASE properties (by default guiStyle[0..15]) belong to the generic style -* used for all controls, when any of those base values is set, it is automatically populated to all -* controls, so, specific control values overwriting generic style should be set after base values. +* After the first BASE set we have the EXTENDED properties (by default guiStyle[16..23]), those +* properties are actually common to all controls and can not be overwritten individually (like BASE ones) +* Some of those properties are: TEXT_SIZE, TEXT_SPACING, LINE_COLOR, BACKGROUND_COLOR * -* After the first BASE set we have the EXTENDED properties (by default guiStyle[16..23]), those -* properties are actually common to all controls and can not be overwritten individually (like BASE ones) -* Some of those properties are: TEXT_SIZE, TEXT_SPACING, LINE_COLOR, BACKGROUND_COLOR +* Custom control properties can be defined using the EXTENDED properties for each independent control. * -* Custom control properties can be defined using the EXTENDED properties for each independent control. -* -* TOOL: rGuiStyler is a visual tool to customize raygui style. +* TOOL: rGuiStyler is a visual tool to customize raygui style: github.com/raysan5/rguistyler * * * RAYGUI ICONS (guiIcons): +* raygui could use a global array containing icons data (allocated on data segment by default), +* a custom icons set could be loaded over this array using GuiLoadIcons(), but loaded icons set +* must be same RAYGUI_ICON_SIZE and no more than RAYGUI_ICON_MAX_ICONS will be loaded * -* raygui could use a global array containing icons data (allocated on data segment by default), -* a custom icons set could be loaded over this array using GuiLoadIcons(), but loaded icons set -* must be same RAYGUI_ICON_SIZE and no more than RAYGUI_ICON_MAX_ICONS will be loaded +* Every icon is codified in binary form, using 1 bit per pixel, so, every 16x16 icon +* requires 8 integers (16*16/32) to be stored in memory. * -* Every icon is codified in binary form, using 1 bit per pixel, so, every 16x16 icon -* requires 8 integers (16*16/32) to be stored in memory. +* When the icon is draw, actually one quad per pixel is drawn if the bit for that pixel is set. * -* When the icon is draw, actually one quad per pixel is drawn if the bit for that pixel is set. +* The global icons array size is fixed and depends on the number of icons and size: * -* The global icons array size is fixed and depends on the number of icons and size: +* static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS]; * -* static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS]; +* guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB * -* guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB +* TOOL: rGuiIcons is a visual tool to customize/create raygui icons: github.com/raysan5/rguiicons * -* TOOL: rGuiIcons is a visual tool to customize raygui icons and create new ones. +* RAYGUI LAYOUT: +* raygui currently does not provide an auto-layout mechanism like other libraries, +* layouts must be defined manually on controls drawing, providing the right bounds Rectangle for it. * +* TOOL: rGuiLayout is a visual tool to create raygui layouts: github.com/raysan5/rguilayout * * CONFIGURATION: +* #define RAYGUI_IMPLEMENTATION +* Generates the implementation of the library into the included file. +* If not defined, the library is in header only mode and can be included in other headers +* or source files without problems. But only ONE file should hold the implementation. * -* #define RAYGUI_IMPLEMENTATION -* Generates the implementation of the library into the included file. -* If not defined, the library is in header only mode and can be included in other headers -* or source files without problems. But only ONE file should hold the implementation. +* #define RAYGUI_STANDALONE +* Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined +* internally in the library and input management and drawing functions must be provided by +* the user (check library implementation for further details). * -* #define RAYGUI_STANDALONE -* Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined -* internally in the library and input management and drawing functions must be provided by -* the user (check library implementation for further details). +* #define RAYGUI_NO_ICONS +* Avoid including embedded ricons data (256 icons, 16x16 pixels, 1-bit per pixel, 2KB) * -* #define RAYGUI_NO_ICONS -* Avoid including embedded ricons data (256 icons, 16x16 pixels, 1-bit per pixel, 2KB) +* #define RAYGUI_CUSTOM_ICONS +* Includes custom ricons.h header defining a set of custom icons, +* this file can be generated using rGuiIcons tool * -* #define RAYGUI_CUSTOM_ICONS -* Includes custom ricons.h header defining a set of custom icons, -* this file can be generated using rGuiIcons tool +* #define RAYGUI_DEBUG_RECS_BOUNDS +* Draw control bounds rectangles for debug * +* #define RAYGUI_DEBUG_TEXT_BOUNDS +* Draw text bounds rectangles for debug * * VERSIONS HISTORY: -* 3.5 (xx-xxx-2022) ADDED: Multiple new icons, useful for code editing tools -* ADDED: GuiTabBar(), based on GuiToggle() -* REMOVED: Unneeded icon editing functions -* REDESIGNED: GuiDrawText() to divide drawing by lines +* 4.0 (12-Sep-2023) ADDED: GuiToggleSlider() +* ADDED: GuiColorPickerHSV() and GuiColorPanelHSV() +* ADDED: Multiple new icons, mostly compiler related +* ADDED: New DEFAULT properties: TEXT_LINE_SPACING, TEXT_ALIGNMENT_VERTICAL, TEXT_WRAP_MODE +* ADDED: New enum values: GuiTextAlignment, GuiTextAlignmentVertical, GuiTextWrapMode +* ADDED: Support loading styles with custom font charset from external file +* REDESIGNED: GuiTextBox(), support mouse cursor positioning +* REDESIGNED: GuiDrawText(), support multiline and word-wrap modes (read only) +* REDESIGNED: GuiProgressBar() to be more visual, progress affects border color +* REDESIGNED: Global alpha consideration moved to GuiDrawRectangle() and GuiDrawText() +* REDESIGNED: GuiScrollPanel(), get parameters by reference and return result value +* REDESIGNED: GuiToggleGroup(), get parameters by reference and return result value +* REDESIGNED: GuiComboBox(), get parameters by reference and return result value +* REDESIGNED: GuiCheckBox(), get parameters by reference and return result value +* REDESIGNED: GuiSlider(), get parameters by reference and return result value +* REDESIGNED: GuiSliderBar(), get parameters by reference and return result value +* REDESIGNED: GuiProgressBar(), get parameters by reference and return result value +* REDESIGNED: GuiListView(), get parameters by reference and return result value +* REDESIGNED: GuiColorPicker(), get parameters by reference and return result value +* REDESIGNED: GuiColorPanel(), get parameters by reference and return result value +* REDESIGNED: GuiColorBarAlpha(), get parameters by reference and return result value +* REDESIGNED: GuiColorBarHue(), get parameters by reference and return result value +* REDESIGNED: GuiGrid(), get parameters by reference and return result value +* REDESIGNED: GuiGrid(), added extra parameter +* REDESIGNED: GuiListViewEx(), change parameters order +* REDESIGNED: All controls return result as int value +* REVIEWED: GuiScrollPanel() to avoid smallish scroll-bars +* REVIEWED: All examples and specially controls_test_suite +* RENAMED: gui_file_dialog module to gui_window_file_dialog +* UPDATED: All styles to include ISO-8859-15 charset (as much as possible) +* +* 3.6 (10-May-2023) ADDED: New icon: SAND_TIMER +* ADDED: GuiLoadStyleFromMemory() (binary only) +* REVIEWED: GuiScrollBar() horizontal movement key +* REVIEWED: GuiTextBox() crash on cursor movement +* REVIEWED: GuiTextBox(), additional inputs support +* REVIEWED: GuiLabelButton(), avoid text cut +* REVIEWED: GuiTextInputBox(), password input +* REVIEWED: Local GetCodepointNext(), aligned with raylib +* REDESIGNED: GuiSlider*()/GuiScrollBar() to support out-of-bounds +* +* 3.5 (20-Apr-2023) ADDED: GuiTabBar(), based on GuiToggle() +* ADDED: Helper functions to split text in separate lines +* ADDED: Multiple new icons, useful for code editing tools +* REMOVED: Unneeded icon editing functions +* REMOVED: GuiTextBoxMulti(), very limited and broken * REMOVED: MeasureTextEx() dependency, logic directly implemented * REMOVED: DrawTextEx() dependency, logic directly implemented -* ADDED: Helper functions to split text in separate lines +* REVIEWED: GuiScrollBar(), improve mouse-click behaviour +* REVIEWED: Library header info, more info, better organized +* REDESIGNED: GuiTextBox() to support cursor movement +* REDESIGNED: GuiDrawText() to divide drawing by lines +* * 3.2 (22-May-2022) RENAMED: Some enum values, for unification, avoiding prefixes * REMOVED: GuiScrollBar(), only internal * REDESIGNED: GuiPanel() to support text parameter @@ -127,6 +203,7 @@ * REDESIGNED: GuiColorBarAlpha() to support text parameter * REDESIGNED: GuiColorBarHue() to support text parameter * REDESIGNED: GuiTextInputBox() to support password +* * 3.1 (12-Jan-2022) REVIEWED: Default style for consistency (aligned with rGuiLayout v2.5 tool) * REVIEWED: GuiLoadStyle() to support compressed font atlas image data and unload previous textures * REVIEWED: External icons usage logic @@ -134,10 +211,12 @@ * RENAMED: Multiple controls properties definitions to prepend RAYGUI_ * RENAMED: RICON_ references to RAYGUI_ICON_ for library consistency * Projects updated and multiple tweaks +* * 3.0 (04-Nov-2021) Integrated ricons data to avoid external file * REDESIGNED: GuiTextBoxMulti() * REMOVED: GuiImageButton*() * Multiple minor tweaks and bugs corrected +* * 2.9 (17-Mar-2021) REMOVED: Tooltip API * 2.8 (03-May-2020) Centralized rectangles drawing to GuiDrawRectangle() * 2.7 (20-Feb-2020) ADDED: Possible tooltips API @@ -147,6 +226,7 @@ * Replaced property INNER_PADDING by TEXT_PADDING, renamed some properties * ADDED: 8 new custom styles ready to use * Multiple minor tweaks and bugs corrected +* * 2.5 (28-May-2019) Implemented extended GuiTextBox(), GuiValueBox(), GuiSpinner() * 2.3 (29-Apr-2019) ADDED: rIcons auxiliar library and support for it, multiple controls reviewed * Refactor all controls drawing mechanism to use control state @@ -165,14 +245,44 @@ * 0.9 (07-Mar-2016) Reviewed and tested by Albert Martos, Ian Eito, Sergio Martinez and Ramon Santamaria. * 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria. * +* DEPENDENCIES: +* raylib 5.0 - Inputs reading (keyboard/mouse), shapes drawing, font loading and text drawing +* +* STANDALONE MODE: +* By default raygui depends on raylib mostly for the inputs and the drawing functionality but that dependency can be disabled +* with the config flag RAYGUI_STANDALONE. In that case is up to the user to provide another backend to cover library needs. +* +* The following functions should be redefined for a custom backend: +* +* - Vector2 GetMousePosition(void); +* - float GetMouseWheelMove(void); +* - bool IsMouseButtonDown(int button); +* - bool IsMouseButtonPressed(int button); +* - bool IsMouseButtonReleased(int button); +* - bool IsKeyDown(int key); +* - bool IsKeyPressed(int key); +* - int GetCharPressed(void); // -- GuiTextBox(), GuiValueBox() +* +* - void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle() +* - void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker() +* +* - Font GetFontDefault(void); // -- GuiLoadStyleDefault() +* - Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle() +* - Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle(), required to load texture from embedded font atlas image +* - void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle(), required to set shapes rec to font white rec (optimization) +* - char *LoadFileText(const char *fileName); // -- GuiLoadStyle(), required to load charset data +* - void UnloadFileText(char *text); // -- GuiLoadStyle(), required to unload charset data +* - const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle(), required to find charset/font file from text .rgs +* - int *LoadCodepoints(const char *text, int *count); // -- GuiLoadStyle(), required to load required font codepoints list +* - void UnloadCodepoints(int *codepoints); // -- GuiLoadStyle(), required to unload codepoints list +* - unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // -- GuiLoadStyle() * * CONTRIBUTORS: -* * Ramon Santamaria: Supervision, review, redesign, update and maintenance * Vlad Adrian: Complete rewrite of GuiTextBox() to support extended features (2019) * Sergio Martinez: Review, testing (2015) and redesign of multiple controls (2018) -* Adria Arranz: Testing and Implementation of additional controls (2018) -* Jordi Jorba: Testing and Implementation of additional controls (2018) +* Adria Arranz: Testing and implementation of additional controls (2018) +* Jordi Jorba: Testing and implementation of additional controls (2018) * Albert Martos: Review and testing of the library (2015) * Ian Eito: Review and testing of the library (2015) * Kevin Gato: Initial implementation of basic components (2014) @@ -181,7 +291,7 @@ * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2023 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. @@ -203,7 +313,10 @@ #ifndef RAYGUI_H #define RAYGUI_H -#define RAYGUI_VERSION "3.2" +#define RAYGUI_VERSION_MAJOR 4 +#define RAYGUI_VERSION_MINOR 0 +#define RAYGUI_VERSION_PATCH 0 +#define RAYGUI_VERSION "4.0" #if !defined(RAYGUI_STANDALONE) #include "raylib.h" @@ -328,37 +441,69 @@ } Font; #endif + // Style property +// NOTE: Used when exporting style as code for convenience typedef struct GuiStyleProp { - unsigned short controlId; - unsigned short propertyId; - unsigned int propertyValue; + unsigned short controlId; // Control identifier + unsigned short propertyId; // Property identifier + int propertyValue; // Property value } GuiStyleProp; +/* +// Controls text style -NOT USED- +// NOTE: Text style is defined by control +typedef struct GuiTextStyle { + unsigned int size; + int charSpacing; + int lineSpacing; + int alignmentH; + int alignmentV; + int padding; +} GuiTextStyle; +*/ + // Gui control state typedef enum { STATE_NORMAL = 0, STATE_FOCUSED, STATE_PRESSED, - STATE_DISABLED, + STATE_DISABLED } GuiState; // Gui control text alignment typedef enum { TEXT_ALIGN_LEFT = 0, TEXT_ALIGN_CENTER, - TEXT_ALIGN_RIGHT, + TEXT_ALIGN_RIGHT } GuiTextAlignment; +// Gui control text alignment vertical +// NOTE: Text vertical position inside the text bounds +typedef enum { + TEXT_ALIGN_TOP = 0, + TEXT_ALIGN_MIDDLE, + TEXT_ALIGN_BOTTOM +} GuiTextAlignmentVertical; + +// Gui control text wrap mode +// NOTE: Useful for multiline text +typedef enum { + TEXT_WRAP_NONE = 0, + TEXT_WRAP_CHAR, + TEXT_WRAP_WORD +} GuiTextWrapMode; + // Gui controls typedef enum { // Default -> populates to all controls when set DEFAULT = 0, + // Basic controls LABEL, // Used also for: LABELBUTTON BUTTON, TOGGLE, // Used also for: TOGGLEGROUP - SLIDER, // Used also for: SLIDERBAR + SLIDER, // Used also for: SLIDERBAR, TOGGLESLIDER PROGRESSBAR, CHECKBOX, COMBOBOX, @@ -375,37 +520,55 @@ typedef enum { // Gui base properties for every control // NOTE: RAYGUI_MAX_PROPS_BASE properties (by default 16 properties) typedef enum { - BORDER_COLOR_NORMAL = 0, - BASE_COLOR_NORMAL, - TEXT_COLOR_NORMAL, - BORDER_COLOR_FOCUSED, - BASE_COLOR_FOCUSED, - TEXT_COLOR_FOCUSED, - BORDER_COLOR_PRESSED, - BASE_COLOR_PRESSED, - TEXT_COLOR_PRESSED, - BORDER_COLOR_DISABLED, - BASE_COLOR_DISABLED, - TEXT_COLOR_DISABLED, - BORDER_WIDTH, - TEXT_PADDING, - TEXT_ALIGNMENT, - RESERVED + BORDER_COLOR_NORMAL = 0, // Control border color in STATE_NORMAL + BASE_COLOR_NORMAL, // Control base color in STATE_NORMAL + TEXT_COLOR_NORMAL, // Control text color in STATE_NORMAL + BORDER_COLOR_FOCUSED, // Control border color in STATE_FOCUSED + BASE_COLOR_FOCUSED, // Control base color in STATE_FOCUSED + TEXT_COLOR_FOCUSED, // Control text color in STATE_FOCUSED + BORDER_COLOR_PRESSED, // Control border color in STATE_PRESSED + BASE_COLOR_PRESSED, // Control base color in STATE_PRESSED + TEXT_COLOR_PRESSED, // Control text color in STATE_PRESSED + BORDER_COLOR_DISABLED, // Control border color in STATE_DISABLED + BASE_COLOR_DISABLED, // Control base color in STATE_DISABLED + TEXT_COLOR_DISABLED, // Control text color in STATE_DISABLED + BORDER_WIDTH, // Control border size, 0 for no border + //TEXT_SIZE, // Control text size (glyphs max height) -> GLOBAL for all controls + //TEXT_SPACING, // Control text spacing between glyphs -> GLOBAL for all controls + //TEXT_LINE_SPACING // Control text spacing between lines -> GLOBAL for all controls + TEXT_PADDING, // Control text padding, not considering border + TEXT_ALIGNMENT, // Control text horizontal alignment inside control text bound (after border and padding) + //TEXT_WRAP_MODE // Control text wrap-mode inside text bounds -> GLOBAL for all controls } GuiControlProperty; -// Gui extended properties depend on control -// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default 8 properties) -//---------------------------------------------------------------------------------- +// TODO: Which text styling properties should be global or per-control? +// At this moment TEXT_PADDING and TEXT_ALIGNMENT is configured and saved per control while +// TEXT_SIZE, TEXT_SPACING, TEXT_LINE_SPACING, TEXT_ALIGNMENT_VERTICAL, TEXT_WRAP_MODE are global and +// should be configured by user as needed while defining the UI layout + +// Gui extended properties depend on control +// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default, max 8 properties) +//---------------------------------------------------------------------------------- // DEFAULT extended properties // NOTE: Those properties are common to all controls or global +// WARNING: We only have 8 slots for those properties by default!!! -> New global control: TEXT? typedef enum { TEXT_SIZE = 16, // Text size (glyphs max height) TEXT_SPACING, // Text spacing between glyphs LINE_COLOR, // Line control color BACKGROUND_COLOR, // Background color + TEXT_LINE_SPACING, // Text spacing between lines + TEXT_ALIGNMENT_VERTICAL, // Text vertical alignment inside text bounds (after border and padding) + TEXT_WRAP_MODE // Text wrap-mode inside text bounds + //TEXT_DECORATION // Text decoration: 0-None, 1-Underline, 2-Line-through, 3-Overline + //TEXT_DECORATION_THICK // Text decoration line thikness } GuiDefaultProperty; +// Other possible text properties: +// TEXT_WEIGHT // Normal, Italic, Bold -> Requires specific font change +// TEXT_INDENT // Text indentation -> Now using TEXT_PADDING... + // Label //typedef enum { } GuiLabelProperty; @@ -430,12 +593,12 @@ typedef enum { // ScrollBar typedef enum { - ARROWS_SIZE = 16, - ARROWS_VISIBLE, - SCROLL_SLIDER_PADDING, // (SLIDERBAR, SLIDER_PADDING) - SCROLL_SLIDER_SIZE, - SCROLL_PADDING, - SCROLL_SPEED, + ARROWS_SIZE = 16, // ScrollBar arrows size + ARROWS_VISIBLE, // ScrollBar arrows visible + SCROLL_SLIDER_PADDING, // ScrollBar slider internal padding + SCROLL_SLIDER_SIZE, // ScrollBar slider size + SCROLL_PADDING, // ScrollBar scroll padding from arrows + SCROLL_SPEED, // ScrollBar scrolling speed } GuiScrollBarProperty; // CheckBox @@ -457,8 +620,7 @@ typedef enum { // TextBox/TextBoxMulti/ValueBox/Spinner typedef enum { - TEXT_INNER_PADDING = 16, // TextBox/TextBoxMulti/ValueBox/Spinner inner text padding - TEXT_LINES_SPACING, // TextBoxMulti lines separation + TEXT_READONLY = 16, // TextBox in read-only mode: 0-text editable, 1-text no-editable } GuiTextBoxProperty; // Spinner @@ -472,7 +634,7 @@ typedef enum { LIST_ITEMS_HEIGHT = 16, // ListView items height LIST_ITEMS_SPACING, // ListView items separation SCROLLBAR_WIDTH, // ListView scrollbar size (usually width) - SCROLLBAR_SIDE, // ListView scrollbar side (0-left, 1-right) + SCROLLBAR_SIDE, // ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE) } GuiListViewProperty; // ColorPicker @@ -501,72 +663,89 @@ extern "C" { // Prevents name mangling of functions #endif // Global gui state control functions -RAYGUIAPI void GuiEnable(void); // Enable gui controls (global state) -RAYGUIAPI void GuiDisable(void); // Disable gui controls (global state) -RAYGUIAPI void GuiLock(void); // Lock gui controls (global state) -RAYGUIAPI void GuiUnlock(void); // Unlock gui controls (global state) -RAYGUIAPI bool GuiIsLocked(void); // Check if gui is locked (global state) -RAYGUIAPI void GuiFade(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f -RAYGUIAPI void GuiSetState(int state); // Set gui state (global state) -RAYGUIAPI int GuiGetState(void); // Get gui state (global state) +RAYGUIAPI void GuiEnable(void); // Enable gui controls (global state) +RAYGUIAPI void GuiDisable(void); // Disable gui controls (global state) +RAYGUIAPI void GuiLock(void); // Lock gui controls (global state) +RAYGUIAPI void GuiUnlock(void); // Unlock gui controls (global state) +RAYGUIAPI bool GuiIsLocked(void); // Check if gui is locked (global state) +RAYGUIAPI void GuiSetAlpha(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f +RAYGUIAPI void GuiSetState(int state); // Set gui state (global state) +RAYGUIAPI int GuiGetState(void); // Get gui state (global state) // Font set/get functions -RAYGUIAPI void GuiSetFont(Font font); // Set gui custom font (global state) -RAYGUIAPI Font GuiGetFont(void); // Get gui custom font (global state) +RAYGUIAPI void GuiSetFont(Font font); // Set gui custom font (global state) +RAYGUIAPI Font GuiGetFont(void); // Get gui custom font (global state) // Style set/get functions -RAYGUIAPI void GuiSetStyle(int control, int property, int value); // Set one style property -RAYGUIAPI int GuiGetStyle(int control, int property); // Get one style property - -// Container/separator controls, useful for controls organization -RAYGUIAPI bool GuiWindowBox(Rectangle bounds, const char *title); // Window Box control, shows a window that can be closed -RAYGUIAPI void GuiGroupBox(Rectangle bounds, const char *text); // Group Box control with text name -RAYGUIAPI void GuiLine(Rectangle bounds, const char *text); // Line separator control, could contain text -RAYGUIAPI void GuiPanel(Rectangle bounds, const char *text); // Panel control, useful to group controls -RAYGUIAPI int GuiTabBar(Rectangle bounds, const char **text, int count, int *active); // Tab Bar control, returns TAB to be closed or -1 -RAYGUIAPI Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll); // Scroll Panel control - -// Basic controls set -RAYGUIAPI void GuiLabel(Rectangle bounds, const char *text); // Label control, shows text -RAYGUIAPI bool GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked -RAYGUIAPI bool GuiLabelButton(Rectangle bounds, const char *text); // Label button control, show true when clicked -RAYGUIAPI bool GuiToggle(Rectangle bounds, const char *text, bool active); // Toggle Button control, returns true when active -RAYGUIAPI int GuiToggleGroup(Rectangle bounds, const char *text, int active); // Toggle Group control, returns active toggle index -RAYGUIAPI bool GuiCheckBox(Rectangle bounds, const char *text, bool checked); // Check Box control, returns true when active -RAYGUIAPI int GuiComboBox(Rectangle bounds, const char *text, int active); // Combo Box control, returns selected item index -RAYGUIAPI bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control, returns selected item -RAYGUIAPI bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control, returns selected value -RAYGUIAPI bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers -RAYGUIAPI bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text -RAYGUIAPI bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control with multiple lines -RAYGUIAPI float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider control, returns selected value -RAYGUIAPI float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider Bar control, returns selected value -RAYGUIAPI float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Progress Bar control, shows current progress value -RAYGUIAPI void GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text -RAYGUIAPI void GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders -RAYGUIAPI Vector2 GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs); // Grid control, returns mouse cell position - -// Advance controls set -RAYGUIAPI int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active); // List View control, returns selected list item index -RAYGUIAPI int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active); // List View with extended parameters -RAYGUIAPI int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message -RAYGUIAPI int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, int *secretViewActive); // Text Input Box control, ask for text, supports secret -RAYGUIAPI Color GuiColorPicker(Rectangle bounds, const char *text, Color color); // Color Picker control (multiple color controls) -RAYGUIAPI Color GuiColorPanel(Rectangle bounds, const char *text, Color color); // Color Panel control -RAYGUIAPI float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha); // Color Bar Alpha control -RAYGUIAPI float GuiColorBarHue(Rectangle bounds, const char *text, float value); // Color Bar Hue control +RAYGUIAPI void GuiSetStyle(int control, int property, int value); // Set one style property +RAYGUIAPI int GuiGetStyle(int control, int property); // Get one style property // Styles loading functions RAYGUIAPI void GuiLoadStyle(const char *fileName); // Load style file over global style variable (.rgs) RAYGUIAPI void GuiLoadStyleDefault(void); // Load style default over global style +// Tooltips management functions +RAYGUIAPI void GuiEnableTooltip(void); // Enable gui tooltips (global state) +RAYGUIAPI void GuiDisableTooltip(void); // Disable gui tooltips (global state) +RAYGUIAPI void GuiSetTooltip(const char *tooltip); // Set tooltip string + // Icons functionality RAYGUIAPI const char *GuiIconText(int iconId, const char *text); // Get text with icon id prepended (if supported) +#if !defined(RAYGUI_NO_ICONS) +RAYGUIAPI void GuiSetIconScale(int scale); // Set default icon drawing size +RAYGUIAPI unsigned int *GuiGetIcons(void); // Get raygui icons data pointer +RAYGUIAPI char **GuiLoadIcons(const char *fileName, bool loadIconsName); // Load raygui icons file (.rgi) into internal icons data +RAYGUIAPI void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color); // Draw icon using pixel size at specified position +#endif + + +// Controls +//---------------------------------------------------------------------------------------------------------- +// Container/separator controls, useful for controls organization +RAYGUIAPI int GuiWindowBox(Rectangle bounds, const char *title); // Window Box control, shows a window that can be closed +RAYGUIAPI int GuiGroupBox(Rectangle bounds, const char *text); // Group Box control with text name +RAYGUIAPI int GuiLine(Rectangle bounds, const char *text); // Line separator control, could contain text +RAYGUIAPI int GuiPanel(Rectangle bounds, const char *text); // Panel control, useful to group controls +RAYGUIAPI int GuiTabBar(Rectangle bounds, const char **text, int count, int *active); // Tab Bar control, returns TAB to be closed or -1 +RAYGUIAPI int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll, Rectangle *view); // Scroll Panel control + +// Basic controls set +RAYGUIAPI int GuiLabel(Rectangle bounds, const char *text); // Label control, shows text +RAYGUIAPI int GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked +RAYGUIAPI int GuiLabelButton(Rectangle bounds, const char *text); // Label button control, show true when clicked +RAYGUIAPI int GuiToggle(Rectangle bounds, const char *text, bool *active); // Toggle Button control, returns true when active +RAYGUIAPI int GuiToggleGroup(Rectangle bounds, const char *text, int *active); // Toggle Group control, returns active toggle index +RAYGUIAPI int GuiToggleSlider(Rectangle bounds, const char *text, int *active); // Toggle Slider control, returns true when clicked +RAYGUIAPI int GuiCheckBox(Rectangle bounds, const char *text, bool *checked); // Check Box control, returns true when active +RAYGUIAPI int GuiComboBox(Rectangle bounds, const char *text, int *active); // Combo Box control, returns selected item index + +RAYGUIAPI int GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control, returns selected item +RAYGUIAPI int GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control, returns selected value +RAYGUIAPI int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers +RAYGUIAPI int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text + +RAYGUIAPI int GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Slider control, returns selected value +RAYGUIAPI int GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Slider Bar control, returns selected value +RAYGUIAPI int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Progress Bar control, shows current progress value +RAYGUIAPI int GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text +RAYGUIAPI int GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders +RAYGUIAPI int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell); // Grid control, returns mouse cell position + +// Advance controls set +RAYGUIAPI int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int *active); // List View control, returns selected list item index +RAYGUIAPI int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollIndex, int *active, int *focus); // List View with extended parameters +RAYGUIAPI int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message +RAYGUIAPI int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, bool *secretViewActive); // Text Input Box control, ask for text, supports secret +RAYGUIAPI int GuiColorPicker(Rectangle bounds, const char *text, Color *color); // Color Picker control (multiple color controls) +RAYGUIAPI int GuiColorPanel(Rectangle bounds, const char *text, Color *color); // Color Panel control +RAYGUIAPI int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha); // Color Bar Alpha control +RAYGUIAPI int GuiColorBarHue(Rectangle bounds, const char *text, float *value); // Color Bar Hue control +RAYGUIAPI int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv); // Color Picker control that avoids conversion to RGB on each call (multiple color controls) +RAYGUIAPI int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv); // Color Panel control that returns HSV color value, used by GuiColorPickerHSV() +//---------------------------------------------------------------------------------------------------------- + #if !defined(RAYGUI_NO_ICONS) -RAYGUIAPI unsigned int *GuiGetIcons(void); // Get raygui icons data pointer -RAYGUIAPI char **GuiLoadIcons(const char *fileName, bool loadIconsName); // Load raygui icons file (.rgi) into internal icons data -RAYGUIAPI void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color); #if !defined(RAYGUI_CUSTOM_ICONS) //---------------------------------------------------------------------------------- @@ -792,7 +971,7 @@ typedef enum { ICON_REG_EXP = 216, ICON_FOLDER = 217, ICON_FILE = 218, - ICON_219 = 219, + ICON_SAND_TIMER = 219, ICON_220 = 220, ICON_221 = 221, ICON_222 = 222, @@ -850,7 +1029,7 @@ typedef enum { #include // Required for: FILE, fopen(), fclose(), fprintf(), feof(), fscanf(), vsprintf() [GuiLoadStyle(), GuiLoadIcons()] #include // Required for: malloc(), calloc(), free() [GuiLoadStyle(), GuiLoadIcons()] -#include // Required for: strlen() [GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()], memset(), memcpy() +#include // Required for: strlen() [GuiTextBox(), GuiValueBox()], memset(), memcpy() #include // Required for: va_list, va_start(), vfprintf(), va_end() [TextFormat()] #include // Required for: roundf() [GuiColorPicker()] @@ -860,6 +1039,11 @@ typedef enum { #define RAYGUI_CLITERAL(name) (name) #endif +// Check if two rectangles are equal, used to validate a slider bounds as an id +#ifndef CHECK_BOUNDS_ID + #define CHECK_BOUNDS_ID(src, dst) ((src.x == dst.x) && (src.y == dst.y) && (src.width == dst.width) && (src.height == dst.height)) +#endif + #if !defined(RAYGUI_NO_ICONS) && !defined(RAYGUI_CUSTOM_ICONS) // Embedded icons, no external file provided @@ -1050,11 +1234,11 @@ static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] = 0x78040000, 0x501f600e, 0x0ef44004, 0x12f41284, 0x0ef41284, 0x10140004, 0x7ffc300c, 0x10003000, // ICON_MODE_3D 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // ICON_CUBE 0x7fe00000, 0x5ff87ff0, 0x47fe4ffc, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // ICON_CUBE_FACE_TOP - 0x7fe00000, 0x50386030, 0x47fe483c, 0x443e443e, 0x443e443e, 0x241e75fe, 0x0c06140e, 0x000007fe, // ICON_CUBE_FACE_LEFT + 0x7fe00000, 0x50386030, 0x47c2483c, 0x443e443e, 0x443e443e, 0x241e75fe, 0x0c06140e, 0x000007fe, // ICON_CUBE_FACE_LEFT 0x7fe00000, 0x50286030, 0x47fe4804, 0x47fe47fe, 0x47fe47fe, 0x27fe77fe, 0x0ffe17fe, 0x000007fe, // ICON_CUBE_FACE_FRONT - 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x3ff27fe2, 0x0ffe1ffa, 0x000007fe, // ICON_CUBE_FACE_BOTTOM + 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x3bf27be2, 0x0bfe1bfa, 0x000007fe, // ICON_CUBE_FACE_BOTTOM 0x7fe00000, 0x70286030, 0x7ffe7804, 0x7c227c02, 0x7c227c22, 0x3c127de2, 0x0c061c0a, 0x000007fe, // ICON_CUBE_FACE_RIGHT - 0x7fe00000, 0x7fe87ff0, 0x7ffe7fe4, 0x7fe27fe2, 0x7fe27fe2, 0x24127fe2, 0x0c06140a, 0x000007fe, // ICON_CUBE_FACE_BACK + 0x7fe00000, 0x6fe85ff0, 0x781e77e4, 0x7be27be2, 0x7be27be2, 0x24127be2, 0x0c06140a, 0x000007fe, // ICON_CUBE_FACE_BACK 0x00000000, 0x2a0233fe, 0x22022602, 0x22022202, 0x2a022602, 0x00a033fe, 0x02080110, 0x00000000, // ICON_CAMERA 0x00000000, 0x200c3ffc, 0x000c000c, 0x3ffc000c, 0x30003000, 0x30003000, 0x3ffc3004, 0x00000000, // ICON_SPECIAL 0x00000000, 0x0022003e, 0x012201e2, 0x0100013e, 0x01000100, 0x79000100, 0x4f004900, 0x00007800, // ICON_LINK_NET @@ -1105,7 +1289,7 @@ static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] = 0x00000000, 0x02000000, 0x07000a80, 0x07001fc0, 0x02000a80, 0x00300030, 0x00000000, 0x00000000, // ICON_REG_EXP 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x40024002, 0x40024002, 0x7ffe4002, 0x00000000, // ICON_FOLDER 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x00003ffc, // ICON_FILE - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_219 + 0x1ff00000, 0x20082008, 0x17d02fe8, 0x05400ba0, 0x09200540, 0x23881010, 0x2fe827c8, 0x00001ff0, // ICON_SAND_TIMER 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_220 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_221 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_222 @@ -1153,8 +1337,10 @@ static unsigned int *guiIconsPtr = guiIcons; #define RAYGUI_ICON_SIZE 0 #endif -#define RAYGUI_MAX_CONTROLS 16 // Maximum number of standard controls -#define RAYGUI_MAX_PROPS_BASE 16 // Maximum number of standard properties +// WARNING: Those values define the total size of the style data array, +// if changed, previous saved styles could become incompatible +#define RAYGUI_MAX_CONTROLS 16 // Maximum number of controls +#define RAYGUI_MAX_PROPS_BASE 16 // Maximum number of base properties #define RAYGUI_MAX_PROPS_EXTENDED 8 // Maximum number of extended properties //---------------------------------------------------------------------------------- @@ -1166,13 +1352,24 @@ typedef enum { BORDER = 0, BASE, TEXT, OTHER } GuiPropertyElement; //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- -static GuiState guiState = STATE_NORMAL; // Gui global state, if !STATE_NORMAL, forces defined state +static GuiState guiState = STATE_NORMAL; // Gui global state, if !STATE_NORMAL, forces defined state -static Font guiFont = { 0 }; // Gui current font (WARNING: highly coupled to raylib) -static bool guiLocked = false; // Gui lock state (no inputs processed) -static float guiAlpha = 1.0f; // Gui element transpacency on drawing +static Font guiFont = { 0 }; // Gui current font (WARNING: highly coupled to raylib) +static bool guiLocked = false; // Gui lock state (no inputs processed) +static float guiAlpha = 1.0f; // Gui controls transparency -static unsigned int guiIconScale = 1; // Gui icon default scale (if icons enabled) +static unsigned int guiIconScale = 1; // Gui icon default scale (if icons enabled) + +static bool guiTooltip = false; // Tooltip enabled/disabled +static const char *guiTooltipPtr = NULL; // Tooltip string pointer (string provided by user) + +static bool guiSliderDragging = false; // Gui slider drag state (no inputs processed except dragged slider) +static Rectangle guiSliderActive = { 0 }; // Gui slider active bounds rectangle, used as an unique identifier + +static int textBoxCursorIndex = 0; // Cursor index, shared by all GuiTextBox*() +//static int blinkCursorFrameCounter = 0; // Frame counter for cursor blinking +static int autoCursorCooldownCounter = 0; // Cooldown frame counter for automatic cursor movement on key-down +static int autoCursorDelayCounter = 0; // Delay frame counter for automatic cursor movement //---------------------------------------------------------------------------------- // Style data array for all gui style properties (allocated on data segment by default) @@ -1217,31 +1414,38 @@ static bool IsMouseButtonReleased(int button); static bool IsKeyDown(int key); static bool IsKeyPressed(int key); -static int GetCharPressed(void); // -- GuiTextBox(), GuiTextBoxMulti(), GuiValueBox() +static int GetCharPressed(void); // -- GuiTextBox(), GuiValueBox() //------------------------------------------------------------------------------- // Drawing required functions //------------------------------------------------------------------------------- -static void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle(), GuiDrawIcon() - +static void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle() static void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker() //------------------------------------------------------------------------------- // Text required functions //------------------------------------------------------------------------------- -static Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount); // -- GuiLoadStyle() -static Font GetFontDefault(void); // -- GuiLoadStyleDefault() -static Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle() -static void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle() -static char *LoadFileText(const char *fileName); // -- GuiLoadStyle() -static const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle() +static Font GetFontDefault(void); // -- GuiLoadStyleDefault() +static Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle(), load font + +static Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle(), required to load texture from embedded font atlas image +static void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle(), required to set shapes rec to font white rec (optimization) + +static char *LoadFileText(const char *fileName); // -- GuiLoadStyle(), required to load charset data +static void UnloadFileText(char *text); // -- GuiLoadStyle(), required to unload charset data + +static const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle(), required to find charset/font file from text .rgs + +static int *LoadCodepoints(const char *text, int *count); // -- GuiLoadStyle(), required to load required font codepoints list +static void UnloadCodepoints(int *codepoints); // -- GuiLoadStyle(), required to unload codepoints list + +static unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // -- GuiLoadStyle() //------------------------------------------------------------------------------- // raylib functions already implemented in raygui //------------------------------------------------------------------------------- static Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value static int ColorToInt(Color color); // Returns hexadecimal value for a Color -static Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f static bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle static const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed' static const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings @@ -1258,11 +1462,13 @@ static void DrawRectangleGradientV(int posX, int posY, int width, int height, Co //---------------------------------------------------------------------------------- // Module specific Functions Declaration //---------------------------------------------------------------------------------- +static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize); // Load style from memory (binary only) + static int GetTextWidth(const char *text); // Gui get text width using gui font and style static Rectangle GetTextBounds(int control, Rectangle bounds); // Get text bounds considering control bounds static const char *GetTextIcon(const char *text, int *iconId); // Get text icon if provided and move text cursor -static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint); // Gui draw text using default font +static void GuiDrawText(const char *text, Rectangle textBounds, int alignment, Color tint); // Gui draw text using default font static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color); // Gui draw rectangle using default raygui style static const char **GuiTextSplit(const char *text, char delimiter, int *count, int *textRow); // Split controls text into multiple strings @@ -1270,6 +1476,9 @@ static Vector3 ConvertHSVtoRGB(Vector3 hsv); // Convert color static Vector3 ConvertRGBtoHSV(Vector3 rgb); // Convert color data from RGB to HSV static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue); // Scroll bar control, used by GuiScrollPanel() +static void GuiTooltip(Rectangle controlRec); // Draw tooltip using control rec position + +static Color GuiFade(Color color, float alpha); // Fade color by an alpha factor //---------------------------------------------------------------------------------- // Gui Setup Functions Definition @@ -1292,7 +1501,7 @@ void GuiUnlock(void) { guiLocked = false; } bool GuiIsLocked(void) { return guiLocked; } // Set gui controls alpha global state -void GuiFade(float alpha) +void GuiSetAlpha(float alpha) { if (alpha < 0.0f) alpha = 0.0f; else if (alpha > 1.0f) alpha = 1.0f; @@ -1318,7 +1527,6 @@ void GuiSetFont(Font font) if (!guiStyleLoaded) GuiLoadStyleDefault(); guiFont = font; - GuiSetStyle(DEFAULT, TEXT_SIZE, font.baseSize); } } @@ -1353,7 +1561,7 @@ int GuiGetStyle(int control, int property) //---------------------------------------------------------------------------------- // Window Box control -bool GuiWindowBox(Rectangle bounds, const char *title) +int GuiWindowBox(Rectangle bounds, const char *title) { // Window title bar height (including borders) // NOTE: This define is also used by GuiMessageBox() and GuiTextInputBox() @@ -1361,8 +1569,8 @@ bool GuiWindowBox(Rectangle bounds, const char *title) #define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT 24 #endif + int result = 0; //GuiState state = guiState; - bool clicked = false; int statusBarHeight = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT; @@ -1389,38 +1597,41 @@ bool GuiWindowBox(Rectangle bounds, const char *title) GuiSetStyle(BUTTON, BORDER_WIDTH, 1); GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); #if defined(RAYGUI_NO_ICONS) - clicked = GuiButton(closeButtonRec, "x"); + result = GuiButton(closeButtonRec, "x"); #else - clicked = GuiButton(closeButtonRec, GuiIconText(ICON_CROSS_SMALL, NULL)); + result = GuiButton(closeButtonRec, GuiIconText(ICON_CROSS_SMALL, NULL)); #endif GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment); //-------------------------------------------------------------------- - return clicked; + return result; // Window close button clicked: result = 1 } // Group Box control with text name -void GuiGroupBox(Rectangle bounds, const char *text) +int GuiGroupBox(Rectangle bounds, const char *text) { #if !defined(RAYGUI_GROUPBOX_LINE_THICK) #define RAYGUI_GROUPBOX_LINE_THICK 1 #endif + int result = 0; GuiState state = guiState; // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, RAYGUI_GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha)); - GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, RAYGUI_GROUPBOX_LINE_THICK }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha)); - GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - 1, bounds.y, RAYGUI_GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha)); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, RAYGUI_GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, RAYGUI_GROUPBOX_LINE_THICK }, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - 1, bounds.y, RAYGUI_GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR))); GuiLine(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y - GuiGetStyle(DEFAULT, TEXT_SIZE)/2, bounds.width, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) }, text); //-------------------------------------------------------------------- + + return result; } // Line control -void GuiLine(Rectangle bounds, const char *text) +int GuiLine(Rectangle bounds, const char *text) { #if !defined(RAYGUI_LINE_ORIGIN_SIZE) #define RAYGUI_LINE_MARGIN_TEXT 12 @@ -1429,9 +1640,10 @@ void GuiLine(Rectangle bounds, const char *text) #define RAYGUI_LINE_TEXT_PADDING 4 #endif + int result = 0; GuiState state = guiState; - Color color = Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha); + Color color = GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)); // Draw control //-------------------------------------------------------------------- @@ -1439,7 +1651,7 @@ void GuiLine(Rectangle bounds, const char *text) else { Rectangle textBounds = { 0 }; - textBounds.width = (float)GetTextWidth(text); + textBounds.width = (float)GetTextWidth(text) + 2; textBounds.height = bounds.height; textBounds.x = bounds.x + RAYGUI_LINE_MARGIN_TEXT; textBounds.y = bounds.y; @@ -1450,15 +1662,18 @@ void GuiLine(Rectangle bounds, const char *text) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + 12 + textBounds.width + 4, bounds.y + bounds.height/2, bounds.width - textBounds.width - RAYGUI_LINE_MARGIN_TEXT - RAYGUI_LINE_TEXT_PADDING, 1 }, 0, BLANK, color); } //-------------------------------------------------------------------- + + return result; } // Panel control -void GuiPanel(Rectangle bounds, const char *text) +int GuiPanel(Rectangle bounds, const char *text) { #if !defined(RAYGUI_PANEL_BORDER_WIDTH) #define RAYGUI_PANEL_BORDER_WIDTH 1 #endif + int result = 0; GuiState state = guiState; // Text will be drawn as a header bar (if provided) @@ -1469,16 +1684,18 @@ void GuiPanel(Rectangle bounds, const char *text) { // Move panel bounds after the header bar bounds.y += (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1; - bounds.height -= (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + 1; + bounds.height -= (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1; } // Draw control //-------------------------------------------------------------------- if (text != NULL) GuiStatusBar(statusBar, text); // Draw panel header as status bar - GuiDrawRectangle(bounds, RAYGUI_PANEL_BORDER_WIDTH, Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED: LINE_COLOR)), guiAlpha), - Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BASE_COLOR_DISABLED : BACKGROUND_COLOR)), guiAlpha)); + GuiDrawRectangle(bounds, RAYGUI_PANEL_BORDER_WIDTH, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED: LINE_COLOR)), + GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BASE_COLOR_DISABLED : BACKGROUND_COLOR))); //-------------------------------------------------------------------- + + return result; } // Tab Bar control @@ -1487,55 +1704,84 @@ int GuiTabBar(Rectangle bounds, const char **text, int count, int *active) { #define RAYGUI_TABBAR_ITEM_WIDTH 160 - GuiState state = guiState; + int result = -1; + //GuiState state = guiState; - int closing = -1; Rectangle tabBounds = { bounds.x, bounds.y, RAYGUI_TABBAR_ITEM_WIDTH, bounds.height }; if (*active < 0) *active = 0; else if (*active > count - 1) *active = count - 1; + int offsetX = 0; // Required in case tabs go out of screen + offsetX = (*active + 2)*RAYGUI_TABBAR_ITEM_WIDTH - GetScreenWidth(); + if (offsetX < 0) offsetX = 0; + + bool toggle = false; // Required for individual toggles + // Draw control //-------------------------------------------------------------------- for (int i = 0; i < count; i++) { - tabBounds.x = bounds.x + (RAYGUI_TABBAR_ITEM_WIDTH + 4)*i; + tabBounds.x = bounds.x + (RAYGUI_TABBAR_ITEM_WIDTH + 4)*i - offsetX; - int textAlignment = GuiGetStyle(TOGGLE, TEXT_ALIGNMENT); - int textPadding = GuiGetStyle(TOGGLE, TEXT_PADDING); - GuiSetStyle(TOGGLE, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); - GuiSetStyle(TOGGLE, TEXT_PADDING, 8); - if (i == *active) GuiToggle(tabBounds, GuiIconText(12, text[i]), true); - else if (GuiToggle(tabBounds, GuiIconText(12, text[i]), false) == true) *active = i; - GuiSetStyle(TOGGLE, TEXT_PADDING, textPadding); - GuiSetStyle(TOGGLE, TEXT_ALIGNMENT, textAlignment); + if (tabBounds.x < GetScreenWidth()) + { + // Draw tabs as toggle controls + int textAlignment = GuiGetStyle(TOGGLE, TEXT_ALIGNMENT); + int textPadding = GuiGetStyle(TOGGLE, TEXT_PADDING); + GuiSetStyle(TOGGLE, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); + GuiSetStyle(TOGGLE, TEXT_PADDING, 8); - // Draw tab close button - // NOTE: Only draw close button for curren tab: if (CheckCollisionPointRec(mousePoint, tabBounds)) - int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); - int tempTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); - GuiSetStyle(BUTTON, BORDER_WIDTH, 1); - GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + if (i == (*active)) + { + toggle = true; + GuiToggle(tabBounds, GuiIconText(12, text[i]), &toggle); + } + else + { + toggle = false; + GuiToggle(tabBounds, GuiIconText(12, text[i]), &toggle); + if (toggle) *active = i; + } + + GuiSetStyle(TOGGLE, TEXT_PADDING, textPadding); + GuiSetStyle(TOGGLE, TEXT_ALIGNMENT, textAlignment); + + // Draw tab close button + // NOTE: Only draw close button for current tab: if (CheckCollisionPointRec(mousePosition, tabBounds)) + int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); + int tempTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); + GuiSetStyle(BUTTON, BORDER_WIDTH, 1); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); #if defined(RAYGUI_NO_ICONS) - if (GuiButton(closeButtonRec, "x")) closing = i; + if (GuiButton(RAYGUI_CLITERAL(Rectangle){ tabBounds.x + tabBounds.width - 14 - 5, tabBounds.y + 5, 14, 14 }, "x")) result = i; #else - if (GuiButton(RAYGUI_CLITERAL(Rectangle){ tabBounds.x + tabBounds.width - 14 - 5, tabBounds.y + 5, 14, 14 }, GuiIconText(ICON_CROSS_SMALL, NULL))) closing = i; + if (GuiButton(RAYGUI_CLITERAL(Rectangle){ tabBounds.x + tabBounds.width - 14 - 5, tabBounds.y + 5, 14, 14 }, GuiIconText(ICON_CROSS_SMALL, NULL))) result = i; #endif - GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); - GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment); + GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment); + } } + // Draw tab-bar bottom line GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, 1 }, 0, BLANK, GetColor(GuiGetStyle(TOGGLE, BORDER_COLOR_NORMAL))); - //GuiLine(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, 1 }, NULL); //-------------------------------------------------------------------- - return closing; // Return closing tab requested + return result; // Return as result the current TAB closing requested } // Scroll Panel control -Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll) +int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll, Rectangle *view) { + #define RAYGUI_MIN_SCROLLBAR_WIDTH 40 + #define RAYGUI_MIN_SCROLLBAR_HEIGHT 40 + + int result = 0; GuiState state = guiState; + float mouseWheelSpeed = 20.0f; // Default movement speed with mouse wheel + + Rectangle temp = { 0 }; + if (view == NULL) view = &temp; Vector2 scrollPos = { 0.0f, 0.0f }; if (scroll != NULL) scrollPos = *scroll; @@ -1560,17 +1806,40 @@ Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, int horizontalScrollBarWidth = hasHorizontalScrollBar? GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH) : 0; int verticalScrollBarWidth = hasVerticalScrollBar? GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH) : 0; - Rectangle horizontalScrollBar = { (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + verticalScrollBarWidth : (float)bounds.x) + GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)bounds.y + bounds.height - horizontalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)bounds.width - verticalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)horizontalScrollBarWidth }; - Rectangle verticalScrollBar = { (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)bounds.x + bounds.width - verticalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH)), (float)bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)verticalScrollBarWidth, (float)bounds.height - horizontalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) }; + Rectangle horizontalScrollBar = { + (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + verticalScrollBarWidth : (float)bounds.x) + GuiGetStyle(DEFAULT, BORDER_WIDTH), + (float)bounds.y + bounds.height - horizontalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH), + (float)bounds.width - verticalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH), + (float)horizontalScrollBarWidth + }; + Rectangle verticalScrollBar = { + (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)bounds.x + bounds.width - verticalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH)), + (float)bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), + (float)verticalScrollBarWidth, + (float)bounds.height - horizontalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) + }; + + // Make sure scroll bars have a minimum width/height + // NOTE: If content >>> bounds, size could be very small or even 0 + if (horizontalScrollBar.width < RAYGUI_MIN_SCROLLBAR_WIDTH) + { + horizontalScrollBar.width = RAYGUI_MIN_SCROLLBAR_WIDTH; + mouseWheelSpeed = 30.0f; // TODO: Calculate speed increment based on content.height vs bounds.height + } + if (verticalScrollBar.height < RAYGUI_MIN_SCROLLBAR_HEIGHT) + { + verticalScrollBar.height = RAYGUI_MIN_SCROLLBAR_HEIGHT; + mouseWheelSpeed = 30.0f; // TODO: Calculate speed increment based on content.width vs bounds.width + } // Calculate view area (area without the scrollbars) - Rectangle view = (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? + *view = (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? RAYGUI_CLITERAL(Rectangle){ bounds.x + verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth } : RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth }; // Clip view area to the actual content size - if (view.width > content.width) view.width = content.width; - if (view.height > content.height) view.height = content.height; + if (view->width > content.width) view->width = content.width; + if (view->height > content.height) view->height = content.height; float horizontalMin = hasHorizontalScrollBar? ((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)-verticalScrollBarWidth : 0) - (float)GuiGetStyle(DEFAULT, BORDER_WIDTH) : (((float)GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)-verticalScrollBarWidth : 0) - (float)GuiGetStyle(DEFAULT, BORDER_WIDTH); float horizontalMax = hasHorizontalScrollBar? content.width - bounds.width + (float)verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH) - (((float)GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)verticalScrollBarWidth : 0) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH); @@ -1604,9 +1873,9 @@ Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, #endif float wheelMove = GetMouseWheelMove(); - // Horizontal scroll (Shift + Mouse wheel) - if (hasHorizontalScrollBar && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_SHIFT))) scrollPos.x += wheelMove*20; - else scrollPos.y += wheelMove*20; // Vertical scroll + // Horizontal and vertical scrolling with mouse wheel + if (hasHorizontalScrollBar && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_LEFT_SHIFT))) scrollPos.x += wheelMove*mouseWheelSpeed; + else scrollPos.y += wheelMove*mouseWheelSpeed; // Vertical scroll } } @@ -1621,7 +1890,7 @@ Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, //-------------------------------------------------------------------- if (text != NULL) GuiStatusBar(statusBar, text); // Draw panel header as status bar - GuiDrawRectangle(bounds, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)), guiAlpha)); // Draw background + GuiDrawRectangle(bounds, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background // Save size of the scrollbar slider const int slider = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); @@ -1648,11 +1917,11 @@ Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, if (hasHorizontalScrollBar && hasVerticalScrollBar) { Rectangle corner = { (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) + 2) : (horizontalScrollBar.x + horizontalScrollBar.width + 2), verticalScrollBar.y + verticalScrollBar.height + 2, (float)horizontalScrollBarWidth - 4, (float)verticalScrollBarWidth - 4 }; - GuiDrawRectangle(corner, 0, BLANK, Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT + (state*3))), guiAlpha)); + GuiDrawRectangle(corner, 0, BLANK, GetColor(GuiGetStyle(LISTVIEW, TEXT + (state*3)))); } // Draw scrollbar lines depending on current state - GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + (state*3))), guiAlpha), BLANK); + GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER + (state*3))), BLANK); // Set scrollbar slider size back to the way it was before GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, slider); @@ -1660,12 +1929,13 @@ Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, if (scroll != NULL) *scroll = scrollPos; - return view; + return result; } // Label control -void GuiLabel(Rectangle bounds, const char *text) +int GuiLabel(Rectangle bounds, const char *text) { + int result = 0; GuiState state = guiState; // Update control @@ -1675,19 +1945,21 @@ void GuiLabel(Rectangle bounds, const char *text) // Draw control //-------------------------------------------------------------------- - GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- + + return result; } // Button control, returns true when clicked -bool GuiButton(Rectangle bounds, const char *text) +int GuiButton(Rectangle bounds, const char *text) { + int result = 0; GuiState state = guiState; - bool pressed = false; // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -1697,33 +1969,35 @@ bool GuiButton(Rectangle bounds, const char *text) if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; else state = STATE_FOCUSED; - if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) result = 1; } } //-------------------------------------------------------------------- // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(BUTTON, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(BUTTON, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(BUTTON, BASE + (state*3))), guiAlpha)); - GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(BUTTON, TEXT + (state*3))), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(BUTTON, BORDER_WIDTH), GetColor(GuiGetStyle(BUTTON, BORDER + (state*3))), GetColor(GuiGetStyle(BUTTON, BASE + (state*3)))); + GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), GetColor(GuiGetStyle(BUTTON, TEXT + (state*3)))); + + if (state == STATE_FOCUSED) GuiTooltip(bounds); //------------------------------------------------------------------ - return pressed; + return result; // Button pressed: result = 1 } // Label button control -bool GuiLabelButton(Rectangle bounds, const char *text) +int GuiLabelButton(Rectangle bounds, const char *text) { GuiState state = guiState; bool pressed = false; // NOTE: We force bounds.width to be all text float textWidth = (float)GetTextWidth(text); - if (bounds.width < textWidth) bounds.width = textWidth; + if ((bounds.width - 2*GuiGetStyle(LABEL, BORDER_WIDTH) - 2*GuiGetStyle(LABEL, TEXT_PADDING)) < textWidth) bounds.width = textWidth + 2*GuiGetStyle(LABEL, BORDER_WIDTH) + 2*GuiGetStyle(LABEL, TEXT_PADDING) + 2; // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -1740,20 +2014,24 @@ bool GuiLabelButton(Rectangle bounds, const char *text) // Draw control //-------------------------------------------------------------------- - GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- return pressed; } // Toggle Button control, returns true when active -bool GuiToggle(Rectangle bounds, const char *text, bool active) +int GuiToggle(Rectangle bounds, const char *text, bool *active) { + int result = 0; GuiState state = guiState; + bool temp = false; + if (active == NULL) active = &temp; + // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -1764,7 +2042,7 @@ bool GuiToggle(Rectangle bounds, const char *text, bool active) else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) { state = STATE_NORMAL; - active = !active; + *active = !(*active); } else state = STATE_FOCUSED; } @@ -1775,28 +2053,36 @@ bool GuiToggle(Rectangle bounds, const char *text, bool active) //-------------------------------------------------------------------- if (state == STATE_NORMAL) { - GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TOGGLE, (active? BORDER_COLOR_PRESSED : (BORDER + state*3)))), guiAlpha), Fade(GetColor(GuiGetStyle(TOGGLE, (active? BASE_COLOR_PRESSED : (BASE + state*3)))), guiAlpha)); - GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, (active? TEXT_COLOR_PRESSED : (TEXT + state*3)))), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), GetColor(GuiGetStyle(TOGGLE, ((*active)? BORDER_COLOR_PRESSED : (BORDER + state*3)))), GetColor(GuiGetStyle(TOGGLE, ((*active)? BASE_COLOR_PRESSED : (BASE + state*3))))); + GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TOGGLE, ((*active)? TEXT_COLOR_PRESSED : (TEXT + state*3))))); } else { - GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TOGGLE, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(TOGGLE, BASE + state*3)), guiAlpha)); - GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, TEXT + state*3)), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), GetColor(GuiGetStyle(TOGGLE, BORDER + state*3)), GetColor(GuiGetStyle(TOGGLE, BASE + state*3))); + GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TOGGLE, TEXT + state*3))); } + + if (state == STATE_FOCUSED) GuiTooltip(bounds); //-------------------------------------------------------------------- - return active; + return result; } // Toggle Group control, returns toggled button codepointIndex -int GuiToggleGroup(Rectangle bounds, const char *text, int active) +int GuiToggleGroup(Rectangle bounds, const char *text, int *active) { #if !defined(RAYGUI_TOGGLEGROUP_MAX_ITEMS) #define RAYGUI_TOGGLEGROUP_MAX_ITEMS 32 #endif + int result = 0; float initBoundsX = bounds.x; + int temp = 0; + if (active == NULL) active = &temp; + + bool toggle = false; // Required for individual toggles + // Get substrings items from text (items pointers) int rows[RAYGUI_TOGGLEGROUP_MAX_ITEMS] = { 0 }; int itemCount = 0; @@ -1813,25 +2099,110 @@ int GuiToggleGroup(Rectangle bounds, const char *text, int active) prevRow = rows[i]; } - if (i == active) GuiToggle(bounds, items[i], true); - else if (GuiToggle(bounds, items[i], false) == true) active = i; + if (i == (*active)) + { + toggle = true; + GuiToggle(bounds, items[i], &toggle); + } + else + { + toggle = false; + GuiToggle(bounds, items[i], &toggle); + if (toggle) *active = i; + } bounds.x += (bounds.width + GuiGetStyle(TOGGLE, GROUP_PADDING)); } - return active; + return result; } -// Check Box control, returns true when active -bool GuiCheckBox(Rectangle bounds, const char *text, bool checked) +// Toggle Slider control extended, returns true when clicked +int GuiToggleSlider(Rectangle bounds, const char *text, int *active) { + int result = 0; GuiState state = guiState; + int temp = 0; + if (active == NULL) active = &temp; + + //bool toggle = false; // Required for individual toggles + + // Get substrings items from text (items pointers) + int itemCount = 0; + const char **items = GuiTextSplit(text, ';', &itemCount, NULL); + + Rectangle slider = { + 0, // Calculated later depending on the active toggle + bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING), + (bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - (itemCount + 1)*GuiGetStyle(SLIDER, SLIDER_PADDING))/itemCount, + bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING) }; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) + { + state = STATE_PRESSED; + (*active)++; + result = 1; + } + else state = STATE_FOCUSED; + } + + if ((*active) && (state != STATE_FOCUSED)) state = STATE_PRESSED; + } + + if (*active >= itemCount) *active = 0; + slider.x = bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH) + (*active + 1)*GuiGetStyle(SLIDER, SLIDER_PADDING) + (*active)*slider.width; + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), GetColor(GuiGetStyle(TOGGLE, BORDER + (state*3))), + GetColor(GuiGetStyle(TOGGLE, BASE_COLOR_NORMAL))); + + // Draw internal slider + if (state == STATE_NORMAL) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED))); + else if (state == STATE_FOCUSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_FOCUSED))); + else if (state == STATE_PRESSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED))); + + // Draw text in slider + if (text != NULL) + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(text); + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + textBounds.x = slider.x + slider.width/2 - textBounds.width/2; + textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; + + GuiDrawText(items[*active], textBounds, GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, TEXT + (state*3))), guiAlpha)); + } + //-------------------------------------------------------------------- + + return result; +} + +// Check Box control, returns 1 when state changed +int GuiCheckBox(Rectangle bounds, const char *text, bool *checked) +{ + int result = 0; + GuiState state = guiState; + + bool temp = false; + if (checked == NULL) checked = &temp; + Rectangle textBounds = { 0 }; if (text != NULL) { - textBounds.width = (float)GetTextWidth(text); + textBounds.width = (float)GetTextWidth(text) + 2; textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); textBounds.x = bounds.x + bounds.width + GuiGetStyle(CHECKBOX, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; @@ -1840,7 +2211,7 @@ bool GuiCheckBox(Rectangle bounds, const char *text, bool checked) // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -1857,35 +2228,43 @@ bool GuiCheckBox(Rectangle bounds, const char *text, bool checked) if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; else state = STATE_FOCUSED; - if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) checked = !checked; + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) + { + *checked = !(*checked); + result = 1; + } } } //-------------------------------------------------------------------- // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(CHECKBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(CHECKBOX, BORDER + (state*3))), guiAlpha), BLANK); + GuiDrawRectangle(bounds, GuiGetStyle(CHECKBOX, BORDER_WIDTH), GetColor(GuiGetStyle(CHECKBOX, BORDER + (state*3))), BLANK); - if (checked) + if (*checked) { Rectangle check = { bounds.x + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING), bounds.y + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING), bounds.width - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)), bounds.height - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)) }; - GuiDrawRectangle(check, 0, BLANK, Fade(GetColor(GuiGetStyle(CHECKBOX, TEXT + state*3)), guiAlpha)); + GuiDrawRectangle(check, 0, BLANK, GetColor(GuiGetStyle(CHECKBOX, TEXT + state*3))); } - GuiDrawText(text, textBounds, (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + GuiDrawText(text, textBounds, (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- - return checked; + return result; } // Combo Box control, returns selected item codepointIndex -int GuiComboBox(Rectangle bounds, const char *text, int active) +int GuiComboBox(Rectangle bounds, const char *text, int *active) { + int result = 0; GuiState state = guiState; + int temp = 0; + if (active == NULL) active = &temp; + bounds.width -= (GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH) + GuiGetStyle(COMBOBOX, COMBO_BUTTON_SPACING)); Rectangle selector = { (float)bounds.x + bounds.width + GuiGetStyle(COMBOBOX, COMBO_BUTTON_SPACING), @@ -1895,12 +2274,12 @@ int GuiComboBox(Rectangle bounds, const char *text, int active) int itemCount = 0; const char **items = GuiTextSplit(text, ';', &itemCount, NULL); - if (active < 0) active = 0; - else if (active > itemCount - 1) active = itemCount - 1; + if (*active < 0) *active = 0; + else if (*active > (itemCount - 1)) *active = itemCount - 1; // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked && (itemCount > 1)) + if ((state != STATE_DISABLED) && !guiLocked && (itemCount > 1) && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -1909,8 +2288,8 @@ int GuiComboBox(Rectangle bounds, const char *text, int active) { if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { - active += 1; - if (active >= itemCount) active = 0; + *active += 1; + if (*active >= itemCount) *active = 0; // Cyclic combobox } if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; @@ -1922,8 +2301,8 @@ int GuiComboBox(Rectangle bounds, const char *text, int active) // Draw control //-------------------------------------------------------------------- // Draw combo box main - GuiDrawRectangle(bounds, GuiGetStyle(COMBOBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COMBOBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(COMBOBOX, BASE + (state*3))), guiAlpha)); - GuiDrawText(items[active], GetTextBounds(COMBOBOX, bounds), GuiGetStyle(COMBOBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(COMBOBOX, TEXT + (state*3))), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(COMBOBOX, BORDER_WIDTH), GetColor(GuiGetStyle(COMBOBOX, BORDER + (state*3))), GetColor(GuiGetStyle(COMBOBOX, BASE + (state*3)))); + GuiDrawText(items[*active], GetTextBounds(COMBOBOX, bounds), GuiGetStyle(COMBOBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(COMBOBOX, TEXT + (state*3)))); // Draw selector using a custom button // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values @@ -1932,20 +2311,22 @@ int GuiComboBox(Rectangle bounds, const char *text, int active) GuiSetStyle(BUTTON, BORDER_WIDTH, 1); GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); - GuiButton(selector, TextFormat("%i/%i", active + 1, itemCount)); + GuiButton(selector, TextFormat("%i/%i", *active + 1, itemCount)); GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign); GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); //-------------------------------------------------------------------- - return active; + return result; } // Dropdown Box control // NOTE: Returns mouse click -bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode) +int GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode) { + int result = 0; GuiState state = guiState; + int itemSelected = *active; int itemFocused = -1; @@ -1958,11 +2339,9 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo Rectangle itemBounds = bounds; - bool pressed = false; // Check mouse button pressed - // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && (editMode || !guiLocked) && (itemCount > 1)) + if ((state != STATE_DISABLED) && (editMode || !guiLocked) && (itemCount > 1) && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -1973,11 +2352,11 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo // Check if mouse has been pressed or released outside limits if (!CheckCollisionPointRec(mousePoint, boundsOpen)) { - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) || IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) || IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) result = 1; } // Check if already selected item has been pressed again - if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) result = 1; // Check focused and selected item for (int i = 0; i < itemCount; i++) @@ -1991,7 +2370,7 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) { itemSelected = i; - pressed = true; // Item selected, change to editMode = false + result = 1; // Item selected } break; } @@ -2005,7 +2384,7 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo { if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { - pressed = true; + result = 1; state = STATE_PRESSED; } else state = STATE_FOCUSED; @@ -2018,8 +2397,8 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo //-------------------------------------------------------------------- if (editMode) GuiPanel(boundsOpen, NULL); - GuiDrawRectangle(bounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BASE + state*3)), guiAlpha)); - GuiDrawText(items[itemSelected], GetTextBounds(DEFAULT, bounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + state*3)), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), GetColor(GuiGetStyle(DROPDOWNBOX, BORDER + state*3)), GetColor(GuiGetStyle(DROPDOWNBOX, BASE + state*3))); + GuiDrawText(items[itemSelected], GetTextBounds(DROPDOWNBOX, bounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + state*3))); if (editMode) { @@ -2031,102 +2410,284 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo if (i == itemSelected) { - GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_PRESSED)), guiAlpha), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_PRESSED)), guiAlpha)); - GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_PRESSED)), guiAlpha)); + GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_PRESSED)), GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_PRESSED))); + GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_PRESSED))); } else if (i == itemFocused) { - GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_FOCUSED)), guiAlpha), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_FOCUSED)), guiAlpha)); - GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_FOCUSED)), guiAlpha)); + GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_FOCUSED)), GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_FOCUSED))); + GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_FOCUSED))); } - else GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_NORMAL)), guiAlpha)); + else GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_NORMAL))); } } // Draw arrows (using icon if available) #if defined(RAYGUI_NO_ICONS) GuiDrawText("v", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 2, 10, 10 }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha)); + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); #else GuiDrawText("#120#", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 6, 10, 10 }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha)); // ICON_ARROW_DOWN_FILL + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); // ICON_ARROW_DOWN_FILL #endif //-------------------------------------------------------------------- *active = itemSelected; - return pressed; + + // TODO: Use result to return more internal states: mouse-press out-of-bounds, mouse-press over selected-item... + return result; // Mouse click: result = 1 } -// Text Box control, updates input text -// NOTE 2: Returns if KEY_ENTER pressed (useful for data validation) -bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode) +// Text Box control +// NOTE: Returns true on ENTER pressed (useful for data validation) +int GuiTextBox(Rectangle bounds, char *text, int bufferSize, bool editMode) { + #if !defined(RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN) + #define RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN 40 // Frames to wait for autocursor movement + #endif + #if !defined(RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) + #define RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY 1 // Frames delay for autocursor movement + #endif + + int result = 0; GuiState state = guiState; + + bool multiline = false; // TODO: Consider multiline text input + int wrapMode = GuiGetStyle(DEFAULT, TEXT_WRAP_MODE); + Rectangle textBounds = GetTextBounds(TEXTBOX, bounds); + int textWidth = GetTextWidth(text) - GetTextWidth(text + textBoxCursorIndex); + int textIndexOffset = 0; // Text index offset to start drawing in the box - bool pressed = false; - int textWidth = GetTextWidth(text); - + // Cursor rectangle + // NOTE: Position X value should be updated Rectangle cursor = { - bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + textWidth + 2, - bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE), - 4, + textBounds.x + textWidth + GuiGetStyle(DEFAULT, TEXT_SPACING), + textBounds.y + textBounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE), + 2, (float)GuiGetStyle(DEFAULT, TEXT_SIZE)*2 }; if (cursor.height >= bounds.height) cursor.height = bounds.height - GuiGetStyle(TEXTBOX, BORDER_WIDTH)*2; if (cursor.y < (bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH))) cursor.y = bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH); + // Mouse cursor rectangle + // NOTE: Initialized outside of screen + Rectangle mouseCursor = cursor; + mouseCursor.x = -1; + mouseCursor.width = 1; + + // Auto-cursor movement logic + // NOTE: Cursor moves automatically when key down after some time + if (IsKeyDown(KEY_LEFT) || IsKeyDown(KEY_RIGHT) || IsKeyDown(KEY_UP) || IsKeyDown(KEY_DOWN) || IsKeyDown(KEY_BACKSPACE) || IsKeyDown(KEY_DELETE)) autoCursorCooldownCounter++; + else + { + autoCursorCooldownCounter = 0; // GLOBAL: Cursor cooldown counter + autoCursorDelayCounter = 0; // GLOBAL: Cursor delay counter + } + + // Blink-cursor frame counter + //if (!autoCursorMode) blinkCursorFrameCounter++; + //else blinkCursorFrameCounter = 0; + // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + // WARNING: Text editing is only supported under certain conditions: + if ((state != STATE_DISABLED) && // Control not disabled + !GuiGetStyle(TEXTBOX, TEXT_READONLY) && // TextBox not on read-only mode + !guiLocked && // Gui not locked + !guiSliderDragging && // No gui slider on dragging + (wrapMode == TEXT_WRAP_NONE)) // No wrap mode { - Vector2 mousePoint = GetMousePosition(); + Vector2 mousePosition = GetMousePosition(); if (editMode) { state = STATE_PRESSED; - int key = GetCharPressed(); // Returns codepoint as Unicode - int keyCount = (int)strlen(text); - int byteSize = 0; - const char *textUTF8 = CodepointToUTF8(key, &byteSize); - - // Only allow keys in range [32..125] - if ((keyCount + byteSize) < textSize) + // If text does not fit in the textbox and current cursor position is out of bounds, + // we add an index offset to text for drawing only what requires depending on cursor + while (textWidth >= textBounds.width) { - //float maxWidth = (bounds.width - (GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)*2)); + int nextCodepointSize = 0; + GetCodepointNext(text + textIndexOffset, &nextCodepointSize); - if (key >= 32) + textIndexOffset += nextCodepointSize; + + textWidth = GetTextWidth(text + textIndexOffset) - GetTextWidth(text + textBoxCursorIndex); + } + + int textLength = (int)strlen(text); // Get current text length + int codepoint = GetCharPressed(); // Get Unicode codepoint + if (multiline && IsKeyPressed(KEY_ENTER)) codepoint = (int)'\n'; + + if (textBoxCursorIndex > textLength) textBoxCursorIndex = textLength; + + // Encode codepoint as UTF-8 + int codepointSize = 0; + const char *charEncoded = CodepointToUTF8(codepoint, &codepointSize); + + // Add codepoint to text, at current cursor position + // NOTE: Make sure we do not overflow buffer size + if (((multiline && (codepoint == (int)'\n')) || (codepoint >= 32)) && ((textLength + codepointSize) < bufferSize)) + { + // Move forward data from cursor position + for (int i = (textLength + codepointSize); i > textBoxCursorIndex; i--) text[i] = text[i - codepointSize]; + + // Add new codepoint in current cursor position + for (int i = 0; i < codepointSize; i++) text[textBoxCursorIndex + i] = charEncoded[i]; + + textBoxCursorIndex += codepointSize; + textLength += codepointSize; + + // Make sure text last character is EOL + text[textLength] = '\0'; + } + + // Move cursor to start + if ((textLength > 0) && IsKeyPressed(KEY_HOME)) textBoxCursorIndex = 0; + + // Move cursor to end + if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_END)) textBoxCursorIndex = textLength; + + // Delete codepoint from text, after current cursor position + if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_DELETE) || (IsKeyDown(KEY_DELETE) && (autoCursorCooldownCounter >= RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN)))) + { + autoCursorDelayCounter++; + + if (IsKeyPressed(KEY_DELETE) || (autoCursorDelayCounter%RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0) // Delay every movement some frames { - for (int i = 0; i < byteSize; i++) + int nextCodepointSize = 0; + GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize); + + // Move backward text from cursor position + for (int i = textBoxCursorIndex; i < textLength; i++) text[i] = text[i + nextCodepointSize]; + + textLength -= codepointSize; + + // Make sure text last character is EOL + text[textLength] = '\0'; + } + } + + // Delete codepoint from text, before current cursor position + if ((textLength > 0) && (IsKeyPressed(KEY_BACKSPACE) || (IsKeyDown(KEY_BACKSPACE) && (autoCursorCooldownCounter >= RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN)))) + { + autoCursorDelayCounter++; + + if (IsKeyPressed(KEY_BACKSPACE) || (autoCursorDelayCounter%RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0) // Delay every movement some frames + { + int prevCodepointSize = 0; + GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize); + + // Move backward text from cursor position + for (int i = (textBoxCursorIndex - prevCodepointSize); i < textLength; i++) text[i] = text[i + prevCodepointSize]; + + // Prevent cursor index from decrementing past 0 + if (textBoxCursorIndex > 0) { - text[keyCount] = textUTF8[i]; - keyCount++; + textBoxCursorIndex -= codepointSize; + textLength -= codepointSize; } - text[keyCount] = '\0'; + // Make sure text last character is EOL + text[textLength] = '\0'; } } - // Delete text - if (keyCount > 0) + // Move cursor position with keys + if (IsKeyPressed(KEY_LEFT) || (IsKeyDown(KEY_LEFT) && (autoCursorCooldownCounter > RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN))) { - if (IsKeyPressed(KEY_BACKSPACE)) + autoCursorDelayCounter++; + + if (IsKeyPressed(KEY_LEFT) || (autoCursorDelayCounter%RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0) // Delay every movement some frames { - while ((keyCount > 0) && ((text[--keyCount] & 0xc0) == 0x80)); - text[keyCount] = '\0'; + int prevCodepointSize = 0; + GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize); + + if (textBoxCursorIndex >= prevCodepointSize) textBoxCursorIndex -= prevCodepointSize; + } + } + else if (IsKeyPressed(KEY_RIGHT) || (IsKeyDown(KEY_RIGHT) && (autoCursorCooldownCounter > RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN))) + { + autoCursorDelayCounter++; + + if (IsKeyPressed(KEY_RIGHT) || (autoCursorDelayCounter%RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0) // Delay every movement some frames + { + int nextCodepointSize = 0; + GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize); + + if ((textBoxCursorIndex + nextCodepointSize) <= textLength) textBoxCursorIndex += nextCodepointSize; } } - if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true; + // Move cursor position with mouse + if (CheckCollisionPointRec(mousePosition, textBounds)) // Mouse hover text + { + float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/(float)guiFont.baseSize; + int codepointIndex = 0; + float glyphWidth = 0.0f; + float widthToMouseX = 0; + int mouseCursorIndex = 0; + + for (int i = textIndexOffset; i < textLength; i++) + { + codepoint = GetCodepointNext(&text[i], &codepointSize); + codepointIndex = GetGlyphIndex(guiFont, codepoint); + + if (guiFont.glyphs[codepointIndex].advanceX == 0) glyphWidth = ((float)guiFont.recs[codepointIndex].width*scaleFactor); + else glyphWidth = ((float)guiFont.glyphs[codepointIndex].advanceX*scaleFactor); + + if (mousePosition.x <= (textBounds.x + (widthToMouseX + glyphWidth/2))) + { + mouseCursor.x = textBounds.x + widthToMouseX; + mouseCursorIndex = i; + break; + } + + widthToMouseX += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + } + + // Check if mouse cursor is at the last position + int textEndWidth = GetTextWidth(text + textIndexOffset); + if (GetMousePosition().x >= (textBounds.x + textEndWidth - glyphWidth/2)) + { + mouseCursor.x = textBounds.x + textEndWidth; + mouseCursorIndex = (int)strlen(text); + } + + // Place cursor at required index on mouse click + if ((mouseCursor.x >= 0) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + { + cursor.x = mouseCursor.x; + textBoxCursorIndex = mouseCursorIndex; + } + } + else mouseCursor.x = -1; + + // Recalculate cursor position.y depending on textBoxCursorIndex + cursor.x = bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + GetTextWidth(text + textIndexOffset) - GetTextWidth(text + textBoxCursorIndex) + GuiGetStyle(DEFAULT, TEXT_SPACING); + //if (multiline) cursor.y = GetTextLines() + + // Finish text editing on ENTER or mouse click outside bounds + if ((!multiline && IsKeyPressed(KEY_ENTER)) || + (!CheckCollisionPointRec(mousePosition, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) + { + textBoxCursorIndex = 0; // GLOBAL: Reset the shared cursor index + result = 1; + } } else { - if (CheckCollisionPointRec(mousePoint, bounds)) + if (CheckCollisionPointRec(mousePosition, bounds)) { state = STATE_FOCUSED; - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + { + textBoxCursorIndex = (int)strlen(text); // GLOBAL: Place cursor index to the end of current text + result = 1; + } } } } @@ -2136,43 +2697,61 @@ bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode) //-------------------------------------------------------------------- if (state == STATE_PRESSED) { - GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED))); } else if (state == STATE_DISABLED) { - GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED)), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED))); } - else GuiDrawRectangle(bounds, 1, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), BLANK); + else GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), BLANK); - if (editMode) - { - // In case we edit and text does not fit in the textbox, - // we move text pointer to a position it fits inside the text box - while ((textWidth >= textBounds.width) && (text[0] != '\0')) - { - int codepointSize = 0; - GetCodepointNext(text, &codepointSize); - text += codepointSize; - textWidth = GetTextWidth(text); - cursor.x = textBounds.x + textWidth + 2; - } - } - - GuiDrawText(text, textBounds, GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))), guiAlpha)); + // Draw text considering index offset if required + // NOTE: Text index offset depends on cursor position + GuiDrawText(text + textIndexOffset, textBounds, GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3)))); // Draw cursor - if (editMode) GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha)); + if (editMode && !GuiGetStyle(TEXTBOX, TEXT_READONLY)) + { + //if (autoCursorMode || ((blinkCursorFrameCounter/40)%2 == 0)) + GuiDrawRectangle(cursor, 0, BLANK, GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED))); + + // Draw mouse position cursor (if required) + if (mouseCursor.x >= 0) GuiDrawRectangle(mouseCursor, 0, BLANK, GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED))); + } + else if (state == STATE_FOCUSED) GuiTooltip(bounds); //-------------------------------------------------------------------- + return result; // Mouse button pressed: result = 1 +} + +/* +// Text Box control with multiple lines and word-wrap +// NOTE: This text-box is readonly, no editing supported by default +bool GuiTextBoxMulti(Rectangle bounds, char *text, int bufferSize, bool editMode) +{ + bool pressed = false; + + GuiSetStyle(TEXTBOX, TEXT_READONLY, 1); + GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_WORD); // WARNING: If wrap mode enabled, text editing is not supported + GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_TOP); + + // TODO: Implement methods to calculate cursor position properly + pressed = GuiTextBox(bounds, text, bufferSize, editMode); + + GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_MIDDLE); + GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_NONE); + GuiSetStyle(TEXTBOX, TEXT_READONLY, 0); + return pressed; } +*/ // Spinner control, returns selected value -bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) +int GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) { + int result = 1; GuiState state = guiState; - bool pressed = false; int tempValue = *value; Rectangle spinner = { bounds.x + GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_SPACING), bounds.y, @@ -2183,7 +2762,7 @@ bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, in Rectangle textBounds = { 0 }; if (text != NULL) { - textBounds.width = (float)GetTextWidth(text); + textBounds.width = (float)GetTextWidth(text) + 2; textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); textBounds.x = bounds.x + bounds.width + GuiGetStyle(SPINNER, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; @@ -2192,7 +2771,7 @@ bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, in // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -2221,8 +2800,7 @@ bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, in // Draw control //-------------------------------------------------------------------- - // TODO: Set Spinner properties for ValueBox - pressed = GuiValueBox(spinner, NULL, &tempValue, minValue, maxValue, editMode); + result = GuiValueBox(spinner, NULL, &tempValue, minValue, maxValue, editMode); // Draw value selector custom buttons // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values @@ -2235,23 +2813,23 @@ bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, in GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); // Draw text label if provided - GuiDrawText(text, textBounds, (GuiGetStyle(SPINNER, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + GuiDrawText(text, textBounds, (GuiGetStyle(SPINNER, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- *value = tempValue; - return pressed; + return result; } // Value Box control, updates input text with numbers // NOTE: Requires static variables: frameCounter -bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) +int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) { #if !defined(RAYGUI_VALUEBOX_MAX_CHARS) #define RAYGUI_VALUEBOX_MAX_CHARS 32 #endif + int result = 0; GuiState state = guiState; - bool pressed = false; char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = "\0"; sprintf(textValue, "%i", *value); @@ -2259,7 +2837,7 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i Rectangle textBounds = { 0 }; if (text != NULL) { - textBounds.width = (float)GetTextWidth(text); + textBounds.width = (float)GetTextWidth(text) + 2; textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; @@ -2268,7 +2846,7 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -2312,7 +2890,7 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i //if (*value > maxValue) *value = maxValue; //else if (*value < minValue) *value = minValue; - if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true; + if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) result = 1; } else { @@ -2322,7 +2900,7 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i if (CheckCollisionPointRec(mousePoint, bounds)) { state = STATE_FOCUSED; - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) result = 1; } } } @@ -2334,208 +2912,36 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i if (state == STATE_PRESSED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_PRESSED)); else if (state == STATE_DISABLED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED)); - // WARNING: BLANK color does not work properly with Fade() - GuiDrawRectangle(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), guiAlpha), baseColor); - GuiDrawText(textValue, GetTextBounds(VALUEBOX, bounds), TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3))), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), baseColor); + GuiDrawText(textValue, GetTextBounds(VALUEBOX, bounds), TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3)))); // Draw cursor if (editMode) { // NOTE: ValueBox internal text is always centered Rectangle cursor = { bounds.x + GetTextWidth(textValue)/2 + bounds.width/2 + 1, bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 4, bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH) }; - GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha)); + GuiDrawRectangle(cursor, 0, BLANK, GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED))); } // Draw text label if provided - GuiDrawText(text, textBounds, (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + GuiDrawText(text, textBounds, (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- - return pressed; -} - -// Text Box control with multiple lines -bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode) -{ - GuiState state = guiState; - bool pressed = false; - - Rectangle textAreaBounds = { - bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING), - bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING), - bounds.width - 2*(GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)), - bounds.height - 2*(GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)) - }; - - // Cursor position, [x, y] values should be updated - Rectangle cursor = { 0, -1, 4, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) + 2 }; - - float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/(float)guiFont.baseSize; // Character rectangle scaling factor - - // Update control - //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) - { - Vector2 mousePoint = GetMousePosition(); - - if (editMode) - { - state = STATE_PRESSED; - - // We get an Unicode codepoint - int codepoint = GetCharPressed(); - int textLength = (int)strlen(text); // Length in bytes (UTF-8 string) - int byteSize = 0; - const char *textUTF8 = CodepointToUTF8(codepoint, &byteSize); - - // Introduce characters - if ((textLength + byteSize) < textSize) - { - if (IsKeyPressed(KEY_ENTER)) - { - text[textLength] = '\n'; - textLength++; - } - else if (codepoint >= 32) - { - // Supports Unicode inputs -> Encoded to UTF-8 - int charUTF8Length = 0; - const char *charEncoded = CodepointToUTF8(codepoint, &charUTF8Length); - memcpy(text + textLength, charEncoded, charUTF8Length); - textLength += charUTF8Length; - } - } - - // Delete characters - if (textLength > 0) - { - if (IsKeyPressed(KEY_BACKSPACE)) - { - if ((unsigned char)text[textLength - 1] < 127) - { - // Remove ASCII equivalent character (1 byte) - textLength--; - text[textLength] = '\0'; - } - else - { - // Remove latest UTF-8 unicode character introduced (n bytes) - int charUTF8Length = 0; - while ((charUTF8Length < textLength) && ((unsigned char)text[textLength - 1 - charUTF8Length] & 0b01000000) == 0) charUTF8Length++; - - textLength -= (charUTF8Length + 1); - text[textLength] = '\0'; - } - } - } - - // Exit edit mode - if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; - } - else - { - if (CheckCollisionPointRec(mousePoint, bounds)) - { - state = STATE_FOCUSED; - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; - } - } - } - //-------------------------------------------------------------------- - - // Draw control - //-------------------------------------------------------------------- - if (state == STATE_PRESSED) - { - GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)), guiAlpha)); - } - else if (state == STATE_DISABLED) - { - GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED)), guiAlpha)); - } - else GuiDrawRectangle(bounds, 1, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), BLANK); - - int wrapMode = 1; // 0-No wrap, 1-Char wrap, 2-Word wrap - Vector2 cursorPos = { textAreaBounds.x, textAreaBounds.y }; - - //int lastSpacePos = 0; - //int lastSpaceWidth = 0; - //int lastSpaceCursorPos = 0; - - for (int i = 0, codepointSize = 0; text[i] != '\0'; i += codepointSize) - { - int codepoint = GetCodepointNext(text + i, &codepointSize); - int index = GetGlyphIndex(guiFont, codepoint); // If requested codepoint is not found, we get '?' (0x3f) - Rectangle atlasRec = guiFont.recs[index]; - GlyphInfo glyphInfo = guiFont.glyphs[index]; // Glyph measures - - if ((codepointSize == 1) && (codepoint == '\n')) - { - cursorPos.y += (guiFont.baseSize*scaleFactor + GuiGetStyle(TEXTBOX, TEXT_LINES_SPACING)); // Line feed - cursorPos.x = textAreaBounds.x; // Carriage return - } - else - { - if (wrapMode == 1) - { - int glyphWidth = 0; - if (glyphInfo.advanceX != 0) glyphWidth += glyphInfo.advanceX; - else glyphWidth += (int)(atlasRec.width + glyphInfo.offsetX); - - // Jump line if the end of the text box area has been reached - if ((cursorPos.x + (glyphWidth*scaleFactor)) > (textAreaBounds.x + textAreaBounds.width)) - { - cursorPos.y += (guiFont.baseSize*scaleFactor + GuiGetStyle(TEXTBOX, TEXT_LINES_SPACING)); // Line feed - cursorPos.x = textAreaBounds.x; // Carriage return - } - } - else if (wrapMode == 2) - { - /* - if ((codepointSize == 1) && (codepoint == ' ')) - { - lastSpacePos = i; - lastSpaceWidth = 0; - lastSpaceCursorPos = cursorPos.x; - } - - // Jump line if last word reaches end of text box area - if ((lastSpaceCursorPos + lastSpaceWidth) > (textAreaBounds.x + textAreaBounds.width)) - { - cursorPos.y += 12; // Line feed - cursorPos.x = textAreaBounds.x; // Carriage return - } - */ - } - - // Draw current character glyph - DrawTextCodepoint(guiFont, codepoint, cursorPos, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), Fade(GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))), guiAlpha)); - - int glyphWidth = 0; - if (glyphInfo.advanceX != 0) glyphWidth += glyphInfo.advanceX; - else glyphWidth += (int)(atlasRec.width + glyphInfo.offsetX); - - cursorPos.x += (glyphWidth*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); - //if (i > lastSpacePos) lastSpaceWidth += (atlasRec.width + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); - } - } - - cursor.x = cursorPos.x; - cursor.y = cursorPos.y; - - // Draw cursor position considering text glyphs - if (editMode) GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha)); - //-------------------------------------------------------------------- - - return pressed; + return result; } // Slider control with pro parameters // NOTE: Other GuiSlider*() controls use this one -float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue, int sliderWidth) +int GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue, int sliderWidth) { + int result = 0; + float oldValue = *value; GuiState state = guiState; - int sliderValue = (int)(((value - minValue)/(maxValue - minValue))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))); + float temp = (maxValue - minValue)/2.0f; + if (value == NULL) value = &temp; + + int sliderValue = (int)(((*value - minValue)/(maxValue - minValue))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))); Rectangle slider = { bounds.x, bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING), 0, bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING) }; @@ -2557,25 +2963,52 @@ float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight { Vector2 mousePoint = GetMousePosition(); - if (CheckCollisionPointRec(mousePoint, bounds)) + if (guiSliderDragging) // Keep dragging outside of bounds + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + if (CHECK_BOUNDS_ID(bounds, guiSliderActive)) + { + state = STATE_PRESSED; + + // Get equivalent value and slider position from mousePosition.x + *value = ((maxValue - minValue)*(mousePoint.x - (float)(bounds.x + sliderWidth/2)))/(float)(bounds.width - sliderWidth) + minValue; + } + } + else + { + guiSliderDragging = false; + guiSliderActive = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; + } + } + else if (CheckCollisionPointRec(mousePoint, bounds)) { if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) { state = STATE_PRESSED; + guiSliderDragging = true; + guiSliderActive = bounds; // Store bounds as an identifier when dragging starts - // Get equivalent value and slider position from mousePoint.x - value = ((maxValue - minValue)*(mousePoint.x - (float)(bounds.x + sliderWidth/2)))/(float)(bounds.width - sliderWidth) + minValue; + if (!CheckCollisionPointRec(mousePoint, slider)) + { + // Get equivalent value and slider position from mousePosition.x + *value = ((maxValue - minValue)*(mousePoint.x - (float)(bounds.x + sliderWidth/2)))/(float)(bounds.width - sliderWidth) + minValue; - if (sliderWidth > 0) slider.x = mousePoint.x - slider.width/2; // Slider - else if (sliderWidth == 0) slider.width = (float)sliderValue; // SliderBar + if (sliderWidth > 0) slider.x = mousePoint.x - slider.width/2; // Slider + else if (sliderWidth == 0) slider.width = (float)sliderValue; // SliderBar + } } else state = STATE_FOCUSED; } - if (value > maxValue) value = maxValue; - else if (value < minValue) value = minValue; + if (*value > maxValue) *value = maxValue; + else if (*value < minValue) *value = minValue; } + // Control value change check + if(oldValue == *value) result = 0; + else result = 1; + // Bar limits check if (sliderWidth > 0) // Slider { @@ -2590,11 +3023,12 @@ float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(SLIDER, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(SLIDER, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), GetColor(GuiGetStyle(SLIDER, BORDER + (state*3))), GetColor(GuiGetStyle(SLIDER, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED))); // Draw slider internal bar (depends on state) - if ((state == STATE_NORMAL) || (state == STATE_PRESSED)) GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED)), guiAlpha)); - else if (state == STATE_FOCUSED) GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_FOCUSED)), guiAlpha)); + if (state == STATE_NORMAL) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED))); + else if (state == STATE_FOCUSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_FOCUSED))); + else if (state == STATE_PRESSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_PRESSED))); // Draw left/right text if provided if (textLeft != NULL) @@ -2605,7 +3039,7 @@ float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SLIDER, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; - GuiDrawText(textLeft, textBounds, TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(SLIDER, TEXT + (state*3))), guiAlpha)); + GuiDrawText(textLeft, textBounds, TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(SLIDER, TEXT + (state*3)))); } if (textRight != NULL) @@ -2616,48 +3050,76 @@ float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight textBounds.x = bounds.x + bounds.width + GuiGetStyle(SLIDER, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; - GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, Fade(GetColor(GuiGetStyle(SLIDER, TEXT + (state*3))), guiAlpha)); + GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, GetColor(GuiGetStyle(SLIDER, TEXT + (state*3)))); } //-------------------------------------------------------------------- - return value; + return result; } // Slider control extended, returns selected value and has text -float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue) +int GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue) { return GuiSliderPro(bounds, textLeft, textRight, value, minValue, maxValue, GuiGetStyle(SLIDER, SLIDER_WIDTH)); } // Slider Bar control extended, returns selected value -float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue) +int GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue) { return GuiSliderPro(bounds, textLeft, textRight, value, minValue, maxValue, 0); } // Progress Bar control extended, shows current progress value -float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue) +int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue) { + int result = 0; GuiState state = guiState; + float temp = (maxValue - minValue)/2.0f; + if (value == NULL) value = &temp; + + // Progress bar Rectangle progress = { bounds.x + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.y + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) + GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING), 0, bounds.height - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) - 2*GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING) }; // Update control //-------------------------------------------------------------------- - if (value > maxValue) value = maxValue; + if (*value > maxValue) *value = maxValue; - if (state != STATE_DISABLED) progress.width = ((float)(value/(maxValue - minValue))*(float)(bounds.width - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH))); + // WARNING: Working with floats could lead to rounding issues + if ((state != STATE_DISABLED)) progress.width = (float)(*value/(maxValue - minValue))*bounds.width - ((*value >= maxValue)? (float)(2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH)) : 0.0f); //-------------------------------------------------------------------- // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(PROGRESSBAR, BORDER + (state*3))), guiAlpha), BLANK); + if (state == STATE_DISABLED) + { + GuiDrawRectangle(bounds, GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), GetColor(GuiGetStyle(PROGRESSBAR, BORDER + (state*3))), BLANK); + } + else + { + if (*value > minValue) + { + // Draw progress bar with colored border, more visual + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, (int)progress.width + (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height - 2 }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, (int)progress.width + (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); + } + else GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); - // Draw slider internal progress bar (depends on state) - if ((state == STATE_NORMAL) || (state == STATE_PRESSED)) GuiDrawRectangle(progress, 0, BLANK, Fade(GetColor(GuiGetStyle(PROGRESSBAR, BASE_COLOR_PRESSED)), guiAlpha)); - else if (state == STATE_FOCUSED) GuiDrawRectangle(progress, 0, BLANK, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT_COLOR_FOCUSED)), guiAlpha)); + if (*value >= maxValue) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + progress.width + 1, bounds.y, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); + else + { + // Draw borders not yet reached by value + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + (int)progress.width + 1, bounds.y, bounds.width - (int)progress.width - 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + (int)progress.width + 1, bounds.y + bounds.height - 1, bounds.width - (int)progress.width - 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - 1, bounds.y + 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height - 2 }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); + } + + // Draw slider internal progress bar (depends on state) + GuiDrawRectangle(progress, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BASE_COLOR_PRESSED))); + } // Draw left/right text if provided if (textLeft != NULL) @@ -2668,7 +3130,7 @@ float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRig textBounds.x = bounds.x - textBounds.width - GuiGetStyle(PROGRESSBAR, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; - GuiDrawText(textLeft, textBounds, TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3))), guiAlpha)); + GuiDrawText(textLeft, textBounds, TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3)))); } if (textRight != NULL) @@ -2679,34 +3141,37 @@ float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRig textBounds.x = bounds.x + bounds.width + GuiGetStyle(PROGRESSBAR, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; - GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3))), guiAlpha)); + GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3)))); } //-------------------------------------------------------------------- - return value; + return result; } // Status Bar control -void GuiStatusBar(Rectangle bounds, const char *text) +int GuiStatusBar(Rectangle bounds, const char *text) { + int result = 0; GuiState state = guiState; // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(STATUSBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(STATUSBAR, (state != STATE_DISABLED)? BORDER_COLOR_NORMAL : BORDER_COLOR_DISABLED)), guiAlpha), - Fade(GetColor(GuiGetStyle(STATUSBAR, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha)); - GuiDrawText(text, GetTextBounds(STATUSBAR, bounds), GuiGetStyle(STATUSBAR, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(STATUSBAR, (state != STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED)), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(STATUSBAR, BORDER_WIDTH), GetColor(GuiGetStyle(STATUSBAR, BORDER + (state*3))), GetColor(GuiGetStyle(STATUSBAR, BASE + (state*3)))); + GuiDrawText(text, GetTextBounds(STATUSBAR, bounds), GuiGetStyle(STATUSBAR, TEXT_ALIGNMENT), GetColor(GuiGetStyle(STATUSBAR, TEXT + (state*3)))); //-------------------------------------------------------------------- + + return result; } // Dummy rectangle control, intended for placeholding -void GuiDummyRec(Rectangle bounds, const char *text) +int GuiDummyRec(Rectangle bounds, const char *text) { + int result = 0; GuiState state = guiState; // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -2721,28 +3186,35 @@ void GuiDummyRec(Rectangle bounds, const char *text) // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha)); - GuiDrawText(text, GetTextBounds(DEFAULT, bounds), TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(BUTTON, (state != STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED)), guiAlpha)); + GuiDrawRectangle(bounds, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED))); + GuiDrawText(text, GetTextBounds(DEFAULT, bounds), TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(BUTTON, (state != STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED))); //------------------------------------------------------------------ + + return result; } // List View control -int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active) +int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int *active) { + int result = 0; int itemCount = 0; const char **items = NULL; if (text != NULL) items = GuiTextSplit(text, ';', &itemCount, NULL); - return GuiListViewEx(bounds, items, itemCount, NULL, scrollIndex, active); + result = GuiListViewEx(bounds, items, itemCount, scrollIndex, active, NULL); + + return result; } // List View control with extended parameters -int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active) +int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollIndex, int *active, int *focus) { + int result = 0; GuiState state = guiState; + int itemFocused = (focus == NULL)? -1 : *focus; - int itemSelected = active; + int itemSelected = (active == NULL)? -1 : *active; // Check if we need a scroll bar bool useScrollBar = false; @@ -2766,7 +3238,7 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, in // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -2814,35 +3286,35 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, in // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha), GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background + GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background // Draw visible items for (int i = 0; ((i < visibleItems) && (text != NULL)); i++) { if (state == STATE_DISABLED) { - if ((startIndex + i) == itemSelected) GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_DISABLED)), guiAlpha), Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_DISABLED)), guiAlpha)); + if ((startIndex + i) == itemSelected) GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_DISABLED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_DISABLED))); - GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED)), guiAlpha)); + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED))); } else { - if ((startIndex + i) == itemSelected) + if (((startIndex + i) == itemSelected) && (active != NULL)) { // Draw item selected - GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_PRESSED)), guiAlpha), Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_PRESSED)), guiAlpha)); - GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED)), guiAlpha)); + GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_PRESSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_PRESSED))); + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED))); } - else if ((startIndex + i) == itemFocused) + else if (((startIndex + i) == itemFocused)) // && (focus != NULL)) // NOTE: We want items focused, despite not returned! { // Draw item focused - GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_FOCUSED)), guiAlpha), Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED)), guiAlpha)); - GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED)), guiAlpha)); + GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_FOCUSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED))); + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED))); } else { // Draw item normal - GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)), guiAlpha)); + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL))); } } @@ -2874,29 +3346,30 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, in } //-------------------------------------------------------------------- + if (active != NULL) *active = itemSelected; if (focus != NULL) *focus = itemFocused; if (scrollIndex != NULL) *scrollIndex = startIndex; - return itemSelected; + return result; } // Color Panel control -Color GuiColorPanel(Rectangle bounds, const char *text, Color color) +int GuiColorPanel(Rectangle bounds, const char *text, Color *color) { - const Color colWhite = { 255, 255, 255, 255 }; - const Color colBlack = { 0, 0, 0, 255 }; - + int result = 0; GuiState state = guiState; Vector2 pickerSelector = { 0 }; - Vector3 vcolor = { (float)color.r/255.0f, (float)color.g/255.0f, (float)color.b/255.0f }; + const Color colWhite = { 255, 255, 255, 255 }; + const Color colBlack = { 0, 0, 0, 255 }; + + Vector3 vcolor = { (float)color->r/255.0f, (float)color->g/255.0f, (float)color->b/255.0f }; Vector3 hsv = ConvertRGBtoHSV(vcolor); pickerSelector.x = bounds.x + (float)hsv.y*bounds.width; // HSV: Saturation pickerSelector.y = bounds.y + (1.0f - (float)hsv.z)*bounds.height; // HSV: Value - float hue = -1.0f; - Vector3 maxHue = { hue >= 0.0f ? hue : hsv.x, 1.0f, 1.0f }; + Vector3 maxHue = { hsv.x, 1.0f, 1.0f }; Vector3 rgbHue = ConvertHSVtoRGB(maxHue); Color maxHueCol = { (unsigned char)(255.0f*rgbHue.x), (unsigned char)(255.0f*rgbHue.y), @@ -2904,7 +3377,7 @@ Color GuiColorPanel(Rectangle bounds, const char *text, Color color) // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) { Vector2 mousePoint = GetMousePosition(); @@ -2927,10 +3400,10 @@ Color GuiColorPanel(Rectangle bounds, const char *text, Color color) Vector3 rgb = ConvertHSVtoRGB(hsv); // NOTE: Vector3ToColor() only available on raylib 1.8.1 - color = RAYGUI_CLITERAL(Color){ (unsigned char)(255.0f*rgb.x), + *color = RAYGUI_CLITERAL(Color){ (unsigned char)(255.0f*rgb.x), (unsigned char)(255.0f*rgb.y), (unsigned char)(255.0f*rgb.z), - (unsigned char)(255.0f*(float)color.a/255.0f) }; + (unsigned char)(255.0f*(float)color->a/255.0f) }; } else state = STATE_FOCUSED; @@ -2947,29 +3420,30 @@ Color GuiColorPanel(Rectangle bounds, const char *text, Color color) // Draw color picker: selector Rectangle selector = { pickerSelector.x - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, pickerSelector.y - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE), (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE) }; - GuiDrawRectangle(selector, 0, BLANK, Fade(colWhite, guiAlpha)); + GuiDrawRectangle(selector, 0, BLANK, colWhite); } else { DrawRectangleGradientEx(bounds, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.6f), guiAlpha)); } - GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK); + GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), BLANK); //-------------------------------------------------------------------- - return color; + return result; } // Color Bar Alpha control // NOTE: Returns alpha value normalized [0..1] -float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) +int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha) { #if !defined(RAYGUI_COLORBARALPHA_CHECKED_SIZE) #define RAYGUI_COLORBARALPHA_CHECKED_SIZE 10 #endif + int result = 0; GuiState state = guiState; - Rectangle selector = { (float)bounds.x + alpha*bounds.width - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.y - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT), (float)bounds.height + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2 }; + Rectangle selector = { (float)bounds.x + (*alpha)*bounds.width - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.y - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT), (float)bounds.height + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2 }; // Update control //-------------------------------------------------------------------- @@ -2977,16 +3451,36 @@ float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) { Vector2 mousePoint = GetMousePosition(); - if (CheckCollisionPointRec(mousePoint, bounds) || - CheckCollisionPointRec(mousePoint, selector)) + if (guiSliderDragging) // Keep dragging outside of bounds + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + if (CHECK_BOUNDS_ID(bounds, guiSliderActive)) + { + state = STATE_PRESSED; + + *alpha = (mousePoint.x - bounds.x)/bounds.width; + if (*alpha <= 0.0f) *alpha = 0.0f; + if (*alpha >= 1.0f) *alpha = 1.0f; + } + } + else + { + guiSliderDragging = false; + guiSliderActive = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; + } + } + else if (CheckCollisionPointRec(mousePoint, bounds) || CheckCollisionPointRec(mousePoint, selector)) { if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) { state = STATE_PRESSED; + guiSliderDragging = true; + guiSliderActive = bounds; // Store bounds as an identifier when dragging starts - alpha = (mousePoint.x - bounds.x)/bounds.width; - if (alpha <= 0.0f) alpha = 0.0f; - if (alpha >= 1.0f) alpha = 1.0f; + *alpha = (mousePoint.x - bounds.x)/bounds.width; + if (*alpha <= 0.0f) *alpha = 0.0f; + if (*alpha >= 1.0f) *alpha = 1.0f; //selector.x = bounds.x + (int)(((alpha - 0)/(100 - 0))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))) - selector.width/2; } else state = STATE_FOCUSED; @@ -3008,7 +3502,7 @@ float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) for (int y = 0; y < checksY; y++) { Rectangle check = { bounds.x + x*RAYGUI_COLORBARALPHA_CHECKED_SIZE, bounds.y + y*RAYGUI_COLORBARALPHA_CHECKED_SIZE, RAYGUI_COLORBARALPHA_CHECKED_SIZE, RAYGUI_COLORBARALPHA_CHECKED_SIZE }; - GuiDrawRectangle(check, 0, BLANK, ((x + y)%2)? Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.4f), guiAlpha) : Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.4f), guiAlpha)); + GuiDrawRectangle(check, 0, BLANK, ((x + y)%2)? Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.4f) : Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.4f)); } } @@ -3016,13 +3510,13 @@ float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) } else DrawRectangleGradientEx(bounds, Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha)); - GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK); + GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), BLANK); // Draw alpha bar: selector - GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha)); + GuiDrawRectangle(selector, 0, BLANK, GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3))); //-------------------------------------------------------------------- - return alpha; + return result; } // Color Bar Hue control @@ -3031,10 +3525,11 @@ float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) // Color GuiColorBarSat() [WHITE->color] // Color GuiColorBarValue() [BLACK->color], HSV/HSL // float GuiColorBarLuminance() [BLACK->WHITE] -float GuiColorBarHue(Rectangle bounds, const char *text, float hue) +int GuiColorBarHue(Rectangle bounds, const char *text, float *hue) { + int result = 0; GuiState state = guiState; - Rectangle selector = { (float)bounds.x - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)bounds.y + hue/360.0f*bounds.height - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2, (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT) }; + Rectangle selector = { (float)bounds.x - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)bounds.y + (*hue)/360.0f*bounds.height - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2, (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT) }; // Update control //-------------------------------------------------------------------- @@ -3042,16 +3537,36 @@ float GuiColorBarHue(Rectangle bounds, const char *text, float hue) { Vector2 mousePoint = GetMousePosition(); - if (CheckCollisionPointRec(mousePoint, bounds) || - CheckCollisionPointRec(mousePoint, selector)) + if (guiSliderDragging) // Keep dragging outside of bounds + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + if (CHECK_BOUNDS_ID(bounds, guiSliderActive)) + { + state = STATE_PRESSED; + + *hue = (mousePoint.y - bounds.y)*360/bounds.height; + if (*hue <= 0.0f) *hue = 0.0f; + if (*hue >= 359.0f) *hue = 359.0f; + } + } + else + { + guiSliderDragging = false; + guiSliderActive = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; + } + } + else if (CheckCollisionPointRec(mousePoint, bounds) || CheckCollisionPointRec(mousePoint, selector)) { if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) { state = STATE_PRESSED; + guiSliderDragging = true; + guiSliderActive = bounds; // Store bounds as an identifier when dragging starts - hue = (mousePoint.y - bounds.y)*360/bounds.height; - if (hue <= 0.0f) hue = 0.0f; - if (hue >= 359.0f) hue = 359.0f; + *hue = (mousePoint.y - bounds.y)*360/bounds.height; + if (*hue <= 0.0f) *hue = 0.0f; + if (*hue >= 359.0f) *hue = 359.0f; } else state = STATE_FOCUSED; @@ -3075,7 +3590,8 @@ float GuiColorBarHue(Rectangle bounds, const char *text, float hue) if (state != STATE_DISABLED) { // Draw hue bar:color bars - DrawRectangleGradientV((int)bounds.x, (int)(bounds.y), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 255, 255, 0, 255 }, guiAlpha)); + // TODO: Use directly DrawRectangleGradientEx(bounds, color1, color2, color2, color1); + DrawRectangleGradientV((int)bounds.x, (int)(bounds.y), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 255, 255, 0, 255 }, guiAlpha)); DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + bounds.height/6), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 255, 255, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 0, 255 }, guiAlpha)); DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 2*(bounds.height/6)), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 255, 255 }, guiAlpha)); DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 3*(bounds.height/6)), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 0, 255, 255 }, guiAlpha)); @@ -3084,13 +3600,13 @@ float GuiColorBarHue(Rectangle bounds, const char *text, float hue) } else DrawRectangleGradientV((int)bounds.x, (int)bounds.y, (int)bounds.width, (int)bounds.height, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha)); - GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK); + GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), BLANK); // Draw hue bar: selector - GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha)); + GuiDrawRectangle(selector, 0, BLANK, GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3))); //-------------------------------------------------------------------- - return hue; + return result; } // Color Picker control @@ -3099,21 +3615,126 @@ float GuiColorBarHue(Rectangle bounds, const char *text, float hue) // float GuiColorBarAlpha(Rectangle bounds, float alpha) // float GuiColorBarHue(Rectangle bounds, float value) // NOTE: bounds define GuiColorPanel() size -Color GuiColorPicker(Rectangle bounds, const char *text, Color color) +int GuiColorPicker(Rectangle bounds, const char *text, Color *color) { - color = GuiColorPanel(bounds, NULL, color); + int result = 0; + + Color temp = { 200, 0, 0, 255 }; + if (color == NULL) color = &temp; + + GuiColorPanel(bounds, NULL, color); Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height }; //Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, BARS_PADDING), bounds.width, GuiGetStyle(COLORPICKER, BARS_THICK) }; - Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ color.r/255.0f, color.g/255.0f, color.b/255.0f }); - hsv.x = GuiColorBarHue(boundsHue, NULL, hsv.x); + Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ (*color).r/255.0f, (*color).g/255.0f, (*color).b/255.0f }); + + GuiColorBarHue(boundsHue, NULL, &hsv.x); + //color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f); Vector3 rgb = ConvertHSVtoRGB(hsv); - color = RAYGUI_CLITERAL(Color){ (unsigned char)roundf(rgb.x*255.0f), (unsigned char)roundf(rgb.y*255.0f), (unsigned char)roundf(rgb.z*255.0f), color.a }; + *color = RAYGUI_CLITERAL(Color){ (unsigned char)roundf(rgb.x*255.0f), (unsigned char)roundf(rgb.y*255.0f), (unsigned char)roundf(rgb.z*255.0f), (*color).a }; - return color; + return result; +} + +// Color Picker control that avoids conversion to RGB and back to HSV on each call, thus avoiding jittering. +// The user can call ConvertHSVtoRGB() to convert *colorHsv value to RGB. +// NOTE: It's divided in multiple controls: +// int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv) +// int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha) +// float GuiColorBarHue(Rectangle bounds, float value) +// NOTE: bounds define GuiColorPanelHSV() size +int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv) +{ + int result = 0; + + Vector3 tempHsv = { 0 }; + + if (colorHsv == NULL) + { + const Vector3 tempColor = { 200.0f/255.0f, 0.0f, 0.0f }; + tempHsv = ConvertRGBtoHSV(tempColor); + colorHsv = &tempHsv; + } + + GuiColorPanelHSV(bounds, NULL, colorHsv); + + const Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height }; + + GuiColorBarHue(boundsHue, NULL, &colorHsv->x); + + return result; +} + +// Color Panel control, returns HSV color value in *colorHsv. +// Used by GuiColorPickerHSV() +int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv) +{ + int result = 0; + GuiState state = guiState; + Vector2 pickerSelector = { 0 }; + + const Color colWhite = { 255, 255, 255, 255 }; + const Color colBlack = { 0, 0, 0, 255 }; + + pickerSelector.x = bounds.x + (float)colorHsv->y*bounds.width; // HSV: Saturation + pickerSelector.y = bounds.y + (1.0f - (float)colorHsv->z)*bounds.height; // HSV: Value + + Vector3 maxHue = { colorHsv->x, 1.0f, 1.0f }; + Vector3 rgbHue = ConvertHSVtoRGB(maxHue); + Color maxHueCol = { (unsigned char)(255.0f*rgbHue.x), + (unsigned char)(255.0f*rgbHue.y), + (unsigned char)(255.0f*rgbHue.z), 255 }; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + state = STATE_PRESSED; + pickerSelector = mousePoint; + + // Calculate color from picker + Vector2 colorPick = { pickerSelector.x - bounds.x, pickerSelector.y - bounds.y }; + + colorPick.x /= (float)bounds.width; // Get normalized value on x + colorPick.y /= (float)bounds.height; // Get normalized value on y + + colorHsv->y = colorPick.x; + colorHsv->z = 1.0f - colorPick.y; + } + else state = STATE_FOCUSED; + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + if (state != STATE_DISABLED) + { + DrawRectangleGradientEx(bounds, Fade(colWhite, guiAlpha), Fade(colWhite, guiAlpha), Fade(maxHueCol, guiAlpha), Fade(maxHueCol, guiAlpha)); + DrawRectangleGradientEx(bounds, Fade(colBlack, 0), Fade(colBlack, guiAlpha), Fade(colBlack, guiAlpha), Fade(colBlack, 0)); + + // Draw color picker: selector + Rectangle selector = { pickerSelector.x - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, pickerSelector.y - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE), (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE) }; + GuiDrawRectangle(selector, 0, BLANK, colWhite); + } + else + { + DrawRectangleGradientEx(bounds, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.6f), guiAlpha)); + } + + GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), BLANK); + //-------------------------------------------------------------------- + + return result; } // Message Box control @@ -3126,7 +3747,7 @@ int GuiMessageBox(Rectangle bounds, const char *title, const char *message, cons #define RAYGUI_MESSAGEBOX_BUTTON_PADDING 12 #endif - int clicked = -1; // Returns clicked button from buttons list, 0 refers to closed window button + int result = -1; // Returns clicked button from buttons list, 0 refers to closed window button int buttonCount = 0; const char **buttonsText = GuiTextSplit(buttons, ';', &buttonCount, NULL); @@ -3136,7 +3757,7 @@ int GuiMessageBox(Rectangle bounds, const char *title, const char *message, cons buttonBounds.width = (bounds.width - RAYGUI_MESSAGEBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount; buttonBounds.height = RAYGUI_MESSAGEBOX_BUTTON_HEIGHT; - int textWidth = GetTextWidth(message); + int textWidth = GetTextWidth(message) + 2; Rectangle textBounds = { 0 }; textBounds.x = bounds.x + bounds.width/2 - textWidth/2; @@ -3146,7 +3767,7 @@ int GuiMessageBox(Rectangle bounds, const char *title, const char *message, cons // Draw control //-------------------------------------------------------------------- - if (GuiWindowBox(bounds, title)) clicked = 0; + if (GuiWindowBox(bounds, title)) result = 0; int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT); GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); @@ -3158,18 +3779,18 @@ int GuiMessageBox(Rectangle bounds, const char *title, const char *message, cons for (int i = 0; i < buttonCount; i++) { - if (GuiButton(buttonBounds, buttonsText[i])) clicked = i + 1; + if (GuiButton(buttonBounds, buttonsText[i])) result = i + 1; buttonBounds.x += (buttonBounds.width + RAYGUI_MESSAGEBOX_BUTTON_PADDING); } GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevTextAlignment); //-------------------------------------------------------------------- - return clicked; + return result; } // Text Input Box control, ask for text -int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, int *secretViewActive) +int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, bool *secretViewActive) { #if !defined(RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT) #define RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT 24 @@ -3185,7 +3806,7 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co // WARNING: No more than one GuiTextInputBox() should be open at the same time static bool textEditMode = false; - int btnIndex = -1; + int result = -1; int buttonCount = 0; const char **buttonsText = GuiTextSplit(buttons, ';', &buttonCount, NULL); @@ -3200,7 +3821,7 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co Rectangle textBounds = { 0 }; if (message != NULL) { - int textSize = GetTextWidth(message); + int textSize = GetTextWidth(message) + 2; textBounds.x = bounds.x + bounds.width/2 - textSize/2; textBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + messageInputHeight/4 - (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/2; @@ -3218,7 +3839,7 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co // Draw control //-------------------------------------------------------------------- - if (GuiWindowBox(bounds, title)) btnIndex = 0; + if (GuiWindowBox(bounds, title)) result = 0; // Draw message if available if (message != NULL) @@ -3235,7 +3856,7 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co if (GuiTextBox(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x, textBoxBounds.y, textBoxBounds.width - 4 - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.height }, ((*secretViewActive == 1) || textEditMode)? text : stars, textMaxSize, textEditMode)) textEditMode = !textEditMode; - *secretViewActive = GuiToggle(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x + textBoxBounds.width - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.y, RAYGUI_TEXTINPUTBOX_HEIGHT, RAYGUI_TEXTINPUTBOX_HEIGHT }, (*secretViewActive == 1)? "#44#" : "#45#", *secretViewActive); + GuiToggle(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x + textBoxBounds.width - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.y, RAYGUI_TEXTINPUTBOX_HEIGHT, RAYGUI_TEXTINPUTBOX_HEIGHT }, (*secretViewActive == 1)? "#44#" : "#45#", secretViewActive); } else { @@ -3247,79 +3868,93 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co for (int i = 0; i < buttonCount; i++) { - if (GuiButton(buttonBounds, buttonsText[i])) btnIndex = i + 1; + if (GuiButton(buttonBounds, buttonsText[i])) result = i + 1; buttonBounds.x += (buttonBounds.width + RAYGUI_MESSAGEBOX_BUTTON_PADDING); } + if (result >= 0) textEditMode = false; + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevBtnTextAlignment); //-------------------------------------------------------------------- - return btnIndex; + return result; // Result is the pressed button index } // Grid control // NOTE: Returns grid mouse-hover selected cell // About drawing lines at subpixel spacing, simple put, not easy solution: // https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster -Vector2 GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs) +int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell) { // Grid lines alpha amount #if !defined(RAYGUI_GRID_ALPHA) #define RAYGUI_GRID_ALPHA 0.15f #endif + int result = 0; GuiState state = guiState; - Vector2 mousePoint = GetMousePosition(); - Vector2 currentCell = { -1, -1 }; - int linesV = ((int)(bounds.width/spacing))*subdivs + 1; - int linesH = ((int)(bounds.height/spacing))*subdivs + 1; + Vector2 mousePoint = GetMousePosition(); + Vector2 currentMouseCell = { -1, -1 }; + + float spaceWidth = spacing/(float)subdivs; + int linesV = (int)(bounds.width/spaceWidth) + 1; + int linesH = (int)(bounds.height/spaceWidth) + 1; + + int color = GuiGetStyle(DEFAULT, LINE_COLOR); // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging) { if (CheckCollisionPointRec(mousePoint, bounds)) { // NOTE: Cell values must be the upper left of the cell the mouse is in - currentCell.x = floorf((mousePoint.x - bounds.x)/spacing); - currentCell.y = floorf((mousePoint.y - bounds.y)/spacing); + currentMouseCell.x = floorf((mousePoint.x - bounds.x)/spacing); + currentMouseCell.y = floorf((mousePoint.y - bounds.y)/spacing); } } //-------------------------------------------------------------------- // Draw control //-------------------------------------------------------------------- + if (state == STATE_DISABLED) color = GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED); - // TODO: Draw background panel? - - switch (state) + if (subdivs > 0) { - case STATE_NORMAL: + // Draw vertical grid lines + for (int i = 0; i < linesV; i++) { - if (subdivs > 0) - { - // Draw vertical grid lines - for (int i = 0; i < linesV; i++) - { - Rectangle lineV = { bounds.x + spacing*i/subdivs, bounds.y, 1, bounds.height }; - GuiDrawRectangle(lineV, 0, BLANK, ((i%subdivs) == 0) ? Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), RAYGUI_GRID_ALPHA*4) : Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), RAYGUI_GRID_ALPHA)); - } + Rectangle lineV = { bounds.x + spacing*i/subdivs, bounds.y, 1, bounds.height }; + GuiDrawRectangle(lineV, 0, BLANK, ((i%subdivs) == 0)? GuiFade(GetColor(color), RAYGUI_GRID_ALPHA*4) : GuiFade(GetColor(color), RAYGUI_GRID_ALPHA)); + } - // Draw horizontal grid lines - for (int i = 0; i < linesH; i++) - { - Rectangle lineH = { bounds.x, bounds.y + spacing*i/subdivs, bounds.width, 1 }; - GuiDrawRectangle(lineH, 0, BLANK, ((i%subdivs) == 0) ? Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), RAYGUI_GRID_ALPHA*4) : Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), RAYGUI_GRID_ALPHA)); - } - } - } break; - default: break; + // Draw horizontal grid lines + for (int i = 0; i < linesH; i++) + { + Rectangle lineH = { bounds.x, bounds.y + spacing*i/subdivs, bounds.width, 1 }; + GuiDrawRectangle(lineH, 0, BLANK, ((i%subdivs) == 0)? GuiFade(GetColor(color), RAYGUI_GRID_ALPHA*4) : GuiFade(GetColor(color), RAYGUI_GRID_ALPHA)); + } } - return currentCell; + if (mouseCell != NULL) *mouseCell = currentMouseCell; + return result; } +//---------------------------------------------------------------------------------- +// Tooltip management functions +// NOTE: Tooltips requires some global variables: tooltipPtr +//---------------------------------------------------------------------------------- +// Enable gui tooltips (global state) +void GuiEnableTooltip(void) { guiTooltip = true; } + +// Disable gui tooltips (global state) +void GuiDisableTooltip(void) { guiTooltip = false; } + +// Set tooltip string +void GuiSetTooltip(const char *tooltip) { guiTooltipPtr = tooltip; } + + //---------------------------------------------------------------------------------- // Styles loading functions //---------------------------------------------------------------------------------- @@ -3369,34 +4004,37 @@ void GuiLoadStyle(const char *fileName) sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName); Font font = { 0 }; + int *codepoints = NULL; + int codepointCount = 0; if (charmapFileName[0] != '0') { - // Load characters from charmap file, - // expected '\n' separated list of integer values - char *charValues = LoadFileText(charmapFileName); - if (charValues != NULL) - { - int glyphCount = 0; - const char **chars = TextSplit(charValues, '\n', &glyphCount); - - int *values = (int *)RAYGUI_MALLOC(glyphCount*sizeof(int)); - for (int i = 0; i < glyphCount; i++) values[i] = TextToInteger(chars[i]); - - if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); - font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, values, glyphCount); - if (font.texture.id == 0) font = GetFontDefault(); - - RAYGUI_FREE(values); - } + // Load text data from file + // NOTE: Expected an UTF-8 array of codepoints, no separation + char *textData = LoadFileText(TextFormat("%s/%s", GetDirectoryPath(fileName), charmapFileName)); + codepoints = LoadCodepoints(textData, &codepointCount); + UnloadFileText(textData); } - else + + if (fontFileName[0] != '\0') { + // In case a font is already loaded and it is not default internal font, unload it if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); - font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0); - if (font.texture.id == 0) font = GetFontDefault(); + + if (codepointCount > 0) font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, codepoints, codepointCount); + else font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0); // Default to 95 standard codepoints } + // If font texture not properly loaded, revert to default font and size/spacing + if (font.texture.id == 0) + { + font = GetFontDefault(); + GuiSetStyle(DEFAULT, TEXT_SIZE, 10); + GuiSetStyle(DEFAULT, TEXT_SPACING, 1); + } + + UnloadCodepoints(codepoints); + if ((font.texture.id > 0) && (font.glyphCount > 0)) GuiSetFont(font); } break; @@ -3415,125 +4053,24 @@ void GuiLoadStyle(const char *fileName) { rgsFile = fopen(fileName, "rb"); - if (rgsFile == NULL) return; - - char signature[5] = { 0 }; - short version = 0; - short reserved = 0; - int propertyCount = 0; - - fread(signature, 1, 4, rgsFile); - fread(&version, 1, sizeof(short), rgsFile); - fread(&reserved, 1, sizeof(short), rgsFile); - fread(&propertyCount, 1, sizeof(int), rgsFile); - - if ((signature[0] == 'r') && - (signature[1] == 'G') && - (signature[2] == 'S') && - (signature[3] == ' ')) + if (rgsFile != NULL) { - short controlId = 0; - short propertyId = 0; - unsigned int propertyValue = 0; + fseek(rgsFile, 0, SEEK_END); + int fileDataSize = ftell(rgsFile); + fseek(rgsFile, 0, SEEK_SET); - for (int i = 0; i < propertyCount; i++) + if (fileDataSize > 0) { - fread(&controlId, 1, sizeof(short), rgsFile); - fread(&propertyId, 1, sizeof(short), rgsFile); - fread(&propertyValue, 1, sizeof(unsigned int), rgsFile); + unsigned char *fileData = (unsigned char *)RAYGUI_MALLOC(fileDataSize*sizeof(unsigned char)); + fread(fileData, sizeof(unsigned char), fileDataSize, rgsFile); - if (controlId == 0) // DEFAULT control - { - // If a DEFAULT property is loaded, it is propagated to all controls - // NOTE: All DEFAULT properties should be defined first in the file - GuiSetStyle(0, (int)propertyId, propertyValue); + GuiLoadStyleFromMemory(fileData, fileDataSize); - if (propertyId < RAYGUI_MAX_PROPS_BASE) for (int i = 1; i < RAYGUI_MAX_CONTROLS; i++) GuiSetStyle(i, (int)propertyId, propertyValue); - } - else GuiSetStyle((int)controlId, (int)propertyId, propertyValue); + RAYGUI_FREE(fileData); } - // Font loading is highly dependant on raylib API to load font data and image -#if !defined(RAYGUI_STANDALONE) - // Load custom font if available - int fontDataSize = 0; - fread(&fontDataSize, 1, sizeof(int), rgsFile); - - if (fontDataSize > 0) - { - Font font = { 0 }; - int fontType = 0; // 0-Normal, 1-SDF - Rectangle whiteRec = { 0 }; - - fread(&font.baseSize, 1, sizeof(int), rgsFile); - fread(&font.glyphCount, 1, sizeof(int), rgsFile); - fread(&fontType, 1, sizeof(int), rgsFile); - - // Load font white rectangle - fread(&whiteRec, 1, sizeof(Rectangle), rgsFile); - - // Load font image parameters - int fontImageUncompSize = 0; - int fontImageCompSize = 0; - fread(&fontImageUncompSize, 1, sizeof(int), rgsFile); - fread(&fontImageCompSize, 1, sizeof(int), rgsFile); - - Image imFont = { 0 }; - imFont.mipmaps = 1; - fread(&imFont.width, 1, sizeof(int), rgsFile); - fread(&imFont.height, 1, sizeof(int), rgsFile); - fread(&imFont.format, 1, sizeof(int), rgsFile); - - if (fontImageCompSize < fontImageUncompSize) - { - // Compressed font atlas image data (DEFLATE), it requires DecompressData() - int dataUncompSize = 0; - unsigned char *compData = (unsigned char *)RAYGUI_MALLOC(fontImageCompSize); - fread(compData, 1, fontImageCompSize, rgsFile); - imFont.data = DecompressData(compData, fontImageCompSize, &dataUncompSize); - - // Security check, dataUncompSize must match the provided fontImageUncompSize - if (dataUncompSize != fontImageUncompSize) RAYGUI_LOG("WARNING: Uncompressed font atlas image data could be corrupted"); - - RAYGUI_FREE(compData); - } - else - { - // Font atlas image data is not compressed - imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageUncompSize); - fread(imFont.data, 1, fontImageUncompSize, rgsFile); - } - - if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); - font.texture = LoadTextureFromImage(imFont); - if (font.texture.id == 0) font = GetFontDefault(); - - RAYGUI_FREE(imFont.data); - - // Load font recs data - font.recs = (Rectangle *)RAYGUI_CALLOC(font.glyphCount, sizeof(Rectangle)); - for (int i = 0; i < font.glyphCount; i++) fread(&font.recs[i], 1, sizeof(Rectangle), rgsFile); - - // Load font chars info data - font.glyphs = (GlyphInfo *)RAYGUI_CALLOC(font.glyphCount, sizeof(GlyphInfo)); - for (int i = 0; i < font.glyphCount; i++) - { - fread(&font.glyphs[i].value, 1, sizeof(int), rgsFile); - fread(&font.glyphs[i].offsetX, 1, sizeof(int), rgsFile); - fread(&font.glyphs[i].offsetY, 1, sizeof(int), rgsFile); - fread(&font.glyphs[i].advanceX, 1, sizeof(int), rgsFile); - } - - GuiSetFont(font); - - // Set font texture source rectangle to be used as white texture to draw shapes - // NOTE: This way, all gui can be draw using a single draw call - if ((whiteRec.width != 0) && (whiteRec.height != 0)) SetShapesTexture(font.texture, whiteRec); - } -#endif + fclose(rgsFile); } - - fclose(rgsFile); } } @@ -3545,6 +4082,8 @@ void GuiLoadStyleDefault(void) guiStyleLoaded = true; // Initialize default LIGHT style property values + // WARNING: Default value are applied to all controls on set but + // they can be overwritten later on for every custom control GuiSetStyle(DEFAULT, BORDER_COLOR_NORMAL, 0x838383ff); GuiSetStyle(DEFAULT, BASE_COLOR_NORMAL, 0xc9c9c9ff); GuiSetStyle(DEFAULT, TEXT_COLOR_NORMAL, 0x686868ff); @@ -3557,17 +4096,29 @@ void GuiLoadStyleDefault(void) GuiSetStyle(DEFAULT, BORDER_COLOR_DISABLED, 0xb5c1c2ff); GuiSetStyle(DEFAULT, BASE_COLOR_DISABLED, 0xe6e9e9ff); GuiSetStyle(DEFAULT, TEXT_COLOR_DISABLED, 0xaeb7b8ff); - GuiSetStyle(DEFAULT, BORDER_WIDTH, 1); // WARNING: Some controls use other values - GuiSetStyle(DEFAULT, TEXT_PADDING, 0); // WARNING: Some controls use other values - GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); // WARNING: Some controls use other values + GuiSetStyle(DEFAULT, BORDER_WIDTH, 1); + GuiSetStyle(DEFAULT, TEXT_PADDING, 0); + GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + + // Initialize default extended property values + // NOTE: By default, extended property values are initialized to 0 + GuiSetStyle(DEFAULT, TEXT_SIZE, 10); // DEFAULT, shared by all controls + GuiSetStyle(DEFAULT, TEXT_SPACING, 1); // DEFAULT, shared by all controls + GuiSetStyle(DEFAULT, LINE_COLOR, 0x90abb5ff); // DEFAULT specific property + GuiSetStyle(DEFAULT, BACKGROUND_COLOR, 0xf5f5f5ff); // DEFAULT specific property + GuiSetStyle(DEFAULT, TEXT_LINE_SPACING, 15); // DEFAULT, 15 pixels between lines + GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_MIDDLE); // DEFAULT, text aligned vertically to middle of text-bounds // Initialize control-specific property values // NOTE: Those properties are in default list but require specific values by control type GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); GuiSetStyle(BUTTON, BORDER_WIDTH, 2); GuiSetStyle(SLIDER, TEXT_PADDING, 4); + GuiSetStyle(PROGRESSBAR, TEXT_PADDING, 4); GuiSetStyle(CHECKBOX, TEXT_PADDING, 4); GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_RIGHT); + GuiSetStyle(DROPDOWNBOX, TEXT_PADDING, 0); + GuiSetStyle(DROPDOWNBOX, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); GuiSetStyle(TEXTBOX, TEXT_PADDING, 4); GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); GuiSetStyle(VALUEBOX, TEXT_PADDING, 0); @@ -3579,10 +4130,6 @@ void GuiLoadStyleDefault(void) // Initialize extended property values // NOTE: By default, extended property values are initialized to 0 - GuiSetStyle(DEFAULT, TEXT_SIZE, 10); // DEFAULT, shared by all controls - GuiSetStyle(DEFAULT, TEXT_SPACING, 1); // DEFAULT, shared by all controls - GuiSetStyle(DEFAULT, LINE_COLOR, 0x90abb5ff); // DEFAULT specific property - GuiSetStyle(DEFAULT, BACKGROUND_COLOR, 0xf5f5f5ff); // DEFAULT specific property GuiSetStyle(TOGGLE, GROUP_PADDING, 2); GuiSetStyle(SLIDER, SLIDER_WIDTH, 16); GuiSetStyle(SLIDER, SLIDER_PADDING, 1); @@ -3592,8 +4139,6 @@ void GuiLoadStyleDefault(void) GuiSetStyle(COMBOBOX, COMBO_BUTTON_SPACING, 2); GuiSetStyle(DROPDOWNBOX, ARROW_PADDING, 16); GuiSetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING, 2); - GuiSetStyle(TEXTBOX, TEXT_LINES_SPACING, 4); - GuiSetStyle(TEXTBOX, TEXT_INNER_PADDING, 4); GuiSetStyle(SPINNER, SPIN_BUTTON_WIDTH, 24); GuiSetStyle(SPINNER, SPIN_BUTTON_SPACING, 2); GuiSetStyle(SCROLLBAR, BORDER_WIDTH, 0); @@ -3617,13 +4162,19 @@ void GuiLoadStyleDefault(void) { // Unload previous font texture UnloadTexture(guiFont.texture); + RL_FREE(guiFont.recs); + RL_FREE(guiFont.glyphs); + guiFont.recs = NULL; + guiFont.glyphs = NULL; // Setup default raylib font guiFont = GetFontDefault(); - // Setup default raylib font rectangle - Rectangle whiteChar = { 41, 46, 2, 8 }; - SetShapesTexture(guiFont.texture, whiteChar); + // NOTE: Default raylib font character 95 is a white square + Rectangle whiteChar = guiFont.recs[95]; + + // NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding on MSAA filtering + SetShapesTexture(guiFont.texture, RAYGUI_CLITERAL(Rectangle){ whiteChar.x + 1, whiteChar.y + 1, whiteChar.width - 2, whiteChar.height - 2 }); } } @@ -3636,7 +4187,7 @@ const char *GuiIconText(int iconId, const char *text) return NULL; #else static char buffer[1024] = { 0 }; - static char iconBuffer[6] = { 0 }; + static char iconBuffer[16] = { 0 }; if (text != NULL) { @@ -3653,7 +4204,7 @@ const char *GuiIconText(int iconId, const char *text) } else { - sprintf(iconBuffer, "#%03i#", iconId & 0x1ff); + sprintf(iconBuffer, "#%03i#", iconId); return iconBuffer; } @@ -3707,10 +4258,10 @@ char **GuiLoadIcons(const char *fileName, bool loadIconsName) short iconSize = 0; fread(signature, 1, 4, rgiFile); - fread(&version, 1, sizeof(short), rgiFile); - fread(&reserved, 1, sizeof(short), rgiFile); - fread(&iconCount, 1, sizeof(short), rgiFile); - fread(&iconSize, 1, sizeof(short), rgiFile); + fread(&version, sizeof(short), 1, rgiFile); + fread(&reserved, sizeof(short), 1, rgiFile); + fread(&iconCount, sizeof(short), 1, rgiFile); + fread(&iconSize, sizeof(short), 1, rgiFile); if ((signature[0] == 'r') && (signature[1] == 'G') && @@ -3723,13 +4274,13 @@ char **GuiLoadIcons(const char *fileName, bool loadIconsName) for (int i = 0; i < iconCount; i++) { guiIconsName[i] = (char *)RAYGUI_MALLOC(RAYGUI_ICON_MAX_NAME_LENGTH); - fread(guiIconsName[i], RAYGUI_ICON_MAX_NAME_LENGTH, 1, rgiFile); + fread(guiIconsName[i], 1, RAYGUI_ICON_MAX_NAME_LENGTH, rgiFile); } } else fseek(rgiFile, iconCount*RAYGUI_ICON_MAX_NAME_LENGTH, SEEK_CUR); // Read icons data directly over internal icons array - fread(guiIconsPtr, iconCount*(iconSize*iconSize/32), sizeof(unsigned int), rgiFile); + fread(guiIconsPtr, sizeof(unsigned int), iconCount*(iconSize*iconSize/32), rgiFile); } fclose(rgiFile); @@ -3750,7 +4301,7 @@ void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color) if (BIT_CHECK(guiIconsPtr[iconId*RAYGUI_ICON_DATA_ELEMENTS + i], k)) { #if !defined(RAYGUI_STANDALONE) - DrawRectangle(posX + (k%RAYGUI_ICON_SIZE)*pixelSize, posY + y*pixelSize, pixelSize, pixelSize, color); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ (float)posX + (k%RAYGUI_ICON_SIZE)*pixelSize, (float)posY + y*pixelSize, (float)pixelSize, (float)pixelSize }, 0, BLANK, color); #endif } @@ -3758,11 +4309,241 @@ void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color) } } } + +// Set icon drawing size +void GuiSetIconScale(int scale) +{ + if (scale >= 1) guiIconScale = scale; +} + #endif // !RAYGUI_NO_ICONS //---------------------------------------------------------------------------------- // Module specific Functions Definition //---------------------------------------------------------------------------------- + +// Load style from memory +// WARNING: Binary files only +static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize) +{ + unsigned char *fileDataPtr = (unsigned char *)fileData; + + char signature[5] = { 0 }; + short version = 0; + short reserved = 0; + int propertyCount = 0; + + memcpy(signature, fileDataPtr, 4); + memcpy(&version, fileDataPtr + 4, sizeof(short)); + memcpy(&reserved, fileDataPtr + 4 + 2, sizeof(short)); + memcpy(&propertyCount, fileDataPtr + 4 + 2 + 2, sizeof(int)); + fileDataPtr += 12; + + if ((signature[0] == 'r') && + (signature[1] == 'G') && + (signature[2] == 'S') && + (signature[3] == ' ')) + { + short controlId = 0; + short propertyId = 0; + unsigned int propertyValue = 0; + + for (int i = 0; i < propertyCount; i++) + { + memcpy(&controlId, fileDataPtr, sizeof(short)); + memcpy(&propertyId, fileDataPtr + 2, sizeof(short)); + memcpy(&propertyValue, fileDataPtr + 2 + 2, sizeof(unsigned int)); + fileDataPtr += 8; + + if (controlId == 0) // DEFAULT control + { + // If a DEFAULT property is loaded, it is propagated to all controls + // NOTE: All DEFAULT properties should be defined first in the file + GuiSetStyle(0, (int)propertyId, propertyValue); + + if (propertyId < RAYGUI_MAX_PROPS_BASE) for (int i = 1; i < RAYGUI_MAX_CONTROLS; i++) GuiSetStyle(i, (int)propertyId, propertyValue); + } + else GuiSetStyle((int)controlId, (int)propertyId, propertyValue); + } + + // Font loading is highly dependant on raylib API to load font data and image + +#if !defined(RAYGUI_STANDALONE) + // Load custom font if available + int fontDataSize = 0; + memcpy(&fontDataSize, fileDataPtr, sizeof(int)); + fileDataPtr += 4; + + if (fontDataSize > 0) + { + Font font = { 0 }; + int fontType = 0; // 0-Normal, 1-SDF + + memcpy(&font.baseSize, fileDataPtr, sizeof(int)); + memcpy(&font.glyphCount, fileDataPtr + 4, sizeof(int)); + memcpy(&fontType, fileDataPtr + 4 + 4, sizeof(int)); + fileDataPtr += 12; + + // Load font white rectangle + Rectangle fontWhiteRec = { 0 }; + memcpy(&fontWhiteRec, fileDataPtr, sizeof(Rectangle)); + fileDataPtr += 16; + + // Load font image parameters + int fontImageUncompSize = 0; + int fontImageCompSize = 0; + memcpy(&fontImageUncompSize, fileDataPtr, sizeof(int)); + memcpy(&fontImageCompSize, fileDataPtr + 4, sizeof(int)); + fileDataPtr += 8; + + Image imFont = { 0 }; + imFont.mipmaps = 1; + memcpy(&imFont.width, fileDataPtr, sizeof(int)); + memcpy(&imFont.height, fileDataPtr + 4, sizeof(int)); + memcpy(&imFont.format, fileDataPtr + 4 + 4, sizeof(int)); + fileDataPtr += 12; + + if ((fontImageCompSize > 0) && (fontImageCompSize != fontImageUncompSize)) + { + // Compressed font atlas image data (DEFLATE), it requires DecompressData() + int dataUncompSize = 0; + unsigned char *compData = (unsigned char *)RAYGUI_MALLOC(fontImageCompSize); + memcpy(compData, fileDataPtr, fontImageCompSize); + fileDataPtr += fontImageCompSize; + + imFont.data = DecompressData(compData, fontImageCompSize, &dataUncompSize); + + // Security check, dataUncompSize must match the provided fontImageUncompSize + if (dataUncompSize != fontImageUncompSize) RAYGUI_LOG("WARNING: Uncompressed font atlas image data could be corrupted"); + + RAYGUI_FREE(compData); + } + else + { + // Font atlas image data is not compressed + imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageUncompSize); + memcpy(imFont.data, fileDataPtr, fontImageUncompSize); + fileDataPtr += fontImageUncompSize; + } + + if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); + font.texture = LoadTextureFromImage(imFont); + + RAYGUI_FREE(imFont.data); + + // Validate font atlas texture was loaded correctly + if (font.texture.id != 0) + { + // Load font recs data + int recsDataSize = font.glyphCount*sizeof(Rectangle); + int recsDataCompressedSize = 0; + + // WARNING: Version 400 adds the compression size parameter + if (version >= 400) + { + // RGS files version 400 support compressed recs data + memcpy(&recsDataCompressedSize, fileDataPtr, sizeof(int)); + fileDataPtr += sizeof(int); + } + + if ((recsDataCompressedSize > 0) && (recsDataCompressedSize != recsDataSize)) + { + // Recs data is compressed, uncompress it + unsigned char *recsDataCompressed = (unsigned char *)RAYGUI_MALLOC(recsDataCompressedSize); + + memcpy(recsDataCompressed, fileDataPtr, recsDataCompressedSize); + fileDataPtr += recsDataCompressedSize; + + int recsDataUncompSize = 0; + font.recs = (Rectangle *)DecompressData(recsDataCompressed, recsDataCompressedSize, &recsDataUncompSize); + + // Security check, data uncompressed size must match the expected original data size + if (recsDataUncompSize != recsDataSize) RAYGUI_LOG("WARNING: Uncompressed font recs data could be corrupted"); + + RAYGUI_FREE(recsDataCompressed); + } + else + { + // Recs data is uncompressed + font.recs = (Rectangle *)RAYGUI_CALLOC(font.glyphCount, sizeof(Rectangle)); + for (int i = 0; i < font.glyphCount; i++) + { + memcpy(&font.recs[i], fileDataPtr, sizeof(Rectangle)); + fileDataPtr += sizeof(Rectangle); + } + } + + // Load font glyphs info data + int glyphsDataSize = font.glyphCount*16; // 16 bytes data per glyph + int glyphsDataCompressedSize = 0; + + // WARNING: Version 400 adds the compression size parameter + if (version >= 400) + { + // RGS files version 400 support compressed glyphs data + memcpy(&glyphsDataCompressedSize, fileDataPtr, sizeof(int)); + fileDataPtr += sizeof(int); + } + + // Allocate required glyphs space to fill with data + font.glyphs = (GlyphInfo *)RAYGUI_CALLOC(font.glyphCount, sizeof(GlyphInfo)); + + if ((glyphsDataCompressedSize > 0) && (glyphsDataCompressedSize != glyphsDataSize)) + { + // Glyphs data is compressed, uncompress it + unsigned char *glypsDataCompressed = (unsigned char *)RAYGUI_MALLOC(glyphsDataCompressedSize); + + memcpy(glypsDataCompressed, fileDataPtr, glyphsDataCompressedSize); + fileDataPtr += glyphsDataCompressedSize; + + int glyphsDataUncompSize = 0; + unsigned char *glyphsDataUncomp = DecompressData(glypsDataCompressed, glyphsDataCompressedSize, &glyphsDataUncompSize); + + // Security check, data uncompressed size must match the expected original data size + if (glyphsDataUncompSize != glyphsDataSize) RAYGUI_LOG("WARNING: Uncompressed font glyphs data could be corrupted"); + + unsigned char *glyphsDataUncompPtr = glyphsDataUncomp; + + for (int i = 0; i < font.glyphCount; i++) + { + memcpy(&font.glyphs[i].value, glyphsDataUncompPtr, sizeof(int)); + memcpy(&font.glyphs[i].offsetX, glyphsDataUncompPtr + 4, sizeof(int)); + memcpy(&font.glyphs[i].offsetY, glyphsDataUncompPtr + 8, sizeof(int)); + memcpy(&font.glyphs[i].advanceX, glyphsDataUncompPtr + 12, sizeof(int)); + glyphsDataUncompPtr += 16; + } + + RAYGUI_FREE(glypsDataCompressed); + RAYGUI_FREE(glyphsDataUncomp); + } + else + { + // Glyphs data is uncompressed + for (int i = 0; i < font.glyphCount; i++) + { + memcpy(&font.glyphs[i].value, fileDataPtr, sizeof(int)); + memcpy(&font.glyphs[i].offsetX, fileDataPtr + 4, sizeof(int)); + memcpy(&font.glyphs[i].offsetY, fileDataPtr + 8, sizeof(int)); + memcpy(&font.glyphs[i].advanceX, fileDataPtr + 12, sizeof(int)); + fileDataPtr += 16; + } + } + } + else font = GetFontDefault(); // Fallback in case of errors loading font atlas texture + + GuiSetFont(font); + + // Set font texture source rectangle to be used as white texture to draw shapes + // NOTE: It makes possible to draw shapes and text (full UI) in a single draw call + if ((fontWhiteRec.x > 0) && + (fontWhiteRec.y > 0) && + (fontWhiteRec.width > 0) && + (fontWhiteRec.height > 0)) SetShapesTexture(font.texture, fontWhiteRec); + } +#endif + } +} + // Gui get text width considering icon static int GetTextWidth(const char *text) { @@ -3777,7 +4558,7 @@ static int GetTextWidth(const char *text) { if (text[0] == '#') { - for (int i = 1; (text[i] != '\0') && (i < 5); i++) + for (int i = 1; (i < 5) && (text[i] != '\0'); i++) { if (text[i] == '#') { @@ -3812,10 +4593,10 @@ static int GetTextWidth(const char *text) int codepoint = GetCodepointNext(&text[i], &codepointSize); int codepointIndex = GetGlyphIndex(guiFont, codepoint); - if (guiFont.glyphs[codepointIndex].advanceX == 0) glyphWidth = ((float)guiFont.recs[codepointIndex].width*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); - else glyphWidth = ((float)guiFont.glyphs[codepointIndex].advanceX*scaleFactor + GuiGetStyle(DEFAULT, TEXT_SPACING)); + if (guiFont.glyphs[codepointIndex].advanceX == 0) glyphWidth = ((float)guiFont.recs[codepointIndex].width*scaleFactor); + else glyphWidth = ((float)guiFont.glyphs[codepointIndex].advanceX*scaleFactor); - textSize.x += glyphWidth; + textSize.x += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); } } @@ -3831,27 +4612,31 @@ static Rectangle GetTextBounds(int control, Rectangle bounds) Rectangle textBounds = bounds; textBounds.x = bounds.x + GuiGetStyle(control, BORDER_WIDTH); - textBounds.y = bounds.y + GuiGetStyle(control, BORDER_WIDTH); + textBounds.y = bounds.y + GuiGetStyle(control, BORDER_WIDTH) + GuiGetStyle(control, TEXT_PADDING); textBounds.width = bounds.width - 2*GuiGetStyle(control, BORDER_WIDTH) - 2*GuiGetStyle(control, TEXT_PADDING); - textBounds.height = bounds.height - 2*GuiGetStyle(control, BORDER_WIDTH); + textBounds.height = bounds.height - 2*GuiGetStyle(control, BORDER_WIDTH) - 2*GuiGetStyle(control, TEXT_PADDING); // NOTE: Text is processed line per line! - // Consider TEXT_PADDING properly, depends on control type and TEXT_ALIGNMENT + // Depending on control, TEXT_PADDING and TEXT_ALIGNMENT properties could affect the text-bounds switch (control) { - case COMBOBOX: bounds.width -= (GuiGetStyle(control, COMBO_BUTTON_WIDTH) + GuiGetStyle(control, COMBO_BUTTON_SPACING)); break; - //case VALUEBOX: break; // NOTE: ValueBox text value always centered, text padding applies to label + case COMBOBOX: + case DROPDOWNBOX: + case LISTVIEW: + // TODO: Special cases (no label): COMBOBOX, DROPDOWNBOX, LISTVIEW + case SLIDER: + case CHECKBOX: + case VALUEBOX: + case SPINNER: + // TODO: More special cases (label on side): SLIDER, CHECKBOX, VALUEBOX, SPINNER default: { + // TODO: WARNING: TEXT_ALIGNMENT is already considered in GuiDrawText() if (GuiGetStyle(control, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT) textBounds.x -= GuiGetStyle(control, TEXT_PADDING); else textBounds.x += GuiGetStyle(control, TEXT_PADDING); - textBounds.width -= 2 * GuiGetStyle(control, TEXT_PADDING); } break; } - // TODO: Special cases (no label): COMBOBOX, DROPDOWNBOX, LISTVIEW (scrollbar?) - // More special cases (label on side): CHECKBOX, SLIDER, VALUEBOX, SPINNER - return textBounds; } @@ -3899,13 +4684,13 @@ const char **GetTextLines(const char *text, int *count) lines[0] = text; int len = 0; *count = 1; - int lineSize = 0; // Stores current line size, not returned + //int lineSize = 0; // Stores current line size, not returned for (int i = 0, k = 0; (i < textSize) && (*count < RAYGUI_MAX_TEXT_LINES); i++) { if (text[i] == '\n') { - lineSize = len; + //lineSize = len; k++; lines[k] = &text[i + 1]; // WARNING: next value is valid? len = 0; @@ -3919,8 +4704,37 @@ const char **GetTextLines(const char *text, int *count) return lines; } +// Get text width to next space for provided string +static float GetNextSpaceWidth(const char *text, int *nextSpaceIndex) +{ + float width = 0; + int codepointByteCount = 0; + int codepoint = 0; + int index = 0; + float glyphWidth = 0; + float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/guiFont.baseSize; + + for (int i = 0; text[i] != '\0'; i++) + { + if (text[i] != ' ') + { + codepoint = GetCodepoint(&text[i], &codepointByteCount); + index = GetGlyphIndex(guiFont, codepoint); + glyphWidth = (guiFont.glyphs[index].advanceX == 0)? guiFont.recs[index].width*scaleFactor : guiFont.glyphs[index].advanceX*scaleFactor; + width += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + } + else + { + *nextSpaceIndex = i; + break; + } + } + + return width; +} + // Gui draw text using default font -static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint) +static void GuiDrawText(const char *text, Rectangle textBounds, int alignment, Color tint) { #define TEXT_VALIGN_PIXEL_OFFSET(h) ((int)h%2) // Vertical alignment for pixel perfect @@ -3928,118 +4742,173 @@ static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color #define ICON_TEXT_PADDING 4 #endif - // We process the text lines one by one - if ((text != NULL) && (text[0] != '\0')) + if ((text == NULL) || (text[0] == '\0')) return; // Security check + + // PROCEDURE: + // - Text is processed line per line + // - For every line, horizontal alignment is defined + // - For all text, vertical alignment is defined (multiline text only) + // - For every line, wordwrap mode is checked (useful for GuitextBox(), read-only) + + // Get text lines (using '\n' as delimiter) to be processed individually + // WARNING: We can't use GuiTextSplit() function because it can be already used + // before the GuiDrawText() call and its buffer is static, it would be overriden :( + int lineCount = 0; + const char **lines = GetTextLines(text, &lineCount); + + // Text style variables + //int alignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT); + int alignmentVertical = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL); + int wrapMode = GuiGetStyle(DEFAULT, TEXT_WRAP_MODE); // Wrap-mode only available in read-only mode, no for text editing + + // TODO: WARNING: This totalHeight is not valid for vertical alignment in case of word-wrap + float totalHeight = (float)(lineCount*GuiGetStyle(DEFAULT, TEXT_SIZE) + (lineCount - 1)*GuiGetStyle(DEFAULT, TEXT_SIZE)/2); + float posOffsetY = 0.0f; + + for (int i = 0; i < lineCount; i++) { - // Get text lines ('\n' delimiter) to process lines individually - // NOTE: We can't use GuiTextSplit() because it can be already use before calling - // GuiDrawText() and static buffer would be overriden :( - int lineCount = 0; - const char **lines = GetTextLines(text, &lineCount); + int iconId = 0; + lines[i] = GetTextIcon(lines[i], &iconId); // Check text for icon and move cursor - //Rectangle textBounds = GetTextBounds(LABEL, bounds); - float totalHeight = (float)(lineCount*GuiGetStyle(DEFAULT, TEXT_SIZE) + (lineCount - 1)*GuiGetStyle(DEFAULT, TEXT_SIZE)/2); - float posOffsetY = 0; + // Get text position depending on alignment and iconId + //--------------------------------------------------------------------------------- + Vector2 textBoundsPosition = { textBounds.x, textBounds.y }; - for (int i = 0; i < lineCount; i++) + // NOTE: We get text size after icon has been processed + // WARNING: GetTextWidth() also processes text icon to get width! -> Really needed? + int textSizeX = GetTextWidth(lines[i]); + + // If text requires an icon, add size to measure + if (iconId >= 0) { - int iconId = 0; - lines[i] = GetTextIcon(lines[i], &iconId); // Check text for icon and move cursor + textSizeX += RAYGUI_ICON_SIZE*guiIconScale; - // Get text position depending on alignment and iconId - //--------------------------------------------------------------------------------- - Vector2 position = { bounds.x, bounds.y }; - - // TODO: We get text size after icon has been processed - // WARNING: GetTextWidth() also processes text icon to get width! -> Really needed? - int textSizeX = GetTextWidth(lines[i]); - - // If text requires an icon, add size to measure - if (iconId >= 0) - { - textSizeX += RAYGUI_ICON_SIZE*guiIconScale; - - // WARNING: If only icon provided, text could be pointing to EOF character: '\0' - if ((lines[i] != NULL) && (lines[i][0] != '\0')) textSizeX += ICON_TEXT_PADDING; - } - - // Check guiTextAlign global variables - switch (alignment) - { - case TEXT_ALIGN_LEFT: - { - position.x = bounds.x; - position.y = bounds.y + posOffsetY + bounds.height/2 - totalHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height); - } break; - case TEXT_ALIGN_CENTER: - { - position.x = bounds.x + bounds.width/2 - textSizeX/2; - position.y = bounds.y + posOffsetY + bounds.height/2 - totalHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height); - } break; - case TEXT_ALIGN_RIGHT: - { - position.x = bounds.x + bounds.width - textSizeX; - position.y = bounds.y + posOffsetY + bounds.height/2 - totalHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height); - } break; - default: break; - } - - // NOTE: Make sure we get pixel-perfect coordinates, - // In case of decimals we got weird text positioning - position.x = (float)((int)position.x); - position.y = (float)((int)position.y); - //--------------------------------------------------------------------------------- - - // Draw text (with icon if available) - //--------------------------------------------------------------------------------- + // WARNING: If only icon provided, text could be pointing to EOF character: '\0' #if !defined(RAYGUI_NO_ICONS) - if (iconId >= 0) - { - // NOTE: We consider icon height, probably different than text size - GuiDrawIcon(iconId, (int)position.x, (int)(bounds.y + bounds.height/2 - RAYGUI_ICON_SIZE*guiIconScale/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height)), guiIconScale, tint); - position.x += (RAYGUI_ICON_SIZE*guiIconScale + ICON_TEXT_PADDING); - } + if ((lines[i] != NULL) && (lines[i][0] != '\0')) textSizeX += ICON_TEXT_PADDING; #endif - //DrawTextEx(guiFont, text, position, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING), tint); + } - // Get size in bytes of text, - // considering end of line and line break - int size = 0; - for (int c = 0; (lines[i][c] != '\0') && (lines[i][c] != '\n'); c++, size++){ } - float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/guiFont.baseSize; + // Check guiTextAlign global variables + switch (alignment) + { + case TEXT_ALIGN_LEFT: textBoundsPosition.x = textBounds.x; break; + case TEXT_ALIGN_CENTER: textBoundsPosition.x = textBounds.x + textBounds.width/2 - textSizeX/2; break; + case TEXT_ALIGN_RIGHT: textBoundsPosition.x = textBounds.x + textBounds.width - textSizeX; break; + default: break; + } - int textOffsetY = 0; - float textOffsetX = 0.0f; - for (int c = 0, codepointSize = 0; c < size; c += codepointSize) + switch (alignmentVertical) + { + // Only valid in case of wordWrap = 0; + case TEXT_ALIGN_TOP: textBoundsPosition.y = textBounds.y + posOffsetY; break; + case TEXT_ALIGN_MIDDLE: textBoundsPosition.y = textBounds.y + posOffsetY + textBounds.height/2 - totalHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(textBounds.height); break; + case TEXT_ALIGN_BOTTOM: textBoundsPosition.y = textBounds.y + posOffsetY + textBounds.height - totalHeight + TEXT_VALIGN_PIXEL_OFFSET(textBounds.height); break; + default: break; + } + + // NOTE: Make sure we get pixel-perfect coordinates, + // In case of decimals we got weird text positioning + textBoundsPosition.x = (float)((int)textBoundsPosition.x); + textBoundsPosition.y = (float)((int)textBoundsPosition.y); + //--------------------------------------------------------------------------------- + + // Draw text (with icon if available) + //--------------------------------------------------------------------------------- +#if !defined(RAYGUI_NO_ICONS) + if (iconId >= 0) + { + // NOTE: We consider icon height, probably different than text size + GuiDrawIcon(iconId, (int)textBoundsPosition.x, (int)(textBounds.y + textBounds.height/2 - RAYGUI_ICON_SIZE*guiIconScale/2 + TEXT_VALIGN_PIXEL_OFFSET(textBounds.height)), guiIconScale, tint); + textBoundsPosition.x += (RAYGUI_ICON_SIZE*guiIconScale + ICON_TEXT_PADDING); + } +#endif + // Get size in bytes of text, + // considering end of line and line break + int lineSize = 0; + for (int c = 0; (lines[i][c] != '\0') && (lines[i][c] != '\n') && (lines[i][c] != '\r'); c++, lineSize++){ } + float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/guiFont.baseSize; + + int textOffsetY = 0; + float textOffsetX = 0.0f; + float glyphWidth = 0; + for (int c = 0, codepointSize = 0; c < lineSize; c += codepointSize) + { + int codepoint = GetCodepointNext(&lines[i][c], &codepointSize); + int index = GetGlyphIndex(guiFont, codepoint); + + // NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f) + // but we need to draw all of the bad bytes using the '?' symbol moving one byte + if (codepoint == 0x3f) codepointSize = 1; // TODO: Review not recognized codepoints size + + // Wrap mode text measuring to space to validate if it can be drawn or + // a new line is required + if (wrapMode == TEXT_WRAP_CHAR) { - int codepoint = GetCodepointNext(&lines[i][c], &codepointSize); - int index = GetGlyphIndex(guiFont, codepoint); + // Get glyph width to check if it goes out of bounds + if (guiFont.glyphs[index].advanceX == 0) glyphWidth = ((float)guiFont.recs[index].width*scaleFactor); + else glyphWidth = (float)guiFont.glyphs[index].advanceX*scaleFactor; - // NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f) - // but we need to draw all of the bad bytes using the '?' symbol moving one byte - if (codepoint == 0x3f) codepointSize = 1; - - if (codepoint == '\n') break; // WARNING: Lines are already processed manually, no need to keep drawing after this codepoint - else + // Jump to next line if current character reach end of the box limits + if ((textOffsetX + glyphWidth) > textBounds.width) { - if ((codepoint != ' ') && (codepoint != '\t')) - { - // TODO: Draw only required text glyphs fitting the bounds.width, '...' can be appended at the end of the text - if (textOffsetX < bounds.width) - { - DrawTextCodepoint(guiFont, codepoint, RAYGUI_CLITERAL(Vector2){ position.x + textOffsetX, position.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), tint); - } - } - - if (guiFont.glyphs[index].advanceX == 0) textOffsetX += ((float)guiFont.recs[index].width*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); - else textOffsetX += ((float)guiFont.glyphs[index].advanceX*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + textOffsetX = 0.0f; + textOffsetY += GuiGetStyle(DEFAULT, TEXT_LINE_SPACING); } } + else if (wrapMode == TEXT_WRAP_WORD) + { + // Get width to next space in line + int nextSpaceIndex = 0; + float nextSpaceWidth = GetNextSpaceWidth(lines[i] + c, &nextSpaceIndex); - posOffsetY += (float)GuiGetStyle(DEFAULT, TEXT_SIZE)*1.5f; // TODO: GuiGetStyle(DEFAULT, TEXT_LINE_SPACING)? - //--------------------------------------------------------------------------------- + if ((textOffsetX + nextSpaceWidth) > textBounds.width) + { + textOffsetX = 0.0f; + textOffsetY += GuiGetStyle(DEFAULT, TEXT_LINE_SPACING); + } + + // TODO: Consider case: (nextSpaceWidth >= textBounds.width) + } + + if (codepoint == '\n') break; // WARNING: Lines are already processed manually, no need to keep drawing after this codepoint + else + { + // TODO: There are multiple types of spaces in Unicode, + // maybe it's a good idea to add support for more: http://jkorpela.fi/chars/spaces.html + if ((codepoint != ' ') && (codepoint != '\t')) // Do not draw codepoints with no glyph + { + if (wrapMode == TEXT_WRAP_NONE) + { + // Draw only required text glyphs fitting the textBounds.width + if (textOffsetX <= (textBounds.width - glyphWidth)) + { + DrawTextCodepoint(guiFont, codepoint, RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); + } + } + else if ((wrapMode == TEXT_WRAP_CHAR) || (wrapMode == TEXT_WRAP_WORD)) + { + // Draw only glyphs inside the bounds + if ((textBoundsPosition.y + textOffsetY) <= (textBounds.y + textBounds.height - GuiGetStyle(DEFAULT, TEXT_SIZE))) + { + DrawTextCodepoint(guiFont, codepoint, RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); + } + } + } + + if (guiFont.glyphs[index].advanceX == 0) textOffsetX += ((float)guiFont.recs[index].width*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + else textOffsetX += ((float)guiFont.glyphs[index].advanceX*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + } } + + if (wrapMode == TEXT_WRAP_NONE) posOffsetY += (float)GuiGetStyle(DEFAULT, TEXT_LINE_SPACING); + else if ((wrapMode == TEXT_WRAP_CHAR) || (wrapMode == TEXT_WRAP_WORD)) posOffsetY += (textOffsetY + (float)GuiGetStyle(DEFAULT, TEXT_LINE_SPACING)); + //--------------------------------------------------------------------------------- } + +#if defined(RAYGUI_DEBUG_TEXT_BOUNDS) + GuiDrawRectangle(textBounds, 0, WHITE, Fade(BLUE, 0.4f)); +#endif } // Gui draw rectangle using default raygui plain style with borders @@ -4048,16 +4917,41 @@ static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, if (color.a > 0) { // Draw rectangle filled with color - DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, color); + DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, GuiFade(color, guiAlpha)); } if (borderWidth > 0) { // Draw rectangle border lines with color - DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, borderWidth, borderColor); - DrawRectangle((int)rec.x, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, borderColor); - DrawRectangle((int)rec.x + (int)rec.width - borderWidth, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, borderColor); - DrawRectangle((int)rec.x, (int)rec.y + (int)rec.height - borderWidth, (int)rec.width, borderWidth, borderColor); + DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, borderWidth, GuiFade(borderColor, guiAlpha)); + DrawRectangle((int)rec.x, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, GuiFade(borderColor, guiAlpha)); + DrawRectangle((int)rec.x + (int)rec.width - borderWidth, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, GuiFade(borderColor, guiAlpha)); + DrawRectangle((int)rec.x, (int)rec.y + (int)rec.height - borderWidth, (int)rec.width, borderWidth, GuiFade(borderColor, guiAlpha)); + } + +#if defined(RAYGUI_DEBUG_RECS_BOUNDS) + DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, Fade(RED, 0.4f)); +#endif +} + +// Draw tooltip using control bounds +static void GuiTooltip(Rectangle controlRec) +{ + if (!guiLocked && guiTooltip && (guiTooltipPtr != NULL) && !guiSliderDragging) + { + Vector2 textSize = MeasureTextEx(GuiGetFont(), guiTooltipPtr, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + + if ((controlRec.x + textSize.x + 16) > GetScreenWidth()) controlRec.x -= (textSize.x + 16 - controlRec.width); + + GuiPanel(RAYGUI_CLITERAL(Rectangle){ controlRec.x, controlRec.y + controlRec.height + 4, textSize.x + 16, GuiGetStyle(DEFAULT, TEXT_SIZE) + 8.f }, NULL); + + int textPadding = GuiGetStyle(LABEL, TEXT_PADDING); + int textAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT); + GuiSetStyle(LABEL, TEXT_PADDING, 0); + GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + GuiLabel(RAYGUI_CLITERAL(Rectangle){ controlRec.x, controlRec.y + controlRec.height + 4, textSize.x + 16, GuiGetStyle(DEFAULT, TEXT_SIZE) + 8.f }, guiTooltipPtr); + GuiSetStyle(LABEL, TEXT_ALIGNMENT, textAlignment); + GuiSetStyle(LABEL, TEXT_PADDING, textPadding); } } @@ -4072,7 +4966,7 @@ static const char **GuiTextSplit(const char *text, char delimiter, int *count, i // 2. Maximum size of text to split is RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE // NOTE: Those definitions could be externally provided if required - // WARNING: HACK: TODO: Review! + // TODO: HACK: GuiTextSplit() - Review how textRows are returned to user // textRow is an externally provided array of integers that stores row number for every splitted string #if !defined(RAYGUI_TEXTSPLIT_MAX_ITEMS) @@ -4251,8 +5145,8 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) bool isVertical = (bounds.width > bounds.height)? false : true; // The size (width or height depending on scrollbar type) of the spinner buttons - const int spinnerSize = GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE)? - (isVertical? (int)bounds.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) : + const int spinnerSize = GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE)? + (isVertical? (int)bounds.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) : (int)bounds.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH)) : 0; // Arrow buttons [<] [>] [∧] [∨] @@ -4269,28 +5163,40 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) if (value > maxValue) value = maxValue; if (value < minValue) value = minValue; - const int range = maxValue - minValue; + const int valueRange = maxValue - minValue; int sliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); // Calculate rectangles for all of the components - arrowUpLeft = RAYGUI_CLITERAL(Rectangle){ - (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), - (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), + arrowUpLeft = RAYGUI_CLITERAL(Rectangle){ + (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), + (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize }; if (isVertical) { arrowDownRight = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + bounds.height - spinnerSize - GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize }; scrollbar = RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING), arrowUpLeft.y + arrowUpLeft.height, bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING)), bounds.height - arrowUpLeft.height - arrowDownRight.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) }; - sliderSize = (sliderSize >= scrollbar.height)? ((int)scrollbar.height - 2) : sliderSize; // Make sure the slider won't get outside of the scrollbar - slider = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), (float)scrollbar.y + (int)(((float)(value - minValue)/range)*(scrollbar.height - sliderSize)), (float)bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)), (float)sliderSize }; + + // Make sure the slider won't get outside of the scrollbar + sliderSize = (sliderSize >= scrollbar.height)? ((int)scrollbar.height - 2) : sliderSize; + slider = RAYGUI_CLITERAL(Rectangle){ + bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), + scrollbar.y + (int)(((float)(value - minValue)/valueRange)*(scrollbar.height - sliderSize)), + bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)), + (float)sliderSize }; } else // horizontal { arrowDownRight = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + bounds.width - spinnerSize - GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize }; scrollbar = RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x + arrowUpLeft.width, bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING), bounds.width - arrowUpLeft.width - arrowDownRight.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH), bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING)) }; - sliderSize = (sliderSize >= scrollbar.width)? ((int)scrollbar.width - 2) : sliderSize; // Make sure the slider won't get outside of the scrollbar - slider = RAYGUI_CLITERAL(Rectangle){ (float)scrollbar.x + (int)(((float)(value - minValue)/range)*(scrollbar.width - sliderSize)), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), (float)sliderSize, (float)bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)) }; + + // Make sure the slider won't get outside of the scrollbar + sliderSize = (sliderSize >= scrollbar.width)? ((int)scrollbar.width - 2) : sliderSize; + slider = RAYGUI_CLITERAL(Rectangle){ + scrollbar.x + (int)(((float)(value - minValue)/valueRange)*(scrollbar.width - sliderSize)), + bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), + (float)sliderSize, + bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)) }; } // Update control @@ -4299,7 +5205,27 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) { Vector2 mousePoint = GetMousePosition(); - if (CheckCollisionPointRec(mousePoint, bounds)) + if (guiSliderDragging) // Keep dragging outside of bounds + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON) && + !CheckCollisionPointRec(mousePoint, arrowUpLeft) && + !CheckCollisionPointRec(mousePoint, arrowDownRight)) + { + if (CHECK_BOUNDS_ID(bounds, guiSliderActive)) + { + state = STATE_PRESSED; + + if (isVertical) value = (int)(((float)(mousePoint.y - scrollbar.y - slider.height/2)*valueRange)/(scrollbar.height - slider.height) + minValue); + else value = (int)(((float)(mousePoint.x - scrollbar.x - slider.width/2)*valueRange)/(scrollbar.width - slider.width) + minValue); + } + } + else + { + guiSliderDragging = false; + guiSliderActive = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; + } + } + else if (CheckCollisionPointRec(mousePoint, bounds)) { state = STATE_FOCUSED; @@ -4307,26 +5233,38 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) int wheel = (int)GetMouseWheelMove(); if (wheel != 0) value += wheel; + // Handle mouse button down if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { - if (CheckCollisionPointRec(mousePoint, arrowUpLeft)) value -= range/GuiGetStyle(SCROLLBAR, SCROLL_SPEED); - else if (CheckCollisionPointRec(mousePoint, arrowDownRight)) value += range/GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + guiSliderDragging = true; + guiSliderActive = bounds; // Store bounds as an identifier when dragging starts + + // Check arrows click + if (CheckCollisionPointRec(mousePoint, arrowUpLeft)) value -= valueRange/GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + else if (CheckCollisionPointRec(mousePoint, arrowDownRight)) value += valueRange/GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + else if (!CheckCollisionPointRec(mousePoint, slider)) + { + // If click on scrollbar position but not on slider, place slider directly on that position + if (isVertical) value = (int)(((float)(mousePoint.y - scrollbar.y - slider.height/2)*valueRange)/(scrollbar.height - slider.height) + minValue); + else value = (int)(((float)(mousePoint.x - scrollbar.x - slider.width/2)*valueRange)/(scrollbar.width - slider.width) + minValue); + } state = STATE_PRESSED; } - else if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + + // Keyboard control on mouse hover scrollbar + /* + if (isVertical) { - if (!isVertical) - { - Rectangle scrollArea = { arrowUpLeft.x + arrowUpLeft.width, arrowUpLeft.y, scrollbar.width, bounds.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) }; - if (CheckCollisionPointRec(mousePoint, scrollArea)) value = (int)(((float)(mousePoint.x - scrollArea.x - slider.width/2)*range)/(scrollArea.width - slider.width) + minValue); - } - else - { - Rectangle scrollArea = { arrowUpLeft.x, arrowUpLeft.y+arrowUpLeft.height, bounds.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH), scrollbar.height }; - if (CheckCollisionPointRec(mousePoint, scrollArea)) value = (int)(((float)(mousePoint.y - scrollArea.y - slider.height/2)*range)/(scrollArea.height - slider.height) + minValue); - } + if (IsKeyDown(KEY_DOWN)) value += 5; + else if (IsKeyDown(KEY_UP)) value -= 5; } + else + { + if (IsKeyDown(KEY_RIGHT)) value += 5; + else if (IsKeyDown(KEY_LEFT)) value -= 5; + } + */ } // Normalize value @@ -4337,28 +5275,28 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(SCROLLBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED)), guiAlpha)); // Draw the background + GuiDrawRectangle(bounds, GuiGetStyle(SCROLLBAR, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED))); // Draw the background - GuiDrawRectangle(scrollbar, 0, BLANK, Fade(GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL)), guiAlpha)); // Draw the scrollbar active area background - GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, BORDER + state*3)), guiAlpha)); // Draw the slider bar + GuiDrawRectangle(scrollbar, 0, BLANK, GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL))); // Draw the scrollbar active area background + GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BORDER + state*3))); // Draw the slider bar // Draw arrows (using icon if available) if (GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE)) { #if defined(RAYGUI_NO_ICONS) - GuiDrawText(isVertical? "^" : "<", + GuiDrawText(isVertical? "^" : "<", RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x, arrowUpLeft.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha)); - GuiDrawText(isVertical? "v" : ">", + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); + GuiDrawText(isVertical? "v" : ">", RAYGUI_CLITERAL(Rectangle){ arrowDownRight.x, arrowDownRight.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha)); + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); #else - GuiDrawText(isVertical? "#121#" : "#118#", + GuiDrawText(isVertical? "#121#" : "#118#", RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x, arrowUpLeft.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3)), guiAlpha)); // ICON_ARROW_UP_FILL / ICON_ARROW_LEFT_FILL - GuiDrawText(isVertical? "#120#" : "#119#", + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3))); // ICON_ARROW_UP_FILL / ICON_ARROW_LEFT_FILL + GuiDrawText(isVertical? "#120#" : "#119#", RAYGUI_CLITERAL(Rectangle){ arrowDownRight.x, arrowDownRight.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3)), guiAlpha)); // ICON_ARROW_DOWN_FILL / ICON_ARROW_RIGHT_FILL + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3))); // ICON_ARROW_DOWN_FILL / ICON_ARROW_RIGHT_FILL #endif } //-------------------------------------------------------------------- @@ -4366,6 +5304,18 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) return value; } +// Color fade-in or fade-out, alpha goes from 0.0f to 1.0f +// WARNING: It multiplies current alpha by alpha scale factor +static Color GuiFade(Color color, float alpha) +{ + if (alpha < 0.0f) alpha = 0.0f; + else if (alpha > 1.0f) alpha = 1.0f; + + Color result = { color.r, color.g, color.b, (unsigned char)(color.a*alpha) }; + + return result; +} + #if defined(RAYGUI_STANDALONE) // Returns a Color struct from hexadecimal value static Color GetColor(int hexValue) @@ -4397,17 +5347,6 @@ static bool CheckCollisionPointRec(Vector2 point, Rectangle rec) return collision; } -// Color fade-in or fade-out, alpha goes from 0.0f to 1.0f -static Color Fade(Color color, float alpha) -{ - if (alpha < 0.0f) alpha = 0.0f; - else if (alpha > 1.0f) alpha = 1.0f; - - Color result = { color.r, color.g, color.b, (unsigned char)(255.0f*alpha) }; - - return result; -} - // Formatting of text with variables to 'embed' static const char *TextFormat(const char *text, ...) { @@ -4443,7 +5382,7 @@ const char **TextSplit(const char *text, char delimiter, int *count) // 2. Maximum size of text to split is RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE #if !defined(RAYGUI_TEXTSPLIT_MAX_ITEMS) - #define RAYGUI_TEXTSPLIT_MAX_ITEMS 128 + #define RAYGUI_TEXTSPLIT_MAX_ITEMS 128 #endif #if !defined(RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE) #define RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE 1024 @@ -4545,37 +5484,40 @@ static int GetCodepointNext(const char *text, int *codepointSize) { const char *ptr = text; int codepoint = 0x3f; // Codepoint (defaults to '?') - *codepointSize = 0; + *codepointSize = 1; // Get current codepoint and bytes processed if (0xf0 == (0xf8 & ptr[0])) { // 4 byte UTF-8 codepoint + if(((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80) || ((ptr[3] & 0xC0) ^ 0x80)) { return codepoint; } //10xxxxxx checks codepoint = ((0x07 & ptr[0]) << 18) | ((0x3f & ptr[1]) << 12) | ((0x3f & ptr[2]) << 6) | (0x3f & ptr[3]); *codepointSize = 4; } else if (0xe0 == (0xf0 & ptr[0])) { // 3 byte UTF-8 codepoint */ + if(((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80)) { return codepoint; } //10xxxxxx checks codepoint = ((0x0f & ptr[0]) << 12) | ((0x3f & ptr[1]) << 6) | (0x3f & ptr[2]); *codepointSize = 3; } else if (0xc0 == (0xe0 & ptr[0])) { // 2 byte UTF-8 codepoint + if((ptr[1] & 0xC0) ^ 0x80) { return codepoint; } //10xxxxxx checks codepoint = ((0x1f & ptr[0]) << 6) | (0x3f & ptr[1]); *codepointSize = 2; } - else + else if (0x00 == (0x80 & ptr[0])) { // 1 byte UTF-8 codepoint codepoint = ptr[0]; *codepointSize = 1; } + return codepoint; } #endif // RAYGUI_STANDALONE #endif // RAYGUI_IMPLEMENTATION -