diff --git a/examples/gui/basic_controls/cyber.png b/examples/gui/basic_controls/cyber.png new file mode 100644 index 0000000..219a009 Binary files /dev/null and b/examples/gui/basic_controls/cyber.png differ diff --git a/examples/gui/basic_controls/go.mod b/examples/gui/basic_controls/go.mod new file mode 100644 index 0000000..1b94db7 --- /dev/null +++ b/examples/gui/basic_controls/go.mod @@ -0,0 +1,11 @@ +module example + +go 1.19 + +require ( + github.com/gen2brain/raylib-go/raygui v0.0.0-20221122151443-e8a384ed1346 + github.com/gen2brain/raylib-go/raylib v0.0.0-20221122155035-fe6d2c0ed32a +) + +replace github.com/gen2brain/raylib-go/raylib => ../../../raylib +replace github.com/gen2brain/raylib-go/raygui => ../../../raygui diff --git a/examples/gui/basic_controls/lavanda.png b/examples/gui/basic_controls/lavanda.png new file mode 100644 index 0000000..d3a53c8 Binary files /dev/null and b/examples/gui/basic_controls/lavanda.png differ diff --git a/examples/gui/basic_controls/main.go b/examples/gui/basic_controls/main.go index 107e2e7..b51838f 100644 --- a/examples/gui/basic_controls/main.go +++ b/examples/gui/basic_controls/main.go @@ -2,9 +2,10 @@ package main import ( "fmt" + "strings" - "github.com/gen2brain/raylib-go/raygui" - "github.com/gen2brain/raylib-go/raylib" + gui "github.com/gen2brain/raylib-go/raygui" + rl "github.com/gen2brain/raylib-go/raylib" ) func main() { @@ -19,19 +20,21 @@ func main() { buttonClicked := false checkboxChecked := false - spinnerValue := 5 + spinnerValue := int32(5) sliderValue := float32(10) sliderBarValue := float32(70) progressValue := float32(0.5) - comboActive := 0 - comboLastActive := 0 - toggleActive := 0 + comboActive := int32(0) + comboLastActive := int32(0) + toggleActive := int32(0) - toggleText := []string{"Item 1", "Item 2", "Item 3"} - comboText := []string{"default_light", "default_dark", "hello_kitty", "monokai", "obsidian", "solarized_light", "solarized", "zahnrad"} - - var inputText string + 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) @@ -47,44 +50,39 @@ func main() { rl.ClearBackground(rl.Beige) - raygui.Label(rl.NewRectangle(50, 50, 80, 20), "Label") + gui.Label(rl.NewRectangle(50, 50, 80, 20), "Label") - buttonClicked = raygui.Button(rl.NewRectangle(50, 70, 80, 40), "Button") + buttonClicked = gui.Button(rl.NewRectangle(50, 70, 80, 40), "Button") - raygui.Label(rl.NewRectangle(70, 140, 20, 20), "Checkbox") - checkboxChecked = raygui.CheckBox(rl.NewRectangle(50, 140, 20, 20), checkboxChecked) + checkboxChecked = gui.CheckBox(rl.NewRectangle(50, 140, 20, 20), "Checkbox", checkboxChecked) - raygui.Label(rl.NewRectangle(50, 190, 200, 20), "ProgressBar") - raygui.ProgressBar(rl.NewRectangle(50, 210, 200, 20), progressValue) - raygui.Label(rl.NewRectangle(200+50+5, 210, 20, 20), fmt.Sprintf("%.1f", progressValue)) + gui.ProgressBar(rl.NewRectangle(50, 210, 200, 20), + fmt.Sprintf("%.1f", progressValue), + "ProgressBar", + progressValue, 0, 1) - raygui.Label(rl.NewRectangle(50, 260, 200, 20), "Slider") - sliderValue = raygui.Slider(rl.NewRectangle(50, 280, 200, 20), sliderValue, 0, 100) - raygui.Label(rl.NewRectangle(200+50+5, 280, 20, 20), fmt.Sprintf("%.0f", sliderValue)) + 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 = raygui.ToggleButton(rl.NewRectangle(50, 350, 100, 40), "ToggleButton", buttonToggle) + buttonToggle = gui.Toggle(rl.NewRectangle(50, 350, 100, 40), "ButtonToggle", buttonToggle) - raygui.Label(rl.NewRectangle(500, 50, 200, 20), "ToggleGroup") - toggleActive = raygui.ToggleGroup(rl.NewRectangle(500, 70, 60, 30), toggleText, toggleActive) + toggleActive = gui.ToggleGroup(rl.NewRectangle(500, 70, 60, 30), toggleText, toggleActive) - raygui.Label(rl.NewRectangle(500, 120, 200, 20), "SliderBar") - sliderBarValue = raygui.SliderBar(rl.NewRectangle(500, 140, 200, 20), sliderBarValue, 0, 100) - raygui.Label(rl.NewRectangle(500+200+5, 140, 20, 20), fmt.Sprintf("%.0f", sliderBarValue)) + 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)) - raygui.Label(rl.NewRectangle(500, 190, 200, 20), "Spinner") - spinnerValue = raygui.Spinner(rl.NewRectangle(500, 210, 200, 20), spinnerValue, 0, 100) + _ = gui.Spinner(rl.NewRectangle(500, 210, 200, 20), "Spinner", &spinnerValue, 0, 100, true) - raygui.Label(rl.NewRectangle(500, 260, 200, 20), "ComboBox") - comboActive = raygui.ComboBox(rl.NewRectangle(500, 280, 200, 20), comboText, comboActive) + gui.Label(rl.NewRectangle(500, 260, 200, 20), "ComboBox") + comboActive = gui.ComboBox(rl.NewRectangle(500, 280, 200, 20), comboList, comboActive) if comboLastActive != comboActive { - raygui.LoadGuiStyle(fmt.Sprintf("styles/%s.style", comboText[comboActive])) + ch := comboText[comboActive] // choosed name + filename := fmt.Sprintf("styles/%s/%s.rgs", ch, ch) + gui.LoadStyle(filename) comboLastActive = comboActive } - raygui.Label(rl.NewRectangle(500, 330, 200, 20), "TextBox") - inputText = raygui.TextBox(rl.NewRectangle(500, 350, 200, 20), inputText) - rl.EndDrawing() } diff --git a/examples/gui/basic_controls/styles/README.md b/examples/gui/basic_controls/styles/README.md new file mode 100644 index 0000000..b78e6f3 --- /dev/null +++ b/examples/gui/basic_controls/styles/README.md @@ -0,0 +1,50 @@ +# 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 new file mode 100644 index 0000000..dc8adc0 --- /dev/null +++ b/examples/gui/basic_controls/styles/ashes/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..f301ff2 --- /dev/null +++ b/examples/gui/basic_controls/styles/ashes/ashes.h @@ -0,0 +1,338 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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, 0x06, 0x00, 0xc0, 0x7f, 0xe2, 0xc7, 0x9f, 0xc4, + 0xe6, 0x23, 0xe3, 0xf0, 0x72, 0xfe, 0xfd, 0x79, 0x6c, 0xfc, 0x36, 0xb7, 0xbc, 0x38, 0xfc, 0xbc, 0x95, 0xdf, 0xc4, 0x8f, + 0xeb, 0x17, 0xd3, 0xcf, 0x1a, 0x87, 0xff, 0x9a, 0x4f, 0x8f, 0xfd, 0xf4, 0x9c, 0x71, 0xd1, 0xfc, 0xe3, 0xc3, 0xf2, 0x3e, + 0x2f, 0x31, 0x26, 0xf6, 0x89, 0x63, 0xcf, 0x7b, 0x3c, 0xd3, 0xf9, 0xed, 0xb9, 0xb5, 0x6f, 0x1d, 0x7f, 0xec, 0xfe, 0x36, + 0x5e, 0x9b, 0xff, 0xdf, 0xff, 0xc6, 0xc6, 0x6f, 0x6b, 0x19, 0xaf, 0x19, 0xe9, 0x9f, 0xd7, 0x34, 0x9a, 0xd2, 0x3e, 0xbe, + 0xd7, 0xc6, 0xd4, 0x71, 0xa8, 0xb2, 0xf4, 0xfa, 0x1a, 0x8f, 0x64, 0x5a, 0xb1, 0xb3, 0x17, 0x46, 0x7a, 0x89, 0xb3, 0xc7, + 0xf3, 0xca, 0xf8, 0xbf, 0x4a, 0xfe, 0xb5, 0xbd, 0x39, 0x2e, 0x90, 0x7f, 0x25, 0xb9, 0x68, 0x58, 0xd3, 0x68, 0x3a, 0xff, + 0xaf, 0x48, 0x3f, 0x9b, 0x7f, 0x34, 0x6e, 0x81, 0xce, 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8, 0x1e, 0xd3, 0xf7, 0x6a, 0x46, 0xcb, 0x77, 0xa7, 0xe8, 0x76, + 0xdd, 0xa3, 0xfd, 0x18, 0x8b, 0xde, 0xdd, 0xc8, 0xff, 0x1e, 0x1d, 0x48, 0xf9, 0xdb, 0xfb, 0xbe, 0xb7, 0xaf, 0xf0, 0x86, + 0x3d, 0x46, 0xb3, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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 new file mode 100644 index 0000000..f491d68 Binary files /dev/null and b/examples/gui/basic_controls/styles/ashes/ashes.rgs differ diff --git a/examples/gui/basic_controls/styles/ashes/ashes.txt.rgs b/examples/gui/basic_controls/styles/ashes/ashes.txt.rgs new file mode 100644 index 0000000..45ab7bd --- /dev/null +++ b/examples/gui/basic_controls/styles/ashes/ashes.txt.rgs @@ -0,0 +1,24 @@ +# +# 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 new file mode 100644 index 0000000..1a6b338 --- /dev/null +++ b/examples/gui/basic_controls/styles/ashes/font_readme.txt @@ -0,0 +1,51 @@ + +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 new file mode 100644 index 0000000..f86859a Binary files /dev/null and b/examples/gui/basic_controls/styles/ashes/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/ashes/style_table.png b/examples/gui/basic_controls/styles/ashes/style_table.png new file mode 100644 index 0000000..8fcee09 Binary files /dev/null and b/examples/gui/basic_controls/styles/ashes/style_table.png differ diff --git a/examples/gui/basic_controls/styles/ashes/v5loxical.ttf b/examples/gui/basic_controls/styles/ashes/v5loxical.ttf new file mode 100644 index 0000000..61501cb Binary files /dev/null and b/examples/gui/basic_controls/styles/ashes/v5loxical.ttf differ diff --git a/examples/gui/basic_controls/styles/bluish/README.md b/examples/gui/basic_controls/styles/bluish/README.md new file mode 100644 index 0000000..1057dde --- /dev/null +++ b/examples/gui/basic_controls/styles/bluish/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..6020210 --- /dev/null +++ b/examples/gui/basic_controls/styles/bluish/bluish.h @@ -0,0 +1,359 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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, 0x1a, 0x3b, 0x99, 0xb9, 0x2d, 0x2b, + 0x58, 0x21, 0x08, 0x6d, 0x4f, 0xcf, 0xb4, 0x0f, 0x91, 0x51, 0x24, 0x2d, 0xe0, 0x34, 0x5a, 0x2f, 0x75, 0x02, 0x00, 0xf8, + 0xcd, 0x1c, 0x7c, 0x6d, 0x0e, 0x5f, 0x3d, 0x27, 0x7a, 0x7a, 0x7d, 0x7d, 0x6e, 0xb4, 0xe7, 0x7a, 0x9b, 0x13, 0x3d, 0xb4, + 0x5a, 0xda, 0x6d, 0xbf, 0x2a, 0x6f, 0x23, 0x56, 0x76, 0xfe, 0x5a, 0x8f, 0xed, 0x55, 0xca, 0xbc, 0x7e, 0x4e, 0xcd, 0x62, + 0x5b, 0x0d, 0xbe, 0xb6, 0x6e, 0xce, 0xb7, 0xd6, 0x12, 0xb4, 0xcc, 0xb5, 0x06, 0xe3, 0xa9, 0x1f, 0x47, 0x6d, 0xf7, 0xd8, + 0x3a, 0x6a, 0xeb, 0x7b, 0x2c, 0x1b, 0x7d, 0x2c, 0xe1, 0x59, 0xf1, 0xf3, 0x3b, 0x46, 0x2b, 0xb4, 0x06, 0xf1, 0xac, 0x9b, + 0xaf, 0x7d, 0x29, 0x87, 0x5e, 0xdd, 0xfa, 0x0e, 0xb5, 0x2e, 0x75, 0x79, 0xaf, 0xc7, 0xaf, 0xb3, 0xa8, 0xa9, 0xd7, 0xc7, + 0x2d, 0xe7, 0xe3, 0xbf, 0x7e, 0x8c, 0xa7, 0x6c, 0x5c, 0x07, 0x3f, 0xa3, 0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f9, + 0x63, 0xb9, 0xf8, 0x47, 0x4f, 0xab, 0x5b, 0x4f, 0x3e, 0xf9, 0xe9, 0x9a, 0x2a, 0x1b, 0xe3, 0x9f, 0x60, 0x33, 0xae, 0x9a, + 0xc7, 0xf8, 0x1a, 0x1b, 0xad, 0x9d, 0xf2, 0x38, 0xaf, 0x32, 0x17, 0xff, 0xab, 0x6a, 0x3b, 0x5c, 0x53, 0x65, 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 new file mode 100644 index 0000000..d3d21ff Binary files /dev/null and b/examples/gui/basic_controls/styles/bluish/bluish.rgs differ diff --git a/examples/gui/basic_controls/styles/bluish/bluish.txt.rgs b/examples/gui/basic_controls/styles/bluish/bluish.txt.rgs new file mode 100644 index 0000000..9a2b7c4 --- /dev/null +++ b/examples/gui/basic_controls/styles/bluish/bluish.txt.rgs @@ -0,0 +1,24 @@ +# +# 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 new file mode 100644 index 0000000..8dd9bdc --- /dev/null +++ b/examples/gui/basic_controls/styles/bluish/font_readme.txt @@ -0,0 +1,76 @@ +_______________________________ +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 new file mode 100644 index 0000000..45c23e0 Binary files /dev/null and b/examples/gui/basic_controls/styles/bluish/homespun.ttf differ diff --git a/examples/gui/basic_controls/styles/bluish/screenshot.png b/examples/gui/basic_controls/styles/bluish/screenshot.png new file mode 100644 index 0000000..3255fdc Binary files /dev/null and b/examples/gui/basic_controls/styles/bluish/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/bluish/style_table.png b/examples/gui/basic_controls/styles/bluish/style_table.png new file mode 100644 index 0000000..6889f6c Binary files /dev/null and b/examples/gui/basic_controls/styles/bluish/style_table.png differ diff --git a/examples/gui/basic_controls/styles/candy/README.md b/examples/gui/basic_controls/styles/candy/README.md new file mode 100644 index 0000000..3442189 --- /dev/null +++ b/examples/gui/basic_controls/styles/candy/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..ef5d5e6 --- /dev/null +++ b/examples/gui/basic_controls/styles/candy/candy.h @@ -0,0 +1,346 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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, 0x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0xf5, 0xdb, 0x74, 0x12, 0xc6, 0x7d, 0xa3, 0xcf, 0xba, 0xdb, 0x77, 0xe2, 0x2c, 0x6c, 0xa8, + 0x3f, 0xea, 0x4f, 0x7d, 0xd6, 0xe3, 0xc4, 0x79, 0x78, 0xd1, 0xfe, 0x51, 0x7f, 0xd4, 0x9f, 0x73, 0xae, 0xff, 0xf9, 0xe6, + 0xef, 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 new file mode 100644 index 0000000..65c000f Binary files /dev/null and b/examples/gui/basic_controls/styles/candy/candy.rgs differ diff --git a/examples/gui/basic_controls/styles/candy/candy.txt.rgs b/examples/gui/basic_controls/styles/candy/candy.txt.rgs new file mode 100644 index 0000000..fe43d10 --- /dev/null +++ b/examples/gui/basic_controls/styles/candy/candy.txt.rgs @@ -0,0 +1,24 @@ +# +# 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 new file mode 100644 index 0000000..cfd8cb2 --- /dev/null +++ b/examples/gui/basic_controls/styles/candy/font_readme.txt @@ -0,0 +1,27 @@ + +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 new file mode 100644 index 0000000..e84aef3 Binary files /dev/null and b/examples/gui/basic_controls/styles/candy/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/candy/style_table.png b/examples/gui/basic_controls/styles/candy/style_table.png new file mode 100644 index 0000000..fcbf972 Binary files /dev/null and b/examples/gui/basic_controls/styles/candy/style_table.png differ diff --git a/examples/gui/basic_controls/styles/candy/v5easter.ttf b/examples/gui/basic_controls/styles/candy/v5easter.ttf new file mode 100644 index 0000000..77a911a Binary files /dev/null and b/examples/gui/basic_controls/styles/candy/v5easter.ttf differ diff --git a/examples/gui/basic_controls/styles/cherry/README.md b/examples/gui/basic_controls/styles/cherry/README.md new file mode 100644 index 0000000..eb9f3d1 --- /dev/null +++ b/examples/gui/basic_controls/styles/cherry/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..68efae8 Binary files /dev/null and b/examples/gui/basic_controls/styles/cherry/Westington.ttf differ diff --git a/examples/gui/basic_controls/styles/cherry/cherry.h b/examples/gui/basic_controls/styles/cherry/cherry.h new file mode 100644 index 0000000..93d8335 --- /dev/null +++ b/examples/gui/basic_controls/styles/cherry/cherry.h @@ -0,0 +1,360 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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_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 0x99, 0x6c, 0xb8, 0x67, 0xa7, 0xaf, 0x8f, 0x66, 0x64, 0xe6, 0xfe, 0x27, 0x7f, 0x0a, 0xc9, 0x90, + 0xdd, 0x99, 0x65, 0xf9, 0x44, 0xfd, 0xeb, 0x19, 0xc0, 0x6e, 0x66, 0xd0, 0xde, 0xff, 0xd4, 0xfc, 0xd7, 0xfd, 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 new file mode 100644 index 0000000..83b341b Binary files /dev/null and b/examples/gui/basic_controls/styles/cherry/cherry.rgs differ diff --git a/examples/gui/basic_controls/styles/cherry/cherry.txt.rgs b/examples/gui/basic_controls/styles/cherry/cherry.txt.rgs new file mode 100644 index 0000000..a830816 --- /dev/null +++ b/examples/gui/basic_controls/styles/cherry/cherry.txt.rgs @@ -0,0 +1,24 @@ +# +# 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 new file mode 100644 index 0000000..669a40b Binary files /dev/null and b/examples/gui/basic_controls/styles/cherry/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/cherry/style_table.png b/examples/gui/basic_controls/styles/cherry/style_table.png new file mode 100644 index 0000000..b556206 Binary files /dev/null and b/examples/gui/basic_controls/styles/cherry/style_table.png 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 new file mode 100644 index 0000000..165c3e7 Binary files /dev/null and b/examples/gui/basic_controls/styles/cyber/Kyrou 7 Wide.ttf differ diff --git a/examples/gui/basic_controls/styles/cyber/README.md b/examples/gui/basic_controls/styles/cyber/README.md new file mode 100644 index 0000000..10de60b --- /dev/null +++ b/examples/gui/basic_controls/styles/cyber/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..627131c --- /dev/null +++ b/examples/gui/basic_controls/styles/cyber/cyber.h @@ -0,0 +1,345 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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, 0x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 0xcf, 0xa2, 0x4a, 0xda, 0x7e, 0xed, 0xbf, 0x40, 0x69, 0x05, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd9, 0xf3, 0x6e, 0x79, 0x42, 0x9a, 0xaa, 0x25, 0x4f, 0xd3, 0x96, 0x14, 0x39, 0x9e, + 0x5b, 0x32, 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 new file mode 100644 index 0000000..577a195 Binary files /dev/null and b/examples/gui/basic_controls/styles/cyber/cyber.rgs differ diff --git a/examples/gui/basic_controls/styles/cyber/cyber.txt.rgs b/examples/gui/basic_controls/styles/cyber/cyber.txt.rgs new file mode 100644 index 0000000..7d4d346 --- /dev/null +++ b/examples/gui/basic_controls/styles/cyber/cyber.txt.rgs @@ -0,0 +1,24 @@ +# +# 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 new file mode 100644 index 0000000..45def0a --- /dev/null +++ b/examples/gui/basic_controls/styles/cyber/font_readme.txt @@ -0,0 +1,36 @@ +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 new file mode 100644 index 0000000..5f0b4b7 Binary files /dev/null and b/examples/gui/basic_controls/styles/cyber/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/cyber/style_table.png b/examples/gui/basic_controls/styles/cyber/style_table.png new file mode 100644 index 0000000..b16d320 Binary files /dev/null and b/examples/gui/basic_controls/styles/cyber/style_table.png differ diff --git a/examples/gui/basic_controls/styles/dark/PixelOperator.ttf b/examples/gui/basic_controls/styles/dark/PixelOperator.ttf new file mode 100644 index 0000000..34fe947 Binary files /dev/null and b/examples/gui/basic_controls/styles/dark/PixelOperator.ttf differ diff --git a/examples/gui/basic_controls/styles/dark/README.md b/examples/gui/basic_controls/styles/dark/README.md new file mode 100644 index 0000000..f9377c4 --- /dev/null +++ b/examples/gui/basic_controls/styles/dark/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..17d6f13 --- /dev/null +++ b/examples/gui/basic_controls/styles/dark/dark.h @@ -0,0 +1,347 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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, 0x3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, 0xe7, 0xab, 0x3b, 0xdf, + 0xbf, 0xff, 0x57, 0xe7, 0xff, 0x3d, 0xe3, 0xff, 0xea, 0xb5, 0xb4, 0xf3, 0xf3, 0xff, 0xcf, 0x18, 0xff, 0xef, 0xbc, 0x22, + 0x73, 0xac, 0xbd, 0x5e, 0x5e, 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 new file mode 100644 index 0000000..9021402 Binary files /dev/null and b/examples/gui/basic_controls/styles/dark/dark.rgs differ diff --git a/examples/gui/basic_controls/styles/dark/font_LICENSE.txt b/examples/gui/basic_controls/styles/dark/font_LICENSE.txt new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/examples/gui/basic_controls/styles/dark/font_LICENSE.txt @@ -0,0 +1,121 @@ +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 new file mode 100644 index 0000000..febb132 Binary files /dev/null and b/examples/gui/basic_controls/styles/dark/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/dark/style_table.png b/examples/gui/basic_controls/styles/dark/style_table.png new file mode 100644 index 0000000..2a3cd55 Binary files /dev/null and b/examples/gui/basic_controls/styles/dark/style_table.png differ diff --git a/examples/gui/basic_controls/styles/default/README.md b/examples/gui/basic_controls/styles/default/README.md new file mode 100644 index 0000000..e1f15d0 --- /dev/null +++ b/examples/gui/basic_controls/styles/default/README.md @@ -0,0 +1,14 @@ +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 new file mode 100644 index 0000000..fa325a6 --- /dev/null +++ b/examples/gui/basic_controls/styles/default/default.txt.rgs @@ -0,0 +1,69 @@ +# +# 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 new file mode 100644 index 0000000..c3b750a Binary files /dev/null and b/examples/gui/basic_controls/styles/default/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/default/style_table.png b/examples/gui/basic_controls/styles/default/style_table.png new file mode 100644 index 0000000..191a14f Binary files /dev/null and b/examples/gui/basic_controls/styles/default/style_table.png differ diff --git a/examples/gui/basic_controls/styles/default_dark.style b/examples/gui/basic_controls/styles/default_dark.style deleted file mode 100644 index 4b903c8..0000000 --- a/examples/gui/basic_controls/styles/default_dark.style +++ /dev/null @@ -1,99 +0,0 @@ -GLOBAL_BASE_COLOR 0xf5f5f5ff -GLOBAL_BORDER_COLOR 0xf5f5f5ff -GLOBAL_TEXT_COLOR 0xf5f5f5ff -GLOBAL_TEXT_FONTSIZE 0xa -GLOBAL_BORDER_WIDTH 0x1 -BACKGROUND_COLOR 0x293235ff -LINES_COLOR 0x90abb5ff -LABEL_BORDER_WIDTH 0x0 -LABEL_TEXT_COLOR 0x90acb4ff -LABEL_TEXT_PADDING 0x0 -BUTTON_BORDER_WIDTH 0x2 -BUTTON_TEXT_PADDING 0x0 -BUTTON_DEFAULT_BORDER_COLOR 0x3e4a4fff -BUTTON_DEFAULT_INSIDE_COLOR 0x344041ff -BUTTON_DEFAULT_TEXT_COLOR 0x90acb4ff -BUTTON_HOVER_BORDER_COLOR 0x47595fff -BUTTON_HOVER_INSIDE_COLOR 0x334f59ff -BUTTON_HOVER_TEXT_COLOR 0x90acb4ff -BUTTON_PRESSED_BORDER_COLOR 0x5f9aa4ff -BUTTON_PRESSED_INSIDE_COLOR 0x334f59ff -BUTTON_PRESSED_TEXT_COLOR 0x5f9aa8ff -TOGGLE_TEXT_PADDING 0x20 -TOGGLE_BORDER_WIDTH 0x1 -TOGGLE_DEFAULT_BORDER_COLOR 0x3e4b4dff -TOGGLE_DEFAULT_INSIDE_COLOR 0x344041ff -TOGGLE_DEFAULT_TEXT_COLOR 0x828282ff -TOGGLE_HOVER_BORDER_COLOR 0x47595fff -TOGGLE_HOVER_INSIDE_COLOR 0x334f59ff -TOGGLE_HOVER_TEXT_COLOR 0x828282ff -TOGGLE_PRESSED_BORDER_COLOR 0x5f9aa8ff -TOGGLE_PRESSED_INSIDE_COLOR 0x334f59ff -TOGGLE_PRESSED_TEXT_COLOR 0x5f9aa8ff -TOGGLE_ACTIVE_BORDER_COLOR 0x92c763ff -TOGGLE_ACTIVE_INSIDE_COLOR 0x334f59ff -TOGGLE_ACTIVE_TEXT_COLOR 0x92c763ff -TOGGLEGROUP_PADDING 0x3 -SLIDER_BORDER_WIDTH 0x1 -SLIDER_BUTTON_BORDER_WIDTH 0x0 -SLIDER_BORDER_COLOR 0x828282ff -SLIDER_INSIDE_COLOR 0x3e4b4dff -SLIDER_DEFAULT_COLOR 0x92c763ff -SLIDER_HOVER_COLOR 0xc3e0a9ff -SLIDER_ACTIVE_COLOR 0xffffffff -SLIDERBAR_BORDER_COLOR 0x828282ff -SLIDERBAR_INSIDE_COLOR 0x344041ff -SLIDERBAR_DEFAULT_COLOR 0x92c763ff -SLIDERBAR_HOVER_COLOR 0xc3e0a9ff -SLIDERBAR_ACTIVE_COLOR 0xffffffff -SLIDERBAR_ZERO_LINE_COLOR 0x828282ff -PROGRESSBAR_BORDER_COLOR 0x828282ff -PROGRESSBAR_INSIDE_COLOR 0x3e4b4dff -PROGRESSBAR_PROGRESS_COLOR 0x92c763ff -PROGRESSBAR_BORDER_WIDTH 0x1 -SPINNER_LABEL_BORDER_COLOR 0x3e4b4dff -SPINNER_LABEL_INSIDE_COLOR 0x344041ff -SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x3e4b4dff -SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0x344041ff -SPINNER_DEFAULT_SYMBOL_COLOR 0x5f9aa8ff -SPINNER_DEFAULT_TEXT_COLOR 0x5f9aa8ff -SPINNER_HOVER_BUTTON_BORDER_COLOR 0x47595fff -SPINNER_HOVER_BUTTON_INSIDE_COLOR 0x334f59ff -SPINNER_HOVER_SYMBOL_COLOR 0x5f9aa8ff -SPINNER_HOVER_TEXT_COLOR 0x5f9aa8ff -SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x92c763ff -SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0x334f59ff -SPINNER_PRESSED_SYMBOL_COLOR 0x92c763ff -SPINNER_PRESSED_TEXT_COLOR 0x92c763ff -COMBOBOX_PADDING 0x1 -COMBOBOX_BUTTON_WIDTH 0x30 -COMBOBOX_BUTTON_HEIGHT 0x20 -COMBOBOX_BORDER_WIDTH 0x1 -COMBOBOX_DEFAULT_BORDER_COLOR 0x3e4b4dff -COMBOBOX_DEFAULT_INSIDE_COLOR 0x344041ff -COMBOBOX_DEFAULT_TEXT_COLOR 0x5f9aa8ff -COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0x5f9aa8ff -COMBOBOX_HOVER_BORDER_COLOR 0x47595fff -COMBOBOX_HOVER_INSIDE_COLOR 0x334f59ff -COMBOBOX_HOVER_TEXT_COLOR 0x5f9aa8ff -COMBOBOX_HOVER_LIST_TEXT_COLOR 0x5f9aa8ff -COMBOBOX_PRESSED_BORDER_COLOR 0x5f9aa8ff -COMBOBOX_PRESSED_INSIDE_COLOR 0x334f59ff -COMBOBOX_PRESSED_TEXT_COLOR 0x5f9aa8ff -COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x92c763ff -COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x334f59ff -COMBOBOX_PRESSED_LIST_TEXT_COLOR 0x92c763ff -CHECKBOX_DEFAULT_BORDER_COLOR 0x47595fff -CHECKBOX_DEFAULT_INSIDE_COLOR 0x344041ff -CHECKBOX_HOVER_BORDER_COLOR 0x47595fff -CHECKBOX_HOVER_INSIDE_COLOR 0x334f59ff -CHECKBOX_CLICK_BORDER_COLOR 0x5f9aa8ff -CHECKBOX_CLICK_INSIDE_COLOR 0x334f59ff -CHECKBOX_STATUS_ACTIVE_COLOR 0x92c763ff -CHECKBOX_INSIDE_WIDTH 0x2 -TEXTBOX_BORDER_WIDTH 0x1 -TEXTBOX_BORDER_COLOR 0x47595fff -TEXTBOX_INSIDE_COLOR 0x828282ff -TEXTBOX_TEXT_COLOR 0xff -TEXTBOX_LINE_COLOR 0xff -TEXTBOX_TEXT_FONTSIZE 0xa diff --git a/examples/gui/basic_controls/styles/default_light.style b/examples/gui/basic_controls/styles/default_light.style deleted file mode 100644 index 3a4786c..0000000 --- a/examples/gui/basic_controls/styles/default_light.style +++ /dev/null @@ -1,99 +0,0 @@ -GLOBAL_BASE_COLOR 0xf5f5f5ff -GLOBAL_BORDER_COLOR 0xf5f5f5ff -GLOBAL_TEXT_COLOR 0xf5f5f5ff -GLOBAL_TEXT_FONTSIZE 0xa -GLOBAL_BORDER_WIDTH 0x1 -BACKGROUND_COLOR 0xf5f5f5ff -LINES_COLOR 0x90abb5ff -LABEL_BORDER_WIDTH 0x1 -LABEL_TEXT_COLOR 0x4d4d4dff -LABEL_TEXT_PADDING 0x14 -BUTTON_BORDER_WIDTH 0x2 -BUTTON_TEXT_PADDING 0x14 -BUTTON_DEFAULT_BORDER_COLOR 0x828282ff -BUTTON_DEFAULT_INSIDE_COLOR 0xc8c8c8ff -BUTTON_DEFAULT_TEXT_COLOR 0x4d4d4dff -BUTTON_HOVER_BORDER_COLOR 0xc8c8c8ff -BUTTON_HOVER_INSIDE_COLOR 0xffffffff -BUTTON_HOVER_TEXT_COLOR 0x868686ff -BUTTON_PRESSED_BORDER_COLOR 0x7bb0d6ff -BUTTON_PRESSED_INSIDE_COLOR 0xbcecffff -BUTTON_PRESSED_TEXT_COLOR 0x5f9aa7ff -TOGGLE_TEXT_PADDING 0x14 -TOGGLE_BORDER_WIDTH 0x1 -TOGGLE_DEFAULT_BORDER_COLOR 0x828282ff -TOGGLE_DEFAULT_INSIDE_COLOR 0xc8c8c8ff -TOGGLE_DEFAULT_TEXT_COLOR 0x828282ff -TOGGLE_HOVER_BORDER_COLOR 0xc8c8c8ff -TOGGLE_HOVER_INSIDE_COLOR 0xffffffff -TOGGLE_HOVER_TEXT_COLOR 0x828282ff -TOGGLE_PRESSED_BORDER_COLOR 0xbdd7eaff -TOGGLE_PRESSED_INSIDE_COLOR 0xddf5ffff -TOGGLE_PRESSED_TEXT_COLOR 0xafccd3ff -TOGGLE_ACTIVE_BORDER_COLOR 0x7bb0d6ff -TOGGLE_ACTIVE_INSIDE_COLOR 0xbcecffff -TOGGLE_ACTIVE_TEXT_COLOR 0x5f9aa7ff -TOGGLEGROUP_PADDING 0x3 -SLIDER_BORDER_WIDTH 0x1 -SLIDER_BUTTON_BORDER_WIDTH 0x1 -SLIDER_BORDER_COLOR 0x828282ff -SLIDER_INSIDE_COLOR 0xc8c8c8ff -SLIDER_DEFAULT_COLOR 0xbcecffff -SLIDER_HOVER_COLOR 0xffffffff -SLIDER_ACTIVE_COLOR 0xddf5ffff -SLIDERBAR_BORDER_COLOR 0x828282ff -SLIDERBAR_INSIDE_COLOR 0xc8c8c8ff -SLIDERBAR_DEFAULT_COLOR 0xbcecffff -SLIDERBAR_HOVER_COLOR 0xffffffff -SLIDERBAR_ACTIVE_COLOR 0xddf5ffff -SLIDERBAR_ZERO_LINE_COLOR 0x828282ff -PROGRESSBAR_BORDER_COLOR 0x828282ff -PROGRESSBAR_INSIDE_COLOR 0xc8c8c8ff -PROGRESSBAR_PROGRESS_COLOR 0xbcecffff -PROGRESSBAR_BORDER_WIDTH 0x2 -SPINNER_LABEL_BORDER_COLOR 0x828282ff -SPINNER_LABEL_INSIDE_COLOR 0xc8c8c8ff -SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x828282ff -SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0xc8c8c8ff -SPINNER_DEFAULT_SYMBOL_COLOR 0xff -SPINNER_DEFAULT_TEXT_COLOR 0xff -SPINNER_HOVER_BUTTON_BORDER_COLOR 0xc8c8c8ff -SPINNER_HOVER_BUTTON_INSIDE_COLOR 0xffffffff -SPINNER_HOVER_SYMBOL_COLOR 0xff -SPINNER_HOVER_TEXT_COLOR 0xff -SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x7bb0d6ff -SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0xbcecffff -SPINNER_PRESSED_SYMBOL_COLOR 0x5f9aa7ff -SPINNER_PRESSED_TEXT_COLOR 0xff -COMBOBOX_PADDING 0x1 -COMBOBOX_BUTTON_WIDTH 0x1e -COMBOBOX_BUTTON_HEIGHT 0x14 -COMBOBOX_BORDER_WIDTH 0x1 -COMBOBOX_DEFAULT_BORDER_COLOR 0x828282ff -COMBOBOX_DEFAULT_INSIDE_COLOR 0xc8c8c8ff -COMBOBOX_DEFAULT_TEXT_COLOR 0x828282ff -COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0x828282ff -COMBOBOX_HOVER_BORDER_COLOR 0xc8c8c8ff -COMBOBOX_HOVER_INSIDE_COLOR 0xffffffff -COMBOBOX_HOVER_TEXT_COLOR 0x828282ff -COMBOBOX_HOVER_LIST_TEXT_COLOR 0x828282ff -COMBOBOX_PRESSED_BORDER_COLOR 0x7bb0d6ff -COMBOBOX_PRESSED_INSIDE_COLOR 0xbcecffff -COMBOBOX_PRESSED_TEXT_COLOR 0x5f9aa7ff -COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x78acff -COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x66e7ffff -COMBOBOX_PRESSED_LIST_TEXT_COLOR 0x78acff -CHECKBOX_DEFAULT_BORDER_COLOR 0x828282ff -CHECKBOX_DEFAULT_INSIDE_COLOR 0xffffffff -CHECKBOX_HOVER_BORDER_COLOR 0xc8c8c8ff -CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff -CHECKBOX_CLICK_BORDER_COLOR 0x66e7ffff -CHECKBOX_CLICK_INSIDE_COLOR 0xddf5ffff -CHECKBOX_STATUS_ACTIVE_COLOR 0xbcecffff -CHECKBOX_INSIDE_WIDTH 0x1 -TEXTBOX_BORDER_WIDTH 0x1 -TEXTBOX_BORDER_COLOR 0x828282ff -TEXTBOX_INSIDE_COLOR 0xf5f5f5ff -TEXTBOX_TEXT_COLOR 0xff -TEXTBOX_LINE_COLOR 0xff -TEXTBOX_TEXT_FONTSIZE 0xa diff --git a/examples/gui/basic_controls/styles/enefete/GenericMobileSystemNuevo.ttf b/examples/gui/basic_controls/styles/enefete/GenericMobileSystemNuevo.ttf new file mode 100644 index 0000000..777a528 Binary files /dev/null and b/examples/gui/basic_controls/styles/enefete/GenericMobileSystemNuevo.ttf differ diff --git a/examples/gui/basic_controls/styles/enefete/README.md b/examples/gui/basic_controls/styles/enefete/README.md new file mode 100644 index 0000000..c7359f2 --- /dev/null +++ b/examples/gui/basic_controls/styles/enefete/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..7fb4b87 --- /dev/null +++ b/examples/gui/basic_controls/styles/enefete/enefete.h @@ -0,0 +1,353 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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 enefe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d, 0x61, 0x55, 0xe6, 0xda, 0xf3, 0x7f, 0x76, + 0x16, 0xc6, 0xea, 0xbb, 0x6d, 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 new file mode 100644 index 0000000..25ed8f8 Binary files /dev/null and b/examples/gui/basic_controls/styles/enefete/enefete.rgs differ diff --git a/examples/gui/basic_controls/styles/enefete/font_LICENSE.txt b/examples/gui/basic_controls/styles/enefete/font_LICENSE.txt new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/examples/gui/basic_controls/styles/enefete/font_LICENSE.txt @@ -0,0 +1,121 @@ +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 new file mode 100644 index 0000000..6135a5d Binary files /dev/null and b/examples/gui/basic_controls/styles/enefete/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/enefete/style_table.png b/examples/gui/basic_controls/styles/enefete/style_table.png new file mode 100644 index 0000000..1bc5bf3 Binary files /dev/null and b/examples/gui/basic_controls/styles/enefete/style_table.png differ diff --git a/examples/gui/basic_controls/styles/hello_kitty.style b/examples/gui/basic_controls/styles/hello_kitty.style deleted file mode 100644 index bba8e32..0000000 --- a/examples/gui/basic_controls/styles/hello_kitty.style +++ /dev/null @@ -1,98 +0,0 @@ -GLOBAL_BASE_COLOR 0xff80c1ff -GLOBAL_BORDER_COLOR 0xf5f5f5ff -GLOBAL_TEXT_COLOR 0x650065ff -GLOBAL_TEXT_FONTSIZE 0xa -GLOBAL_BORDER_WIDTH 0x1 -BACKGROUND_COLOR 0xffd4eaff -LABEL_BORDER_WIDTH 0x1 -LABEL_TEXT_COLOR 0x650065ff -LABEL_TEXT_PADDING 0x14 -BUTTON_BORDER_WIDTH 0x2 -BUTTON_TEXT_PADDING 0x14 -BUTTON_DEFAULT_BORDER_COLOR 0x828282ff -BUTTON_DEFAULT_INSIDE_COLOR 0xffc6e3ff -BUTTON_DEFAULT_TEXT_COLOR 0x650065ff -BUTTON_HOVER_BORDER_COLOR 0xc8c8c8ff -BUTTON_HOVER_INSIDE_COLOR 0xffc6e3ff -BUTTON_HOVER_TEXT_COLOR 0x761c76ff -BUTTON_PRESSED_BORDER_COLOR 0x7bb0d6ff -BUTTON_PRESSED_INSIDE_COLOR 0xffb8dcff -BUTTON_PRESSED_TEXT_COLOR 0xa971a9ff -TOGGLE_TEXT_PADDING 0x14 -TOGGLE_BORDER_WIDTH 0x1 -TOGGLE_DEFAULT_BORDER_COLOR 0x828282ff -TOGGLE_DEFAULT_INSIDE_COLOR 0xffc6e3ff -TOGGLE_DEFAULT_TEXT_COLOR 0x650065ff -TOGGLE_HOVER_BORDER_COLOR 0xc8c8c8ff -TOGGLE_HOVER_INSIDE_COLOR 0xffc6e3ff -TOGGLE_HOVER_TEXT_COLOR 0x761c76ff -TOGGLE_PRESSED_BORDER_COLOR 0xbdd7eaff -TOGGLE_PRESSED_INSIDE_COLOR 0xffb8dcff -TOGGLE_PRESSED_TEXT_COLOR 0xa971a9ff -TOGGLE_ACTIVE_BORDER_COLOR 0x7bb0d6ff -TOGGLE_ACTIVE_INSIDE_COLOR 0xff8ec7ff -TOGGLE_ACTIVE_TEXT_COLOR 0xa971a9ff -TOGGLEGROUP_PADDING 0x3 -SLIDER_BORDER_WIDTH 0x1 -SLIDER_BUTTON_BORDER_WIDTH 0x1 -SLIDER_BORDER_COLOR 0x828282ff -SLIDER_INSIDE_COLOR 0xffc6e3ff -SLIDER_DEFAULT_COLOR 0xffaad5ff -SLIDER_HOVER_COLOR 0xff9cceff -SLIDER_ACTIVE_COLOR 0xff80c1ff -SLIDERBAR_BORDER_COLOR 0x828282ff -SLIDERBAR_INSIDE_COLOR 0xffc6e3ff -SLIDERBAR_DEFAULT_COLOR 0xffaad5ff -SLIDERBAR_HOVER_COLOR 0xff9cceff -SLIDERBAR_ACTIVE_COLOR 0xff80c1ff -SLIDERBAR_ZERO_LINE_COLOR 0xff8ec7ff -PROGRESSBAR_BORDER_COLOR 0x828282ff -PROGRESSBAR_INSIDE_COLOR 0xffc6e3ff -PROGRESSBAR_PROGRESS_COLOR 0xffaad5ff -PROGRESSBAR_BORDER_WIDTH 0x2 -SPINNER_LABEL_BORDER_COLOR 0x828282ff -SPINNER_LABEL_INSIDE_COLOR 0xffc6e3ff -SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x828282ff -SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0xffc6e3ff -SPINNER_DEFAULT_SYMBOL_COLOR 0x650065ff -SPINNER_DEFAULT_TEXT_COLOR 0x650065ff -SPINNER_HOVER_BUTTON_BORDER_COLOR 0xc8c8c8ff -SPINNER_HOVER_BUTTON_INSIDE_COLOR 0xffc6e3ff -SPINNER_HOVER_SYMBOL_COLOR 0x761c76ff -SPINNER_HOVER_TEXT_COLOR 0x761c76ff -SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x7bb0d6ff -SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0xffb8dcff -SPINNER_PRESSED_SYMBOL_COLOR 0xa971a9ff -SPINNER_PRESSED_TEXT_COLOR 0xa971a9ff -COMBOBOX_PADDING 0x1 -COMBOBOX_BUTTON_WIDTH 0x1e -COMBOBOX_BUTTON_HEIGHT 0x1e -COMBOBOX_BORDER_WIDTH 0x1 -COMBOBOX_DEFAULT_BORDER_COLOR 0x828282ff -COMBOBOX_DEFAULT_INSIDE_COLOR 0xffc6e3ff -COMBOBOX_DEFAULT_TEXT_COLOR 0x650065ff -COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0x650065ff -COMBOBOX_HOVER_BORDER_COLOR 0xc8c8c8ff -COMBOBOX_HOVER_INSIDE_COLOR 0xffc6e3ff -COMBOBOX_HOVER_TEXT_COLOR 0x761c76ff -COMBOBOX_HOVER_LIST_TEXT_COLOR 0x761c76ff -COMBOBOX_PRESSED_BORDER_COLOR 0x7bb0d6ff -COMBOBOX_PRESSED_INSIDE_COLOR 0xff8ec7ff -COMBOBOX_PRESSED_TEXT_COLOR 0xba8dbaff -COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x78acff -COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0xff8ec7ff -COMBOBOX_PRESSED_LIST_TEXT_COLOR 0xba8dbaff -CHECKBOX_DEFAULT_BORDER_COLOR 0x828282ff -CHECKBOX_DEFAULT_INSIDE_COLOR 0xffc6e3ff -CHECKBOX_HOVER_BORDER_COLOR 0xc8c8c8ff -CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff -CHECKBOX_CLICK_BORDER_COLOR 0x66e7ffff -CHECKBOX_CLICK_INSIDE_COLOR 0xffaad5ff -CHECKBOX_STATUS_ACTIVE_COLOR 0xff8ec7ff -CHECKBOX_INSIDE_WIDTH 0x4 -TEXTBOX_BORDER_WIDTH 0x1 -TEXTBOX_BORDER_COLOR 0x828282ff -TEXTBOX_INSIDE_COLOR 0xffc6e3ff -TEXTBOX_TEXT_COLOR 0x650065ff -TEXTBOX_LINE_COLOR 0x985598ff -TEXTBOX_TEXT_FONTSIZE 0xa diff --git a/examples/gui/basic_controls/styles/jungle/Pixel Intv.otf b/examples/gui/basic_controls/styles/jungle/Pixel Intv.otf new file mode 100644 index 0000000..e8c54a7 Binary files /dev/null and b/examples/gui/basic_controls/styles/jungle/Pixel Intv.otf differ diff --git a/examples/gui/basic_controls/styles/jungle/README.md b/examples/gui/basic_controls/styles/jungle/README.md new file mode 100644 index 0000000..a08b6fc --- /dev/null +++ b/examples/gui/basic_controls/styles/jungle/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..b4e6c6e --- /dev/null +++ b/examples/gui/basic_controls/styles/jungle/font_readme.txt @@ -0,0 +1,47 @@ +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 new file mode 100644 index 0000000..f506dc1 --- /dev/null +++ b/examples/gui/basic_controls/styles/jungle/jungle.h @@ -0,0 +1,342 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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, 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, + 0x4b, 0x3d, 0x3b, 0x77, 0xa6, 0xfe, 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 new file mode 100644 index 0000000..b767af3 Binary files /dev/null and b/examples/gui/basic_controls/styles/jungle/jungle.rgs differ diff --git a/examples/gui/basic_controls/styles/jungle/jungle.txt.rgs b/examples/gui/basic_controls/styles/jungle/jungle.txt.rgs new file mode 100644 index 0000000..1852268 --- /dev/null +++ b/examples/gui/basic_controls/styles/jungle/jungle.txt.rgs @@ -0,0 +1,24 @@ +# +# 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 new file mode 100644 index 0000000..bc6afef Binary files /dev/null and b/examples/gui/basic_controls/styles/jungle/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/jungle/style_table.png b/examples/gui/basic_controls/styles/jungle/style_table.png new file mode 100644 index 0000000..17d5f96 Binary files /dev/null and b/examples/gui/basic_controls/styles/jungle/style_table.png differ diff --git a/examples/gui/basic_controls/styles/lavanda/Cartridge.ttf b/examples/gui/basic_controls/styles/lavanda/Cartridge.ttf new file mode 100644 index 0000000..19d7280 Binary files /dev/null and b/examples/gui/basic_controls/styles/lavanda/Cartridge.ttf differ diff --git a/examples/gui/basic_controls/styles/lavanda/README.md b/examples/gui/basic_controls/styles/lavanda/README.md new file mode 100644 index 0000000..396dfc5 --- /dev/null +++ b/examples/gui/basic_controls/styles/lavanda/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..c9ff454 --- /dev/null +++ b/examples/gui/basic_controls/styles/lavanda/font_readme.txt @@ -0,0 +1,6 @@ +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 new file mode 100644 index 0000000..7d8c7fb --- /dev/null +++ b/examples/gui/basic_controls/styles/lavanda/lavanda.h @@ -0,0 +1,354 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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, 0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0x63, 0xbc, 0xfa, 0xb4, 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 new file mode 100644 index 0000000..3aa3e6f Binary files /dev/null and b/examples/gui/basic_controls/styles/lavanda/lavanda.rgs differ diff --git a/examples/gui/basic_controls/styles/lavanda/lavanda.txt.rgs b/examples/gui/basic_controls/styles/lavanda/lavanda.txt.rgs new file mode 100644 index 0000000..23de947 --- /dev/null +++ b/examples/gui/basic_controls/styles/lavanda/lavanda.txt.rgs @@ -0,0 +1,24 @@ +# +# 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 new file mode 100644 index 0000000..d6b621c Binary files /dev/null and b/examples/gui/basic_controls/styles/lavanda/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/lavanda/style_table.png b/examples/gui/basic_controls/styles/lavanda/style_table.png new file mode 100644 index 0000000..c067fe1 Binary files /dev/null and b/examples/gui/basic_controls/styles/lavanda/style_table.png differ diff --git a/examples/gui/basic_controls/styles/monokai.style b/examples/gui/basic_controls/styles/monokai.style deleted file mode 100644 index 0248d6e..0000000 --- a/examples/gui/basic_controls/styles/monokai.style +++ /dev/null @@ -1,98 +0,0 @@ -GLOBAL_BASE_COLOR 0x262921ff -GLOBAL_BORDER_COLOR 0x102ff -GLOBAL_TEXT_COLOR 0xf8f8f1ff -GLOBAL_TEXT_FONTSIZE 0xa -GLOBAL_BORDER_WIDTH 0x1 -BACKGROUND_COLOR 0xb6b7b5ff -LABEL_BORDER_WIDTH 0x1 -LABEL_TEXT_COLOR 0xf8f8f1ff -LABEL_TEXT_PADDING 0x14 -BUTTON_BORDER_WIDTH 0x2 -BUTTON_TEXT_PADDING 0x14 -BUTTON_DEFAULT_BORDER_COLOR 0x38393aff -BUTTON_DEFAULT_INSIDE_COLOR 0x9e9f9cff -BUTTON_DEFAULT_TEXT_COLOR 0xf8f8f1ff -BUTTON_HOVER_BORDER_COLOR 0x1c1d1eff -BUTTON_HOVER_INSIDE_COLOR 0x9e9f9cff -BUTTON_HOVER_TEXT_COLOR 0xf8f8f2ff -BUTTON_PRESSED_BORDER_COLOR 0x102ff -BUTTON_PRESSED_INSIDE_COLOR 0x868883ff -BUTTON_PRESSED_TEXT_COLOR 0xfbfbf7ff -TOGGLE_TEXT_PADDING 0x14 -TOGGLE_BORDER_WIDTH 0x1 -TOGGLE_DEFAULT_BORDER_COLOR 0x38393aff -TOGGLE_DEFAULT_INSIDE_COLOR 0x9e9f9cff -TOGGLE_DEFAULT_TEXT_COLOR 0xf8f8f1ff -TOGGLE_HOVER_BORDER_COLOR 0x1c1d1eff -TOGGLE_HOVER_INSIDE_COLOR 0x9e9f9cff -TOGGLE_HOVER_TEXT_COLOR 0xf8f8f2ff -TOGGLE_PRESSED_BORDER_COLOR 0x102ff -TOGGLE_PRESSED_INSIDE_COLOR 0x868883ff -TOGGLE_PRESSED_TEXT_COLOR 0xfbfbf7ff -TOGGLE_ACTIVE_BORDER_COLOR 0x102ff -TOGGLE_ACTIVE_INSIDE_COLOR 0x3e4039ff -TOGGLE_ACTIVE_TEXT_COLOR 0xfbfbf7ff -TOGGLEGROUP_PADDING 0x3 -SLIDER_BORDER_WIDTH 0x1 -SLIDER_BUTTON_BORDER_WIDTH 0x1 -SLIDER_BORDER_COLOR 0x38393aff -SLIDER_INSIDE_COLOR 0x9e9f9cff -SLIDER_DEFAULT_COLOR 0x6e706bff -SLIDER_HOVER_COLOR 0x565852ff -SLIDER_ACTIVE_COLOR 0x262921ff -SLIDERBAR_BORDER_COLOR 0x38393aff -SLIDERBAR_INSIDE_COLOR 0x9e9f9cff -SLIDERBAR_DEFAULT_COLOR 0x6e706bff -SLIDERBAR_HOVER_COLOR 0x565852ff -SLIDERBAR_ACTIVE_COLOR 0x262921ff -SLIDERBAR_ZERO_LINE_COLOR 0x3e4039ff -PROGRESSBAR_BORDER_COLOR 0x38393aff -PROGRESSBAR_INSIDE_COLOR 0x9e9f9cff -PROGRESSBAR_PROGRESS_COLOR 0x6e706bff -PROGRESSBAR_BORDER_WIDTH 0x2 -SPINNER_LABEL_BORDER_COLOR 0x38393aff -SPINNER_LABEL_INSIDE_COLOR 0x9e9f9cff -SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x38393aff -SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0x9e9f9cff -SPINNER_DEFAULT_SYMBOL_COLOR 0xf8f8f1ff -SPINNER_DEFAULT_TEXT_COLOR 0xf8f8f1ff -SPINNER_HOVER_BUTTON_BORDER_COLOR 0x1c1d1eff -SPINNER_HOVER_BUTTON_INSIDE_COLOR 0x9e9f9cff -SPINNER_HOVER_SYMBOL_COLOR 0xf8f8f2ff -SPINNER_HOVER_TEXT_COLOR 0xf8f8f2ff -SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x102ff -SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0x868883ff -SPINNER_PRESSED_SYMBOL_COLOR 0xfbfbf7ff -SPINNER_PRESSED_TEXT_COLOR 0xfbfbf7ff -COMBOBOX_PADDING 0x1 -COMBOBOX_BUTTON_WIDTH 0x1e -COMBOBOX_BUTTON_HEIGHT 0x1e -COMBOBOX_BORDER_WIDTH 0x1 -COMBOBOX_DEFAULT_BORDER_COLOR 0x38393aff -COMBOBOX_DEFAULT_INSIDE_COLOR 0x9e9f9cff -COMBOBOX_DEFAULT_TEXT_COLOR 0xf8f8f1ff -COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0xf8f8f1ff -COMBOBOX_HOVER_BORDER_COLOR 0x1c1d1eff -COMBOBOX_HOVER_INSIDE_COLOR 0x9e9f9cff -COMBOBOX_HOVER_TEXT_COLOR 0xf8f8f2ff -COMBOBOX_HOVER_LIST_TEXT_COLOR 0xf8f8f2ff -COMBOBOX_PRESSED_BORDER_COLOR 0x102ff -COMBOBOX_PRESSED_INSIDE_COLOR 0x3e4039ff -COMBOBOX_PRESSED_TEXT_COLOR 0xfbfbf8ff -COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x102ff -COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x3e4039ff -COMBOBOX_PRESSED_LIST_TEXT_COLOR 0xfbfbf8ff -CHECKBOX_DEFAULT_BORDER_COLOR 0x38393aff -CHECKBOX_DEFAULT_INSIDE_COLOR 0x9e9f9cff -CHECKBOX_HOVER_BORDER_COLOR 0x1c1d1eff -CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff -CHECKBOX_CLICK_BORDER_COLOR 0x102ff -CHECKBOX_CLICK_INSIDE_COLOR 0x6e706bff -CHECKBOX_STATUS_ACTIVE_COLOR 0x3e4039ff -CHECKBOX_INSIDE_WIDTH 0x4 -TEXTBOX_BORDER_WIDTH 0x1 -TEXTBOX_BORDER_COLOR 0x38393aff -TEXTBOX_INSIDE_COLOR 0x9e9f9cff -TEXTBOX_TEXT_COLOR 0xf8f8f1ff -TEXTBOX_LINE_COLOR 0xfafaf5ff -TEXTBOX_TEXT_FONTSIZE 0xa diff --git a/examples/gui/basic_controls/styles/obsidian.style b/examples/gui/basic_controls/styles/obsidian.style deleted file mode 100644 index 79d4053..0000000 --- a/examples/gui/basic_controls/styles/obsidian.style +++ /dev/null @@ -1,98 +0,0 @@ -GLOBAL_BASE_COLOR 0x293034ff -GLOBAL_BORDER_COLOR 0x102ff -GLOBAL_TEXT_COLOR 0xa8e2aeff -GLOBAL_TEXT_FONTSIZE 0xa -GLOBAL_BORDER_WIDTH 0x1 -BACKGROUND_COLOR 0xb7babbff -LABEL_BORDER_WIDTH 0x1 -LABEL_TEXT_COLOR 0xa8e2aeff -LABEL_TEXT_PADDING 0x14 -BUTTON_BORDER_WIDTH 0x2 -BUTTON_TEXT_PADDING 0x14 -BUTTON_DEFAULT_BORDER_COLOR 0x38393aff -BUTTON_DEFAULT_INSIDE_COLOR 0x9fa3a4ff -BUTTON_DEFAULT_TEXT_COLOR 0xa8e2aeff -BUTTON_HOVER_BORDER_COLOR 0x1c1d1eff -BUTTON_HOVER_INSIDE_COLOR 0x9fa3a4ff -BUTTON_HOVER_TEXT_COLOR 0xb1e5b7ff -BUTTON_PRESSED_BORDER_COLOR 0x102ff -BUTTON_PRESSED_INSIDE_COLOR 0x888c8eff -BUTTON_PRESSED_TEXT_COLOR 0xceeed2ff -TOGGLE_TEXT_PADDING 0x14 -TOGGLE_BORDER_WIDTH 0x1 -TOGGLE_DEFAULT_BORDER_COLOR 0x38393aff -TOGGLE_DEFAULT_INSIDE_COLOR 0x9fa3a4ff -TOGGLE_DEFAULT_TEXT_COLOR 0xa8e2aeff -TOGGLE_HOVER_BORDER_COLOR 0x1c1d1eff -TOGGLE_HOVER_INSIDE_COLOR 0x9fa3a4ff -TOGGLE_HOVER_TEXT_COLOR 0xb1e5b7ff -TOGGLE_PRESSED_BORDER_COLOR 0x102ff -TOGGLE_PRESSED_INSIDE_COLOR 0x888c8eff -TOGGLE_PRESSED_TEXT_COLOR 0xceeed2ff -TOGGLE_ACTIVE_BORDER_COLOR 0x102ff -TOGGLE_ACTIVE_INSIDE_COLOR 0x40474aff -TOGGLE_ACTIVE_TEXT_COLOR 0xceeed2ff -TOGGLEGROUP_PADDING 0x3 -SLIDER_BORDER_WIDTH 0x1 -SLIDER_BUTTON_BORDER_WIDTH 0x1 -SLIDER_BORDER_COLOR 0x38393aff -SLIDER_INSIDE_COLOR 0x9fa3a4ff -SLIDER_DEFAULT_COLOR 0x707577ff -SLIDER_HOVER_COLOR 0x585e61ff -SLIDER_ACTIVE_COLOR 0x293034ff -SLIDERBAR_BORDER_COLOR 0x38393aff -SLIDERBAR_INSIDE_COLOR 0x9fa3a4ff -SLIDERBAR_DEFAULT_COLOR 0x707577ff -SLIDERBAR_HOVER_COLOR 0x585e61ff -SLIDERBAR_ACTIVE_COLOR 0x293034ff -SLIDERBAR_ZERO_LINE_COLOR 0x40474aff -PROGRESSBAR_BORDER_COLOR 0x38393aff -PROGRESSBAR_INSIDE_COLOR 0x9fa3a4ff -PROGRESSBAR_PROGRESS_COLOR 0x707577ff -PROGRESSBAR_BORDER_WIDTH 0x2 -SPINNER_LABEL_BORDER_COLOR 0x38393aff -SPINNER_LABEL_INSIDE_COLOR 0x9fa3a4ff -SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x38393aff -SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0x9fa3a4ff -SPINNER_DEFAULT_SYMBOL_COLOR 0xa8e2aeff -SPINNER_DEFAULT_TEXT_COLOR 0xa8e2aeff -SPINNER_HOVER_BUTTON_BORDER_COLOR 0x1c1d1eff -SPINNER_HOVER_BUTTON_INSIDE_COLOR 0x9fa3a4ff -SPINNER_HOVER_SYMBOL_COLOR 0xb1e5b7ff -SPINNER_HOVER_TEXT_COLOR 0xb1e5b7ff -SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x102ff -SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0x888c8eff -SPINNER_PRESSED_SYMBOL_COLOR 0xceeed2ff -SPINNER_PRESSED_TEXT_COLOR 0xceeed2ff -COMBOBOX_PADDING 0x1 -COMBOBOX_BUTTON_WIDTH 0x1e -COMBOBOX_BUTTON_HEIGHT 0x1e -COMBOBOX_BORDER_WIDTH 0x1 -COMBOBOX_DEFAULT_BORDER_COLOR 0x38393aff -COMBOBOX_DEFAULT_INSIDE_COLOR 0x9fa3a4ff -COMBOBOX_DEFAULT_TEXT_COLOR 0xa8e2aeff -COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0xa8e2aeff -COMBOBOX_HOVER_BORDER_COLOR 0x1c1d1eff -COMBOBOX_HOVER_INSIDE_COLOR 0x9fa3a4ff -COMBOBOX_HOVER_TEXT_COLOR 0xb1e5b7ff -COMBOBOX_HOVER_LIST_TEXT_COLOR 0xb1e5b7ff -COMBOBOX_PRESSED_BORDER_COLOR 0x102ff -COMBOBOX_PRESSED_INSIDE_COLOR 0x40474aff -COMBOBOX_PRESSED_TEXT_COLOR 0xd8f2dbff -COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x102ff -COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x40474aff -COMBOBOX_PRESSED_LIST_TEXT_COLOR 0xd8f2dbff -CHECKBOX_DEFAULT_BORDER_COLOR 0x38393aff -CHECKBOX_DEFAULT_INSIDE_COLOR 0x9fa3a4ff -CHECKBOX_HOVER_BORDER_COLOR 0x1c1d1eff -CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff -CHECKBOX_CLICK_BORDER_COLOR 0x102ff -CHECKBOX_CLICK_INSIDE_COLOR 0x707577ff -CHECKBOX_STATUS_ACTIVE_COLOR 0x40474aff -CHECKBOX_INSIDE_WIDTH 0x4 -TEXTBOX_BORDER_WIDTH 0x1 -TEXTBOX_BORDER_COLOR 0x38393aff -TEXTBOX_INSIDE_COLOR 0x9fa3a4ff -TEXTBOX_TEXT_COLOR 0xa8e2aeff -TEXTBOX_LINE_COLOR 0xc5ebc9ff -TEXTBOX_TEXT_FONTSIZE 0xa diff --git a/examples/gui/basic_controls/styles/solarized.style b/examples/gui/basic_controls/styles/solarized.style deleted file mode 100644 index 24605c1..0000000 --- a/examples/gui/basic_controls/styles/solarized.style +++ /dev/null @@ -1,98 +0,0 @@ -GLOBAL_BASE_COLOR 0x2b36ff -GLOBAL_BORDER_COLOR 0x102ff -GLOBAL_TEXT_COLOR 0xf8f8f1ff -GLOBAL_TEXT_FONTSIZE 0xa -GLOBAL_BORDER_WIDTH 0x1 -BACKGROUND_COLOR 0xaab8bcff -LABEL_BORDER_WIDTH 0x1 -LABEL_TEXT_COLOR 0xf8f8f1ff -LABEL_TEXT_PADDING 0x14 -BUTTON_BORDER_WIDTH 0x2 -BUTTON_TEXT_PADDING 0x14 -BUTTON_DEFAULT_BORDER_COLOR 0x38393aff -BUTTON_DEFAULT_INSIDE_COLOR 0x8da0a5ff -BUTTON_DEFAULT_TEXT_COLOR 0xf8f8f1ff -BUTTON_HOVER_BORDER_COLOR 0x1c1d1eff -BUTTON_HOVER_INSIDE_COLOR 0x8da0a5ff -BUTTON_HOVER_TEXT_COLOR 0xf8f8f2ff -BUTTON_PRESSED_BORDER_COLOR 0x102ff -BUTTON_PRESSED_INSIDE_COLOR 0x71898fff -BUTTON_PRESSED_TEXT_COLOR 0xfbfbf7ff -TOGGLE_TEXT_PADDING 0x14 -TOGGLE_BORDER_WIDTH 0x1 -TOGGLE_DEFAULT_BORDER_COLOR 0x38393aff -TOGGLE_DEFAULT_INSIDE_COLOR 0x8da0a5ff -TOGGLE_DEFAULT_TEXT_COLOR 0xf8f8f1ff -TOGGLE_HOVER_BORDER_COLOR 0x1c1d1eff -TOGGLE_HOVER_INSIDE_COLOR 0x8da0a5ff -TOGGLE_HOVER_TEXT_COLOR 0xf8f8f2ff -TOGGLE_PRESSED_BORDER_COLOR 0x102ff -TOGGLE_PRESSED_INSIDE_COLOR 0x71898fff -TOGGLE_PRESSED_TEXT_COLOR 0xfbfbf7ff -TOGGLE_ACTIVE_BORDER_COLOR 0x102ff -TOGGLE_ACTIVE_INSIDE_COLOR 0x1c424cff -TOGGLE_ACTIVE_TEXT_COLOR 0xfbfbf7ff -TOGGLEGROUP_PADDING 0x3 -SLIDER_BORDER_WIDTH 0x1 -SLIDER_BUTTON_BORDER_WIDTH 0x1 -SLIDER_BORDER_COLOR 0x38393aff -SLIDER_INSIDE_COLOR 0x8da0a5ff -SLIDER_DEFAULT_COLOR 0x557179ff -SLIDER_HOVER_COLOR 0x385a62ff -SLIDER_ACTIVE_COLOR 0x2b36ff -SLIDERBAR_BORDER_COLOR 0x38393aff -SLIDERBAR_INSIDE_COLOR 0x8da0a5ff -SLIDERBAR_DEFAULT_COLOR 0x557179ff -SLIDERBAR_HOVER_COLOR 0x385a62ff -SLIDERBAR_ACTIVE_COLOR 0x2b36ff -SLIDERBAR_ZERO_LINE_COLOR 0x1c424cff -PROGRESSBAR_BORDER_COLOR 0x38393aff -PROGRESSBAR_INSIDE_COLOR 0x8da0a5ff -PROGRESSBAR_PROGRESS_COLOR 0x557179ff -PROGRESSBAR_BORDER_WIDTH 0x2 -SPINNER_LABEL_BORDER_COLOR 0x38393aff -SPINNER_LABEL_INSIDE_COLOR 0x8da0a5ff -SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x38393aff -SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0x8da0a5ff -SPINNER_DEFAULT_SYMBOL_COLOR 0xf8f8f1ff -SPINNER_DEFAULT_TEXT_COLOR 0xf8f8f1ff -SPINNER_HOVER_BUTTON_BORDER_COLOR 0x1c1d1eff -SPINNER_HOVER_BUTTON_INSIDE_COLOR 0x8da0a5ff -SPINNER_HOVER_SYMBOL_COLOR 0xf8f8f2ff -SPINNER_HOVER_TEXT_COLOR 0xf8f8f2ff -SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x102ff -SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0x71898fff -SPINNER_PRESSED_SYMBOL_COLOR 0xfbfbf7ff -SPINNER_PRESSED_TEXT_COLOR 0xfbfbf7ff -COMBOBOX_PADDING 0x1 -COMBOBOX_BUTTON_WIDTH 0x1e -COMBOBOX_BUTTON_HEIGHT 0x1e -COMBOBOX_BORDER_WIDTH 0x1 -COMBOBOX_DEFAULT_BORDER_COLOR 0x38393aff -COMBOBOX_DEFAULT_INSIDE_COLOR 0x8da0a5ff -COMBOBOX_DEFAULT_TEXT_COLOR 0xf8f8f1ff -COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0xf8f8f1ff -COMBOBOX_HOVER_BORDER_COLOR 0x1c1d1eff -COMBOBOX_HOVER_INSIDE_COLOR 0x8da0a5ff -COMBOBOX_HOVER_TEXT_COLOR 0xf8f8f2ff -COMBOBOX_HOVER_LIST_TEXT_COLOR 0xf8f8f2ff -COMBOBOX_PRESSED_BORDER_COLOR 0x102ff -COMBOBOX_PRESSED_INSIDE_COLOR 0x1c424cff -COMBOBOX_PRESSED_TEXT_COLOR 0xfbfbf8ff -COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x102ff -COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x1c424cff -COMBOBOX_PRESSED_LIST_TEXT_COLOR 0xfbfbf8ff -CHECKBOX_DEFAULT_BORDER_COLOR 0x38393aff -CHECKBOX_DEFAULT_INSIDE_COLOR 0x8da0a5ff -CHECKBOX_HOVER_BORDER_COLOR 0x1c1d1eff -CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff -CHECKBOX_CLICK_BORDER_COLOR 0x102ff -CHECKBOX_CLICK_INSIDE_COLOR 0x557179ff -CHECKBOX_STATUS_ACTIVE_COLOR 0x1c424cff -CHECKBOX_INSIDE_WIDTH 0x4 -TEXTBOX_BORDER_WIDTH 0x1 -TEXTBOX_BORDER_COLOR 0x38393aff -TEXTBOX_INSIDE_COLOR 0x8da0a5ff -TEXTBOX_TEXT_COLOR 0xf8f8f1ff -TEXTBOX_LINE_COLOR 0xfafaf5ff -TEXTBOX_TEXT_FONTSIZE 0xa diff --git a/examples/gui/basic_controls/styles/solarized_light.style b/examples/gui/basic_controls/styles/solarized_light.style deleted file mode 100644 index 8d413c9..0000000 --- a/examples/gui/basic_controls/styles/solarized_light.style +++ /dev/null @@ -1,98 +0,0 @@ -GLOBAL_BASE_COLOR 0xfcf6e3ff -GLOBAL_BORDER_COLOR 0x102ff -GLOBAL_TEXT_COLOR 0x657b82ff -GLOBAL_TEXT_FONTSIZE 0xa -GLOBAL_BORDER_WIDTH 0x1 -BACKGROUND_COLOR 0xfefcf5ff -LABEL_BORDER_WIDTH 0x1 -LABEL_TEXT_COLOR 0x657b82ff -LABEL_TEXT_PADDING 0x14 -BUTTON_BORDER_WIDTH 0x2 -BUTTON_TEXT_PADDING 0x14 -BUTTON_DEFAULT_BORDER_COLOR 0x38393aff -BUTTON_DEFAULT_INSIDE_COLOR 0xfdfbf2ff -BUTTON_DEFAULT_TEXT_COLOR 0x657b82ff -BUTTON_HOVER_BORDER_COLOR 0x1c1d1eff -BUTTON_HOVER_INSIDE_COLOR 0xfdfbf2ff -BUTTON_HOVER_TEXT_COLOR 0x76898fff -BUTTON_PRESSED_BORDER_COLOR 0x102ff -BUTTON_PRESSED_INSIDE_COLOR 0xfdfaefff -BUTTON_PRESSED_TEXT_COLOR 0xa9b5b9ff -TOGGLE_TEXT_PADDING 0x14 -TOGGLE_BORDER_WIDTH 0x1 -TOGGLE_DEFAULT_BORDER_COLOR 0x38393aff -TOGGLE_DEFAULT_INSIDE_COLOR 0xfdfbf2ff -TOGGLE_DEFAULT_TEXT_COLOR 0x657b82ff -TOGGLE_HOVER_BORDER_COLOR 0x1c1d1eff -TOGGLE_HOVER_INSIDE_COLOR 0xfdfbf2ff -TOGGLE_HOVER_TEXT_COLOR 0x76898fff -TOGGLE_PRESSED_BORDER_COLOR 0x102ff -TOGGLE_PRESSED_INSIDE_COLOR 0xfdfaefff -TOGGLE_PRESSED_TEXT_COLOR 0xa9b5b9ff -TOGGLE_ACTIVE_BORDER_COLOR 0x102ff -TOGGLE_ACTIVE_INSIDE_COLOR 0xfcf7e6ff -TOGGLE_ACTIVE_TEXT_COLOR 0xa9b5b9ff -TOGGLEGROUP_PADDING 0x3 -SLIDER_BORDER_WIDTH 0x1 -SLIDER_BUTTON_BORDER_WIDTH 0x1 -SLIDER_BORDER_COLOR 0x38393aff -SLIDER_INSIDE_COLOR 0xfdfbf2ff -SLIDER_DEFAULT_COLOR 0xfdf9ecff -SLIDER_HOVER_COLOR 0xfcf8e9ff -SLIDER_ACTIVE_COLOR 0xfcf6e3ff -SLIDERBAR_BORDER_COLOR 0x38393aff -SLIDERBAR_INSIDE_COLOR 0xfdfbf2ff -SLIDERBAR_DEFAULT_COLOR 0xfdf9ecff -SLIDERBAR_HOVER_COLOR 0xfcf8e9ff -SLIDERBAR_ACTIVE_COLOR 0xfcf6e3ff -SLIDERBAR_ZERO_LINE_COLOR 0xfcf7e6ff -PROGRESSBAR_BORDER_COLOR 0x38393aff -PROGRESSBAR_INSIDE_COLOR 0xfdfbf2ff -PROGRESSBAR_PROGRESS_COLOR 0xfdf9ecff -PROGRESSBAR_BORDER_WIDTH 0x2 -SPINNER_LABEL_BORDER_COLOR 0x38393aff -SPINNER_LABEL_INSIDE_COLOR 0xfdfbf2ff -SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x38393aff -SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0xfdfbf2ff -SPINNER_DEFAULT_SYMBOL_COLOR 0x657b82ff -SPINNER_DEFAULT_TEXT_COLOR 0x657b82ff -SPINNER_HOVER_BUTTON_BORDER_COLOR 0x1c1d1eff -SPINNER_HOVER_BUTTON_INSIDE_COLOR 0xfdfbf2ff -SPINNER_HOVER_SYMBOL_COLOR 0x76898fff -SPINNER_HOVER_TEXT_COLOR 0x76898fff -SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x102ff -SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0xfdfaefff -SPINNER_PRESSED_SYMBOL_COLOR 0xa9b5b9ff -SPINNER_PRESSED_TEXT_COLOR 0xa9b5b9ff -COMBOBOX_PADDING 0x1 -COMBOBOX_BUTTON_WIDTH 0x1e -COMBOBOX_BUTTON_HEIGHT 0x1e -COMBOBOX_BORDER_WIDTH 0x1 -COMBOBOX_DEFAULT_BORDER_COLOR 0x38393aff -COMBOBOX_DEFAULT_INSIDE_COLOR 0xfdfbf2ff -COMBOBOX_DEFAULT_TEXT_COLOR 0x657b82ff -COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0x657b82ff -COMBOBOX_HOVER_BORDER_COLOR 0x1c1d1eff -COMBOBOX_HOVER_INSIDE_COLOR 0xfdfbf2ff -COMBOBOX_HOVER_TEXT_COLOR 0x76898fff -COMBOBOX_HOVER_LIST_TEXT_COLOR 0x76898fff -COMBOBOX_PRESSED_BORDER_COLOR 0x102ff -COMBOBOX_PRESSED_INSIDE_COLOR 0xfcf7e6ff -COMBOBOX_PRESSED_TEXT_COLOR 0xbac4c7ff -COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x102ff -COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0xfcf7e6ff -COMBOBOX_PRESSED_LIST_TEXT_COLOR 0xbac4c7ff -CHECKBOX_DEFAULT_BORDER_COLOR 0x38393aff -CHECKBOX_DEFAULT_INSIDE_COLOR 0xfdfbf2ff -CHECKBOX_HOVER_BORDER_COLOR 0x1c1d1eff -CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff -CHECKBOX_CLICK_BORDER_COLOR 0x102ff -CHECKBOX_CLICK_INSIDE_COLOR 0xfdf9ecff -CHECKBOX_STATUS_ACTIVE_COLOR 0xfcf7e6ff -CHECKBOX_INSIDE_WIDTH 0x4 -TEXTBOX_BORDER_WIDTH 0x1 -TEXTBOX_BORDER_COLOR 0x38393aff -TEXTBOX_INSIDE_COLOR 0xfdfbf2ff -TEXTBOX_TEXT_COLOR 0x657b82ff -TEXTBOX_LINE_COLOR 0x98a7abff -TEXTBOX_TEXT_FONTSIZE 0xa diff --git a/examples/gui/basic_controls/styles/sunny/GenericMobileSystemNuevo.ttf b/examples/gui/basic_controls/styles/sunny/GenericMobileSystemNuevo.ttf new file mode 100644 index 0000000..777a528 Binary files /dev/null and b/examples/gui/basic_controls/styles/sunny/GenericMobileSystemNuevo.ttf differ diff --git a/examples/gui/basic_controls/styles/sunny/README.md b/examples/gui/basic_controls/styles/sunny/README.md new file mode 100644 index 0000000..8da6659 --- /dev/null +++ b/examples/gui/basic_controls/styles/sunny/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..60f42f6 --- /dev/null +++ b/examples/gui/basic_controls/styles/sunny/font_LICENSE.txt @@ -0,0 +1,160 @@ +===| 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 new file mode 100644 index 0000000..643f7a9 Binary files /dev/null and b/examples/gui/basic_controls/styles/sunny/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/sunny/style_table.png b/examples/gui/basic_controls/styles/sunny/style_table.png new file mode 100644 index 0000000..f429989 Binary files /dev/null and b/examples/gui/basic_controls/styles/sunny/style_table.png differ diff --git a/examples/gui/basic_controls/styles/sunny/sunny.h b/examples/gui/basic_controls/styles/sunny/sunny.h new file mode 100644 index 0000000..ec10ca9 --- /dev/null +++ b/examples/gui/basic_controls/styles/sunny/sunny.h @@ -0,0 +1,369 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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, 0xee, 0x49, 0x5c, 0x6c, 0x1b, 0xfb, + 0x5f, 0xb9, 0xfd, 0x8a, 0xa9, 0xb6, 0x89, 0x8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 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 new file mode 100644 index 0000000..62b6241 Binary files /dev/null and b/examples/gui/basic_controls/styles/sunny/sunny.rgs differ diff --git a/examples/gui/basic_controls/styles/terminal/Mecha.ttf b/examples/gui/basic_controls/styles/terminal/Mecha.ttf new file mode 100644 index 0000000..928f63a Binary files /dev/null and b/examples/gui/basic_controls/styles/terminal/Mecha.ttf differ diff --git a/examples/gui/basic_controls/styles/terminal/README.md b/examples/gui/basic_controls/styles/terminal/README.md new file mode 100644 index 0000000..6b10d2d --- /dev/null +++ b/examples/gui/basic_controls/styles/terminal/README.md @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..7b8562b Binary files /dev/null and b/examples/gui/basic_controls/styles/terminal/screenshot.png differ diff --git a/examples/gui/basic_controls/styles/terminal/style_table.png b/examples/gui/basic_controls/styles/terminal/style_table.png new file mode 100644 index 0000000..7b527b2 Binary files /dev/null and b/examples/gui/basic_controls/styles/terminal/style_table.png differ diff --git a/examples/gui/basic_controls/styles/terminal/terminal.h b/examples/gui/basic_controls/styles/terminal/terminal.h new file mode 100644 index 0000000..096fa43 --- /dev/null +++ b/examples/gui/basic_controls/styles/terminal/terminal.h @@ -0,0 +1,338 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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 new file mode 100644 index 0000000..5ce1b80 Binary files /dev/null and b/examples/gui/basic_controls/styles/terminal/terminal.rgs differ diff --git a/examples/gui/basic_controls/styles/terminal/terminal.txt.rgs b/examples/gui/basic_controls/styles/terminal/terminal.txt.rgs new file mode 100644 index 0000000..a75caa3 --- /dev/null +++ b/examples/gui/basic_controls/styles/terminal/terminal.txt.rgs @@ -0,0 +1,24 @@ +# +# 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/basic_controls/styles/zahnrad.style b/examples/gui/basic_controls/styles/zahnrad.style deleted file mode 100644 index 54ca5f6..0000000 --- a/examples/gui/basic_controls/styles/zahnrad.style +++ /dev/null @@ -1,98 +0,0 @@ -GLOBAL_BASE_COLOR 0xf5f5f5ff -GLOBAL_BORDER_COLOR 0xf5f5f5ff -GLOBAL_TEXT_COLOR 0xf5f5f5ff -GLOBAL_TEXT_FONTSIZE 0xa -GLOBAL_BORDER_WIDTH 0x1 -BACKGROUND_COLOR 0x2d2d2dff -LABEL_BORDER_WIDTH 0x2 -LABEL_TEXT_COLOR 0xafafafff -LABEL_TEXT_PADDING 0x14 -BUTTON_BORDER_WIDTH 0x1 -BUTTON_TEXT_PADDING 0x14 -BUTTON_DEFAULT_BORDER_COLOR 0x414141ff -BUTTON_DEFAULT_INSIDE_COLOR 0x323232ff -BUTTON_DEFAULT_TEXT_COLOR 0xafafafff -BUTTON_HOVER_BORDER_COLOR 0x3e3e3eff -BUTTON_HOVER_INSIDE_COLOR 0x2d2d2dff -BUTTON_HOVER_TEXT_COLOR 0x767472ff -BUTTON_PRESSED_BORDER_COLOR 0x414141ff -BUTTON_PRESSED_INSIDE_COLOR 0x323232ff -BUTTON_PRESSED_TEXT_COLOR 0x616161ff -TOGGLE_TEXT_PADDING 0x14 -TOGGLE_BORDER_WIDTH 0x1 -TOGGLE_DEFAULT_BORDER_COLOR 0x414141ff -TOGGLE_DEFAULT_INSIDE_COLOR 0x323232ff -TOGGLE_DEFAULT_TEXT_COLOR 0xafafafff -TOGGLE_HOVER_BORDER_COLOR 0x3e3e3eff -TOGGLE_HOVER_INSIDE_COLOR 0x2d2d2dff -TOGGLE_HOVER_TEXT_COLOR 0x767472ff -TOGGLE_PRESSED_BORDER_COLOR 0x414141ff -TOGGLE_PRESSED_INSIDE_COLOR 0x323232ff -TOGGLE_PRESSED_TEXT_COLOR 0x616161ff -TOGGLE_ACTIVE_BORDER_COLOR 0xafafafff -TOGGLE_ACTIVE_INSIDE_COLOR 0x414141ff -TOGGLE_ACTIVE_TEXT_COLOR 0xa3a3a3ff -TOGGLEGROUP_PADDING 0x3 -SLIDER_BORDER_WIDTH 0x0 -SLIDER_BUTTON_BORDER_WIDTH 0x0 -SLIDER_BORDER_COLOR 0x414141ff -SLIDER_INSIDE_COLOR 0x232525ff -SLIDER_DEFAULT_COLOR 0x646464ff -SLIDER_HOVER_COLOR 0x767472ff -SLIDER_ACTIVE_COLOR 0x929291ff -SLIDERBAR_BORDER_COLOR 0x828282ff -SLIDERBAR_INSIDE_COLOR 0x262626ff -SLIDERBAR_DEFAULT_COLOR 0x616161ff -SLIDERBAR_HOVER_COLOR 0x646464ff -SLIDERBAR_ACTIVE_COLOR 0x929292ff -SLIDERBAR_ZERO_LINE_COLOR 0xafafafff -PROGRESSBAR_BORDER_COLOR 0x828282ff -PROGRESSBAR_INSIDE_COLOR 0x262626ff -PROGRESSBAR_PROGRESS_COLOR 0x646464ff -PROGRESSBAR_BORDER_WIDTH 0x0 -SPINNER_LABEL_BORDER_COLOR 0x414141ff -SPINNER_LABEL_INSIDE_COLOR 0x323232ff -SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x414141ff -SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0x323232ff -SPINNER_DEFAULT_SYMBOL_COLOR 0xafafafff -SPINNER_DEFAULT_TEXT_COLOR 0xafafafff -SPINNER_HOVER_BUTTON_BORDER_COLOR 0x3e3e3eff -SPINNER_HOVER_BUTTON_INSIDE_COLOR 0x2d2d2dff -SPINNER_HOVER_SYMBOL_COLOR 0x767472ff -SPINNER_HOVER_TEXT_COLOR 0x767472ff -SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x414141ff -SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0x323232ff -SPINNER_PRESSED_SYMBOL_COLOR 0x646464ff -SPINNER_PRESSED_TEXT_COLOR 0x646464ff -COMBOBOX_PADDING 0x1 -COMBOBOX_BUTTON_WIDTH 0x1e -COMBOBOX_BUTTON_HEIGHT 0x1e -COMBOBOX_BORDER_WIDTH 0x1 -COMBOBOX_DEFAULT_BORDER_COLOR 0x414141ff -COMBOBOX_DEFAULT_INSIDE_COLOR 0x323232ff -COMBOBOX_DEFAULT_TEXT_COLOR 0xafafafff -COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0xafafafff -COMBOBOX_HOVER_BORDER_COLOR 0x3e3e3eff -COMBOBOX_HOVER_INSIDE_COLOR 0x2d2d2dff -COMBOBOX_HOVER_TEXT_COLOR 0x767472ff -COMBOBOX_HOVER_LIST_TEXT_COLOR 0x767472ff -COMBOBOX_PRESSED_BORDER_COLOR 0x414141ff -COMBOBOX_PRESSED_INSIDE_COLOR 0x323232ff -COMBOBOX_PRESSED_TEXT_COLOR 0x646464ff -COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x414141ff -COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x323232ff -COMBOBOX_PRESSED_LIST_TEXT_COLOR 0x646464ff -CHECKBOX_DEFAULT_BORDER_COLOR 0x414141ff -CHECKBOX_DEFAULT_INSIDE_COLOR 0x323232ff -CHECKBOX_HOVER_BORDER_COLOR 0x3e3e3eff -CHECKBOX_HOVER_INSIDE_COLOR 0x2d2d2dff -CHECKBOX_CLICK_BORDER_COLOR 0x414141ff -CHECKBOX_CLICK_INSIDE_COLOR 0x323232ff -CHECKBOX_STATUS_ACTIVE_COLOR 0x414141ff -CHECKBOX_INSIDE_WIDTH 0x2 -TEXTBOX_BORDER_WIDTH 0x1 -TEXTBOX_BORDER_COLOR 0x414141ff -TEXTBOX_INSIDE_COLOR 0x323232ff -TEXTBOX_TEXT_COLOR 0xafafafff -TEXTBOX_LINE_COLOR 0xafafafff -TEXTBOX_TEXT_FONTSIZE 0x9 diff --git a/examples/gui/button/go.mod b/examples/gui/button/go.mod new file mode 100644 index 0000000..7ce5cb7 --- /dev/null +++ b/examples/gui/button/go.mod @@ -0,0 +1,8 @@ +module example + +go 1.19 + +require ( + github.com/gen2brain/raylib-go/raygui v0.0.0-20221117130019-ce3c8e83dd6d + github.com/gen2brain/raylib-go/raylib v0.0.0-20221117130019-ce3c8e83dd6d +) diff --git a/examples/gui/button/main.go b/examples/gui/button/main.go new file mode 100644 index 0000000..c7b3a12 --- /dev/null +++ b/examples/gui/button/main.go @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + + rl "github.com/gen2brain/raylib-go/raylib" + gui "github.com/gen2brain/raylib-go/raygui" +) + +func main() { + rl.InitWindow(800, 450, "raygui - button") + + rl.SetTargetFPS(60) + + var button bool + + for !rl.WindowShouldClose() { + rl.BeginDrawing() + + rl.ClearBackground(rl.Black) + + button = gui.Button(rl.NewRectangle(50, 150, 100, 40), "Click") + if button { + fmt.Println("Clicked on button") + } + + rl.EndDrawing() + } + + rl.CloseWindow() +} diff --git a/examples/gui/controls_test_suite/controls_test_suite.go b/examples/gui/controls_test_suite/controls_test_suite.go new file mode 100644 index 0000000..1cad647 --- /dev/null +++ b/examples/gui/controls_test_suite/controls_test_suite.go @@ -0,0 +1,286 @@ +package main + +import ( + "fmt" + + gui "github.com/gen2brain/raylib-go/raygui" + rl "github.com/gen2brain/raylib-go/raylib" +) + +/******************************************************************************************* +* +* raygui - controls test suite +* +* TEST CONTROLS: +* - gui.DropdownBox() +* - gui.CheckBox() +* - gui.Spinner() +* - gui.ValueBox() +* - gui.TextBox() +* - gui.Button() +* - gui.ComboBox() +* - gui.ListView() +* - gui.ToggleGroup() +* - gui.TextBoxMulti() +* - gui.ColorPicker() +* - gui.Slider() +* - gui.SliderBar() +* - gui.ProgressBar() +* - gui.ColorBarAlpha() +* - gui.ScrollPanel() +* +* +* DEPENDENCIES: +* raylib 4.0 - Windowing/input management and drawing. +* raygui 3.2 - Immediate-mode GUI controls. +* +* COMPILATION (Windows - MinGW): +* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99 +* +* LICENSE: zlib/libpng +* +* Copyright (c) 2016-2022 Ramon Santamaria (@raysan5) +* +**********************************************************************************************/ + +//#define RAYGUI_CUSTOM_ICONS // It requires providing gui_icons.h in the same directory +//#include "gui_icons.h" // External icons data provided, it can be generated with rGuiIcons tool + +//------------------------------------------------------------------------------------ +// Program main entry point +//------------------------------------------------------------------------------------ +func main() { + // Initialization + //--------------------------------------------------------------------------------------- + const ( + screenWidth = 690 + screenHeight = 560 + ) + + rl.InitWindow(screenWidth, screenHeight, "raygui - controls test suite") + rl.SetExitKey(0) + + // GUI controls initialization + //---------------------------------------------------------------------------------- + var ( + dropdownBox000Active int32 = 0 + dropDown000EditMode bool = false + + dropdownBox001Active int32 = 0 + dropDown001EditMode bool = false + + spinner001Value int32 = 0 + spinnerEditMode bool = false + + valueBox002Value int32 = 0 + valueBoxEditMode bool = false + + textBoxText = "Text box" + textBoxEditMode bool = false + + listViewScrollIndex int32 = 0 + listViewActive int32 = -1 + + listViewExScrollIndex int32 = 0 + listViewExActive int32 = 2 + listViewExFocus int32 = -1 + listViewExList = []string{"This", "is", "a", "list view", "with", "disable", "elements", "amazing!"} + + multiTextBoxText = "Multi text box" + multiTextBoxEditMode bool = false + colorPickerValue = rl.Red + + sliderValue float32 = 50 + sliderBarValue float32 = 60 + progressValue float32 = 0.4 + + forceSquaredChecked bool = false + + alphaValue float32 = 0.5 + + comboBoxActive int32 = 1 + + toggleGroupActive int32 = 0 + + // TODO viewScroll = rl.Vector2{0, 0} + + //---------------------------------------------------------------------------------- + + // Custom GUI font loading + //Font font = LoadFontEx("fonts/rainyhearts16.ttf", 12, 0, 0); + //GuiSetFont(font); + + exitWindow bool = false + showMessageBox bool = false + + textInput string + showTextInputBox bool = false + + // TODO textInputFileName string + ) + + rl.SetTargetFPS(60) + //-------------------------------------------------------------------------------------- + + // Main game loop + for !exitWindow { // Detect window close button or ESC key + // Update + //---------------------------------------------------------------------------------- + exitWindow = rl.WindowShouldClose() + + if rl.IsKeyPressed(rl.KeyEscape) { + showMessageBox = !showMessageBox + } + + if rl.IsKeyDown(rl.KeyLeftControl) && rl.IsKeyPressed(rl.KeyS) { + showTextInputBox = true + } + + // TODO if rl.IsFileDropped() { + // TODO var droppedFiles gui.FilePathList = rl.LoadDroppedFiles() + // TODO if (droppedFiles.count > 0) && rl.IsFileExtension(droppedFiles.paths[0], ".rgs") { + // TODO gui.LoadStyle(droppedFiles.paths[0]) + // TODO } + // TODO rl.UnloadDroppedFiles(droppedFiles) // Clear internal buffers + // TODO } + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + rl.BeginDrawing() + + rl.ClearBackground(rl.GetColor(uint(gui.GetStyle(gui.DEFAULT, gui.BACKGROUND_COLOR)))) + + // raygui: controls drawing + //---------------------------------------------------------------------------------- + if dropDown000EditMode || dropDown001EditMode { + gui.Lock() + } else if !dropDown000EditMode && !dropDown001EditMode { + gui.Unlock() + } + //GuiDisable(); + + // First GUI column + //GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); + forceSquaredChecked = gui.CheckBox(rl.Rectangle{25, 108, 15, 15}, "FORCE CHECK!", forceSquaredChecked) + + 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 + } + if gui.ValueBox(rl.Rectangle{25, 175, 125, 30}, "", &valueBox002Value, 0, 100, valueBoxEditMode) { + valueBoxEditMode = !valueBoxEditMode + } + gui.SetStyle(gui.TEXTBOX, gui.TEXT_ALIGNMENT, gui.TEXT_ALIGN_LEFT) + if gui.TextBox(rl.Rectangle{25, 215, 125, 30}, &textBoxText, 64, textBoxEditMode) { + textBoxEditMode = !textBoxEditMode + } + + gui.SetStyle(gui.BUTTON, gui.TEXT_ALIGNMENT, gui.TEXT_ALIGN_CENTER) + + if gui.Button(rl.Rectangle{25, 255, 125, 30}, gui.IconText(gui.ICON_FILE_SAVE, "Save File")) { + showTextInputBox = true + } + + gui.GroupBox(rl.Rectangle{25, 310, 125, 150}, "STATES") + //GuiLock(); + gui.SetState(gui.STATE_NORMAL) + if gui.Button(rl.Rectangle{30, 320, 115, 30}, "NORMAL") { + } + gui.SetState(gui.STATE_FOCUSED) + if gui.Button(rl.Rectangle{30, 355, 115, 30}, "FOCUSED") { + } + gui.SetState(gui.STATE_PRESSED) + if gui.Button(rl.Rectangle{30, 390, 115, 30}, "#15#PRESSED") { + } + gui.SetState(gui.STATE_DISABLED) + if gui.Button(rl.Rectangle{30, 425, 115, 30}, "DISABLED") { + } + gui.SetState(gui.STATE_NORMAL) + //GuiUnlock(); + + comboBoxActive = gui.ComboBox(rl.Rectangle{25, 470, 125, 30}, "ONE;TWO;THREE;FOUR", comboBoxActive) + + // NOTE: gui.DropdownBox must draw after any other control that can be covered on unfolding + gui.SetStyle(gui.DROPDOWNBOX, gui.TEXT_ALIGNMENT, gui.TEXT_ALIGN_LEFT) + if gui.DropdownBox(rl.Rectangle{25, 65, 125, 30}, "#01#ONE;#02#TWO;#03#THREE;#04#FOUR", &dropdownBox001Active, dropDown001EditMode) { + dropDown001EditMode = !dropDown001EditMode + } + + gui.SetStyle(gui.DROPDOWNBOX, gui.TEXT_ALIGNMENT, gui.TEXT_ALIGN_CENTER) + if gui.DropdownBox(rl.Rectangle{25, 25, 125, 30}, "ONE;TWO;THREE", &dropdownBox000Active, dropDown000EditMode) { + dropDown000EditMode = !dropDown000EditMode + } + + // Second GUI column + listViewActive = gui.ListView(rl.Rectangle{165, 25, 140, 140}, "Charmander;Bulbasaur;#18#Squirtel;Pikachu;Eevee;Pidgey", &listViewScrollIndex, listViewActive) + listViewExActive = gui.ListViewEx(rl.Rectangle{165, 180, 140, 200}, listViewExList, &listViewExFocus, &listViewExScrollIndex, listViewExActive) + + 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 + } + 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) + 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) + + 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") + + alphaValue = gui.ColorBarAlpha(rl.Rectangle{320, 490, 200, 30}, "", alphaValue) + + 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") + + if (result == 0) || (result == 2) { + showMessageBox = false + } else if result == 1 { + exitWindow = true + } + } + + if showTextInputBox { + rl.DrawRectangle(0, 0, int32(rl.GetScreenWidth()), int32(rl.GetScreenHeight()), rl.Fade(rl.RayWhite, 0.8)) + 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) + + if result == 1 { + // TODO: Validate textInput value and save + // strcpy(textInputFileName, textInput) + // TODO textInputFileName = textInput + } + if (result == 0) || (result == 1) || (result == 2) { + showTextInputBox = false + //strcpy(textInput, "\0"); + textInput = "" + } + } + //---------------------------------------------------------------------------------- + + rl.EndDrawing() + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + rl.CloseWindow() // Close window and OpenGL context + //-------------------------------------------------------------------------------------- +} diff --git a/examples/gui/controls_test_suite/controls_test_suite.png b/examples/gui/controls_test_suite/controls_test_suite.png new file mode 100644 index 0000000..8db0e25 Binary files /dev/null and b/examples/gui/controls_test_suite/controls_test_suite.png differ diff --git a/examples/gui/controls_test_suite/go.mod b/examples/gui/controls_test_suite/go.mod new file mode 100644 index 0000000..1b94db7 --- /dev/null +++ b/examples/gui/controls_test_suite/go.mod @@ -0,0 +1,11 @@ +module example + +go 1.19 + +require ( + github.com/gen2brain/raylib-go/raygui v0.0.0-20221122151443-e8a384ed1346 + github.com/gen2brain/raylib-go/raylib v0.0.0-20221122155035-fe6d2c0ed32a +) + +replace github.com/gen2brain/raylib-go/raylib => ../../../raylib +replace github.com/gen2brain/raylib-go/raygui => ../../../raygui diff --git a/examples/gui/portable_window/go.mod b/examples/gui/portable_window/go.mod new file mode 100644 index 0000000..1b94db7 --- /dev/null +++ b/examples/gui/portable_window/go.mod @@ -0,0 +1,11 @@ +module example + +go 1.19 + +require ( + github.com/gen2brain/raylib-go/raygui v0.0.0-20221122151443-e8a384ed1346 + github.com/gen2brain/raylib-go/raylib v0.0.0-20221122155035-fe6d2c0ed32a +) + +replace github.com/gen2brain/raylib-go/raylib => ../../../raylib +replace github.com/gen2brain/raylib-go/raygui => ../../../raygui diff --git a/examples/gui/portable_window/portable_window.go b/examples/gui/portable_window/portable_window.go new file mode 100644 index 0000000..2e4754b --- /dev/null +++ b/examples/gui/portable_window/portable_window.go @@ -0,0 +1,99 @@ +package main + +import ( + "fmt" + + gui "github.com/gen2brain/raylib-go/raygui" + rl "github.com/gen2brain/raylib-go/raylib" +) + +/******************************************************************************************* +* +* raygui - portable window +* +* DEPENDENCIES: +* raylib 4.0 - Windowing/input management and drawing. +* raygui 3.0 - Immediate-mode GUI controls. +* +* COMPILATION (Windows - MinGW): +* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99 +* +* LICENSE: zlib/libpng +* +* Copyright (c) 2016-2022 Ramon Santamaria (@raysan5) +* +**********************************************************************************************/ + +//------------------------------------------------------------------------------------ +// Program main entry point +//------------------------------------------------------------------------------------ +func main() { + // Initialization + //--------------------------------------------------------------------------------------- + const ( + screenWidth = 800 + screenHeight = 600 + ) + + rl.SetConfigFlags(rl.FlagWindowUndecorated) + rl.InitWindow(screenWidth, screenHeight, "raygui - portable window") + + // General variables + var ( + mousePosition = rl.Vector2{0, 0} + windowPosition = rl.Vector2{500, 200} + panOffset = mousePosition + dragWindow = false + ) + + rl.SetWindowPosition(int(windowPosition.X), int(windowPosition.Y)) + + exitWindow := false + + rl.SetTargetFPS(60) + //-------------------------------------------------------------------------------------- + + // Main game loop + for !exitWindow && !rl.WindowShouldClose() { // Detect window close button or ESC key + // Update + //---------------------------------------------------------------------------------- + mousePosition = rl.GetMousePosition() + + if rl.IsMouseButtonPressed(rl.MouseLeftButton) { + if (rl.CheckCollisionPointRec(mousePosition, rl.Rectangle{0, 0, screenWidth, 20})) { + dragWindow = true + panOffset = mousePosition + } + } + + if dragWindow { + windowPosition.X += (mousePosition.X - panOffset.X) + windowPosition.Y += (mousePosition.Y - panOffset.Y) + + if rl.IsMouseButtonReleased(rl.MouseLeftButton) { + dragWindow = false + } + + rl.SetWindowPosition(int(windowPosition.X), int(windowPosition.Y)) + } + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + rl.BeginDrawing() + + rl.ClearBackground(rl.RayWhite) + + exitWindow = gui.WindowBox(rl.Rectangle{0, 0, screenWidth, screenHeight}, "#198# PORTABLE WINDOW") + + rl.DrawText(fmt.Sprintf("Mouse Position: [ %.0f, %.0f ]", mousePosition.X, mousePosition.Y), 10, 40, 10, rl.DarkGray) + + rl.EndDrawing() + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + rl.CloseWindow() // Close window and OpenGL context + //-------------------------------------------------------------------------------------- +} diff --git a/examples/gui/portable_window/portable_window.png b/examples/gui/portable_window/portable_window.png new file mode 100644 index 0000000..bc6e34e Binary files /dev/null and b/examples/gui/portable_window/portable_window.png differ diff --git a/examples/gui/scroll_panel/go.mod b/examples/gui/scroll_panel/go.mod new file mode 100644 index 0000000..1b94db7 --- /dev/null +++ b/examples/gui/scroll_panel/go.mod @@ -0,0 +1,11 @@ +module example + +go 1.19 + +require ( + github.com/gen2brain/raylib-go/raygui v0.0.0-20221122151443-e8a384ed1346 + github.com/gen2brain/raylib-go/raylib v0.0.0-20221122155035-fe6d2c0ed32a +) + +replace github.com/gen2brain/raylib-go/raylib => ../../../raylib +replace github.com/gen2brain/raylib-go/raygui => ../../../raygui diff --git a/examples/gui/scroll_panel/scroll_panel.go b/examples/gui/scroll_panel/scroll_panel.go new file mode 100644 index 0000000..dc6e207 --- /dev/null +++ b/examples/gui/scroll_panel/scroll_panel.go @@ -0,0 +1,191 @@ +package main + +import ( + "fmt" + + gui "github.com/gen2brain/raylib-go/raygui" + rl "github.com/gen2brain/raylib-go/raylib" +) + +/******************************************************************************************* +* +* raygui - Controls test +* +* TEST CONTROLS: +* - gui.ScrollPanel() +* +* DEPENDENCIES: +* raylib 4.0 - Windowing/input management and drawing. +* raygui 3.0 - Immediate-mode GUI controls. +* +* COMPILATION (Windows - MinGW): +* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99 +* +* COMPILATION (Linux - gcc): +* gcc -o $(NAME_PART) $(FILE_NAME) -I../../src -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 -std=c99 +* +* LICENSE: zlib/libpng +* +* Copyright (c) 2019-2022 Vlad Adrian (@Demizdor) and Ramon Santamaria (@raysan5) +* +**********************************************************************************************/ + +//------------------------------------------------------------------------------------ +// Program main entry point +//------------------------------------------------------------------------------------ +func main() { + + // Initialization + //--------------------------------------------------------------------------------------- + const ( + screenWidth = 800 + screenHeight = 450 + ) + + rl.InitWindow(screenWidth, screenHeight, "raygui - gui.ScrollPanel()") + + var ( + panelRec = rl.Rectangle{20, 40, 200, 150} + panelContentRec = rl.Rectangle{0, 0, 340, 340} + panelScroll = rl.Vector2{99, -20} + + showContentArea = true + ) + + rl.SetTargetFPS(60) + //--------------------------------------------------------------------------------------- + + // Main game loop + for !rl.WindowShouldClose() { + // Detect window close button or ESC key + + // Update + //---------------------------------------------------------------------------------- + // TODO: Implement required update logic + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + rl.BeginDrawing() + + rl.ClearBackground(rl.RayWhite) + + rl.DrawText(fmt.Sprintf("[%.1f, %.1f]", panelScroll.X, panelScroll.Y), 4, 4, 20, rl.Red) + + view := gui.ScrollPanel(panelRec, "", panelContentRec, &panelScroll) + + rl.BeginScissorMode(int32(view.X), int32(view.Y), int32(view.Width), int32(view.Height)) + gui.Grid(rl.Rectangle{ + float32(panelRec.X + panelScroll.X), + float32(panelRec.Y + panelScroll.Y), + float32(panelContentRec.Width), + float32(panelContentRec.Height), + }, "", 16, 3) + rl.EndScissorMode() + + if showContentArea { + rl.DrawRectangle( + int32(panelRec.X+panelScroll.X), + int32(panelRec.Y+panelScroll.Y), + int32(panelContentRec.Width), + int32(panelContentRec.Height), + rl.Fade(rl.Red, 0.1), + ) + } + + DrawStyleEditControls() + + showContentArea = gui.CheckBox(rl.Rectangle{565, 80, 20, 20}, "SHOW CONTENT AREA", showContentArea) + + panelContentRec.Width = gui.SliderBar(rl.Rectangle{590, 385, 145, 15}, + "WIDTH", + fmt.Sprintf("%.1f", panelContentRec.Width), + panelContentRec.Width, + 1, 600) + panelContentRec.Height = gui.SliderBar(rl.Rectangle{590, 410, 145, 15}, + "HEIGHT", + fmt.Sprintf("%.1f", panelContentRec.Height), + panelContentRec.Height, 1, 400) + + rl.EndDrawing() + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + rl.CloseWindow() // Close window and OpenGL context + //-------------------------------------------------------------------------------------- +} + +// Draw and process scroll bar style edition controls +func DrawStyleEditControls() { + // ScrollPanel style controls + //---------------------------------------------------------- + gui.GroupBox(rl.Rectangle{550, 170, 220, 205}, "SCROLLBAR STYLE") + + var style int32 + + style = gui.GetStyle(gui.SCROLLBAR, gui.BORDER_WIDTH) + gui.Label(rl.Rectangle{555, 195, 110, 10}, "BORDER_WIDTH") + gui.Spinner(rl.Rectangle{670, 190, 90, 20}, "", &style, 0, 6, false) + gui.SetStyle(gui.SCROLLBAR, gui.BORDER_WIDTH, style) + + style = gui.GetStyle(gui.SCROLLBAR, gui.ARROWS_SIZE) + gui.Label(rl.Rectangle{555, 220, 110, 10}, "ARROWS_SIZE") + gui.Spinner(rl.Rectangle{670, 215, 90, 20}, "", &style, 4, 14, false) + gui.SetStyle(gui.SCROLLBAR, gui.ARROWS_SIZE, style) + + style = gui.GetStyle(gui.SCROLLBAR, gui.SLIDER_PADDING) + gui.Label(rl.Rectangle{555, 245, 110, 10}, "SLIDER_PADDING") + gui.Spinner(rl.Rectangle{670, 240, 90, 20}, "", &style, 0, 14, false) + gui.SetStyle(gui.SCROLLBAR, gui.SLIDER_PADDING, style) + + style = boolToint32( gui.CheckBox(rl.Rectangle{565, 280, 20, 20}, "ARROWS_VISIBLE", int32Tobool(gui.GetStyle(gui.SCROLLBAR, gui.ARROWS_VISIBLE)))) + gui.SetStyle(gui.SCROLLBAR, gui.ARROWS_VISIBLE, style) + + style = gui.GetStyle(gui.SCROLLBAR, gui.SLIDER_PADDING) + gui.Label(rl.Rectangle{555, 325, 110, 10}, "SLIDER_PADDING") + gui.Spinner(rl.Rectangle{670, 320, 90, 20}, "", &style, 0, 14, false) + gui.SetStyle(gui.SCROLLBAR, gui.SLIDER_PADDING, style) + + style = gui.GetStyle(gui.SCROLLBAR, gui.SLIDER_WIDTH) + gui.Label(rl.Rectangle{555, 350, 110, 10}, "SLIDER_WIDTH") + gui.Spinner(rl.Rectangle{670, 345, 90, 20}, "", &style, 2, 100, false) + gui.SetStyle(gui.SCROLLBAR, gui.SLIDER_WIDTH, style) + + var text string + if gui.GetStyle(gui.LISTVIEW, gui.SCROLLBAR_SIDE) == gui.SCROLLBAR_LEFT_SIDE { + text = "SCROLLBAR: LEFT" + } else { + text = "SCROLLBAR: RIGHT" + } + style = boolToint32( gui.Toggle(rl.Rectangle{560, 110, 200, 35}, text, int32Tobool(gui.GetStyle(gui.LISTVIEW, gui.SCROLLBAR_SIDE)))) + gui.SetStyle(gui.LISTVIEW, gui.SCROLLBAR_SIDE, style) + //---------------------------------------------------------- + + // ScrollBar style controls + //---------------------------------------------------------- + gui.GroupBox(rl.Rectangle{550, 20, 220, 135}, "SCROLLPANEL STYLE") + + style = gui.GetStyle(gui.LISTVIEW, gui.SCROLLBAR_WIDTH) + gui.Label(rl.Rectangle{555, 35, 110, 10}, "SCROLLBAR_WIDTH") + gui.Spinner(rl.Rectangle{670, 30, 90, 20}, "", &style, 6, 30, false) + gui.SetStyle(gui.LISTVIEW, gui.SCROLLBAR_WIDTH, style) + + style = gui.GetStyle(gui.DEFAULT, gui.BORDER_WIDTH) + gui.Label(rl.Rectangle{555, 60, 110, 10}, "BORDER_WIDTH") + gui.Spinner(rl.Rectangle{670, 55, 90, 20}, "", &style, 0, 20, false) + gui.SetStyle(gui.DEFAULT, gui.BORDER_WIDTH, style) + //---------------------------------------------------------- +} + +func boolToint32(b bool) int32 { + if b { + return 1 + } + return 0 +} + +func int32Tobool(v int32) bool { + return 0 < v +} diff --git a/examples/gui/scroll_panel/scroll_panel.png b/examples/gui/scroll_panel/scroll_panel.png new file mode 100644 index 0000000..fe2e095 Binary files /dev/null and b/examples/gui/scroll_panel/scroll_panel.png differ diff --git a/raygui/README.md b/raygui/README.md index bcbaaff..0ce259d 100644 --- a/raygui/README.md +++ b/raygui/README.md @@ -2,4 +2,17 @@ raygui is simple and easy-to-use IMGUI (immediate mode GUI API) library. -![screenshot](https://goo.gl/ieeaLj) + +### basic_controls + +![Demo](examples/basic_controls/cyber.png) + + +### controls_test_suite + +![Demo](examples/controls_test_suite/controls_test_suite.png) + + +### scroll_panel + +![Demo](examples/scroll_panel/scroll_panel.png) diff --git a/raygui/button.go b/raygui/button.go deleted file mode 100644 index 741e3e9..0000000 --- a/raygui/button.go +++ /dev/null @@ -1,38 +0,0 @@ -package raygui - -import "github.com/gen2brain/raylib-go/raylib" - -// buttonColoring describes the per-state properties for a Button control. -type buttonColoring struct { - Border, Inside, Text Property -} - -// buttonColors lists the styling for each supported state. -var buttonColors = map[ControlState]buttonColoring{ - Normal: {ButtonDefaultBorderColor, ButtonDefaultInsideColor, ButtonDefaultTextColor}, - Clicked: {ButtonDefaultBorderColor, ButtonDefaultInsideColor, ButtonDefaultTextColor}, - Focused: {ButtonHoverBorderColor, ButtonHoverInsideColor, ButtonHoverTextColor}, - Pressed: {ButtonPressedBorderColor, ButtonPressedInsideColor, ButtonPressedTextColor}, -} - -// Button - Button element, returns true when clicked -func Button(bounds rl.Rectangle, text string) bool { - textHeight := int32(style[GlobalTextFontsize]) - textWidth := rl.MeasureText(text, textHeight) - - ConstrainRectangle(&bounds, textWidth, textWidth+GetStyle32(ButtonTextPadding), textHeight, textHeight+GetStyle32(ButtonTextPadding)/2) - - // Determine what state we're in and whether its valid. - state := GetInteractionState(bounds) - colors, exist := buttonColors[state] - if !exist { - return false - } - - // Draw control - b := bounds.ToInt32() - DrawBorderedRectangle(b, GetStyle32(ButtonBorderWidth), GetStyleColor(colors.Border), GetStyleColor(colors.Inside)) - rl.DrawText(text, b.X+((b.Width/2)-(rl.MeasureText(text, textHeight)/2)), b.Y+((b.Height/2)-(textHeight/2)), textHeight, GetStyleColor(colors.Text)) - - return state == Clicked -} diff --git a/raygui/checkbox.go b/raygui/checkbox.go deleted file mode 100644 index 99a8c6a..0000000 --- a/raygui/checkbox.go +++ /dev/null @@ -1,40 +0,0 @@ -package raygui - -import "github.com/gen2brain/raylib-go/raylib" - -// checkboxColoring describes the per-state properties for a CheckBox control. -type checkboxColoring struct { - Border, Inside Property -} - -// checkboxColors lists the styling for each supported state. -var checkboxColors = map[ControlState]checkboxColoring{ - Normal: {CheckboxDefaultBorderColor, CheckboxDefaultInsideColor}, - Clicked: {CheckboxDefaultBorderColor, CheckboxDefaultInsideColor}, - Pressed: {CheckboxClickBorderColor, CheckboxClickInsideColor}, - Focused: {CheckboxHoverBorderColor, CheckboxHoverInsideColor}, -} - -// CheckBox - Check Box element, returns true when active -func CheckBox(bounds rl.Rectangle, checked bool) bool { - state := GetInteractionState(bounds) - colors, exists := checkboxColors[state] - if !exists { - return checked - } - - // Update control - if state == Clicked { - checked = !checked - } - - // Render control - box := bounds.ToInt32() - DrawBorderedRectangle(box, GetStyle32(ToggleBorderWidth), GetStyleColor(colors.Border), GetStyleColor(colors.Inside)) - if checked { - // Show the inner button. - DrawInsetRectangle(box, GetStyle32(CheckboxInsideWidth), GetStyleColor(CheckboxDefaultActiveColor)) - } - - return checked -} diff --git a/raygui/combobox.go b/raygui/combobox.go deleted file mode 100644 index ce45adf..0000000 --- a/raygui/combobox.go +++ /dev/null @@ -1,75 +0,0 @@ -package raygui - -import ( - "fmt" - - "github.com/gen2brain/raylib-go/raylib" -) - -// comboboxColoring describes the per-state colors for a Combobox control. -type comboboxColoring struct { - Border Property - Inside Property - List Property - Text Property -} - -// comboboxColors lists the styling for each supported state. -var comboboxColors = map[ControlState]comboboxColoring{ - Normal: {ComboboxDefaultBorderColor, ComboboxDefaultInsideColor, ComboboxDefaultListTextColor, ComboboxDefaultTextColor}, - Clicked: {ComboboxDefaultBorderColor, ComboboxDefaultInsideColor, ComboboxDefaultListTextColor, ComboboxDefaultTextColor}, - Focused: {ComboboxHoverBorderColor, ComboboxHoverInsideColor, ComboboxHoverListTextColor, ComboboxHoverTextColor}, - Pressed: {ComboboxPressedBorderColor, ComboboxPressedInsideColor, ComboboxPressedListTextColor, ComboboxPressedTextColor}, -} - -// ComboBox draws a simplified version of a ComboBox allowing the user to select a string -// from a list accompanied by an N/M counter. The widget does not provide a drop-down/completion -// or any input support. -func ComboBox(bounds rl.Rectangle, comboText []string, active int) int { - // Reject invalid selections and disable rendering. - comboCount := len(comboText) - if active < 0 || active >= comboCount { - rl.TraceLog(rl.LogWarning, "ComboBox active expects 0 <= active <= %d", comboCount) - return -1 - } - - // Calculate text dimensions. - textHeight := GetStyle32(GlobalTextFontsize) - activeText := comboText[active] - textWidth := rl.MeasureText(activeText, textHeight) - - // Ensure box is large enough. - ConstrainRectangle(&bounds, textWidth, textWidth+GetStyle32(ToggleTextPadding), textHeight, textHeight+GetStyle32(ToggleTextPadding)) - b := bounds.ToInt32() - - // Generate the worst-case sizing of the counter so we can avoid resizing it as the numbers go up/down. - clickWidth := rl.MeasureText(fmt.Sprintf("%d/%d", comboCount, comboCount), b.Height) - - // Counter shows the index of the selection and the maximum number, e.g. "1/3". - counter := rl.NewRectangle(bounds.X+bounds.Width+float32(style[ComboboxPadding]), bounds.Y, float32(clickWidth), float32(b.Height)) - c := counter.ToInt32() - - // Determine if the user is interacting with the control, and if so, which state it is in. - state := GetInteractionState(bounds, counter) - colors, exists := comboboxColors[state] - if !exists { - return active - } - - // Update the control when the user releases the mouse over it. - if state == Clicked { - // increment but wrap to 0 on reaching end-of-list. - active = (active + 1) % comboCount - } - - // Render the box itself - DrawBorderedRectangle(b, GetStyle32(ComboboxBorderWidth), GetStyleColor(colors.Border), GetStyleColor(colors.Inside)) - rl.DrawText(activeText, b.X+((b.Width/2)-(rl.MeasureText(activeText, textHeight)/2)), b.Y+((b.Height/2)-(textHeight/2)), textHeight, GetStyleColor(colors.Text)) - - // Render the accompanying "clicks" box showing the element counter. - DrawBorderedRectangle(c, GetStyle32(ComboboxBorderWidth), GetStyleColor(colors.Border), GetStyleColor(colors.Inside)) - counterText := fmt.Sprintf("%d/%d", active+1, comboCount) - rl.DrawText(counterText, c.X+((c.Width/2)-(rl.MeasureText(counterText, textHeight)/2)), c.Y+((c.Height/2)-(textHeight/2)), textHeight, GetStyleColor(colors.List)) - - return active -} diff --git a/raygui/cstring.go b/raygui/cstring.go new file mode 100644 index 0000000..c321ae2 --- /dev/null +++ b/raygui/cstring.go @@ -0,0 +1,102 @@ +package raygui + +/* +#include +// Code from https://blog.pytool.com/language/golang/cgo/go-cgo-string/ + +static char** make_str_array(int size) { + return calloc(sizeof(char*), size); +} + +static int len_str_array(char **arr) { + int i = 0; + while (arr[i] != NULL) i++; + return i+1; // NULL does count +} + +static void set_str_array(char **arr, int idx, char *s) { + arr[idx] = s; +} + +static void free_str_array(char **arr, int size) { + int i; + for (i = 0; i < size; i++) { + free(arr[i]); + } + free(arr); +} +*/ +import "C" + +import ( + "unsafe" +) + +// CStringArray represents an array of pointers to NULL terminated C strings, +// the array itself is terminated with a NULL +type CStringArray struct { + Pointer unsafe.Pointer + Length int +} + +// NewCStringArray returns an instance of CStringArray +func NewCStringArray() *CStringArray { + return &CStringArray{} +} + +// NewCStringArrayFromSlice makes an instance of CStringArray then copy the +// input slice to it. +func NewCStringArrayFromSlice(ss []string) *CStringArray { + var arr CStringArray + arr.Copy(ss) + return &arr +} + +func NewCStringArrayFromPointer(p unsafe.Pointer) *CStringArray { + return &CStringArray{ + Length: int(C.len_str_array((**C.char)(p))), + Pointer: p, + } +} + +// ToSlice converts CStringArray to Go slice of strings +func (arr *CStringArray) ToSlice() []string { + if arr.Length == 0 || arr.Pointer == nil { + return []string{} + } + + var ss []string + var cs **C.char + defer C.free(unsafe.Pointer(cs)) + p := uintptr(arr.Pointer) + for { + cs = (**C.char)(unsafe.Pointer(p)) + if *cs == nil { // skip NULL - the last element + break + } + ss = append(ss, C.GoString(*cs)) + p += unsafe.Sizeof(p) + } + + return ss +} + +// Copy converts Go slice of strings to C underlying struct of CStringArray +func (arr *CStringArray) Copy(ss []string) { + arr.Length = len(ss) + 1 // one more element for NULL at the end + arr.Pointer = unsafe.Pointer(C.make_str_array(C.int(arr.Length))) + + for i, s := range ss { + cs := C.CString(s) // will be free by Free() method + C.set_str_array((**C.char)(arr.Pointer), C.int(i), cs) + } +} + +// Free frees C underlying struct of CStringArray +// MUST call this method after using CStringArray +// Exception: If you use NewCStringArrayFromPointer() to create CStringArray object +// and you use other way to free C underlying structure pointed by the pointer, +// then don't need to call Free() +func (arr *CStringArray) Free() { + C.free_str_array((**C.char)(arr.Pointer), C.int(arr.Length)) +} diff --git a/raygui/go.mod b/raygui/go.mod index e054032..c2adde5 100644 --- a/raygui/go.mod +++ b/raygui/go.mod @@ -1,7 +1,7 @@ module github.com/gen2brain/raylib-go/raygui -go 1.16 +go 1.19 -replace github.com/gen2brain/raylib-go/raylib => ../raylib +require github.com/gen2brain/raylib-go/raylib v0.0.0-20221117130019-ce3c8e83dd6d -require github.com/gen2brain/raylib-go/raylib v0.0.0-20211111173445-914ca1ffdc4d +replace github.com/gen2brain/raylib-go/raylib => ../../../raylib diff --git a/raygui/label.go b/raygui/label.go deleted file mode 100644 index ba2dd94..0000000 --- a/raygui/label.go +++ /dev/null @@ -1,21 +0,0 @@ -package raygui - -import rl "github.com/gen2brain/raylib-go/raylib" - -// Label - Label element, show text -func Label(bounds rl.Rectangle, text string) { - LabelEx(bounds, text, rl.GetColor(uint(style[LabelTextColor])), rl.NewColor(0, 0, 0, 0), rl.NewColor(0, 0, 0, 0)) -} - -// LabelEx - Label element extended, configurable colors -func LabelEx(bounds rl.Rectangle, text string, textColor, border, inner rl.Color) { - textHeight := GetStyle32(GlobalTextFontsize) - textWidth := rl.MeasureText(text, textHeight) - - ConstrainRectangle(&bounds, textWidth, textWidth+GetStyle32(LabelTextPadding), textHeight, textHeight+GetStyle32(LabelTextPadding)/2) - - // Draw control - b := bounds.ToInt32() - DrawBorderedRectangle(b, GetStyle32(LabelBorderWidth), border, inner) - rl.DrawText(text, b.X+((b.Width/2)-(textWidth/2)), b.Y+((b.Height/2)-(textHeight/2)), textHeight, textColor) -} diff --git a/raygui/progressbar.go b/raygui/progressbar.go deleted file mode 100644 index a9410b8..0000000 --- a/raygui/progressbar.go +++ /dev/null @@ -1,23 +0,0 @@ -package raygui - -import "github.com/gen2brain/raylib-go/raylib" - -// ProgressBar - Progress Bar element, shows current progress value -func ProgressBar(bounds rl.Rectangle, value float32) { - b := bounds.ToInt32() - if value > 1.0 { - value = 1.0 - } else if value < 0.0 { - value = 0.0 - } - - borderWidth := GetStyle32(ProgressbarBorderWidth) - progressBar := InsetRectangle(b, borderWidth) // backing rectangle - progressWidth := int32(value * float32(progressBar.Width)) // how much should be replaced with progress - progressValue := rl.RectangleInt32{progressBar.X, progressBar.Y, progressWidth, progressBar.Height} - - // Draw control - rl.DrawRectangle(b.X, b.Y, b.Width, b.Height, GetStyleColor(ProgressbarBorderColor)) - rl.DrawRectangle(progressBar.X, progressBar.Y, progressBar.Width, progressBar.Height, GetStyleColor(ProgressbarInsideColor)) - rl.DrawRectangle(progressValue.X, progressValue.Y, progressValue.Width, progressValue.Height, GetStyleColor(ProgressbarProgressColor)) -} diff --git a/raygui/raygui.go b/raygui/raygui.go index 6224a8a..0e9ee60 100644 --- a/raygui/raygui.go +++ b/raygui/raygui.go @@ -1,79 +1,1509 @@ -// Package raygui - Simple and easy-to-use IMGUI (immediate mode GUI API) library - package raygui +/* +#cgo CFLAGS: -DRAYGUI_IMPLEMENTATION -I../raylib/ +#include "raygui.h" +#include +*/ +import "C" + import ( + "strings" + "unsafe" + rl "github.com/gen2brain/raylib-go/raylib" ) -// GUI controls states -type ControlState int - const ( - Disabled ControlState = iota - // Normal is the default state for rendering GUI elements. - Normal - // Focused indicates the mouse is hovering over the GUI element. - Focused - // Pressed indicates the mouse is hovering over the GUI element and LMB is pressed down. - Pressed - // Clicked indicates the mouse is hovering over the GUI element and LMB has just been released. - Clicked + SCROLLBAR_LEFT_SIDE = 0 + SCROLLBAR_RIGHT_SIDE = 1 ) -// IsColliding will return true if 'point' is within any of the given rectangles. -func IsInAny(point rl.Vector2, rectangles ...rl.Rectangle) bool { - for _, rect := range rectangles { - if rl.CheckCollisionPointRec(point, rect) { - return true - } - } - return false +// GuiStyleProp - transpiled function from C4GO/tests/raylib/raygui.h:332 +// +//* +//* raygui v3.5-dev - 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. +//* +//* Controls provided: +//* +//* # Container/separators Controls +//* - WindowBox --> StatusBar, Panel +//* - GroupBox --> Line +//* - Line +//* - Panel --> StatusBar +//* - ScrollPanel --> StatusBar +//* +//* # Basic Controls +//* - Label +//* - Button +//* - LabelButton --> Label +//* - Toggle +//* - ToggleGroup --> Toggle +//* - CheckBox +//* - ComboBox +//* - DropdownBox +//* - TextBox +//* - TextBoxMulti +//* - ValueBox --> TextBox +//* - Spinner --> Button, ValueBox +//* - Slider +//* - SliderBar --> Slider +//* - ProgressBar +//* - StatusBar +//* - DummyRec +//* - Grid +//* +//* # Advance Controls +//* - ListView +//* - rl.ColorPicker --> rl.ColorPanel, rl.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). +//* +//* +//* 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 +//* +//* 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)]; +//* +//* 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. +//* +//* 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. +//* +//* TOOL: rGuiStyler is a visual tool to customize raygui style. +//* +//* +//* 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 +//* +//* 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. +//* +//* 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]; +//* +//* guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB +//* +//* TOOL: rGuiIcons is a visual tool to customize raygui icons and create new ones. +//* +//* +//* 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_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_CUSTOM_ICONS +//* Includes custom ricons.h header defining a set of custom icons, +//* this file can be generated using rGuiIcons tool +//* +//* +//* 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 +//* REMOVED: MeasureTextEx() dependency, logic directly implemented +//* REMOVED: DrawTextEx() dependency, logic directly implemented +//* ADDED: Helper functions to split text in separate lines +//* 3.2 (22-May-2022) RENAMED: Some enum values, for unification, avoiding prefixes +//* REMOVED: GuiScrollBar(), only internal +//* REDESIGNED: GuiPanel() to support text parameter +//* REDESIGNED: GuiScrollPanel() to support text parameter +//* REDESIGNED: GuiColorPicker() to support text parameter +//* REDESIGNED: GuiColorPanel() to support text parameter +//* 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 +//* REVIEWED: GuiLine() for centered alignment when including text +//* 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 +//* 2.6 (09-Sep-2019) ADDED: GuiTextInputBox() +//* REDESIGNED: GuiListView*(), GuiDropdownBox(), GuiSlider*(), GuiProgressBar(), GuiMessageBox() +//* REVIEWED: GuiTextBox(), GuiSpinner(), GuiValueBox(), GuiLoadStyle() +//* 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 +//* 2.2 (05-Feb-2019) ADDED: GuiScrollBar(), GuiScrollPanel(), reviewed GuiListView(), removed Gui*Ex() controls +//* 2.1 (26-Dec-2018) REDESIGNED: GuiCheckBox(), GuiComboBox(), GuiDropdownBox(), GuiToggleGroup() > Use combined text string +//* REDESIGNED: Style system (breaking change) +//* 2.0 (08-Nov-2018) ADDED: Support controls guiLock and custom fonts +//* REVIEWED: GuiComboBox(), GuiListView()... +//* 1.9 (09-Oct-2018) REVIEWED: GuiGrid(), GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()... +//* 1.8 (01-May-2018) Lot of rework and redesign to align with rGuiStyler and rGuiLayout +//* 1.5 (21-Jun-2017) Working in an improved styles system +//* 1.4 (15-Jun-2017) Rewritten all GUI functions (removed useless ones) +//* 1.3 (12-Jun-2017) Complete redesign of style system +//* 1.1 (01-Jun-2017) Complete review of the library +//* 1.0 (07-Jun-2016) Converted to header-only by Ramon Santamaria. +//* 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. +//* +//* +//* 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) +//* 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) +//* Daniel Nicolas: Initial implementation of basic components (2014) +//* +//* +//* LICENSE: zlib/libpng +//* +//* Copyright (c) 2014-2022 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. +//* +//* Permission is granted to anyone to use this software for any purpose, including commercial +//* applications, and to alter it and redistribute it freely, subject to the following restrictions: +//* +//* 1. The origin of this software must not be misrepresented; you must not claim that you +//* wrote the original software. If you use this software in a product, an acknowledgment +//* in the product documentation would be appreciated but is not required. +//* +//* 2. Altered source versions must be plainly marked as such, and must not be misrepresented +//* as being the original software. +//* +//* 3. This notice may not be removed or altered from any source distribution. +//* +// +// Function specifiers in case library is build/used as a shared library (Windows) +// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll +// Function specifiers definition +//---------------------------------------------------------------------------------- +// Defines and Macros +//---------------------------------------------------------------------------------- +// Allow custom memory allocators +// Simple log system to avoid printf() calls if required +// NOTE: Avoiding those calls, also avoids const strings memory usage +//---------------------------------------------------------------------------------- +// Types and Structures Definition +// NOTE: Some types are required for RAYGUI_STANDALONE usage +//---------------------------------------------------------------------------------- +// Style property +type GuiStyleProp struct { + controlId uint16 + propertyId uint16 + propertyValue uint32 } -// GetInteractionState determines the current state of a control based on mouse position and -// button states. -func GetInteractionState(rectangles ...rl.Rectangle) ControlState { - switch { - case !IsInAny(rl.GetMousePosition(), rectangles...): - return Normal - case rl.IsMouseButtonDown(rl.MouseLeftButton): - return Pressed - case rl.IsMouseButtonReleased(rl.MouseLeftButton) || rl.IsMouseButtonPressed(rl.MouseLeftButton): - return Clicked - default: - return Focused - } +// STATE_NORMAL - transpiled function from C4GO/tests/raylib/raygui.h:339 +// Gui control state +const ( + STATE_NORMAL int32 = 0 + STATE_FOCUSED = 1 + STATE_PRESSED = 2 + STATE_DISABLED = 3 +) + +// GuiState - transpiled function from C4GO/tests/raylib/raygui.h:339 +type GuiState = int32 + +// TEXT_ALIGN_LEFT - transpiled function from C4GO/tests/raylib/raygui.h:347 +// Gui control text alignment +const ( + TEXT_ALIGN_LEFT int32 = 0 + TEXT_ALIGN_CENTER = 1 + TEXT_ALIGN_RIGHT = 2 +) + +// GuiTextAlignment - transpiled function from C4GO/tests/raylib/raygui.h:347 +type GuiTextAlignment = int32 + +// DEFAULT - transpiled function from C4GO/tests/raylib/raygui.h:354 +// Gui controls +const ( + DEFAULT int32 = 0 + LABEL = 1 + BUTTON = 2 + TOGGLE = 3 + SLIDER = 4 + PROGRESSBAR = 5 + CHECKBOX = 6 + COMBOBOX = 7 + DROPDOWNBOX = 8 + TEXTBOX = 9 + VALUEBOX = 10 + SPINNER = 11 + LISTVIEW = 12 + COLORPICKER = 13 + SCROLLBAR = 14 + STATUSBAR = 15 +) + +// GuiControl - transpiled function from C4GO/tests/raylib/raygui.h:354 +type GuiControl = int32 + +// BORDER_COLOR_NORMAL - transpiled function from C4GO/tests/raylib/raygui.h:377 +// Default -> populates to all controls when set +// Basic controls +// Used also for: LABELBUTTON +// Used also for: TOGGLEGROUP +// Used also for: SLIDERBAR +// Used also for: TEXTBOXMULTI +// Uses: BUTTON, VALUEBOX +// Gui base properties for every control +// NOTE: RAYGUI_MAX_PROPS_BASE properties (by default 16 properties) +const ( + BORDER_COLOR_NORMAL int32 = 0 + BASE_COLOR_NORMAL = 1 + TEXT_COLOR_NORMAL = 2 + BORDER_COLOR_FOCUSED = 3 + BASE_COLOR_FOCUSED = 4 + TEXT_COLOR_FOCUSED = 5 + BORDER_COLOR_PRESSED = 6 + BASE_COLOR_PRESSED = 7 + TEXT_COLOR_PRESSED = 8 + BORDER_COLOR_DISABLED = 9 + BASE_COLOR_DISABLED = 10 + TEXT_COLOR_DISABLED = 11 + BORDER_WIDTH = 12 + TEXT_PADDING = 13 + TEXT_ALIGNMENT = 14 + RESERVED = 15 +) + +// GuiControlProperty - transpiled function from C4GO/tests/raylib/raygui.h:377 +type GuiControlProperty = int32 + +// TEXT_SIZE - transpiled function from C4GO/tests/raylib/raygui.h:402 +// Gui extended properties depend on control +// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default 8 properties) +//---------------------------------------------------------------------------------- +// 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 +) + +// GuiDefaultProperty - transpiled function from C4GO/tests/raylib/raygui.h:402 +type GuiDefaultProperty = int32 + +// GROUP_PADDING - transpiled function from C4GO/tests/raylib/raygui.h:416 +// Text size (glyphs max height) +// Text spacing between glyphs +// Line control color +// Background color +// Label +//typedef enum { } GuiLabelProperty; +// Button/Spinner +//typedef enum { } GuiButtonProperty; +// Toggle/ToggleGroup +const ( + GROUP_PADDING int32 = 16 +) + +// GuiToggleProperty - transpiled function from C4GO/tests/raylib/raygui.h:416 +type GuiToggleProperty = int32 + +// SLIDER_WIDTH - transpiled function from C4GO/tests/raylib/raygui.h:421 +// ToggleGroup separation between toggles +// Slider/SliderBar +const ( + SLIDER_WIDTH int32 = 16 + SLIDER_PADDING = 17 +) + +// GuiSliderProperty - transpiled function from C4GO/tests/raylib/raygui.h:421 +type GuiSliderProperty = int32 + +// PROGRESS_PADDING - transpiled function from C4GO/tests/raylib/raygui.h:427 +// Slider size of internal bar +// Slider/SliderBar internal bar padding +// ProgressBar +const ( + PROGRESS_PADDING int32 = 16 +) + +// GuiProgressBarProperty - transpiled function from C4GO/tests/raylib/raygui.h:427 +type GuiProgressBarProperty = int32 + +// ARROWS_SIZE - transpiled function from C4GO/tests/raylib/raygui.h:432 +// ProgressBar internal padding +// ScrollBar +const ( + ARROWS_SIZE int32 = 16 + ARROWS_VISIBLE = 17 + SCROLL_SLIDER_PADDING = 18 + SCROLL_SLIDER_SIZE = 19 + SCROLL_PADDING = 20 + SCROLL_SPEED = 21 +) + +// GuiScrollBarProperty - transpiled function from C4GO/tests/raylib/raygui.h:432 +type GuiScrollBarProperty = int32 + +// CHECK_PADDING - transpiled function from C4GO/tests/raylib/raygui.h:442 +// (SLIDERBAR, SLIDER_PADDING) +// CheckBox +const ( + CHECK_PADDING int32 = 16 +) + +// GuiCheckBoxProperty - transpiled function from C4GO/tests/raylib/raygui.h:442 +type GuiCheckBoxProperty = int32 + +// COMBO_BUTTON_WIDTH - transpiled function from C4GO/tests/raylib/raygui.h:447 +// CheckBox internal check padding +// ComboBox +const ( + COMBO_BUTTON_WIDTH int32 = 16 + COMBO_BUTTON_SPACING = 17 +) + +// GuiComboBoxProperty - transpiled function from C4GO/tests/raylib/raygui.h:447 +type GuiComboBoxProperty = int32 + +// ARROW_PADDING - transpiled function from C4GO/tests/raylib/raygui.h:453 +// ComboBox right button width +// ComboBox button separation +// DropdownBox +const ( + ARROW_PADDING int32 = 16 + DROPDOWN_ITEMS_SPACING = 17 +) + +// GuiDropdownBoxProperty - transpiled function from C4GO/tests/raylib/raygui.h:453 +type GuiDropdownBoxProperty = int32 + +// TEXT_INNER_PADDING - transpiled function from C4GO/tests/raylib/raygui.h:459 +// DropdownBox arrow separation from border and items +// DropdownBox items separation +// TextBox/TextBoxMulti/ValueBox/Spinner +const ( + TEXT_INNER_PADDING int32 = 16 + TEXT_LINES_SPACING = 17 +) + +// GuiTextBoxProperty - transpiled function from C4GO/tests/raylib/raygui.h:459 +type GuiTextBoxProperty = int32 + +// SPIN_BUTTON_WIDTH - transpiled function from C4GO/tests/raylib/raygui.h:465 +// TextBox/TextBoxMulti/ValueBox/Spinner inner text padding +// TextBoxMulti lines separation +// Spinner +const ( + SPIN_BUTTON_WIDTH int32 = 16 + SPIN_BUTTON_SPACING = 17 +) + +// GuiSpinnerProperty - transpiled function from C4GO/tests/raylib/raygui.h:465 +type GuiSpinnerProperty = int32 + +// LIST_ITEMS_HEIGHT - transpiled function from C4GO/tests/raylib/raygui.h:471 +// Spinner left/right buttons width +// Spinner buttons separation +// ListView +const ( + LIST_ITEMS_HEIGHT int32 = 16 + LIST_ITEMS_SPACING = 17 + SCROLLBAR_WIDTH = 18 + SCROLLBAR_SIDE = 19 +) + +// GuiListViewProperty - transpiled function from C4GO/tests/raylib/raygui.h:471 +type GuiListViewProperty = int32 + +// COLOR_SELECTOR_SIZE - transpiled function from C4GO/tests/raylib/raygui.h:479 +// ListView items height +// ListView items separation +// ListView scrollbar size (usually width) +// ListView scrollbar side (0-left, 1-right) +// rl.ColorPicker +const ( + COLOR_SELECTOR_SIZE int32 = 16 + HUEBAR_WIDTH = 17 + HUEBAR_PADDING = 18 + HUEBAR_SELECTOR_HEIGHT = 19 + HUEBAR_SELECTOR_OVERFLOW = 20 +) + +// GuiColorPickerProperty - transpiled function from C4GO/tests/raylib/raygui.h:479 +type GuiColorPickerProperty = int32 + +// GuiEnable - transpiled function from C4GO/tests/raylib/raygui.h:504 +// rl.ColorPicker right hue bar width +// rl.ColorPicker right hue bar separation from panel +// rl.ColorPicker right hue bar selector height +// rl.ColorPicker right hue bar selector overflow +//---------------------------------------------------------------------------------- +// Global Variables Definition +//---------------------------------------------------------------------------------- +// ... +//---------------------------------------------------------------------------------- +// Module Functions Declaration +//---------------------------------------------------------------------------------- +// Global gui state control functions +// Enable gui controls (global state) +func Enable() { + C.GuiEnable() } -// Constrain rectangle will ensure that if width/height are below given minimums, they will -// be set to an ideal minimum. -func ConstrainRectangle(bounds *rl.Rectangle, minWidth, idealWidth, minHeight, idealHeight int32) { - if int32(bounds.Width) < minWidth { - bounds.Width = float32(idealWidth) - } - if int32(bounds.Height) < minHeight { - bounds.Height = float32(idealHeight) - } +// GuiDisable - transpiled function from C4GO/tests/raylib/raygui.h:505 +// Disable gui controls (global state) +func Disable() { + C.GuiDisable() } -// InsetRectangle returns the dimensions of a rectangle inset by a margin within an outer rectangle. -func InsetRectangle(outer rl.RectangleInt32, inset int32) rl.RectangleInt32 { - return rl.RectangleInt32{ - X: outer.X + inset, Y: outer.Y + inset, - Width: outer.Width - 2*inset, Height: outer.Height - 2*inset, +// GuiLock - transpiled function from C4GO/tests/raylib/raygui.h:506 +// Lock gui controls (global state) +func Lock() { + C.GuiLock() +} + +// GuiUnlock - transpiled function from C4GO/tests/raylib/raygui.h:507 +// Unlock gui controls (global state) +func Unlock() { + C.GuiUnlock() +} + +// GuiIsLocked - transpiled function from C4GO/tests/raylib/raygui.h:508 +// Check if gui is locked (global state) +func IsLocked() bool { + return bool(C.GuiIsLocked()) +} + +// GuiFade - transpiled function from C4GO/tests/raylib/raygui.h:509 +// Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f +func Fade(alpha float32) { + calpha := C.float(alpha) + C.GuiFade(calpha) +} + +// GuiSetState - transpiled function from C4GO/tests/raylib/raygui.h:510 +// Set gui state (global state) +func SetState(state int32) { + cstate := C.int(state) + C.GuiSetState(cstate) +} + +// GuiGetState - transpiled function from C4GO/tests/raylib/raygui.h:511 +// Get gui state (global state) +func GetState() int32 { + return int32(C.GuiGetState()) +} + +// GuiSetStyle - transpiled function from C4GO/tests/raylib/raygui.h:518 +func SetStyle(control int32, property int32, value int32) { + ccontrol := C.int(control) + cproperty := C.int(property) + cvalue := C.int(value) + C.GuiSetStyle(ccontrol, cproperty, cvalue) +} + +// GuiGetStyle - transpiled function from C4GO/tests/raylib/raygui.h:519 +// Get one style property +func GetStyle(control int32, property int32) int32 { + ccontrol := C.int(control) + cproperty := C.int(property) + return int32(C.GuiGetStyle(ccontrol, cproperty)) +} + +// GuiWindowBox - transpiled function from C4GO/tests/raylib/raygui.h:522 +// Container/separator controls, useful for controls organization +// Window Box control, shows a window that can be closed +func WindowBox(bounds rl.Rectangle, title string) bool { + var cbounds C.struct_Rectangle + cbounds.height = C.float(bounds.Height) + cbounds.x = C.float(bounds.X) + cbounds.y = C.float(bounds.Y) + cbounds.width = C.float(bounds.Width) + ctitle := C.CString(title) + defer C.free(unsafe.Pointer(ctitle)) + return bool(C.GuiWindowBox(cbounds, ctitle)) +} + +// GuiGroupBox - transpiled function from C4GO/tests/raylib/raygui.h:523 +// Group Box control with text name +func GroupBox(bounds rl.Rectangle, text string) { + var cbounds C.struct_Rectangle + cbounds.height = C.float(bounds.Height) + cbounds.x = C.float(bounds.X) + cbounds.y = C.float(bounds.Y) + cbounds.width = C.float(bounds.Width) + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + C.GuiGroupBox(cbounds, ctext) +} + +// GuiLine - transpiled function from C4GO/tests/raylib/raygui.h:524 +// Line separator control, could contain text +func Line(bounds rl.Rectangle, text string) { + 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)) + C.GuiLine(cbounds, ctext) +} + +// GuiPanel - transpiled function from C4GO/tests/raylib/raygui.h:525 +// Panel control, useful to group controls +func Panel(bounds rl.Rectangle, text string) { + 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)) + C.GuiPanel(cbounds, ctext) +} + +// Scroll Panel control +func ScrollPanel(bounds rl.Rectangle, text string, content rl.Rectangle, scroll *rl.Vector2) rl.Rectangle { + 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)) + var ccontent C.struct_Rectangle + ccontent.x = C.float(content.X) + ccontent.y = C.float(content.Y) + ccontent.width = C.float(content.Width) + ccontent.height = C.float(content.Height) + var cscroll C.struct_Vector2 + cscroll.x = C.float(scroll.X) + cscroll.y = C.float(scroll.Y) + defer func() { + scroll.X = float32(cscroll.x) + scroll.Y = float32(cscroll.y) + }() + + var res C.struct_Rectangle + res = C.GuiScrollPanel(cbounds, ctext, ccontent, &cscroll) + + 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 +} + +// Scroll bar control (used by GuiScrollPanel()) +func ScrollBar(bounds rl.Rectangle, value, minValue, maxValue 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) + + cvalue := C.int(value) + cminValue := C.int(minValue) + cmaxValue := C.int(maxValue) + + return int32(C.GuiScrollBar(cbounds, cvalue, cminValue, cmaxValue)) +} + +// Label control, shows text +func Label(bounds rl.Rectangle, text string) { + 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)) + C.GuiLabel(cbounds, ctext) +} + +// GuiButton - transpiled function from C4GO/tests/raylib/raygui.h:531 +// Button control, returns true when clicked +func Button(bounds rl.Rectangle, text string) 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) + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + return bool(C.GuiButton(cbounds, ctext)) +} + +// GuiLabelButton - transpiled function from C4GO/tests/raylib/raygui.h:532 +// Label button control, show true when clicked +func LabelButton(bounds rl.Rectangle, text string) 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) + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + return bool(C.GuiLabelButton(cbounds, ctext)) +} + +// Toggle Button control, returns true when active +func Toggle(bounds rl.Rectangle, text string, active 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) + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + cactive := C.bool(active) + return bool(C.GuiToggle(cbounds, ctext, cactive)) +} + +// GuiToggleGroup - transpiled function from C4GO/tests/raylib/raygui.h:534 +// Toggle Group control, returns active toggle index +func ToggleGroup(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) + return int32(C.GuiToggleGroup(cbounds, ctext, cactive)) +} + +// Check Box control, returns true when active +func CheckBox(bounds rl.Rectangle, text string, checked 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) + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + cchecked := C.bool(checked) + return bool(C.GuiCheckBox(cbounds, ctext, cchecked)) +} + +// GuiComboBox - transpiled function from C4GO/tests/raylib/raygui.h:536 +// Combo Box control, returns selected item index +func ComboBox(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) + return int32(C.GuiComboBox(cbounds, ctext, cactive)) +} + +// GuiSlider - transpiled function from C4GO/tests/raylib/raygui.h:542 +// Spinner control, returns selected value +func Spinner(bounds rl.Rectangle, text string, value *int32, minValue, maxValue int, 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) + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + + if value == nil { + value = new(int32) } + cvalue := C.int(*value) + defer func() { + *value = int32(cvalue) + }() + + cminValue := C.int(minValue) + cmaxValue := C.int(maxValue) + ceditMode := C.bool(editMode) + + return bool(C.GuiSpinner(cbounds, ctext, &cvalue, cminValue, cmaxValue, ceditMode)) } -// DrawInsetRectangle is a helper to draw a box inset by a margin of an outer container. -func DrawInsetRectangle(outer rl.RectangleInt32, inset int32, color rl.Color) { - inside := InsetRectangle(outer, inset) - rl.DrawRectangle(inside.X, inside.Y, inside.Width, inside.Height, color) +func Slider(bounds rl.Rectangle, textLeft string, textRight string, value float32, minValue float32, maxValue float32) float32 { + 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) + ctextLeft := C.CString(textLeft) + defer C.free(unsafe.Pointer(ctextLeft)) + ctextRight := C.CString(textRight) + defer C.free(unsafe.Pointer(ctextRight)) + cvalue := C.float(value) + cminValue := C.float(minValue) + cmaxValue := C.float(maxValue) + return float32(C.GuiSlider(cbounds, ctextLeft, ctextRight, cvalue, cminValue, cmaxValue)) } -// DrawBorderedRectangle is a helper to draw a box with a border around it. -func DrawBorderedRectangle(bounds rl.RectangleInt32, borderWidth int32, borderColor, insideColor rl.Color) { - inside := InsetRectangle(bounds, borderWidth) - rl.DrawRectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height, borderColor) - rl.DrawRectangle(inside.X, inside.Y, inside.Width, inside.Height, insideColor) +// GuiSliderBar - transpiled function from C4GO/tests/raylib/raygui.h:543 +// Slider Bar control, returns selected value +func SliderBar(bounds rl.Rectangle, textLeft string, textRight string, value float32, minValue float32, maxValue float32) float32 { + 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) + ctextLeft := C.CString(textLeft) + defer C.free(unsafe.Pointer(ctextLeft)) + ctextRight := C.CString(textRight) + defer C.free(unsafe.Pointer(ctextRight)) + cvalue := C.float(value) + cminValue := C.float(minValue) + cmaxValue := C.float(maxValue) + return float32(C.GuiSliderBar(cbounds, ctextLeft, ctextRight, cvalue, cminValue, cmaxValue)) } + +// GuiProgressBar - transpiled function from C4GO/tests/raylib/raygui.h:544 +// Progress Bar control, shows current progress value +func ProgressBar(bounds rl.Rectangle, textLeft string, textRight string, value float32, minValue float32, maxValue float32) float32 { + 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) + ctextLeft := C.CString(textLeft) + defer C.free(unsafe.Pointer(ctextLeft)) + ctextRight := C.CString(textRight) + defer C.free(unsafe.Pointer(ctextRight)) + cvalue := C.float(value) + cminValue := C.float(minValue) + cmaxValue := C.float(maxValue) + return float32(C.GuiProgressBar(cbounds, ctextLeft, ctextRight, cvalue, cminValue, cmaxValue)) +} + +// GuiStatusBar - transpiled function from C4GO/tests/raylib/raygui.h:545 +// Status Bar control, shows info text +func StatusBar(bounds rl.Rectangle, text string) { + 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)) + C.GuiStatusBar(cbounds, ctext) +} + +// GuiDummyRec - transpiled function from C4GO/tests/raylib/raygui.h:546 +// Dummy control for placeholders +func DummyRec(bounds rl.Rectangle, text string) { + 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)) + C.GuiDummyRec(cbounds, ctext) +} + +// GuiGrid - transpiled function from C4GO/tests/raylib/raygui.h:547 +// Grid control, returns mouse cell position +func Grid(bounds rl.Rectangle, text string, spacing float32, subdivs int32) rl.Vector2 { + var cbounds C.struct_Rectangle + cbounds.y = C.float(bounds.Y) + cbounds.width = C.float(bounds.Width) + cbounds.height = C.float(bounds.Height) + cbounds.x = C.float(bounds.X) + ctext := C.CString(text) + 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 +} + +// GuiMessageBox - transpiled function from C4GO/tests/raylib/raygui.h:552 +// Advance controls set + +// List View control, returns selected list item index +// List View control +func ListView(bounds rl.Rectangle, text string, scrollIndex *int32, 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)) + + if scrollIndex == nil { + scrollIndex = new(int32) + } + cscrollIndex := C.int(*scrollIndex) + defer func() { + *scrollIndex = int32(cscrollIndex) + }() + + cactive := C.int(active) + + return int32(C.GuiListView(cbounds, ctext, &cscrollIndex, cactive)) +} + +// Message Box control, displays a message +func MessageBox(bounds rl.Rectangle, title string, message string, buttons string) 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) + ctitle := C.CString(title) + defer C.free(unsafe.Pointer(ctitle)) + cmessage := C.CString(message) + defer C.free(unsafe.Pointer(cmessage)) + cbuttons := C.CString(buttons) + defer C.free(unsafe.Pointer(cbuttons)) + return int32(C.GuiMessageBox(cbounds, ctitle, cmessage, cbuttons)) +} + +// GuiColorPicker - transpiled function from C4GO/tests/raylib/raygui.h:554 +// rl.Color Picker control (multiple color controls) +func ColorPicker(bounds rl.Rectangle, text string, color rl.Color) rl.Color { + 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 ccolor C.struct_Color + ccolor.r = C.uchar(color.R) + ccolor.g = C.uchar(color.G) + ccolor.b = C.uchar(color.B) + ccolor.a = C.uchar(color.A) + cResult := 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) + return goRes +} + +// GuiColorPanel - transpiled function from C4GO/tests/raylib/raygui.h:555 +// Color Panel control +func ColorPanel(bounds rl.Rectangle, text string, color rl.Color) rl.Color { + 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)) + var ccolor C.struct_Color + ccolor.b = C.uchar(color.B) + ccolor.a = C.uchar(color.A) + ccolor.r = C.uchar(color.R) + ccolor.g = C.uchar(color.G) + cResult := 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) + return goRes +} + +// GuiColorBarAlpha - transpiled function from C4GO/tests/raylib/raygui.h:556 +// Color Bar Alpha control +func ColorBarAlpha(bounds rl.Rectangle, text string, alpha float32) float32 { + 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)) + calpha := C.float(alpha) + return float32(C.GuiColorBarAlpha(cbounds, ctext, calpha)) +} + +// GuiColorBarHue - transpiled function from C4GO/tests/raylib/raygui.h:557 +// Color Bar Hue control +func ColorBarHue(bounds rl.Rectangle, text string, value float32) float32 { + 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)) + cvalue := C.float(value) + return float32(C.GuiColorBarHue(cbounds, ctext, cvalue)) +} + +// Dropdown Box control +// NOTE: Returns mouse click +func DropdownBox(bounds rl.Rectangle, text string, active *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) + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + + if active == nil { + active = new(int32) + } + cactive := C.int(*active) + defer func() { + *active = int32(cactive) + }() + + ceditMode := C.bool(editMode) + + return bool(C.GuiDropdownBox(cbounds, ctext, &cactive, ceditMode)) +} + +// Value Box control, updates input text with numbers +// NOTE: Requires static variables: frameCounter +func ValueBox(bounds rl.Rectangle, text string, value *int32, minValue, maxValue int, 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) + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + + if value == nil { + value = new(int32) + } + cvalue := C.int(*value) + defer func() { + *value = int32(cvalue) + }() + + cminValue := C.int(minValue) + cmaxValue := C.int(maxValue) + ceditMode := C.bool(editMode) + + return bool(C.GuiValueBox(cbounds, ctext, &cvalue, cminValue, cmaxValue, ceditMode)) +} + +// Text Box control, updates input text +// NOTE 2: Returns if KEY_ENTER pressed (useful for data validation) +func TextBox(bounds rl.Rectangle, text *string, textSize int, 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(string(bs)) + // no need : C.free(unsafe.Pointer(ctext)) + }() + + ctextSize := C.int(textSize) + ceditMode := C.bool(editMode) + + return bool(C.GuiTextBox(cbounds, ctext, ctextSize, ceditMode)) +} + +// GuiLoadStyle - transpiled function from C4GO/tests/raylib/raygui.h:560 +// Styles loading functions +// Load style file over global style variable (.rgs) +func LoadStyle(fileName string) { + cfileName := C.CString(fileName) + defer C.free(unsafe.Pointer(cfileName)) + C.GuiLoadStyle(cfileName) +} + +// TODO +// GuiLoadStyleDefault - transpiled function from C4GO/tests/raylib/raygui.h:561 +// Load style default over global style +func LoadStyleDefault() { + C.GuiLoadStyleDefault() +} + +// GuiIconText - transpiled function from C4GO/tests/raylib/raygui.h:564 +// Icons functionality +// Get text with icon id prepended (if supported) +func IconText(iconId int32, text string) string { + ciconId := C.int(iconId) + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + return C.GoString(C.GuiIconText(ciconId, ctext)) +} + +// TODO +// GuiGetIcons - transpiled function from C4GO/tests/raylib/raygui.h:567 +// Get raygui icons data pointer +// func GetIcons() []uint32 { +// return C.GuiGetIcons() +// } + +// ICON_NONE - transpiled function from C4GO/tests/raylib/raygui.h:575 +//---------------------------------------------------------------------------------- +// 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 +) + +// Text Input Box control, ask for text +func TextInputBox(bounds rl.Rectangle, title, message, buttons string, text *string, textMaxSize int32, secretViewActive *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) + + ctitle := C.CString(title) + defer C.free(unsafe.Pointer(ctitle)) + + cmessage := C.CString(message) + defer C.free(unsafe.Pointer(cmessage)) + + cbuttons := C.CString(buttons) + defer C.free(unsafe.Pointer(cbuttons)) + + 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 = string(bs) + // no need : C.free(unsafe.Pointer(ctext)) + }() + + ctextMaxSize := C.int(textMaxSize) + + if secretViewActive == nil { + secretViewActive = new(int32) + } + csecretViewActive := C.int(*secretViewActive) + defer func() { + *secretViewActive = int32(csecretViewActive) + }() + + return int32(C.GuiTextInputBox(cbounds, ctitle, cmessage, cbuttons, ctext, ctextMaxSize, &csecretViewActive)) +} + +// Text Box 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 = string(bs) + // no need : C.free(unsafe.Pointer(ctext)) + }() + + ctextSize := (C.int)(textSize) + ceditMode := (C.bool)(editMode) + + return bool(C.GuiTextBoxMulti(cbounds, ctext, ctextSize, ceditMode)) +} + +// List View 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) + cbounds.width = C.float(bounds.Width) + cbounds.height = C.float(bounds.Height) + + ctext := NewCStringArrayFromSlice(text) + defer ctext.Free() + + count := C.int(len(text)) + + if focus == nil { + focus = new(int32) + } + cfocus := C.int(*focus) + defer func() { + *focus = int32(cfocus) + }() + + if scrollIndex == nil { + scrollIndex = new(int32) + } + cscrollIndex := C.int(*scrollIndex) + defer func() { + *scrollIndex = int32(cscrollIndex) + }() + + cactive := C.int(active) + + return int32(C.GuiListViewEx(cbounds, (**C.char)(ctext.Pointer), count, &cfocus, &cscrollIndex, cactive)) +} + +// Tab Bar control +// NOTE: Using GuiToggle() for the TABS +func TabBar(bounds rl.Rectangle, text []string, active *int32) int32 { + // int GuiTabBar(Rectangle bounds, const char **text, int count, int *active) + + 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 := NewCStringArrayFromSlice(text) + defer ctext.Free() + + count := C.int(len(text)) + + if active == nil { + active = new(int32) + } + cactive := C.int(*active) + defer func() { + *active = int32(cactive) + }() + return int32(C.GuiTabBar(cbounds, (**C.char)(ctext.Pointer), count, &cactive)) +} + +// Warning (*ast.FunctionDecl): {prefix: n:SetAudioStreamCallback,t1:void (AudioStream, AudioCallback),t2:}. C4GO/tests/raylib/raylib.h:1567 :cannot transpileFunctionDecl. cannot bindingFunctionDecl func `SetAudioStreamCallback`. field type is pointer: `rAudioBuffer *` + +// Warning (*ast.FunctionDecl): {prefix: n:AttachAudioStreamProcessor,t1:void (AudioStream, AudioCallback),t2:}. C4GO/tests/raylib/raylib.h:1569 :cannot transpileFunctionDecl. cannot bindingFunctionDecl func `AttachAudioStreamProcessor`. field type is pointer: `rAudioBuffer *` + +// Warning (*ast.FunctionDecl): {prefix: n:DetachAudioStreamProcessor,t1:void (AudioStream, AudioCallback),t2:}. C4GO/tests/raylib/raylib.h:1570 :cannot transpileFunctionDecl. cannot bindingFunctionDecl func `DetachAudioStreamProcessor`. field type is pointer: `rAudioBuffer *` + +// Warning (*ast.FunctionDecl): {prefix: n:GuiSetFont,t1:void (Font),t2:}. C4GO/tests/raylib/raygui.h:514 :cannot transpileFunctionDecl. cannot bindingFunctionDecl func `GuiSetFont`. field type is pointer: `Rectangle *` + +// Warning (*ast.FunctionDecl): {prefix: n:GuiGetFont,t1:Font (void),t2:}. C4GO/tests/raylib/raygui.h:515 :cannot transpileFunctionDecl. cannot bindingFunctionDecl func `GuiGetFont`. field type is pointer: `Rectangle *` diff --git a/raygui/raygui.h b/raygui/raygui.h new file mode 100644 index 0000000..2325cd4 --- /dev/null +++ b/raygui/raygui.h @@ -0,0 +1,4581 @@ +/******************************************************************************************* +* +* raygui v3.5-dev - 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. +* +* Controls provided: +* +* # Container/separators Controls +* - WindowBox --> StatusBar, Panel +* - GroupBox --> Line +* - Line +* - Panel --> StatusBar +* - ScrollPanel --> StatusBar +* +* # Basic Controls +* - Label +* - Button +* - LabelButton --> Label +* - Toggle +* - ToggleGroup --> Toggle +* - CheckBox +* - ComboBox +* - DropdownBox +* - TextBox +* - TextBoxMulti +* - ValueBox --> TextBox +* - Spinner --> Button, ValueBox +* - Slider +* - SliderBar --> Slider +* - ProgressBar +* - StatusBar +* - DummyRec +* - Grid +* +* # 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). +* +* +* 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 +* +* 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)]; +* +* 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. +* +* 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. +* +* TOOL: rGuiStyler is a visual tool to customize raygui style. +* +* +* 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 +* +* 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. +* +* 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]; +* +* guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB +* +* TOOL: rGuiIcons is a visual tool to customize raygui icons and create new ones. +* +* +* 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_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_CUSTOM_ICONS +* Includes custom ricons.h header defining a set of custom icons, +* this file can be generated using rGuiIcons tool +* +* +* 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 +* REMOVED: MeasureTextEx() dependency, logic directly implemented +* REMOVED: DrawTextEx() dependency, logic directly implemented +* ADDED: Helper functions to split text in separate lines +* 3.2 (22-May-2022) RENAMED: Some enum values, for unification, avoiding prefixes +* REMOVED: GuiScrollBar(), only internal +* REDESIGNED: GuiPanel() to support text parameter +* REDESIGNED: GuiScrollPanel() to support text parameter +* REDESIGNED: GuiColorPicker() to support text parameter +* REDESIGNED: GuiColorPanel() to support text parameter +* 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 +* REVIEWED: GuiLine() for centered alignment when including text +* 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 +* 2.6 (09-Sep-2019) ADDED: GuiTextInputBox() +* REDESIGNED: GuiListView*(), GuiDropdownBox(), GuiSlider*(), GuiProgressBar(), GuiMessageBox() +* REVIEWED: GuiTextBox(), GuiSpinner(), GuiValueBox(), GuiLoadStyle() +* 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 +* 2.2 (05-Feb-2019) ADDED: GuiScrollBar(), GuiScrollPanel(), reviewed GuiListView(), removed Gui*Ex() controls +* 2.1 (26-Dec-2018) REDESIGNED: GuiCheckBox(), GuiComboBox(), GuiDropdownBox(), GuiToggleGroup() > Use combined text string +* REDESIGNED: Style system (breaking change) +* 2.0 (08-Nov-2018) ADDED: Support controls guiLock and custom fonts +* REVIEWED: GuiComboBox(), GuiListView()... +* 1.9 (09-Oct-2018) REVIEWED: GuiGrid(), GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()... +* 1.8 (01-May-2018) Lot of rework and redesign to align with rGuiStyler and rGuiLayout +* 1.5 (21-Jun-2017) Working in an improved styles system +* 1.4 (15-Jun-2017) Rewritten all GUI functions (removed useless ones) +* 1.3 (12-Jun-2017) Complete redesign of style system +* 1.1 (01-Jun-2017) Complete review of the library +* 1.0 (07-Jun-2016) Converted to header-only by Ramon Santamaria. +* 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. +* +* +* 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) +* 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) +* Daniel Nicolas: Initial implementation of basic components (2014) +* +* +* LICENSE: zlib/libpng +* +* Copyright (c) 2014-2022 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. +* +* Permission is granted to anyone to use this software for any purpose, including commercial +* applications, and to alter it and redistribute it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not claim that you +* wrote the original software. If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but is not required. +* +* 2. Altered source versions must be plainly marked as such, and must not be misrepresented +* as being the original software. +* +* 3. This notice may not be removed or altered from any source distribution. +* +**********************************************************************************************/ + +#ifndef RAYGUI_H +#define RAYGUI_H + +#define RAYGUI_VERSION "3.2" + +#if !defined(RAYGUI_STANDALONE) + #include "raylib.h" +#endif + +// Function specifiers in case library is build/used as a shared library (Windows) +// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll +#if defined(_WIN32) + #if defined(BUILD_LIBTYPE_SHARED) + #define RAYGUIAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) + #elif defined(USE_LIBTYPE_SHARED) + #define RAYGUIAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) + #endif +#endif + +// Function specifiers definition +#ifndef RAYGUIAPI + #define RAYGUIAPI // Functions defined as 'extern' by default (implicit specifiers) +#endif + +//---------------------------------------------------------------------------------- +// Defines and Macros +//---------------------------------------------------------------------------------- +// Allow custom memory allocators +#ifndef RAYGUI_MALLOC + #define RAYGUI_MALLOC(sz) malloc(sz) +#endif +#ifndef RAYGUI_CALLOC + #define RAYGUI_CALLOC(n,sz) calloc(n,sz) +#endif +#ifndef RAYGUI_FREE + #define RAYGUI_FREE(p) free(p) +#endif + +// Simple log system to avoid printf() calls if required +// NOTE: Avoiding those calls, also avoids const strings memory usage +#define RAYGUI_SUPPORT_LOG_INFO +#if defined(RAYGUI_SUPPORT_LOG_INFO) + #define RAYGUI_LOG(...) printf(__VA_ARGS__) +#else + #define RAYGUI_LOG(...) +#endif + +//---------------------------------------------------------------------------------- +// Types and Structures Definition +// NOTE: Some types are required for RAYGUI_STANDALONE usage +//---------------------------------------------------------------------------------- +#if defined(RAYGUI_STANDALONE) + #ifndef __cplusplus + // Boolean type + #ifndef true + typedef enum { false, true } bool; + #endif + #endif + + // Vector2 type + typedef struct Vector2 { + float x; + float y; + } Vector2; + + // Vector3 type // -- ConvertHSVtoRGB(), ConvertRGBtoHSV() + typedef struct Vector3 { + float x; + float y; + float z; + } Vector3; + + // Color type, RGBA (32bit) + typedef struct Color { + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char a; + } Color; + + // Rectangle type + typedef struct Rectangle { + float x; + float y; + float width; + float height; + } Rectangle; + + // TODO: Texture2D type is very coupled to raylib, required by Font type + // It should be redesigned to be provided by user + typedef struct Texture2D { + unsigned int id; // OpenGL texture id + int width; // Texture base width + int height; // Texture base height + int mipmaps; // Mipmap levels, 1 by default + int format; // Data format (PixelFormat type) + } Texture2D; + + // Image, pixel data stored in CPU memory (RAM) + typedef struct Image { + void *data; // Image raw data + int width; // Image base width + int height; // Image base height + int mipmaps; // Mipmap levels, 1 by default + int format; // Data format (PixelFormat type) + } Image; + + // GlyphInfo, font characters glyphs info + typedef struct GlyphInfo { + int value; // Character value (Unicode) + int offsetX; // Character offset X when drawing + int offsetY; // Character offset Y when drawing + int advanceX; // Character advance position X + Image image; // Character image data + } GlyphInfo; + + // TODO: Font type is very coupled to raylib, mostly required by GuiLoadStyle() + // It should be redesigned to be provided by user + typedef struct Font { + int baseSize; // Base size (default chars height) + int glyphCount; // Number of glyph characters + int glyphPadding; // Padding around the glyph characters + Texture2D texture; // Texture atlas containing the glyphs + Rectangle *recs; // Rectangles in texture for the glyphs + GlyphInfo *glyphs; // Glyphs info data + } Font; +#endif + +// Style property +typedef struct GuiStyleProp { + unsigned short controlId; + unsigned short propertyId; + unsigned int propertyValue; +} GuiStyleProp; + +// Gui control state +typedef enum { + STATE_NORMAL = 0, + STATE_FOCUSED, + STATE_PRESSED, + STATE_DISABLED, +} GuiState; + +// Gui control text alignment +typedef enum { + TEXT_ALIGN_LEFT = 0, + TEXT_ALIGN_CENTER, + TEXT_ALIGN_RIGHT, +} GuiTextAlignment; + +// 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 + PROGRESSBAR, + CHECKBOX, + COMBOBOX, + DROPDOWNBOX, + TEXTBOX, // Used also for: TEXTBOXMULTI + VALUEBOX, + SPINNER, // Uses: BUTTON, VALUEBOX + LISTVIEW, + COLORPICKER, + SCROLLBAR, + STATUSBAR +} GuiControl; + +// 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 +} GuiControlProperty; + +// Gui extended properties depend on control +// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default 8 properties) +//---------------------------------------------------------------------------------- + +// DEFAULT extended properties +// NOTE: Those properties are common to all controls or global +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 +} GuiDefaultProperty; + +// Label +//typedef enum { } GuiLabelProperty; + +// Button/Spinner +//typedef enum { } GuiButtonProperty; + +// Toggle/ToggleGroup +typedef enum { + GROUP_PADDING = 16, // ToggleGroup separation between toggles +} GuiToggleProperty; + +// Slider/SliderBar +typedef enum { + SLIDER_WIDTH = 16, // Slider size of internal bar + SLIDER_PADDING // Slider/SliderBar internal bar padding +} GuiSliderProperty; + +// ProgressBar +typedef enum { + PROGRESS_PADDING = 16, // ProgressBar internal padding +} GuiProgressBarProperty; + +// ScrollBar +typedef enum { + ARROWS_SIZE = 16, + ARROWS_VISIBLE, + SCROLL_SLIDER_PADDING, // (SLIDERBAR, SLIDER_PADDING) + SCROLL_SLIDER_SIZE, + SCROLL_PADDING, + SCROLL_SPEED, +} GuiScrollBarProperty; + +// CheckBox +typedef enum { + CHECK_PADDING = 16 // CheckBox internal check padding +} GuiCheckBoxProperty; + +// ComboBox +typedef enum { + COMBO_BUTTON_WIDTH = 16, // ComboBox right button width + COMBO_BUTTON_SPACING // ComboBox button separation +} GuiComboBoxProperty; + +// DropdownBox +typedef enum { + ARROW_PADDING = 16, // DropdownBox arrow separation from border and items + DROPDOWN_ITEMS_SPACING // DropdownBox items separation +} GuiDropdownBoxProperty; + +// TextBox/TextBoxMulti/ValueBox/Spinner +typedef enum { + TEXT_INNER_PADDING = 16, // TextBox/TextBoxMulti/ValueBox/Spinner inner text padding + TEXT_LINES_SPACING, // TextBoxMulti lines separation +} GuiTextBoxProperty; + +// Spinner +typedef enum { + SPIN_BUTTON_WIDTH = 16, // Spinner left/right buttons width + SPIN_BUTTON_SPACING, // Spinner buttons separation +} GuiSpinnerProperty; + +// ListView +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) +} GuiListViewProperty; + +// ColorPicker +typedef enum { + COLOR_SELECTOR_SIZE = 16, + HUEBAR_WIDTH, // ColorPicker right hue bar width + HUEBAR_PADDING, // ColorPicker right hue bar separation from panel + HUEBAR_SELECTOR_HEIGHT, // ColorPicker right hue bar selector height + HUEBAR_SELECTOR_OVERFLOW // ColorPicker right hue bar selector overflow +} GuiColorPickerProperty; + +#define SCROLLBAR_LEFT_SIDE 0 +#define SCROLLBAR_RIGHT_SIDE 1 + +//---------------------------------------------------------------------------------- +// Global Variables Definition +//---------------------------------------------------------------------------------- +// ... + +//---------------------------------------------------------------------------------- +// Module Functions Declaration +//---------------------------------------------------------------------------------- + +#if defined(__cplusplus) +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) + +// 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) + +// 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 + +// 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 + +// 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 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) +//---------------------------------------------------------------------------------- +// Icons enumeration +//---------------------------------------------------------------------------------- +typedef enum { + ICON_NONE = 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, +} GuiIconName; +#endif + +#endif + +#if defined(__cplusplus) +} // Prevents name mangling of functions +#endif + +#endif // RAYGUI_H + +/*********************************************************************************** +* +* RAYGUI IMPLEMENTATION +* +************************************************************************************/ + +#if defined(RAYGUI_IMPLEMENTATION) + +#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: va_list, va_start(), vfprintf(), va_end() [TextFormat()] +#include // Required for: roundf() [GuiColorPicker()] + +#ifdef __cplusplus + #define RAYGUI_CLITERAL(name) name +#else + #define RAYGUI_CLITERAL(name) (name) +#endif + +#if !defined(RAYGUI_NO_ICONS) && !defined(RAYGUI_CUSTOM_ICONS) + +// Embedded icons, no external file provided +#define RAYGUI_ICON_SIZE 16 // Size of icons in pixels (squared) +#define RAYGUI_ICON_MAX_ICONS 256 // Maximum number of icons +#define RAYGUI_ICON_MAX_NAME_LENGTH 32 // Maximum length of icon name id + +// Icons data is defined by bit array (every bit represents one pixel) +// Those arrays are stored as unsigned int data arrays, so, +// every array element defines 32 pixels (bits) of information +// One icon is defined by 8 int, (8 int * 32 bit = 256 bit = 16*16 pixels) +// NOTE: Number of elemens depend on RAYGUI_ICON_SIZE (by default 16x16 pixels) +#define RAYGUI_ICON_DATA_ELEMENTS (RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32) + +//---------------------------------------------------------------------------------- +// Icons data for all gui possible icons (allocated on data segment by default) +// +// NOTE 1: 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 +// +// NOTE 2: A different icon 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 +// +// guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB +//---------------------------------------------------------------------------------- +static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_NONE + 0x3ff80000, 0x2f082008, 0x2042207e, 0x40027fc2, 0x40024002, 0x40024002, 0x40024002, 0x00007ffe, // ICON_FOLDER_FILE_OPEN + 0x3ffe0000, 0x44226422, 0x400247e2, 0x5ffa4002, 0x57ea500a, 0x500a500a, 0x40025ffa, 0x00007ffe, // ICON_FILE_SAVE_CLASSIC + 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024002, 0x44424282, 0x793e4102, 0x00000100, // ICON_FOLDER_OPEN + 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024102, 0x44424102, 0x793e4282, 0x00000000, // ICON_FOLDER_SAVE + 0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x24442284, 0x21042104, 0x20042104, 0x00003ffc, // ICON_FILE_OPEN + 0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x21042104, 0x22842444, 0x20042104, 0x00003ffc, // ICON_FILE_SAVE + 0x3ff00000, 0x201c2010, 0x00042004, 0x20041004, 0x20844784, 0x00841384, 0x20042784, 0x00003ffc, // ICON_FILE_EXPORT + 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x22042204, 0x22042f84, 0x20042204, 0x00003ffc, // ICON_FILE_ADD + 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x25042884, 0x25042204, 0x20042884, 0x00003ffc, // ICON_FILE_DELETE + 0x3ff00000, 0x201c2010, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // ICON_FILETYPE_TEXT + 0x3ff00000, 0x201c2010, 0x27042004, 0x244424c4, 0x26442444, 0x20642664, 0x20042004, 0x00003ffc, // ICON_FILETYPE_AUDIO + 0x3ff00000, 0x201c2010, 0x26042604, 0x20042004, 0x35442884, 0x2414222c, 0x20042004, 0x00003ffc, // ICON_FILETYPE_IMAGE + 0x3ff00000, 0x201c2010, 0x20c42004, 0x22442144, 0x22442444, 0x20c42144, 0x20042004, 0x00003ffc, // ICON_FILETYPE_PLAY + 0x3ff00000, 0x3ffc2ff0, 0x3f3c2ff4, 0x3dbc2eb4, 0x3dbc2bb4, 0x3f3c2eb4, 0x3ffc2ff4, 0x00002ff4, // ICON_FILETYPE_VIDEO + 0x3ff00000, 0x201c2010, 0x21842184, 0x21842004, 0x21842184, 0x21842184, 0x20042184, 0x00003ffc, // ICON_FILETYPE_INFO + 0x0ff00000, 0x381c0810, 0x28042804, 0x28042804, 0x28042804, 0x28042804, 0x20102ffc, 0x00003ff0, // ICON_FILE_COPY + 0x00000000, 0x701c0000, 0x079c1e14, 0x55a000f0, 0x079c00f0, 0x701c1e14, 0x00000000, 0x00000000, // ICON_FILE_CUT + 0x01c00000, 0x13e41bec, 0x3f841004, 0x204420c4, 0x20442044, 0x20442044, 0x207c2044, 0x00003fc0, // ICON_FILE_PASTE + 0x00000000, 0x3aa00fe0, 0x2abc2aa0, 0x2aa42aa4, 0x20042aa4, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_CURSOR_HAND + 0x00000000, 0x003c000c, 0x030800c8, 0x30100c10, 0x10202020, 0x04400840, 0x01800280, 0x00000000, // ICON_CURSOR_POINTER + 0x00000000, 0x00180000, 0x01f00078, 0x03e007f0, 0x07c003e0, 0x04000e40, 0x00000000, 0x00000000, // ICON_CURSOR_CLASSIC + 0x00000000, 0x04000000, 0x11000a00, 0x04400a80, 0x01100220, 0x00580088, 0x00000038, 0x00000000, // ICON_PENCIL + 0x04000000, 0x15000a00, 0x50402880, 0x14102820, 0x05040a08, 0x015c028c, 0x007c00bc, 0x00000000, // ICON_PENCIL_BIG + 0x01c00000, 0x01400140, 0x01400140, 0x0ff80140, 0x0ff80808, 0x0aa80808, 0x0aa80aa8, 0x00000ff8, // ICON_BRUSH_CLASSIC + 0x1ffc0000, 0x5ffc7ffe, 0x40004000, 0x00807f80, 0x01c001c0, 0x01c001c0, 0x01c001c0, 0x00000080, // ICON_BRUSH_PAINTER + 0x00000000, 0x00800000, 0x01c00080, 0x03e001c0, 0x07f003e0, 0x036006f0, 0x000001c0, 0x00000000, // ICON_WATER_DROP + 0x00000000, 0x3e003800, 0x1f803f80, 0x0c201e40, 0x02080c10, 0x00840104, 0x00380044, 0x00000000, // ICON_COLOR_PICKER + 0x00000000, 0x07800300, 0x1fe00fc0, 0x3f883fd0, 0x0e021f04, 0x02040402, 0x00f00108, 0x00000000, // ICON_RUBBER + 0x00c00000, 0x02800140, 0x08200440, 0x20081010, 0x2ffe3004, 0x03f807fc, 0x00e001f0, 0x00000040, // ICON_COLOR_BUCKET + 0x00000000, 0x21843ffc, 0x01800180, 0x01800180, 0x01800180, 0x01800180, 0x03c00180, 0x00000000, // ICON_TEXT_T + 0x00800000, 0x01400180, 0x06200340, 0x0c100620, 0x1ff80c10, 0x380c1808, 0x70067004, 0x0000f80f, // ICON_TEXT_A + 0x78000000, 0x50004000, 0x00004800, 0x03c003c0, 0x03c003c0, 0x00100000, 0x0002000a, 0x0000000e, // ICON_SCALE + 0x75560000, 0x5e004002, 0x54001002, 0x41001202, 0x408200fe, 0x40820082, 0x40820082, 0x00006afe, // ICON_RESIZE + 0x00000000, 0x3f003f00, 0x3f003f00, 0x3f003f00, 0x00400080, 0x001c0020, 0x001c001c, 0x00000000, // ICON_FILTER_POINT + 0x6d800000, 0x00004080, 0x40804080, 0x40800000, 0x00406d80, 0x001c0020, 0x001c001c, 0x00000000, // ICON_FILTER_BILINEAR + 0x40080000, 0x1ffe2008, 0x14081008, 0x11081208, 0x10481088, 0x10081028, 0x10047ff8, 0x00001002, // ICON_CROP + 0x00100000, 0x3ffc0010, 0x2ab03550, 0x22b02550, 0x20b02150, 0x20302050, 0x2000fff0, 0x00002000, // ICON_CROP_ALPHA + 0x40000000, 0x1ff82000, 0x04082808, 0x01082208, 0x00482088, 0x00182028, 0x35542008, 0x00000002, // ICON_SQUARE_TOGGLE + 0x00000000, 0x02800280, 0x06c006c0, 0x0ea00ee0, 0x1e901eb0, 0x3e883e98, 0x7efc7e8c, 0x00000000, // ICON_SYMMETRY + 0x01000000, 0x05600100, 0x1d480d50, 0x7d423d44, 0x3d447d42, 0x0d501d48, 0x01000560, 0x00000100, // ICON_SYMMETRY_HORIZONTAL + 0x01800000, 0x04200240, 0x10080810, 0x00001ff8, 0x00007ffe, 0x0ff01ff8, 0x03c007e0, 0x00000180, // ICON_SYMMETRY_VERTICAL + 0x00000000, 0x010800f0, 0x02040204, 0x02040204, 0x07f00308, 0x1c000e00, 0x30003800, 0x00000000, // ICON_LENS + 0x00000000, 0x061803f0, 0x08240c0c, 0x08040814, 0x0c0c0804, 0x23f01618, 0x18002400, 0x00000000, // ICON_LENS_BIG + 0x00000000, 0x00000000, 0x1c7007c0, 0x638e3398, 0x1c703398, 0x000007c0, 0x00000000, 0x00000000, // ICON_EYE_ON + 0x00000000, 0x10002000, 0x04700fc0, 0x610e3218, 0x1c703098, 0x001007a0, 0x00000008, 0x00000000, // ICON_EYE_OFF + 0x00000000, 0x00007ffc, 0x40047ffc, 0x10102008, 0x04400820, 0x02800280, 0x02800280, 0x00000100, // ICON_FILTER_TOP + 0x00000000, 0x40027ffe, 0x10082004, 0x04200810, 0x02400240, 0x02400240, 0x01400240, 0x000000c0, // ICON_FILTER + 0x00800000, 0x00800080, 0x00000080, 0x3c9e0000, 0x00000000, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_POINT + 0x00800000, 0x00800080, 0x00800080, 0x3f7e01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_SMALL + 0x00800000, 0x00800080, 0x03e00080, 0x3e3e0220, 0x03e00220, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_BIG + 0x01000000, 0x04400280, 0x01000100, 0x43842008, 0x43849ab2, 0x01002008, 0x04400100, 0x01000280, // ICON_TARGET_MOVE + 0x01000000, 0x04400280, 0x01000100, 0x41042108, 0x41049ff2, 0x01002108, 0x04400100, 0x01000280, // ICON_CURSOR_MOVE + 0x781e0000, 0x500a4002, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x4002500a, 0x0000781e, // ICON_CURSOR_SCALE + 0x00000000, 0x20003c00, 0x24002800, 0x01000200, 0x00400080, 0x00140024, 0x003c0004, 0x00000000, // ICON_CURSOR_SCALE_RIGHT + 0x00000000, 0x0004003c, 0x00240014, 0x00800040, 0x02000100, 0x28002400, 0x3c002000, 0x00000000, // ICON_CURSOR_SCALE_LEFT + 0x00000000, 0x00100020, 0x10101fc8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // ICON_UNDO + 0x00000000, 0x08000400, 0x080813f8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // ICON_REDO + 0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3f902020, 0x00400020, 0x00000000, // ICON_REREDO + 0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3fc82010, 0x00200010, 0x00000000, // ICON_MUTATE + 0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18101020, 0x00100fc8, 0x00000020, // ICON_ROTATE + 0x00000000, 0x04000200, 0x240429fc, 0x20042204, 0x20442004, 0x3f942024, 0x00400020, 0x00000000, // ICON_REPEAT + 0x00000000, 0x20001000, 0x22104c0e, 0x00801120, 0x11200040, 0x4c0e2210, 0x10002000, 0x00000000, // ICON_SHUFFLE + 0x7ffe0000, 0x50024002, 0x44024802, 0x41024202, 0x40424082, 0x40124022, 0x4002400a, 0x00007ffe, // ICON_EMPTYBOX + 0x00800000, 0x03e00080, 0x08080490, 0x3c9e0808, 0x08080808, 0x03e00490, 0x00800080, 0x00000000, // ICON_TARGET + 0x00800000, 0x00800080, 0x00800080, 0x3ffe01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_SMALL_FILL + 0x00800000, 0x00800080, 0x03e00080, 0x3ffe03e0, 0x03e003e0, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_BIG_FILL + 0x01000000, 0x07c00380, 0x01000100, 0x638c2008, 0x638cfbbe, 0x01002008, 0x07c00100, 0x01000380, // ICON_TARGET_MOVE_FILL + 0x01000000, 0x07c00380, 0x01000100, 0x610c2108, 0x610cfffe, 0x01002108, 0x07c00100, 0x01000380, // ICON_CURSOR_MOVE_FILL + 0x781e0000, 0x6006700e, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x700e6006, 0x0000781e, // ICON_CURSOR_SCALE_FILL + 0x00000000, 0x38003c00, 0x24003000, 0x01000200, 0x00400080, 0x000c0024, 0x003c001c, 0x00000000, // ICON_CURSOR_SCALE_RIGHT_FILL + 0x00000000, 0x001c003c, 0x0024000c, 0x00800040, 0x02000100, 0x30002400, 0x3c003800, 0x00000000, // ICON_CURSOR_SCALE_LEFT_FILL + 0x00000000, 0x00300020, 0x10301ff8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // ICON_UNDO_FILL + 0x00000000, 0x0c000400, 0x0c081ff8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // ICON_REDO_FILL + 0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3ff02060, 0x00400060, 0x00000000, // ICON_REREDO_FILL + 0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3ff82030, 0x00200030, 0x00000000, // ICON_MUTATE_FILL + 0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18301020, 0x00300ff8, 0x00000020, // ICON_ROTATE_FILL + 0x00000000, 0x06000200, 0x26042ffc, 0x20042204, 0x20442004, 0x3ff42064, 0x00400060, 0x00000000, // ICON_REPEAT_FILL + 0x00000000, 0x30001000, 0x32107c0e, 0x00801120, 0x11200040, 0x7c0e3210, 0x10003000, 0x00000000, // ICON_SHUFFLE_FILL + 0x00000000, 0x30043ffc, 0x24042804, 0x21042204, 0x20442084, 0x20142024, 0x3ffc200c, 0x00000000, // ICON_EMPTYBOX_SMALL + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX + 0x00000000, 0x23c43ffc, 0x23c423c4, 0x200423c4, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_TOP + 0x00000000, 0x3e043ffc, 0x3e043e04, 0x20043e04, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_TOP_RIGHT + 0x00000000, 0x20043ffc, 0x20042004, 0x3e043e04, 0x3e043e04, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_RIGHT + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x3e042004, 0x3e043e04, 0x3ffc3e04, 0x00000000, // ICON_BOX_BOTTOM_RIGHT + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x23c42004, 0x23c423c4, 0x3ffc23c4, 0x00000000, // ICON_BOX_BOTTOM + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x207c2004, 0x207c207c, 0x3ffc207c, 0x00000000, // ICON_BOX_BOTTOM_LEFT + 0x00000000, 0x20043ffc, 0x20042004, 0x207c207c, 0x207c207c, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_LEFT + 0x00000000, 0x207c3ffc, 0x207c207c, 0x2004207c, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_TOP_LEFT + 0x00000000, 0x20043ffc, 0x20042004, 0x23c423c4, 0x23c423c4, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_CENTER + 0x7ffe0000, 0x40024002, 0x47e24182, 0x4ff247e2, 0x47e24ff2, 0x418247e2, 0x40024002, 0x00007ffe, // ICON_BOX_CIRCLE_MASK + 0x7fff0000, 0x40014001, 0x40014001, 0x49555ddd, 0x4945495d, 0x400149c5, 0x40014001, 0x00007fff, // ICON_POT + 0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x404e40ce, 0x48125432, 0x4006540e, 0x00007ffe, // ICON_ALPHA_MULTIPLY + 0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x5c4e40ce, 0x44124432, 0x40065c0e, 0x00007ffe, // ICON_ALPHA_CLEAR + 0x7ffe0000, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x00007ffe, // ICON_DITHERING + 0x07fe0000, 0x1ffa0002, 0x7fea000a, 0x402a402a, 0x5b2a512a, 0x5128552a, 0x40205128, 0x00007fe0, // ICON_MIPMAPS + 0x00000000, 0x1ff80000, 0x12481248, 0x12481ff8, 0x1ff81248, 0x12481248, 0x00001ff8, 0x00000000, // ICON_BOX_GRID + 0x12480000, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x00001248, // ICON_GRID + 0x00000000, 0x1c380000, 0x1c3817e8, 0x08100810, 0x08100810, 0x17e81c38, 0x00001c38, 0x00000000, // ICON_BOX_CORNERS_SMALL + 0x700e0000, 0x700e5ffa, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x5ffa700e, 0x0000700e, // ICON_BOX_CORNERS_BIG + 0x3f7e0000, 0x21422142, 0x21422142, 0x00003f7e, 0x21423f7e, 0x21422142, 0x3f7e2142, 0x00000000, // ICON_FOUR_BOXES + 0x00000000, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x00000000, // ICON_GRID_FILL + 0x7ffe0000, 0x7ffe7ffe, 0x77fe7000, 0x77fe77fe, 0x777e7700, 0x777e777e, 0x777e777e, 0x0000777e, // ICON_BOX_MULTISIZE + 0x781e0000, 0x40024002, 0x00004002, 0x01800000, 0x00000180, 0x40020000, 0x40024002, 0x0000781e, // ICON_ZOOM_SMALL + 0x781e0000, 0x40024002, 0x00004002, 0x03c003c0, 0x03c003c0, 0x40020000, 0x40024002, 0x0000781e, // ICON_ZOOM_MEDIUM + 0x781e0000, 0x40024002, 0x07e04002, 0x07e007e0, 0x07e007e0, 0x400207e0, 0x40024002, 0x0000781e, // ICON_ZOOM_BIG + 0x781e0000, 0x5ffa4002, 0x1ff85ffa, 0x1ff81ff8, 0x1ff81ff8, 0x5ffa1ff8, 0x40025ffa, 0x0000781e, // ICON_ZOOM_ALL + 0x00000000, 0x2004381c, 0x00002004, 0x00000000, 0x00000000, 0x20040000, 0x381c2004, 0x00000000, // ICON_ZOOM_CENTER + 0x00000000, 0x1db80000, 0x10081008, 0x10080000, 0x00001008, 0x10081008, 0x00001db8, 0x00000000, // ICON_BOX_DOTS_SMALL + 0x35560000, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x35562002, 0x00000000, // ICON_BOX_DOTS_BIG + 0x7ffe0000, 0x40024002, 0x48124ff2, 0x49924812, 0x48124992, 0x4ff24812, 0x40024002, 0x00007ffe, // ICON_BOX_CONCENTRIC + 0x00000000, 0x10841ffc, 0x10841084, 0x1ffc1084, 0x10841084, 0x10841084, 0x00001ffc, 0x00000000, // ICON_BOX_GRID_BIG + 0x00000000, 0x00000000, 0x10000000, 0x04000800, 0x01040200, 0x00500088, 0x00000020, 0x00000000, // ICON_OK_TICK + 0x00000000, 0x10080000, 0x04200810, 0x01800240, 0x02400180, 0x08100420, 0x00001008, 0x00000000, // ICON_CROSS + 0x00000000, 0x02000000, 0x00800100, 0x00200040, 0x00200010, 0x00800040, 0x02000100, 0x00000000, // ICON_ARROW_LEFT + 0x00000000, 0x00400000, 0x01000080, 0x04000200, 0x04000800, 0x01000200, 0x00400080, 0x00000000, // ICON_ARROW_RIGHT + 0x00000000, 0x00000000, 0x00000000, 0x08081004, 0x02200410, 0x00800140, 0x00000000, 0x00000000, // ICON_ARROW_DOWN + 0x00000000, 0x00000000, 0x01400080, 0x04100220, 0x10040808, 0x00000000, 0x00000000, 0x00000000, // ICON_ARROW_UP + 0x00000000, 0x02000000, 0x03800300, 0x03e003c0, 0x03e003f0, 0x038003c0, 0x02000300, 0x00000000, // ICON_ARROW_LEFT_FILL + 0x00000000, 0x00400000, 0x01c000c0, 0x07c003c0, 0x07c00fc0, 0x01c003c0, 0x004000c0, 0x00000000, // ICON_ARROW_RIGHT_FILL + 0x00000000, 0x00000000, 0x00000000, 0x0ff81ffc, 0x03e007f0, 0x008001c0, 0x00000000, 0x00000000, // ICON_ARROW_DOWN_FILL + 0x00000000, 0x00000000, 0x01c00080, 0x07f003e0, 0x1ffc0ff8, 0x00000000, 0x00000000, 0x00000000, // ICON_ARROW_UP_FILL + 0x00000000, 0x18a008c0, 0x32881290, 0x24822686, 0x26862482, 0x12903288, 0x08c018a0, 0x00000000, // ICON_AUDIO + 0x00000000, 0x04800780, 0x004000c0, 0x662000f0, 0x08103c30, 0x130a0e18, 0x0000318e, 0x00000000, // ICON_FX + 0x00000000, 0x00800000, 0x08880888, 0x2aaa0a8a, 0x0a8a2aaa, 0x08880888, 0x00000080, 0x00000000, // ICON_WAVE + 0x00000000, 0x00600000, 0x01080090, 0x02040108, 0x42044204, 0x24022402, 0x00001800, 0x00000000, // ICON_WAVE_SINUS + 0x00000000, 0x07f80000, 0x04080408, 0x04080408, 0x04080408, 0x7c0e0408, 0x00000000, 0x00000000, // ICON_WAVE_SQUARE + 0x00000000, 0x00000000, 0x00a00040, 0x22084110, 0x08021404, 0x00000000, 0x00000000, 0x00000000, // ICON_WAVE_TRIANGULAR + 0x00000000, 0x00000000, 0x04200000, 0x01800240, 0x02400180, 0x00000420, 0x00000000, 0x00000000, // ICON_CROSS_SMALL + 0x00000000, 0x18380000, 0x12281428, 0x10a81128, 0x112810a8, 0x14281228, 0x00001838, 0x00000000, // ICON_PLAYER_PREVIOUS + 0x00000000, 0x18000000, 0x11801600, 0x10181060, 0x10601018, 0x16001180, 0x00001800, 0x00000000, // ICON_PLAYER_PLAY_BACK + 0x00000000, 0x00180000, 0x01880068, 0x18080608, 0x06081808, 0x00680188, 0x00000018, 0x00000000, // ICON_PLAYER_PLAY + 0x00000000, 0x1e780000, 0x12481248, 0x12481248, 0x12481248, 0x12481248, 0x00001e78, 0x00000000, // ICON_PLAYER_PAUSE + 0x00000000, 0x1ff80000, 0x10081008, 0x10081008, 0x10081008, 0x10081008, 0x00001ff8, 0x00000000, // ICON_PLAYER_STOP + 0x00000000, 0x1c180000, 0x14481428, 0x15081488, 0x14881508, 0x14281448, 0x00001c18, 0x00000000, // ICON_PLAYER_NEXT + 0x00000000, 0x03c00000, 0x08100420, 0x10081008, 0x10081008, 0x04200810, 0x000003c0, 0x00000000, // ICON_PLAYER_RECORD + 0x00000000, 0x0c3007e0, 0x13c81818, 0x14281668, 0x14281428, 0x1c381c38, 0x08102244, 0x00000000, // ICON_MAGNET + 0x07c00000, 0x08200820, 0x3ff80820, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // ICON_LOCK_CLOSE + 0x07c00000, 0x08000800, 0x3ff80800, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // ICON_LOCK_OPEN + 0x01c00000, 0x0c180770, 0x3086188c, 0x60832082, 0x60034781, 0x30062002, 0x0c18180c, 0x01c00770, // ICON_CLOCK + 0x0a200000, 0x1b201b20, 0x04200e20, 0x04200420, 0x04700420, 0x0e700e70, 0x0e700e70, 0x04200e70, // ICON_TOOLS + 0x01800000, 0x3bdc318c, 0x0ff01ff8, 0x7c3e1e78, 0x1e787c3e, 0x1ff80ff0, 0x318c3bdc, 0x00000180, // ICON_GEAR + 0x01800000, 0x3ffc318c, 0x1c381ff8, 0x781e1818, 0x1818781e, 0x1ff81c38, 0x318c3ffc, 0x00000180, // ICON_GEAR_BIG + 0x00000000, 0x08080ff8, 0x08081ffc, 0x0aa80aa8, 0x0aa80aa8, 0x0aa80aa8, 0x08080aa8, 0x00000ff8, // ICON_BIN + 0x00000000, 0x00000000, 0x20043ffc, 0x08043f84, 0x04040f84, 0x04040784, 0x000007fc, 0x00000000, // ICON_HAND_POINTER + 0x00000000, 0x24400400, 0x00001480, 0x6efe0e00, 0x00000e00, 0x24401480, 0x00000400, 0x00000000, // ICON_LASER + 0x00000000, 0x03c00000, 0x08300460, 0x11181118, 0x11181118, 0x04600830, 0x000003c0, 0x00000000, // ICON_COIN + 0x00000000, 0x10880080, 0x06c00810, 0x366c07e0, 0x07e00240, 0x00001768, 0x04200240, 0x00000000, // ICON_EXPLOSION + 0x00000000, 0x3d280000, 0x2528252c, 0x3d282528, 0x05280528, 0x05e80528, 0x00000000, 0x00000000, // ICON_1UP + 0x01800000, 0x03c003c0, 0x018003c0, 0x0ff007e0, 0x0bd00bd0, 0x0a500bd0, 0x02400240, 0x02400240, // ICON_PLAYER + 0x01800000, 0x03c003c0, 0x118013c0, 0x03c81ff8, 0x07c003c8, 0x04400440, 0x0c080478, 0x00000000, // ICON_PLAYER_JUMP + 0x3ff80000, 0x30183ff8, 0x30183018, 0x3ff83ff8, 0x03000300, 0x03c003c0, 0x03e00300, 0x000003e0, // ICON_KEY + 0x3ff80000, 0x3ff83ff8, 0x33983ff8, 0x3ff83398, 0x3ff83ff8, 0x00000540, 0x0fe00aa0, 0x00000fe0, // ICON_DEMON + 0x00000000, 0x0ff00000, 0x20041008, 0x25442004, 0x10082004, 0x06000bf0, 0x00000300, 0x00000000, // ICON_TEXT_POPUP + 0x00000000, 0x11440000, 0x07f00be8, 0x1c1c0e38, 0x1c1c0c18, 0x07f00e38, 0x11440be8, 0x00000000, // ICON_GEAR_EX + 0x00000000, 0x20080000, 0x0c601010, 0x07c00fe0, 0x07c007c0, 0x0c600fe0, 0x20081010, 0x00000000, // ICON_CRACK + 0x00000000, 0x20080000, 0x0c601010, 0x04400fe0, 0x04405554, 0x0c600fe0, 0x20081010, 0x00000000, // ICON_CRACK_POINTS + 0x00000000, 0x00800080, 0x01c001c0, 0x1ffc3ffe, 0x03e007f0, 0x07f003e0, 0x0c180770, 0x00000808, // ICON_STAR + 0x0ff00000, 0x08180810, 0x08100818, 0x0a100810, 0x08180810, 0x08100818, 0x08100810, 0x00001ff8, // ICON_DOOR + 0x0ff00000, 0x08100810, 0x08100810, 0x10100010, 0x4f902010, 0x10102010, 0x08100010, 0x00000ff0, // ICON_EXIT + 0x00040000, 0x001f000e, 0x0ef40004, 0x12f41284, 0x0ef41214, 0x10040004, 0x7ffc3004, 0x10003000, // ICON_MODE_2D + 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, 0x50286030, 0x47fe4804, 0x47fe47fe, 0x47fe47fe, 0x27fe77fe, 0x0ffe17fe, 0x000007fe, // ICON_CUBE_FACE_FRONT + 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x3ff27fe2, 0x0ffe1ffa, 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 + 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 + 0x00000000, 0x44007c00, 0x45004600, 0x00627cbe, 0x00620022, 0x45007cbe, 0x44004600, 0x00007c00, // ICON_LINK_BOXES + 0x00000000, 0x0044007c, 0x0010007c, 0x3f100010, 0x3f1021f0, 0x3f100010, 0x3f0021f0, 0x00000000, // ICON_LINK_MULTI + 0x00000000, 0x0044007c, 0x00440044, 0x0010007c, 0x00100010, 0x44107c10, 0x440047f0, 0x00007c00, // ICON_LINK + 0x00000000, 0x0044007c, 0x00440044, 0x0000007c, 0x00000010, 0x44007c10, 0x44004550, 0x00007c00, // ICON_LINK_BROKE + 0x02a00000, 0x22a43ffc, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // ICON_TEXT_NOTES + 0x3ffc0000, 0x20042004, 0x245e27c4, 0x27c42444, 0x2004201e, 0x201e2004, 0x20042004, 0x00003ffc, // ICON_NOTEBOOK + 0x00000000, 0x07e00000, 0x04200420, 0x24243ffc, 0x24242424, 0x24242424, 0x3ffc2424, 0x00000000, // ICON_SUITCASE + 0x00000000, 0x0fe00000, 0x08200820, 0x40047ffc, 0x7ffc5554, 0x40045554, 0x7ffc4004, 0x00000000, // ICON_SUITCASE_ZIP + 0x00000000, 0x20043ffc, 0x3ffc2004, 0x13c81008, 0x100813c8, 0x10081008, 0x1ff81008, 0x00000000, // ICON_MAILBOX + 0x00000000, 0x40027ffe, 0x5ffa5ffa, 0x5ffa5ffa, 0x40025ffa, 0x03c07ffe, 0x1ff81ff8, 0x00000000, // ICON_MONITOR + 0x0ff00000, 0x6bfe7ffe, 0x7ffe7ffe, 0x68167ffe, 0x08106816, 0x08100810, 0x0ff00810, 0x00000000, // ICON_PRINTER + 0x3ff80000, 0xfffe2008, 0x870a8002, 0x904a888a, 0x904a904a, 0x870a888a, 0xfffe8002, 0x00000000, // ICON_PHOTO_CAMERA + 0x0fc00000, 0xfcfe0cd8, 0x8002fffe, 0x84428382, 0x84428442, 0x80028382, 0xfffe8002, 0x00000000, // ICON_PHOTO_CAMERA_FLASH + 0x00000000, 0x02400180, 0x08100420, 0x20041008, 0x23c42004, 0x22442244, 0x3ffc2244, 0x00000000, // ICON_HOUSE + 0x00000000, 0x1c700000, 0x3ff83ef8, 0x3ff83ff8, 0x0fe01ff0, 0x038007c0, 0x00000100, 0x00000000, // ICON_HEART + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0xe000c000, // ICON_CORNER + 0x00000000, 0x14001c00, 0x15c01400, 0x15401540, 0x155c1540, 0x15541554, 0x1ddc1554, 0x00000000, // ICON_VERTICAL_BARS + 0x00000000, 0x03000300, 0x1b001b00, 0x1b601b60, 0x1b6c1b60, 0x1b6c1b6c, 0x1b6c1b6c, 0x00000000, // ICON_VERTICAL_BARS_FILL + 0x00000000, 0x00000000, 0x403e7ffe, 0x7ffe403e, 0x7ffe0000, 0x43fe43fe, 0x00007ffe, 0x00000000, // ICON_LIFE_BARS + 0x7ffc0000, 0x43844004, 0x43844284, 0x43844004, 0x42844284, 0x42844284, 0x40044384, 0x00007ffc, // ICON_INFO + 0x40008000, 0x10002000, 0x04000800, 0x01000200, 0x00400080, 0x00100020, 0x00040008, 0x00010002, // ICON_CROSSLINE + 0x00000000, 0x1ff01ff0, 0x18301830, 0x1f001830, 0x03001f00, 0x00000300, 0x03000300, 0x00000000, // ICON_HELP + 0x3ff00000, 0x2abc3550, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x00003ffc, // ICON_FILETYPE_ALPHA + 0x3ff00000, 0x201c2010, 0x22442184, 0x28142424, 0x29942814, 0x2ff42994, 0x20042004, 0x00003ffc, // ICON_FILETYPE_HOME + 0x07fe0000, 0x04020402, 0x7fe20402, 0x44224422, 0x44224422, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_LAYERS_VISIBLE + 0x07fe0000, 0x04020402, 0x7c020402, 0x44024402, 0x44024402, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_LAYERS + 0x00000000, 0x40027ffe, 0x7ffe4002, 0x40024002, 0x40024002, 0x40024002, 0x7ffe4002, 0x00000000, // ICON_WINDOW + 0x09100000, 0x09f00910, 0x09100910, 0x00000910, 0x24a2779e, 0x27a224a2, 0x709e20a2, 0x00000000, // ICON_HIDPI + 0x3ff00000, 0x201c2010, 0x2a842e84, 0x2e842a84, 0x2ba42004, 0x2aa42aa4, 0x20042ba4, 0x00003ffc, // ICON_FILETYPE_BINARY + 0x00000000, 0x00000000, 0x00120012, 0x4a5e4bd2, 0x485233d2, 0x00004bd2, 0x00000000, 0x00000000, // ICON_HEX + 0x01800000, 0x381c0660, 0x23c42004, 0x23c42044, 0x13c82204, 0x08101008, 0x02400420, 0x00000180, // ICON_SHIELD + 0x007e0000, 0x20023fc2, 0x40227fe2, 0x400a403a, 0x400a400a, 0x400a400a, 0x4008400e, 0x00007ff8, // ICON_FILE_NEW + 0x00000000, 0x0042007e, 0x40027fc2, 0x44024002, 0x5f024402, 0x44024402, 0x7ffe4002, 0x00000000, // ICON_FOLDER_ADD + 0x44220000, 0x12482244, 0xf3cf0000, 0x14280420, 0x48122424, 0x08100810, 0x1ff81008, 0x03c00420, // ICON_ALARM + 0x0aa00000, 0x1ff80aa0, 0x1068700e, 0x1008706e, 0x1008700e, 0x1008700e, 0x0aa01ff8, 0x00000aa0, // ICON_CPU + 0x07e00000, 0x04201db8, 0x04a01c38, 0x04a01d38, 0x04a01d38, 0x04a01d38, 0x04201d38, 0x000007e0, // ICON_ROM + 0x00000000, 0x03c00000, 0x3c382ff0, 0x3c04380c, 0x01800000, 0x03c003c0, 0x00000180, 0x00000000, // ICON_STEP_OVER + 0x01800000, 0x01800180, 0x01800180, 0x03c007e0, 0x00000180, 0x01800000, 0x03c003c0, 0x00000180, // ICON_STEP_INTO + 0x01800000, 0x07e003c0, 0x01800180, 0x01800180, 0x00000180, 0x01800000, 0x03c003c0, 0x00000180, // ICON_STEP_OUT + 0x00000000, 0x0ff003c0, 0x181c1c34, 0x303c301c, 0x30003000, 0x1c301800, 0x03c00ff0, 0x00000000, // ICON_RESTART + 0x00000000, 0x00000000, 0x07e003c0, 0x0ff00ff0, 0x0ff00ff0, 0x03c007e0, 0x00000000, 0x00000000, // ICON_BREAKPOINT_ON + 0x00000000, 0x00000000, 0x042003c0, 0x08100810, 0x08100810, 0x03c00420, 0x00000000, 0x00000000, // ICON_BREAKPOINT_OFF + 0x00000000, 0x00000000, 0x1ff81ff8, 0x1ff80000, 0x00001ff8, 0x1ff81ff8, 0x00000000, 0x00000000, // ICON_BURGER_MENU + 0x00000000, 0x00000000, 0x00880070, 0x0c880088, 0x1e8810f8, 0x3e881288, 0x00000000, 0x00000000, // ICON_CASE_SENSITIVE + 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 + 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 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_223 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_224 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_225 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_226 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_227 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_228 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_229 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_230 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_231 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_232 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_233 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_234 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_235 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_236 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_237 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_238 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_239 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_240 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_241 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_242 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_243 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_244 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_245 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_246 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_247 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_248 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_249 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_250 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_251 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_252 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_253 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_254 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_255 +}; + +// NOTE: We keep a pointer to the icons array, useful to point to other sets if required +static unsigned int *guiIconsPtr = guiIcons; + +#endif // !RAYGUI_NO_ICONS && !RAYGUI_CUSTOM_ICONS + +#ifndef RAYGUI_ICON_SIZE + #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 +#define RAYGUI_MAX_PROPS_EXTENDED 8 // Maximum number of extended properties + +//---------------------------------------------------------------------------------- +// Types and Structures Definition +//---------------------------------------------------------------------------------- +// Gui control property style color element +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 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 unsigned int guiIconScale = 1; // Gui icon default scale (if icons enabled) + +//---------------------------------------------------------------------------------- +// Style data array for all gui style properties (allocated on data segment by default) +// +// NOTE 1: First set of BASE properties are generic to all controls but could be individually +// overwritten per control, first set of EXTENDED properties are generic to all controls and +// can not be overwritten individually but custom EXTENDED properties can be used by control +// +// NOTE 2: A new style set could be loaded over this array using GuiLoadStyle(), +// but default gui style could always be recovered with GuiLoadStyleDefault() +// +// guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB +//---------------------------------------------------------------------------------- +static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)] = { 0 }; + +static bool guiStyleLoaded = false; // Style loaded flag for lazy style initialization + +//---------------------------------------------------------------------------------- +// Standalone Mode Functions Declaration +// +// NOTE: raygui depend on some raylib input and drawing functions +// To use raygui as standalone library, below functions must be defined by the user +//---------------------------------------------------------------------------------- +#if defined(RAYGUI_STANDALONE) + +#define KEY_RIGHT 262 +#define KEY_LEFT 263 +#define KEY_DOWN 264 +#define KEY_UP 265 +#define KEY_BACKSPACE 259 +#define KEY_ENTER 257 + +#define MOUSE_LEFT_BUTTON 0 + +// Input required functions +//------------------------------------------------------------------------------- +static Vector2 GetMousePosition(void); +static float GetMouseWheelMove(void); +static bool IsMouseButtonDown(int button); +static bool IsMouseButtonPressed(int button); +static bool IsMouseButtonReleased(int button); + +static bool IsKeyDown(int key); +static bool IsKeyPressed(int key); +static int GetCharPressed(void); // -- GuiTextBox(), GuiTextBoxMulti(), GuiValueBox() +//------------------------------------------------------------------------------- + +// Drawing required functions +//------------------------------------------------------------------------------- +static void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle(), GuiDrawIcon() + +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() +//------------------------------------------------------------------------------- + +// 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 +static int TextToInteger(const char *text); // Get integer value from text + +static int GetCodepointNext(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded text +static const char *CodepointToUTF8(int codepoint, int *byteSize); // Encode codepoint into UTF-8 text (char array size returned as parameter) + +static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2); // Draw rectangle vertical gradient +//------------------------------------------------------------------------------- + +#endif // RAYGUI_STANDALONE + +//---------------------------------------------------------------------------------- +// Module specific Functions Declaration +//---------------------------------------------------------------------------------- +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 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 +static Vector3 ConvertHSVtoRGB(Vector3 hsv); // Convert color data from HSV to RGB +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() + +//---------------------------------------------------------------------------------- +// Gui Setup Functions Definition +//---------------------------------------------------------------------------------- +// Enable gui global state +// NOTE: We check for STATE_DISABLED to avoid messing custom global state setups +void GuiEnable(void) { if (guiState == STATE_DISABLED) guiState = STATE_NORMAL; } + +// Disable gui global state +// NOTE: We check for STATE_NORMAL to avoid messing custom global state setups +void GuiDisable(void) { if (guiState == STATE_NORMAL) guiState = STATE_DISABLED; } + +// Lock gui global state +void GuiLock(void) { guiLocked = true; } + +// Unlock gui global state +void GuiUnlock(void) { guiLocked = false; } + +// Check if gui is locked (global state) +bool GuiIsLocked(void) { return guiLocked; } + +// Set gui controls alpha global state +void GuiFade(float alpha) +{ + if (alpha < 0.0f) alpha = 0.0f; + else if (alpha > 1.0f) alpha = 1.0f; + + guiAlpha = alpha; +} + +// Set gui state (global state) +void GuiSetState(int state) { guiState = (GuiState)state; } + +// Get gui state (global state) +int GuiGetState(void) { return guiState; } + +// Set custom gui font +// NOTE: Font loading/unloading is external to raygui +void GuiSetFont(Font font) +{ + if (font.texture.id > 0) + { + // NOTE: If we try to setup a font but default style has not been + // lazily loaded before, it will be overwritten, so we need to force + // default style loading first + if (!guiStyleLoaded) GuiLoadStyleDefault(); + + guiFont = font; + GuiSetStyle(DEFAULT, TEXT_SIZE, font.baseSize); + } +} + +// Get custom gui font +Font GuiGetFont(void) +{ + return guiFont; +} + +// Set control style property value +void GuiSetStyle(int control, int property, int value) +{ + if (!guiStyleLoaded) GuiLoadStyleDefault(); + guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value; + + // Default properties are propagated to all controls + if ((control == 0) && (property < RAYGUI_MAX_PROPS_BASE)) + { + for (int i = 1; i < RAYGUI_MAX_CONTROLS; i++) guiStyle[i*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value; + } +} + +// Get control style property value +int GuiGetStyle(int control, int property) +{ + if (!guiStyleLoaded) GuiLoadStyleDefault(); + return guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property]; +} + +//---------------------------------------------------------------------------------- +// Gui Controls Functions Definition +//---------------------------------------------------------------------------------- + +// Window Box control +bool GuiWindowBox(Rectangle bounds, const char *title) +{ + // Window title bar height (including borders) + // NOTE: This define is also used by GuiMessageBox() and GuiTextInputBox() + #if !defined(RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT) + #define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT 24 + #endif + + //GuiState state = guiState; + bool clicked = false; + + int statusBarHeight = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT; + + Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)statusBarHeight }; + if (bounds.height < statusBarHeight*2.0f) bounds.height = statusBarHeight*2.0f; + + Rectangle windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - 1, bounds.width, bounds.height - (float)statusBarHeight + 1 }; + Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - 20, + statusBar.y + statusBarHeight/2.0f - 18.0f/2.0f, 18, 18 }; + + // Update control + //-------------------------------------------------------------------- + // NOTE: Logic is directly managed by button + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiStatusBar(statusBar, title); // Draw window header as status bar + GuiPanel(windowPanel, NULL); // Draw window base + + // Draw window close button + 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) + clicked = GuiButton(closeButtonRec, "x"); +#else + clicked = GuiButton(closeButtonRec, GuiIconText(ICON_CROSS_SMALL, NULL)); +#endif + GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment); + //-------------------------------------------------------------------- + + return clicked; +} + +// Group Box control with text name +void GuiGroupBox(Rectangle bounds, const char *text) +{ + #if !defined(RAYGUI_GROUPBOX_LINE_THICK) + #define RAYGUI_GROUPBOX_LINE_THICK 1 + #endif + + 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)); + + GuiLine(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y - GuiGetStyle(DEFAULT, TEXT_SIZE)/2, bounds.width, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) }, text); + //-------------------------------------------------------------------- +} + +// Line control +void GuiLine(Rectangle bounds, const char *text) +{ + #if !defined(RAYGUI_LINE_ORIGIN_SIZE) + #define RAYGUI_LINE_MARGIN_TEXT 12 + #endif + #if !defined(RAYGUI_LINE_TEXT_PADDING) + #define RAYGUI_LINE_TEXT_PADDING 4 + #endif + + GuiState state = guiState; + + Color color = Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha); + + // Draw control + //-------------------------------------------------------------------- + if (text == NULL) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height/2, bounds.width, 1 }, 0, BLANK, color); + else + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(text); + textBounds.height = bounds.height; + textBounds.x = bounds.x + RAYGUI_LINE_MARGIN_TEXT; + textBounds.y = bounds.y; + + // Draw line with embedded text label: "--- text --------------" + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height/2, RAYGUI_LINE_MARGIN_TEXT - RAYGUI_LINE_TEXT_PADDING, 1 }, 0, BLANK, color); + GuiDrawText(text, textBounds, TEXT_ALIGN_LEFT, color); + 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); + } + //-------------------------------------------------------------------- +} + +// Panel control +void GuiPanel(Rectangle bounds, const char *text) +{ + #if !defined(RAYGUI_PANEL_BORDER_WIDTH) + #define RAYGUI_PANEL_BORDER_WIDTH 1 + #endif + + GuiState state = guiState; + + // Text will be drawn as a header bar (if provided) + Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT }; + if ((text != NULL) && (bounds.height < RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f)) bounds.height = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f; + + if (text != NULL) + { + // Move panel bounds after the header bar + bounds.y += (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)); + //-------------------------------------------------------------------- +} + +// Tab Bar control +// NOTE: Using GuiToggle() for the TABS +int GuiTabBar(Rectangle bounds, const char **text, int count, int *active) +{ + #define RAYGUI_TABBAR_ITEM_WIDTH 160 + + 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; + + // Draw control + //-------------------------------------------------------------------- + for (int i = 0; i < count; i++) + { + tabBounds.x = bounds.x + (RAYGUI_TABBAR_ITEM_WIDTH + 4)*i; + + 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); + + // 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 defined(RAYGUI_NO_ICONS) + if (GuiButton(closeButtonRec, "x")) closing = 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; +#endif + GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment); + } + + 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 +} + +// Scroll Panel control +Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll) +{ + GuiState state = guiState; + + Vector2 scrollPos = { 0.0f, 0.0f }; + if (scroll != NULL) scrollPos = *scroll; + + // Text will be drawn as a header bar (if provided) + Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT }; + if (bounds.height < RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f) bounds.height = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f; + + if (text != NULL) + { + // Move panel bounds after the header bar + bounds.y += (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1; + bounds.height -= (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + 1; + } + + bool hasHorizontalScrollBar = (content.width > bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false; + bool hasVerticalScrollBar = (content.height > bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false; + + // Recheck to account for the other scrollbar being visible + if (!hasHorizontalScrollBar) hasHorizontalScrollBar = (hasVerticalScrollBar && (content.width > (bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH))))? true : false; + if (!hasVerticalScrollBar) hasVerticalScrollBar = (hasHorizontalScrollBar && (content.height > (bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH))))? true : false; + + 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) }; + + // Calculate view area (area without the scrollbars) + Rectangle 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; + + 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); + float verticalMin = hasVerticalScrollBar? 0.0f : -1.0f; + float verticalMax = hasVerticalScrollBar? content.height - bounds.height + (float)horizontalScrollBarWidth + (float)GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH); + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check button state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + +#if defined(SUPPORT_SCROLLBAR_KEY_INPUT) + if (hasHorizontalScrollBar) + { + if (IsKeyDown(KEY_RIGHT)) scrollPos.x -= GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + if (IsKeyDown(KEY_LEFT)) scrollPos.x += GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + } + + if (hasVerticalScrollBar) + { + if (IsKeyDown(KEY_DOWN)) scrollPos.y -= GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + if (IsKeyDown(KEY_UP)) scrollPos.y += GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + } +#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 + } + } + + // Normalize scroll values + if (scrollPos.x > -horizontalMin) scrollPos.x = -horizontalMin; + if (scrollPos.x < -horizontalMax) scrollPos.x = -horizontalMax; + if (scrollPos.y > -verticalMin) scrollPos.y = -verticalMin; + if (scrollPos.y < -verticalMax) scrollPos.y = -verticalMax; + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + 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 + + // Save size of the scrollbar slider + const int slider = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); + + // Draw horizontal scrollbar if visible + if (hasHorizontalScrollBar) + { + // Change scrollbar slider size to show the diff in size between the content width and the widget width + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)(((bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth)/(int)content.width)*((int)bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth))); + scrollPos.x = (float)-GuiScrollBar(horizontalScrollBar, (int)-scrollPos.x, (int)horizontalMin, (int)horizontalMax); + } + else scrollPos.x = 0.0f; + + // Draw vertical scrollbar if visible + if (hasVerticalScrollBar) + { + // Change scrollbar slider size to show the diff in size between the content height and the widget height + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)(((bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth)/(int)content.height)*((int)bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth))); + scrollPos.y = (float)-GuiScrollBar(verticalScrollBar, (int)-scrollPos.y, (int)verticalMin, (int)verticalMax); + } + else scrollPos.y = 0.0f; + + // Draw detail corner rectangle if both scroll bars are visible + 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)); + } + + // Draw scrollbar lines depending on current state + GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + (state*3))), guiAlpha), BLANK); + + // Set scrollbar slider size back to the way it was before + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, slider); + //-------------------------------------------------------------------- + + if (scroll != NULL) *scroll = scrollPos; + + return view; +} + +// Label control +void GuiLabel(Rectangle bounds, const char *text) +{ + GuiState state = guiState; + + // Update control + //-------------------------------------------------------------------- + //... + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + //-------------------------------------------------------------------- +} + +// Button control, returns true when clicked +bool GuiButton(Rectangle bounds, const char *text) +{ + GuiState state = guiState; + bool pressed = false; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check button state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; + } + } + //-------------------------------------------------------------------- + + // 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)); + //------------------------------------------------------------------ + + return pressed; +} + +// Label button control +bool 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; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check checkbox state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + //-------------------------------------------------------------------- + + return pressed; +} + +// Toggle Button control, returns true when active +bool GuiToggle(Rectangle bounds, const char *text, bool active) +{ + GuiState state = guiState; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check toggle button state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) + { + state = STATE_NORMAL; + active = !active; + } + else state = STATE_FOCUSED; + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + 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)); + } + 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)); + } + //-------------------------------------------------------------------- + + return active; +} + +// Toggle Group control, returns toggled button codepointIndex +int GuiToggleGroup(Rectangle bounds, const char *text, int active) +{ + #if !defined(RAYGUI_TOGGLEGROUP_MAX_ITEMS) + #define RAYGUI_TOGGLEGROUP_MAX_ITEMS 32 + #endif + + float initBoundsX = bounds.x; + + // Get substrings items from text (items pointers) + int rows[RAYGUI_TOGGLEGROUP_MAX_ITEMS] = { 0 }; + int itemCount = 0; + const char **items = GuiTextSplit(text, ';', &itemCount, rows); + + int prevRow = rows[0]; + + for (int i = 0; i < itemCount; i++) + { + if (prevRow != rows[i]) + { + bounds.x = initBoundsX; + bounds.y += (bounds.height + GuiGetStyle(TOGGLE, GROUP_PADDING)); + prevRow = rows[i]; + } + + if (i == active) GuiToggle(bounds, items[i], true); + else if (GuiToggle(bounds, items[i], false) == true) active = i; + + bounds.x += (bounds.width + GuiGetStyle(TOGGLE, GROUP_PADDING)); + } + + return active; +} + +// Check Box control, returns true when active +bool GuiCheckBox(Rectangle bounds, const char *text, bool checked) +{ + GuiState state = guiState; + + Rectangle textBounds = { 0 }; + + if (text != NULL) + { + textBounds.width = (float)GetTextWidth(text); + 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; + if (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(CHECKBOX, TEXT_PADDING); + } + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + Rectangle totalBounds = { + (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT)? textBounds.x : bounds.x, + bounds.y, + bounds.width + textBounds.width + GuiGetStyle(CHECKBOX, TEXT_PADDING), + bounds.height, + }; + + // Check checkbox state + if (CheckCollisionPointRec(mousePoint, totalBounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) checked = !checked; + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawRectangle(bounds, GuiGetStyle(CHECKBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(CHECKBOX, BORDER + (state*3))), guiAlpha), BLANK); + + 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)); + } + + GuiDrawText(text, textBounds, (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + //-------------------------------------------------------------------- + + return checked; +} + +// Combo Box control, returns selected item codepointIndex +int GuiComboBox(Rectangle bounds, const char *text, int active) +{ + GuiState state = guiState; + + bounds.width -= (GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH) + GuiGetStyle(COMBOBOX, COMBO_BUTTON_SPACING)); + + Rectangle selector = { (float)bounds.x + bounds.width + GuiGetStyle(COMBOBOX, COMBO_BUTTON_SPACING), + (float)bounds.y, (float)GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH), (float)bounds.height }; + + // Get substrings items from text (items pointers, lengths and count) + int itemCount = 0; + const char **items = GuiTextSplit(text, ';', &itemCount, NULL); + + if (active < 0) active = 0; + else if (active > itemCount - 1) active = itemCount - 1; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked && (itemCount > 1)) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds) || + CheckCollisionPointRec(mousePoint, selector)) + { + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + { + active += 1; + if (active >= itemCount) active = 0; + } + + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + } + } + //-------------------------------------------------------------------- + + // 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)); + + // Draw selector using a custom button + // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values + int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); + int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); + GuiSetStyle(BUTTON, BORDER_WIDTH, 1); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + + GuiButton(selector, TextFormat("%i/%i", active + 1, itemCount)); + + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign); + GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); + //-------------------------------------------------------------------- + + return active; +} + +// Dropdown Box control +// NOTE: Returns mouse click +bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode) +{ + GuiState state = guiState; + int itemSelected = *active; + int itemFocused = -1; + + // Get substrings items from text (items pointers, lengths and count) + int itemCount = 0; + const char **items = GuiTextSplit(text, ';', &itemCount, NULL); + + Rectangle boundsOpen = bounds; + boundsOpen.height = (itemCount + 1)*(bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); + + Rectangle itemBounds = bounds; + + bool pressed = false; // Check mouse button pressed + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && (editMode || !guiLocked) && (itemCount > 1)) + { + Vector2 mousePoint = GetMousePosition(); + + if (editMode) + { + state = STATE_PRESSED; + + // 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; + } + + // Check if already selected item has been pressed again + if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + + // Check focused and selected item + for (int i = 0; i < itemCount; i++) + { + // Update item rectangle y position for next item + itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); + + if (CheckCollisionPointRec(mousePoint, itemBounds)) + { + itemFocused = i; + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) + { + itemSelected = i; + pressed = true; // Item selected, change to editMode = false + } + break; + } + } + + itemBounds = bounds; + } + else + { + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + { + pressed = true; + state = STATE_PRESSED; + } + else state = STATE_FOCUSED; + } + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + 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)); + + if (editMode) + { + // Draw visible items + for (int i = 0; i < itemCount; i++) + { + // Update item rectangle y position for next item + itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); + + 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)); + } + 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)); + } + else GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_NORMAL)), guiAlpha)); + } + } + + // 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)); +#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 +#endif + //-------------------------------------------------------------------- + + *active = itemSelected; + return pressed; +} + +// 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) +{ + GuiState state = guiState; + Rectangle textBounds = GetTextBounds(TEXTBOX, bounds); + + bool pressed = false; + int textWidth = GetTextWidth(text); + + Rectangle cursor = { + bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + textWidth + 2, + bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE), + 4, + (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); + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = 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) + { + //float maxWidth = (bounds.width - (GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)*2)); + + if (key >= 32) + { + for (int i = 0; i < byteSize; i++) + { + text[keyCount] = textUTF8[i]; + keyCount++; + } + + text[keyCount] = '\0'; + } + } + + // Delete text + if (keyCount > 0) + { + if (IsKeyPressed(KEY_BACKSPACE)) + { + while ((keyCount > 0) && ((text[--keyCount] & 0xc0) == 0x80)); + text[keyCount] = '\0'; + } + } + + if (IsKeyPressed(KEY_ENTER) || (!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); + + 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 cursor + if (editMode) GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha)); + //-------------------------------------------------------------------- + + return pressed; +} + +// Spinner control, returns selected value +bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) +{ + 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, + bounds.width - 2*(GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_SPACING)), bounds.height }; + Rectangle leftButtonBound = { (float)bounds.x, (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height }; + Rectangle rightButtonBound = { (float)bounds.x + bounds.width - GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height }; + + Rectangle textBounds = { 0 }; + if (text != NULL) + { + textBounds.width = (float)GetTextWidth(text); + 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; + if (GuiGetStyle(SPINNER, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SPINNER, TEXT_PADDING); + } + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check spinner state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + } + } + +#if defined(RAYGUI_NO_ICONS) + if (GuiButton(leftButtonBound, "<")) tempValue--; + if (GuiButton(rightButtonBound, ">")) tempValue++; +#else + if (GuiButton(leftButtonBound, GuiIconText(ICON_ARROW_LEFT_FILL, NULL))) tempValue--; + if (GuiButton(rightButtonBound, GuiIconText(ICON_ARROW_RIGHT_FILL, NULL))) tempValue++; +#endif + + if (!editMode) + { + if (tempValue < minValue) tempValue = minValue; + if (tempValue > maxValue) tempValue = maxValue; + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + // TODO: Set Spinner properties for ValueBox + pressed = GuiValueBox(spinner, NULL, &tempValue, minValue, maxValue, editMode); + + // Draw value selector custom buttons + // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values + int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); + int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); + GuiSetStyle(BUTTON, BORDER_WIDTH, GuiGetStyle(SPINNER, BORDER_WIDTH)); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign); + 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)); + //-------------------------------------------------------------------- + + *value = tempValue; + return pressed; +} + +// 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) +{ + #if !defined(RAYGUI_VALUEBOX_MAX_CHARS) + #define RAYGUI_VALUEBOX_MAX_CHARS 32 + #endif + + GuiState state = guiState; + bool pressed = false; + + char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = "\0"; + sprintf(textValue, "%i", *value); + + Rectangle textBounds = { 0 }; + if (text != NULL) + { + textBounds.width = (float)GetTextWidth(text); + 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; + if (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(VALUEBOX, TEXT_PADDING); + } + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + bool valueHasChanged = false; + + if (editMode) + { + state = STATE_PRESSED; + + int keyCount = (int)strlen(textValue); + + // Only allow keys in range [48..57] + if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS) + { + if (GetTextWidth(textValue) < bounds.width) + { + int key = GetCharPressed(); + if ((key >= 48) && (key <= 57)) + { + textValue[keyCount] = (char)key; + keyCount++; + valueHasChanged = true; + } + } + } + + // Delete text + if (keyCount > 0) + { + if (IsKeyPressed(KEY_BACKSPACE)) + { + keyCount--; + textValue[keyCount] = '\0'; + valueHasChanged = true; + } + } + + if (valueHasChanged) *value = TextToInteger(textValue); + + // NOTE: We are not clamp values until user input finishes + //if (*value > maxValue) *value = maxValue; + //else if (*value < minValue) *value = minValue; + + if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true; + } + else + { + if (*value > maxValue) *value = maxValue; + else if (*value < minValue) *value = minValue; + + if (CheckCollisionPointRec(mousePoint, bounds)) + { + state = STATE_FOCUSED; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + } + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + Color baseColor = BLANK; + 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)); + + // 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)); + } + + // 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)); + //-------------------------------------------------------------------- + + 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; +} + +// 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) +{ + GuiState state = guiState; + + 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) }; + + if (sliderWidth > 0) // Slider + { + slider.x += (sliderValue - sliderWidth/2); + slider.width = (float)sliderWidth; + } + else if (sliderWidth == 0) // SliderBar + { + slider.x += GuiGetStyle(SLIDER, BORDER_WIDTH); + slider.width = (float)sliderValue; + } + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + state = STATE_PRESSED; + + // 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 (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; + } + + // Bar limits check + if (sliderWidth > 0) // Slider + { + if (slider.x <= (bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH))) slider.x = bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH); + else if ((slider.x + slider.width) >= (bounds.x + bounds.width)) slider.x = bounds.x + bounds.width - slider.width - GuiGetStyle(SLIDER, BORDER_WIDTH); + } + else if (sliderWidth == 0) // SliderBar + { + if (slider.width > bounds.width) slider.width = bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH); + } + //-------------------------------------------------------------------- + + // 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)); + + // 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)); + + // Draw left/right text if provided + if (textLeft != NULL) + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(textLeft); + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + 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)); + } + + if (textRight != NULL) + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(textRight); + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + 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)); + } + //-------------------------------------------------------------------- + + return value; +} + +// 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) +{ + 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) +{ + 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) +{ + GuiState state = guiState; + + 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 (state != STATE_DISABLED) progress.width = ((float)(value/(maxValue - minValue))*(float)(bounds.width - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH))); + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawRectangle(bounds, GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(PROGRESSBAR, BORDER + (state*3))), guiAlpha), BLANK); + + // 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)); + + // Draw left/right text if provided + if (textLeft != NULL) + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(textLeft); + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + 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)); + } + + if (textRight != NULL) + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(textRight); + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + 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)); + } + //-------------------------------------------------------------------- + + return value; +} + +// Status Bar control +void GuiStatusBar(Rectangle bounds, const char *text) +{ + 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)); + //-------------------------------------------------------------------- +} + +// Dummy rectangle control, intended for placeholding +void GuiDummyRec(Rectangle bounds, const char *text) +{ + GuiState state = guiState; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check button state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + } + } + //-------------------------------------------------------------------- + + // 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)); + //------------------------------------------------------------------ +} + +// List View control +int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active) +{ + int itemCount = 0; + const char **items = NULL; + + if (text != NULL) items = GuiTextSplit(text, ';', &itemCount, NULL); + + return GuiListViewEx(bounds, items, itemCount, NULL, scrollIndex, active); +} + +// List View control with extended parameters +int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active) +{ + GuiState state = guiState; + int itemFocused = (focus == NULL)? -1 : *focus; + int itemSelected = active; + + // Check if we need a scroll bar + bool useScrollBar = false; + if ((GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING))*count > bounds.height) useScrollBar = true; + + // Define base item rectangle [0] + Rectangle itemBounds = { 0 }; + itemBounds.x = bounds.x + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING); + itemBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) + GuiGetStyle(DEFAULT, BORDER_WIDTH); + itemBounds.width = bounds.width - 2*GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) - GuiGetStyle(DEFAULT, BORDER_WIDTH); + itemBounds.height = (float)GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT); + if (useScrollBar) itemBounds.width -= GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH); + + // Get items on the list + int visibleItems = (int)bounds.height/(GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING)); + if (visibleItems > count) visibleItems = count; + + int startIndex = (scrollIndex == NULL)? 0 : *scrollIndex; + if ((startIndex < 0) || (startIndex > (count - visibleItems))) startIndex = 0; + int endIndex = startIndex + visibleItems; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check mouse inside list view + if (CheckCollisionPointRec(mousePoint, bounds)) + { + state = STATE_FOCUSED; + + // Check focused and selected item + for (int i = 0; i < visibleItems; i++) + { + if (CheckCollisionPointRec(mousePoint, itemBounds)) + { + itemFocused = startIndex + i; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + { + if (itemSelected == (startIndex + i)) itemSelected = -1; + else itemSelected = startIndex + i; + } + break; + } + + // Update item rectangle y position for next item + itemBounds.y += (GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING)); + } + + if (useScrollBar) + { + int wheelMove = (int)GetMouseWheelMove(); + startIndex -= wheelMove; + + if (startIndex < 0) startIndex = 0; + else if (startIndex > (count - visibleItems)) startIndex = count - visibleItems; + + endIndex = startIndex + visibleItems; + if (endIndex > count) endIndex = count; + } + } + else itemFocused = -1; + + // Reset item rectangle y to [0] + itemBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) + GuiGetStyle(DEFAULT, BORDER_WIDTH); + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha), 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)); + + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED)), guiAlpha)); + } + else + { + if ((startIndex + i) == itemSelected) + { + // 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)); + } + else if ((startIndex + i) == itemFocused) + { + // 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)); + } + else + { + // Draw item normal + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)), guiAlpha)); + } + } + + // Update item rectangle y position for next item + itemBounds.y += (GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING)); + } + + if (useScrollBar) + { + Rectangle scrollBarBounds = { + bounds.x + bounds.width - GuiGetStyle(LISTVIEW, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH), + bounds.y + GuiGetStyle(LISTVIEW, BORDER_WIDTH), (float)GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH), + bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) + }; + + // Calculate percentage of visible items and apply same percentage to scrollbar + float percentVisible = (float)(endIndex - startIndex)/count; + float sliderSize = bounds.height*percentVisible; + + int prevSliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); // Save default slider size + int prevScrollSpeed = GuiGetStyle(SCROLLBAR, SCROLL_SPEED); // Save default scroll speed + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)sliderSize); // Change slider size + GuiSetStyle(SCROLLBAR, SCROLL_SPEED, count - visibleItems); // Change scroll speed + + startIndex = GuiScrollBar(scrollBarBounds, startIndex, 0, count - visibleItems); + + GuiSetStyle(SCROLLBAR, SCROLL_SPEED, prevScrollSpeed); // Reset scroll speed to default + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, prevSliderSize); // Reset slider size to default + } + //-------------------------------------------------------------------- + + if (focus != NULL) *focus = itemFocused; + if (scrollIndex != NULL) *scrollIndex = startIndex; + + return itemSelected; +} + +// Color Panel control +Color GuiColorPanel(Rectangle bounds, const char *text, Color color) +{ + const Color colWhite = { 255, 255, 255, 255 }; + const Color colBlack = { 0, 0, 0, 255 }; + + GuiState state = guiState; + Vector2 pickerSelector = { 0 }; + + 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 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) + { + 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 + + hsv.y = colorPick.x; + hsv.z = 1.0f - colorPick.y; + + Vector3 rgb = ConvertHSVtoRGB(hsv); + + // NOTE: Vector3ToColor() only available on raylib 1.8.1 + 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) }; + + } + 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, Fade(colWhite, guiAlpha)); + } + 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); + //-------------------------------------------------------------------- + + return color; +} + +// Color Bar Alpha control +// NOTE: Returns alpha value normalized [0..1] +float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) +{ + #if !defined(RAYGUI_COLORBARALPHA_CHECKED_SIZE) + #define RAYGUI_COLORBARALPHA_CHECKED_SIZE 10 + #endif + + 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 }; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds) || + CheckCollisionPointRec(mousePoint, selector)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + state = STATE_PRESSED; + + 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; + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + + // Draw alpha bar: checked background + if (state != STATE_DISABLED) + { + int checksX = (int)bounds.width/RAYGUI_COLORBARALPHA_CHECKED_SIZE; + int checksY = (int)bounds.height/RAYGUI_COLORBARALPHA_CHECKED_SIZE; + + for (int x = 0; x < checksX; x++) + { + 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)); + } + } + + DrawRectangleGradientEx(bounds, RAYGUI_CLITERAL(Color){ 255, 255, 255, 0 }, RAYGUI_CLITERAL(Color){ 255, 255, 255, 0 }, Fade(RAYGUI_CLITERAL(Color){ 0, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 0, 0, 255 }, guiAlpha)); + } + 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); + + // Draw alpha bar: selector + GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha)); + //-------------------------------------------------------------------- + + return alpha; +} + +// Color Bar Hue control +// Returns hue value normalized [0..1] +// NOTE: Other similar bars (for reference): +// Color GuiColorBarSat() [WHITE->color] +// Color GuiColorBarValue() [BLACK->color], HSV/HSL +// float GuiColorBarLuminance() [BLACK->WHITE] +float GuiColorBarHue(Rectangle bounds, const char *text, float hue) +{ + 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) }; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds) || + CheckCollisionPointRec(mousePoint, selector)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + 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 state = STATE_FOCUSED; + + /*if (IsKeyDown(KEY_UP)) + { + hue -= 2.0f; + if (hue <= 0.0f) hue = 0.0f; + } + else if (IsKeyDown(KEY_DOWN)) + { + hue += 2.0f; + if (hue >= 360.0f) hue = 360.0f; + }*/ + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + 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)); + 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)); + DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 4*(bounds.height/6)), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 0, 0, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 255, 255 }, guiAlpha)); + DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 5*(bounds.height/6)), (int)bounds.width, (int)(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 0, 255 }, guiAlpha)); + } + 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); + + // Draw hue bar: selector + GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha)); + //-------------------------------------------------------------------- + + return hue; +} + +// Color Picker control +// NOTE: It's divided in multiple controls: +// Color GuiColorPanel(Rectangle bounds, Color color) +// 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) +{ + color = 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); + //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 }; + + return color; +} + +// Message Box control +int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons) +{ + #if !defined(RAYGUI_MESSAGEBOX_BUTTON_HEIGHT) + #define RAYGUI_MESSAGEBOX_BUTTON_HEIGHT 24 + #endif + #if !defined(RAYGUI_MESSAGEBOX_BUTTON_PADDING) + #define RAYGUI_MESSAGEBOX_BUTTON_PADDING 12 + #endif + + int clicked = -1; // Returns clicked button from buttons list, 0 refers to closed window button + + int buttonCount = 0; + const char **buttonsText = GuiTextSplit(buttons, ';', &buttonCount, NULL); + Rectangle buttonBounds = { 0 }; + buttonBounds.x = bounds.x + RAYGUI_MESSAGEBOX_BUTTON_PADDING; + buttonBounds.y = bounds.y + bounds.height - RAYGUI_MESSAGEBOX_BUTTON_HEIGHT - RAYGUI_MESSAGEBOX_BUTTON_PADDING; + buttonBounds.width = (bounds.width - RAYGUI_MESSAGEBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount; + buttonBounds.height = RAYGUI_MESSAGEBOX_BUTTON_HEIGHT; + + int textWidth = GetTextWidth(message); + + Rectangle textBounds = { 0 }; + textBounds.x = bounds.x + bounds.width/2 - textWidth/2; + textBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + RAYGUI_MESSAGEBOX_BUTTON_PADDING; + textBounds.width = (float)textWidth; + textBounds.height = bounds.height - RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 3*RAYGUI_MESSAGEBOX_BUTTON_PADDING - RAYGUI_MESSAGEBOX_BUTTON_HEIGHT; + + // Draw control + //-------------------------------------------------------------------- + if (GuiWindowBox(bounds, title)) clicked = 0; + + int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT); + GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + GuiLabel(textBounds, message); + GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment); + + prevTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + + for (int i = 0; i < buttonCount; i++) + { + if (GuiButton(buttonBounds, buttonsText[i])) clicked = i + 1; + buttonBounds.x += (buttonBounds.width + RAYGUI_MESSAGEBOX_BUTTON_PADDING); + } + + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevTextAlignment); + //-------------------------------------------------------------------- + + return clicked; +} + +// 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) +{ + #if !defined(RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT) + #define RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT 24 + #endif + #if !defined(RAYGUI_TEXTINPUTBOX_BUTTON_PADDING) + #define RAYGUI_TEXTINPUTBOX_BUTTON_PADDING 12 + #endif + #if !defined(RAYGUI_TEXTINPUTBOX_HEIGHT) + #define RAYGUI_TEXTINPUTBOX_HEIGHT 26 + #endif + + // Used to enable text edit mode + // WARNING: No more than one GuiTextInputBox() should be open at the same time + static bool textEditMode = false; + + int btnIndex = -1; + + int buttonCount = 0; + const char **buttonsText = GuiTextSplit(buttons, ';', &buttonCount, NULL); + Rectangle buttonBounds = { 0 }; + buttonBounds.x = bounds.x + RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; + buttonBounds.y = bounds.y + bounds.height - RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT - RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; + buttonBounds.width = (bounds.width - RAYGUI_TEXTINPUTBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount; + buttonBounds.height = RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT; + + int messageInputHeight = (int)bounds.height - RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT - 2*RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; + + Rectangle textBounds = { 0 }; + if (message != NULL) + { + int textSize = GetTextWidth(message); + + 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; + textBounds.width = (float)textSize; + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + } + + Rectangle textBoxBounds = { 0 }; + textBoxBounds.x = bounds.x + RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; + textBoxBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - RAYGUI_TEXTINPUTBOX_HEIGHT/2; + if (message == NULL) textBoxBounds.y = bounds.y + 24 + RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; + else textBoxBounds.y += (messageInputHeight/2 + messageInputHeight/4); + textBoxBounds.width = bounds.width - RAYGUI_TEXTINPUTBOX_BUTTON_PADDING*2; + textBoxBounds.height = RAYGUI_TEXTINPUTBOX_HEIGHT; + + // Draw control + //-------------------------------------------------------------------- + if (GuiWindowBox(bounds, title)) btnIndex = 0; + + // Draw message if available + if (message != NULL) + { + int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT); + GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + GuiLabel(textBounds, message); + GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment); + } + + if (secretViewActive != NULL) + { + static char stars[] = "****************"; + 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); + } + else + { + if (GuiTextBox(textBoxBounds, text, textMaxSize, textEditMode)) textEditMode = !textEditMode; + } + + int prevBtnTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + + for (int i = 0; i < buttonCount; i++) + { + if (GuiButton(buttonBounds, buttonsText[i])) btnIndex = i + 1; + buttonBounds.x += (buttonBounds.width + RAYGUI_MESSAGEBOX_BUTTON_PADDING); + } + + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevBtnTextAlignment); + //-------------------------------------------------------------------- + + return btnIndex; +} + +// 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) +{ + // Grid lines alpha amount + #if !defined(RAYGUI_GRID_ALPHA) + #define RAYGUI_GRID_ALPHA 0.15f + #endif + + 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; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + 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); + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + + // TODO: Draw background panel? + + switch (state) + { + case STATE_NORMAL: + { + 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)); + } + + // 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; + } + + return currentCell; +} + +//---------------------------------------------------------------------------------- +// Styles loading functions +//---------------------------------------------------------------------------------- + +// Load raygui style file (.rgs) +// NOTE: By default a binary file is expected, that file could contain a custom font, +// in that case, custom font image atlas is GRAY+ALPHA and pixel data can be compressed (DEFLATE) +void GuiLoadStyle(const char *fileName) +{ + #define MAX_LINE_BUFFER_SIZE 256 + + bool tryBinary = false; + + // Try reading the files as text file first + FILE *rgsFile = fopen(fileName, "rt"); + + if (rgsFile != NULL) + { + char buffer[MAX_LINE_BUFFER_SIZE] = { 0 }; + fgets(buffer, MAX_LINE_BUFFER_SIZE, rgsFile); + + if (buffer[0] == '#') + { + int controlId = 0; + int propertyId = 0; + unsigned int propertyValue = 0; + + while (!feof(rgsFile)) + { + switch (buffer[0]) + { + case 'p': + { + // Style property: p + + sscanf(buffer, "p %d %d 0x%x", &controlId, &propertyId, &propertyValue); + GuiSetStyle(controlId, propertyId, (int)propertyValue); + + } break; + case 'f': + { + // Style font: f + + int fontSize = 0; + char charmapFileName[256] = { 0 }; + char fontFileName[256] = { 0 }; + sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName); + + Font font = { 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); + } + } + else + { + 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 ((font.texture.id > 0) && (font.glyphCount > 0)) GuiSetFont(font); + + } break; + default: break; + } + + fgets(buffer, MAX_LINE_BUFFER_SIZE, rgsFile); + } + } + else tryBinary = true; + + fclose(rgsFile); + } + + if (tryBinary) + { + 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] == ' ')) + { + short controlId = 0; + short propertyId = 0; + unsigned int propertyValue = 0; + + for (int i = 0; i < propertyCount; i++) + { + fread(&controlId, 1, sizeof(short), rgsFile); + fread(&propertyId, 1, sizeof(short), rgsFile); + fread(&propertyValue, 1, sizeof(unsigned int), 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); + + 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; + 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); + } +} + +// Load style default over global style +void GuiLoadStyleDefault(void) +{ + // We set this variable first to avoid cyclic function calls + // when calling GuiSetStyle() and GuiGetStyle() + guiStyleLoaded = true; + + // Initialize default LIGHT style property values + GuiSetStyle(DEFAULT, BORDER_COLOR_NORMAL, 0x838383ff); + GuiSetStyle(DEFAULT, BASE_COLOR_NORMAL, 0xc9c9c9ff); + GuiSetStyle(DEFAULT, TEXT_COLOR_NORMAL, 0x686868ff); + GuiSetStyle(DEFAULT, BORDER_COLOR_FOCUSED, 0x5bb2d9ff); + GuiSetStyle(DEFAULT, BASE_COLOR_FOCUSED, 0xc9effeff); + GuiSetStyle(DEFAULT, TEXT_COLOR_FOCUSED, 0x6c9bbcff); + GuiSetStyle(DEFAULT, BORDER_COLOR_PRESSED, 0x0492c7ff); + GuiSetStyle(DEFAULT, BASE_COLOR_PRESSED, 0x97e8ffff); + GuiSetStyle(DEFAULT, TEXT_COLOR_PRESSED, 0x368bafff); + 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 + + // 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(CHECKBOX, TEXT_PADDING, 4); + GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_RIGHT); + GuiSetStyle(TEXTBOX, TEXT_PADDING, 4); + GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); + GuiSetStyle(VALUEBOX, TEXT_PADDING, 0); + GuiSetStyle(VALUEBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); + GuiSetStyle(SPINNER, TEXT_PADDING, 0); + GuiSetStyle(SPINNER, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); + GuiSetStyle(STATUSBAR, TEXT_PADDING, 8); + GuiSetStyle(STATUSBAR, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); + + // 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); + GuiSetStyle(PROGRESSBAR, PROGRESS_PADDING, 1); + GuiSetStyle(CHECKBOX, CHECK_PADDING, 1); + GuiSetStyle(COMBOBOX, COMBO_BUTTON_WIDTH, 32); + 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); + GuiSetStyle(SCROLLBAR, ARROWS_VISIBLE, 0); + GuiSetStyle(SCROLLBAR, ARROWS_SIZE, 6); + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING, 0); + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, 16); + GuiSetStyle(SCROLLBAR, SCROLL_PADDING, 0); + GuiSetStyle(SCROLLBAR, SCROLL_SPEED, 12); + GuiSetStyle(LISTVIEW, LIST_ITEMS_HEIGHT, 28); + GuiSetStyle(LISTVIEW, LIST_ITEMS_SPACING, 2); + GuiSetStyle(LISTVIEW, SCROLLBAR_WIDTH, 12); + GuiSetStyle(LISTVIEW, SCROLLBAR_SIDE, SCROLLBAR_RIGHT_SIDE); + GuiSetStyle(COLORPICKER, COLOR_SELECTOR_SIZE, 8); + GuiSetStyle(COLORPICKER, HUEBAR_WIDTH, 16); + GuiSetStyle(COLORPICKER, HUEBAR_PADDING, 8); + GuiSetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT, 8); + GuiSetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW, 2); + + if (guiFont.texture.id != GetFontDefault().texture.id) + { + // Unload previous font texture + UnloadTexture(guiFont.texture); + + // Setup default raylib font + guiFont = GetFontDefault(); + + // Setup default raylib font rectangle + Rectangle whiteChar = { 41, 46, 2, 8 }; + SetShapesTexture(guiFont.texture, whiteChar); + } +} + +// Get text with icon id prepended +// NOTE: Useful to add icons by name id (enum) instead of +// a number that can change between ricon versions +const char *GuiIconText(int iconId, const char *text) +{ +#if defined(RAYGUI_NO_ICONS) + return NULL; +#else + static char buffer[1024] = { 0 }; + static char iconBuffer[6] = { 0 }; + + if (text != NULL) + { + memset(buffer, 0, 1024); + sprintf(buffer, "#%03i#", iconId); + + for (int i = 5; i < 1024; i++) + { + buffer[i] = text[i - 5]; + if (text[i - 5] == '\0') break; + } + + return buffer; + } + else + { + sprintf(iconBuffer, "#%03i#", iconId & 0x1ff); + + return iconBuffer; + } +#endif +} + +#if !defined(RAYGUI_NO_ICONS) +// Get full icons data pointer +unsigned int *GuiGetIcons(void) { return guiIconsPtr; } + +// Load raygui icons file (.rgi) +// NOTE: In case nameIds are required, they can be requested with loadIconsName, +// they are returned as a guiIconsName[iconCount][RAYGUI_ICON_MAX_NAME_LENGTH], +// WARNING: guiIconsName[]][] memory should be manually freed! +char **GuiLoadIcons(const char *fileName, bool loadIconsName) +{ + // Style File Structure (.rgi) + // ------------------------------------------------------ + // Offset | Size | Type | Description + // ------------------------------------------------------ + // 0 | 4 | char | Signature: "rGI " + // 4 | 2 | short | Version: 100 + // 6 | 2 | short | reserved + + // 8 | 2 | short | Num icons (N) + // 10 | 2 | short | Icons size (Options: 16, 32, 64) (S) + + // Icons name id (32 bytes per name id) + // foreach (icon) + // { + // 12+32*i | 32 | char | Icon NameId + // } + + // Icons data: One bit per pixel, stored as unsigned int array (depends on icon size) + // S*S pixels/32bit per unsigned int = K unsigned int per icon + // foreach (icon) + // { + // ... | K | unsigned int | Icon Data + // } + + FILE *rgiFile = fopen(fileName, "rb"); + + char **guiIconsName = NULL; + + if (rgiFile != NULL) + { + char signature[5] = { 0 }; + short version = 0; + short reserved = 0; + short iconCount = 0; + 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); + + if ((signature[0] == 'r') && + (signature[1] == 'G') && + (signature[2] == 'I') && + (signature[3] == ' ')) + { + if (loadIconsName) + { + guiIconsName = (char **)RAYGUI_MALLOC(iconCount*sizeof(char **)); + 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); + } + } + 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); + } + + fclose(rgiFile); + } + + return guiIconsName; +} + +// Draw selected icon using rectangles pixel-by-pixel +void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color) +{ + #define BIT_CHECK(a,b) ((a) & (1u<<(b))) + + for (int i = 0, y = 0; i < RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32; i++) + { + for (int k = 0; k < 32; k++) + { + 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); + #endif + } + + if ((k == 15) || (k == 31)) y++; + } + } +} +#endif // !RAYGUI_NO_ICONS + +//---------------------------------------------------------------------------------- +// Module specific Functions Definition +//---------------------------------------------------------------------------------- +// Gui get text width considering icon +static int GetTextWidth(const char *text) +{ + #if !defined(ICON_TEXT_PADDING) + #define ICON_TEXT_PADDING 4 + #endif + + Vector2 textSize = { 0 }; + int textIconOffset = 0; + + if ((text != NULL) && (text[0] != '\0')) + { + if (text[0] == '#') + { + for (int i = 1; (text[i] != '\0') && (i < 5); i++) + { + if (text[i] == '#') + { + textIconOffset = i; + break; + } + } + } + + text += textIconOffset; + + // Make sure guiFont is set, GuiGetStyle() initializes it lazynessly + float fontSize = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + + // Custom MeasureText() implementation + if ((guiFont.texture.id > 0) && (text != NULL)) + { + // Get size in bytes of text, considering end of line and line break + int size = 0; + for (int i = 0; i < MAX_LINE_BUFFER_SIZE; i++) + { + if ((text[i] != '\0') && (text[i] != '\n')) size++; + else break; + } + + float scaleFactor = fontSize/(float)guiFont.baseSize; + textSize.y = (float)guiFont.baseSize*scaleFactor; + float glyphWidth = 0.0f; + + for (int i = 0, codepointSize = 0; i < size; i += codepointSize) + { + 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)); + + textSize.x += glyphWidth; + } + } + + if (textIconOffset > 0) textSize.x += (RAYGUI_ICON_SIZE - ICON_TEXT_PADDING); + } + + return (int)textSize.x; +} + +// Get text bounds considering control bounds +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.width = bounds.width - 2*GuiGetStyle(control, BORDER_WIDTH) - 2*GuiGetStyle(control, TEXT_PADDING); + textBounds.height = bounds.height - 2*GuiGetStyle(control, BORDER_WIDTH); + + // Consider TEXT_PADDING properly, depends on control type and TEXT_ALIGNMENT + 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 + default: + { + 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; +} + +// Get text icon if provided and move text cursor +// NOTE: We support up to 999 values for iconId +static const char *GetTextIcon(const char *text, int *iconId) +{ +#if !defined(RAYGUI_NO_ICONS) + *iconId = -1; + if (text[0] == '#') // Maybe we have an icon! + { + char iconValue[4] = { 0 }; // Maximum length for icon value: 3 digits + '\0' + + int pos = 1; + while ((pos < 4) && (text[pos] >= '0') && (text[pos] <= '9')) + { + iconValue[pos - 1] = text[pos]; + pos++; + } + + if (text[pos] == '#') + { + *iconId = TextToInteger(iconValue); + + // Move text pointer after icon + // WARNING: If only icon provided, it could point to EOL character: '\0' + if (*iconId >= 0) text += (pos + 1); + } + } +#endif + + return text; +} + +// Get text divided into lines (by line-breaks '\n') +const char **GetTextLines(const char *text, int *count) +{ + #define RAYGUI_MAX_TEXT_LINES 128 + + static const char *lines[RAYGUI_MAX_TEXT_LINES] = { 0 }; + for (int i = 0; i < RAYGUI_MAX_TEXT_LINES; i++) lines[i] = NULL; // Init NULL pointers to substrings + + int textSize = (int)strlen(text); + + lines[0] = text; + int len = 0; + *count = 1; + 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; + k++; + lines[k] = &text[i + 1]; // WARNING: next value is valid? + len = 0; + *count += 1; + } + else len++; + } + + //lines[*count - 1].size = len; + + return lines; +} + +// Gui draw text using default font +static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint) +{ + #define TEXT_VALIGN_PIXEL_OFFSET(h) ((int)h%2) // Vertical alignment for pixel perfect + + #if !defined(ICON_TEXT_PADDING) + #define ICON_TEXT_PADDING 4 + #endif + + // We process the text lines one by one + if ((text != NULL) && (text[0] != '\0')) + { + // 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); + + //Rectangle textBounds = GetTextBounds(LABEL, bounds); + float totalHeight = (float)(lineCount*GuiGetStyle(DEFAULT, TEXT_SIZE) + (lineCount - 1)*GuiGetStyle(DEFAULT, TEXT_SIZE)/2); + float posOffsetY = 0; + + for (int i = 0; i < lineCount; i++) + { + int iconId = 0; + lines[i] = GetTextIcon(lines[i], &iconId); // Check text for icon and move cursor + + // 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) + //--------------------------------------------------------------------------------- +#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); + } +#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; + + int textOffsetY = 0; + float textOffsetX = 0.0f; + for (int c = 0, codepointSize = 0; c < size; 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; + + if (codepoint == '\n') break; // WARNING: Lines are already processed manually, no need to keep drawing after this codepoint + else + { + 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)); + } + } + + posOffsetY += (float)GuiGetStyle(DEFAULT, TEXT_SIZE)*1.5f; // TODO: GuiGetStyle(DEFAULT, TEXT_LINE_SPACING)? + //--------------------------------------------------------------------------------- + } + } +} + +// Gui draw rectangle using default raygui plain style with borders +static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color) +{ + if (color.a > 0) + { + // Draw rectangle filled with color + DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, color); + } + + 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); + } +} + +// Split controls text into multiple strings +// Also check for multiple columns (required by GuiToggleGroup()) +static const char **GuiTextSplit(const char *text, char delimiter, int *count, int *textRow) +{ + // NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter) + // inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated, + // all used memory is static... it has some limitations: + // 1. Maximum number of possible split strings is set by RAYGUI_TEXTSPLIT_MAX_ITEMS + // 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! + // textRow is an externally provided array of integers that stores row number for every splitted string + + #if !defined(RAYGUI_TEXTSPLIT_MAX_ITEMS) + #define RAYGUI_TEXTSPLIT_MAX_ITEMS 128 + #endif + #if !defined(RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE) + #define RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE 1024 + #endif + + static const char *result[RAYGUI_TEXTSPLIT_MAX_ITEMS] = { NULL }; // String pointers array (points to buffer data) + static char buffer[RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE] = { 0 }; // Buffer data (text input copy with '\0' added) + memset(buffer, 0, RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE); + + result[0] = buffer; + int counter = 1; + + if (textRow != NULL) textRow[0] = 0; + + // Count how many substrings we have on text and point to every one + for (int i = 0; i < RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE; i++) + { + buffer[i] = text[i]; + if (buffer[i] == '\0') break; + else if ((buffer[i] == delimiter) || (buffer[i] == '\n')) + { + result[counter] = buffer + i + 1; + + if (textRow != NULL) + { + if (buffer[i] == '\n') textRow[counter] = textRow[counter - 1] + 1; + else textRow[counter] = textRow[counter - 1]; + } + + buffer[i] = '\0'; // Set an end of string at this point + + counter++; + if (counter == RAYGUI_TEXTSPLIT_MAX_ITEMS) break; + } + } + + *count = counter; + + return result; +} + +// Convert color data from RGB to HSV +// NOTE: Color data should be passed normalized +static Vector3 ConvertRGBtoHSV(Vector3 rgb) +{ + Vector3 hsv = { 0 }; + float min = 0.0f; + float max = 0.0f; + float delta = 0.0f; + + min = (rgb.x < rgb.y)? rgb.x : rgb.y; + min = (min < rgb.z)? min : rgb.z; + + max = (rgb.x > rgb.y)? rgb.x : rgb.y; + max = (max > rgb.z)? max : rgb.z; + + hsv.z = max; // Value + delta = max - min; + + if (delta < 0.00001f) + { + hsv.y = 0.0f; + hsv.x = 0.0f; // Undefined, maybe NAN? + return hsv; + } + + if (max > 0.0f) + { + // NOTE: If max is 0, this divide would cause a crash + hsv.y = (delta/max); // Saturation + } + else + { + // NOTE: If max is 0, then r = g = b = 0, s = 0, h is undefined + hsv.y = 0.0f; + hsv.x = 0.0f; // Undefined, maybe NAN? + return hsv; + } + + // NOTE: Comparing float values could not work properly + if (rgb.x >= max) hsv.x = (rgb.y - rgb.z)/delta; // Between yellow & magenta + else + { + if (rgb.y >= max) hsv.x = 2.0f + (rgb.z - rgb.x)/delta; // Between cyan & yellow + else hsv.x = 4.0f + (rgb.x - rgb.y)/delta; // Between magenta & cyan + } + + hsv.x *= 60.0f; // Convert to degrees + + if (hsv.x < 0.0f) hsv.x += 360.0f; + + return hsv; +} + +// Convert color data from HSV to RGB +// NOTE: Color data should be passed normalized +static Vector3 ConvertHSVtoRGB(Vector3 hsv) +{ + Vector3 rgb = { 0 }; + float hh = 0.0f, p = 0.0f, q = 0.0f, t = 0.0f, ff = 0.0f; + long i = 0; + + // NOTE: Comparing float values could not work properly + if (hsv.y <= 0.0f) + { + rgb.x = hsv.z; + rgb.y = hsv.z; + rgb.z = hsv.z; + return rgb; + } + + hh = hsv.x; + if (hh >= 360.0f) hh = 0.0f; + hh /= 60.0f; + + i = (long)hh; + ff = hh - i; + p = hsv.z*(1.0f - hsv.y); + q = hsv.z*(1.0f - (hsv.y*ff)); + t = hsv.z*(1.0f - (hsv.y*(1.0f - ff))); + + switch (i) + { + case 0: + { + rgb.x = hsv.z; + rgb.y = t; + rgb.z = p; + } break; + case 1: + { + rgb.x = q; + rgb.y = hsv.z; + rgb.z = p; + } break; + case 2: + { + rgb.x = p; + rgb.y = hsv.z; + rgb.z = t; + } break; + case 3: + { + rgb.x = p; + rgb.y = q; + rgb.z = hsv.z; + } break; + case 4: + { + rgb.x = t; + rgb.y = p; + rgb.z = hsv.z; + } break; + case 5: + default: + { + rgb.x = hsv.z; + rgb.y = p; + rgb.z = q; + } break; + } + + return rgb; +} + +// Scroll bar control (used by GuiScrollPanel()) +static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) +{ + GuiState state = guiState; + + // Is the scrollbar horizontal or vertical? + 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) : + (int)bounds.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH)) : 0; + + // Arrow buttons [<] [>] [∧] [∨] + Rectangle arrowUpLeft = { 0 }; + Rectangle arrowDownRight = { 0 }; + + // Actual area of the scrollbar excluding the arrow buttons + Rectangle scrollbar = { 0 }; + + // Slider bar that moves --[///]----- + Rectangle slider = { 0 }; + + // Normalize value + if (value > maxValue) value = maxValue; + if (value < minValue) value = minValue; + + const int range = 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), + (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 }; + } + 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)) }; + } + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds)) + { + state = STATE_FOCUSED; + + // Handle mouse wheel + int wheel = (int)GetMouseWheelMove(); + if (wheel != 0) value += wheel; + + 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); + + state = STATE_PRESSED; + } + else if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + 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); + } + } + } + + // Normalize value + if (value > maxValue) value = maxValue; + if (value < minValue) value = minValue; + } + //-------------------------------------------------------------------- + + // 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(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 + + // Draw arrows (using icon if available) + if (GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE)) + { +#if defined(RAYGUI_NO_ICONS) + 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" : ">", + 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)); +#else + 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#", + 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 +#endif + } + //-------------------------------------------------------------------- + + return value; +} + +#if defined(RAYGUI_STANDALONE) +// Returns a Color struct from hexadecimal value +static Color GetColor(int hexValue) +{ + Color color; + + color.r = (unsigned char)(hexValue >> 24) & 0xFF; + color.g = (unsigned char)(hexValue >> 16) & 0xFF; + color.b = (unsigned char)(hexValue >> 8) & 0xFF; + color.a = (unsigned char)hexValue & 0xFF; + + return color; +} + +// Returns hexadecimal value for a Color +static int ColorToInt(Color color) +{ + return (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a); +} + +// Check if point is inside rectangle +static bool CheckCollisionPointRec(Vector2 point, Rectangle rec) +{ + bool collision = false; + + if ((point.x >= rec.x) && (point.x <= (rec.x + rec.width)) && + (point.y >= rec.y) && (point.y <= (rec.y + rec.height))) collision = true; + + 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, ...) +{ + #if !defined(RAYGUI_TEXTFORMAT_MAX_SIZE) + #define RAYGUI_TEXTFORMAT_MAX_SIZE 256 + #endif + + static char buffer[RAYGUI_TEXTFORMAT_MAX_SIZE]; + + va_list args; + va_start(args, text); + vsprintf(buffer, text, args); + va_end(args); + + return buffer; +} + +// Draw rectangle with vertical gradient fill color +// NOTE: This function is only used by GuiColorPicker() +static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2) +{ + Rectangle bounds = { (float)posX, (float)posY, (float)width, (float)height }; + DrawRectangleGradientEx(bounds, color1, color2, color2, color1); +} + +// Split string into multiple strings +const char **TextSplit(const char *text, char delimiter, int *count) +{ + // NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter) + // inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated, + // all used memory is static... it has some limitations: + // 1. Maximum number of possible split strings is set by RAYGUI_TEXTSPLIT_MAX_ITEMS + // 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 + #endif + #if !defined(RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE) + #define RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE 1024 + #endif + + static const char *result[RAYGUI_TEXTSPLIT_MAX_ITEMS] = { NULL }; + static char buffer[RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE] = { 0 }; + memset(buffer, 0, RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE); + + result[0] = buffer; + int counter = 0; + + if (text != NULL) + { + counter = 1; + + // Count how many substrings we have on text and point to every one + for (int i = 0; i < RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE; i++) + { + buffer[i] = text[i]; + if (buffer[i] == '\0') break; + else if (buffer[i] == delimiter) + { + buffer[i] = '\0'; // Set an end of string at this point + result[counter] = buffer + i + 1; + counter++; + + if (counter == RAYGUI_TEXTSPLIT_MAX_ITEMS) break; + } + } + } + + *count = counter; + return result; +} + +// Get integer value from text +// NOTE: This function replaces atoi() [stdlib.h] +static int TextToInteger(const char *text) +{ + int value = 0; + int sign = 1; + + if ((text[0] == '+') || (text[0] == '-')) + { + if (text[0] == '-') sign = -1; + text++; + } + + for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); ++i) value = value*10 + (int)(text[i] - '0'); + + return value*sign; +} + +// Encode codepoint into UTF-8 text (char array size returned as parameter) +static const char *CodepointToUTF8(int codepoint, int *byteSize) +{ + static char utf8[6] = { 0 }; + int size = 0; + + if (codepoint <= 0x7f) + { + utf8[0] = (char)codepoint; + size = 1; + } + else if (codepoint <= 0x7ff) + { + utf8[0] = (char)(((codepoint >> 6) & 0x1f) | 0xc0); + utf8[1] = (char)((codepoint & 0x3f) | 0x80); + size = 2; + } + else if (codepoint <= 0xffff) + { + utf8[0] = (char)(((codepoint >> 12) & 0x0f) | 0xe0); + utf8[1] = (char)(((codepoint >> 6) & 0x3f) | 0x80); + utf8[2] = (char)((codepoint & 0x3f) | 0x80); + size = 3; + } + else if (codepoint <= 0x10ffff) + { + utf8[0] = (char)(((codepoint >> 18) & 0x07) | 0xf0); + utf8[1] = (char)(((codepoint >> 12) & 0x3f) | 0x80); + utf8[2] = (char)(((codepoint >> 6) & 0x3f) | 0x80); + utf8[3] = (char)((codepoint & 0x3f) | 0x80); + size = 4; + } + + *byteSize = size; + + return utf8; +} + +// Get next codepoint in a UTF-8 encoded text, scanning until '\0' is found +// When a invalid UTF-8 byte is encountered we exit as soon as possible and a '?'(0x3f) codepoint is returned +// Total number of bytes processed are returned as a parameter +// NOTE: the standard says U+FFFD should be returned in case of errors +// but that character is not supported by the default font in raylib +static int GetCodepointNext(const char *text, int *codepointSize) +{ + const char *ptr = text; + int codepoint = 0x3f; // Codepoint (defaults to '?') + *codepointSize = 0; + + // Get current codepoint and bytes processed + if (0xf0 == (0xf8 & ptr[0])) + { + // 4 byte UTF-8 codepoint + 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 */ + 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 + codepoint = ((0x1f & ptr[0]) << 6) | (0x3f & ptr[1]); + *codepointSize = 2; + } + else + { + // 1 byte UTF-8 codepoint + codepoint = ptr[0]; + *codepointSize = 1; + } + + return codepoint; +} +#endif // RAYGUI_STANDALONE + +#endif // RAYGUI_IMPLEMENTATION + diff --git a/raygui/slider.go b/raygui/slider.go deleted file mode 100644 index a011818..0000000 --- a/raygui/slider.go +++ /dev/null @@ -1,76 +0,0 @@ -package raygui - -import rl "github.com/gen2brain/raylib-go/raylib" - -// Slider - Slider element, returns selected value -func Slider(bounds rl.Rectangle, value, minValue, maxValue float32) float32 { - b := bounds.ToInt32() - sliderPos := float32(0) - state := Normal - - buttonTravelDistance := float32(0) - mousePoint := rl.GetMousePosition() - - // Update control - if value < minValue { - value = minValue - } else if value >= maxValue { - value = maxValue - } - - sliderPos = (value - minValue) / (maxValue - minValue) - - sliderButton := rl.RectangleInt32{} - sliderButton.Width = (b.Width-(2*int32(style[SliderButtonBorderWidth])))/10 - 8 - sliderButton.Height = b.Height - (2 * int32(style[SliderBorderWidth]+2*style[SliderButtonBorderWidth])) - - sliderButtonMinPos := b.X + int32(style[SliderBorderWidth]) + int32(style[SliderButtonBorderWidth]) - sliderButtonMaxPos := b.X + b.Width - (int32(style[SliderBorderWidth]) + int32(style[SliderButtonBorderWidth]) + sliderButton.Width) - - buttonTravelDistance = float32(sliderButtonMaxPos - sliderButtonMinPos) - - sliderButton.X = b.X + int32(style[SliderBorderWidth]) + int32(style[SliderButtonBorderWidth]) + int32(sliderPos*buttonTravelDistance) - sliderButton.Y = b.Y + int32(style[SliderBorderWidth]) + int32(style[SliderButtonBorderWidth]) - - if rl.CheckCollisionPointRec(mousePoint, bounds) { - state = Focused - - if rl.IsMouseButtonDown(rl.MouseLeftButton) { - state = Pressed - } - - if state == Pressed && rl.IsMouseButtonDown(rl.MouseLeftButton) { - sliderButton.X = int32(mousePoint.X) - sliderButton.Width/2 - - if sliderButton.X <= sliderButtonMinPos { - sliderButton.X = sliderButtonMinPos - } else if sliderButton.X >= sliderButtonMaxPos { - sliderButton.X = sliderButtonMaxPos - } - - sliderPos = float32(sliderButton.X-sliderButtonMinPos) / buttonTravelDistance - } - } else { - state = Normal - } - - // Draw control - rl.DrawRectangle(b.X, b.Y, b.Width, b.Height, rl.GetColor(uint(style[SliderBorderColor]))) - rl.DrawRectangle(b.X+int32(style[SliderBorderWidth]), b.Y+int32(style[SliderBorderWidth]), b.Width-(2*int32(style[SliderBorderWidth])), b.Height-(2*int32(style[SliderBorderWidth])), rl.GetColor(uint(style[SliderInsideColor]))) - - switch state { - case Normal: - rl.DrawRectangle(sliderButton.X, sliderButton.Y, sliderButton.Width, sliderButton.Height, rl.GetColor(uint(style[SliderDefaultColor]))) - break - case Focused: - rl.DrawRectangle(sliderButton.X, sliderButton.Y, sliderButton.Width, sliderButton.Height, rl.GetColor(uint(style[SliderHoverColor]))) - break - case Pressed: - rl.DrawRectangle(sliderButton.X, sliderButton.Y, sliderButton.Width, sliderButton.Height, rl.GetColor(uint(style[SliderActiveColor]))) - break - default: - break - } - - return minValue + (maxValue-minValue)*sliderPos -} diff --git a/raygui/sliderbar.go b/raygui/sliderbar.go deleted file mode 100644 index 2ad9265..0000000 --- a/raygui/sliderbar.go +++ /dev/null @@ -1,76 +0,0 @@ -package raygui - -import rl "github.com/gen2brain/raylib-go/raylib" - -// SliderBar - Slider Bar element, returns selected value -func SliderBar(bounds rl.Rectangle, value, minValue, maxValue float32) float32 { - b := bounds.ToInt32() - state := Normal - - mousePoint := rl.GetMousePosition() - - fixedValue := float32(0) - fixedMinValue := float32(0) - - fixedValue = value - minValue - maxValue = maxValue - minValue - fixedMinValue = 0 - - // Update control - if fixedValue <= fixedMinValue { - fixedValue = fixedMinValue - } else if fixedValue >= maxValue { - fixedValue = maxValue - } - - sliderBar := rl.RectangleInt32{} - - sliderBar.X = b.X + int32(style[SliderBorderWidth]) - sliderBar.Y = b.Y + int32(style[SliderBorderWidth]) - sliderBar.Width = int32((fixedValue * (float32(b.Width) - 2*float32(style[SliderBorderWidth]))) / (maxValue - fixedMinValue)) - sliderBar.Height = b.Height - 2*int32(style[SliderBorderWidth]) - - if rl.CheckCollisionPointRec(mousePoint, bounds) { - state = Focused - - if rl.IsMouseButtonDown(rl.MouseLeftButton) { - state = Pressed - - sliderBar.Width = (int32(mousePoint.X) - b.X - int32(style[SliderBorderWidth])) - - if int32(mousePoint.X) <= (b.X + int32(style[SliderBorderWidth])) { - sliderBar.Width = 0 - } else if int32(mousePoint.X) >= (b.X + b.Width - int32(style[SliderBorderWidth])) { - sliderBar.Width = b.Width - 2*int32(style[SliderBorderWidth]) - } - } - } else { - state = Normal - } - - fixedValue = (float32(sliderBar.Width) * (maxValue - fixedMinValue)) / (float32(b.Width) - 2*float32(style[SliderBorderWidth])) - - // Draw control - rl.DrawRectangle(b.X, b.Y, b.Width, b.Height, rl.GetColor(uint(style[SliderbarBorderColor]))) - rl.DrawRectangle(b.X+int32(style[SliderBorderWidth]), b.Y+int32(style[SliderBorderWidth]), b.Width-(2*int32(style[SliderBorderWidth])), b.Height-(2*int32(style[SliderBorderWidth])), rl.GetColor(uint(style[SliderbarInsideColor]))) - - switch state { - case Normal: - rl.DrawRectangle(sliderBar.X, sliderBar.Y, sliderBar.Width, sliderBar.Height, rl.GetColor(uint(style[SliderbarDefaultColor]))) - break - case Focused: - rl.DrawRectangle(sliderBar.X, sliderBar.Y, sliderBar.Width, sliderBar.Height, rl.GetColor(uint(style[SliderbarHoverColor]))) - break - case Pressed: - rl.DrawRectangle(sliderBar.X, sliderBar.Y, sliderBar.Width, sliderBar.Height, rl.GetColor(uint(style[SliderbarActiveColor]))) - break - default: - break - } - - if minValue < 0 && maxValue > 0 { - rl.DrawRectangle((b.X+int32(style[SliderBorderWidth]))-int32(minValue*(float32(b.Width-(int32(style[SliderBorderWidth])*2))/maxValue)), sliderBar.Y, 1, sliderBar.Height, rl.GetColor(uint(style[SliderbarZeroLineColor]))) - } - - return fixedValue + minValue -} diff --git a/raygui/spinner.go b/raygui/spinner.go deleted file mode 100644 index 8527538..0000000 --- a/raygui/spinner.go +++ /dev/null @@ -1,177 +0,0 @@ -package raygui - -import ( - "fmt" - - rl "github.com/gen2brain/raylib-go/raylib" -) - -// For spinner -var ( - framesCounter int - framesCounter2 int - valueSpeed bool -) - -// Spinner - Spinner element, returns selected value -func Spinner(bounds rl.Rectangle, value, minValue, maxValue int) int { - b := bounds.ToInt32() - state := Normal - - mousePoint := rl.GetMousePosition() - labelBoxBound := rl.RectangleInt32{b.X + b.Width/4 + 1, b.Y, b.Width / 2, b.Height} - leftButtonBound := rl.RectangleInt32{b.X, b.Y, b.Width / 4, b.Height} - rightButtonBound := rl.RectangleInt32{b.X + b.Width - b.Width/4 + 1, b.Y, b.Width / 4, b.Height} - - textHeight := int32(style[GlobalTextFontsize]) - textWidth := rl.MeasureText(fmt.Sprintf("%d", value), textHeight) - - buttonSide := 0 - - // Update control - if rl.CheckCollisionPointRec(mousePoint, leftButtonBound.ToFloat32()) || rl.CheckCollisionPointRec(mousePoint, rightButtonBound.ToFloat32()) || rl.CheckCollisionPointRec(mousePoint, labelBoxBound.ToFloat32()) { - if rl.IsKeyDown(rl.KeyLeft) { - state = Pressed - buttonSide = 1 - - if value > minValue { - value-- - } - } else if rl.IsKeyDown(rl.KeyRight) { - state = Pressed - buttonSide = 2 - - if value < maxValue { - value++ - } - } - } - - if rl.CheckCollisionPointRec(mousePoint, leftButtonBound.ToFloat32()) { - buttonSide = 1 - state = Focused - - if rl.IsMouseButtonDown(rl.MouseLeftButton) { - if !valueSpeed { - if value > minValue { - value-- - } - valueSpeed = true - } else { - framesCounter++ - } - - state = Pressed - - if value > minValue { - if framesCounter >= 30 { - value-- - } - } - } - } else if rl.CheckCollisionPointRec(mousePoint, rightButtonBound.ToFloat32()) { - buttonSide = 2 - state = Focused - - if rl.IsMouseButtonDown(rl.MouseLeftButton) { - if !valueSpeed { - if value < maxValue { - value++ - } - valueSpeed = true - } else { - framesCounter++ - } - - state = Pressed - - if value < maxValue { - if framesCounter >= 30 { - value++ - } - } - } - } else if !rl.CheckCollisionPointRec(mousePoint, labelBoxBound.ToFloat32()) { - buttonSide = 0 - } - - if rl.IsMouseButtonUp(rl.MouseLeftButton) { - valueSpeed = false - framesCounter = 0 - } - - // Draw control - switch state { - case Normal: - rl.DrawRectangle(leftButtonBound.X, leftButtonBound.Y, leftButtonBound.Width, leftButtonBound.Height, rl.GetColor(uint(style[SpinnerDefaultButtonBorderColor]))) - rl.DrawRectangle(leftButtonBound.X+2, leftButtonBound.Y+2, leftButtonBound.Width-4, leftButtonBound.Height-4, rl.GetColor(uint(style[SpinnerDefaultButtonInsideColor]))) - - rl.DrawRectangle(rightButtonBound.X, rightButtonBound.Y, rightButtonBound.Width, rightButtonBound.Height, rl.GetColor(uint(style[SpinnerDefaultButtonBorderColor]))) - rl.DrawRectangle(rightButtonBound.X+2, rightButtonBound.Y+2, rightButtonBound.Width-4, rightButtonBound.Height-4, rl.GetColor(uint(style[SpinnerDefaultButtonInsideColor]))) - - rl.DrawText("-", leftButtonBound.X+(leftButtonBound.Width/2-(rl.MeasureText("+", textHeight))/2), leftButtonBound.Y+(leftButtonBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerDefaultSymbolColor]))) - rl.DrawText("+", rightButtonBound.X+(rightButtonBound.Width/2-(rl.MeasureText("-", textHeight))/2), rightButtonBound.Y+(rightButtonBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerDefaultSymbolColor]))) - - rl.DrawRectangle(labelBoxBound.X, labelBoxBound.Y, labelBoxBound.Width, labelBoxBound.Height, rl.GetColor(uint(style[SpinnerLabelBorderColor]))) - rl.DrawRectangle(labelBoxBound.X+1, labelBoxBound.Y+1, labelBoxBound.Width-2, labelBoxBound.Height-2, rl.GetColor(uint(style[SpinnerLabelInsideColor]))) - - rl.DrawText(fmt.Sprintf("%d", value), labelBoxBound.X+(labelBoxBound.Width/2-textWidth/2), labelBoxBound.Y+(labelBoxBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerDefaultTextColor]))) - break - case Focused: - if buttonSide == 1 { - rl.DrawRectangle(leftButtonBound.X, leftButtonBound.Y, leftButtonBound.Width, leftButtonBound.Height, rl.GetColor(uint(style[SpinnerHoverButtonBorderColor]))) - rl.DrawRectangle(leftButtonBound.X+2, leftButtonBound.Y+2, leftButtonBound.Width-4, leftButtonBound.Height-4, rl.GetColor(uint(style[SpinnerHoverButtonInsideColor]))) - - rl.DrawRectangle(rightButtonBound.X, rightButtonBound.Y, rightButtonBound.Width, rightButtonBound.Height, rl.GetColor(uint(style[SpinnerDefaultButtonBorderColor]))) - rl.DrawRectangle(rightButtonBound.X+2, rightButtonBound.Y+2, rightButtonBound.Width-4, rightButtonBound.Height-4, rl.GetColor(uint(style[SpinnerDefaultButtonInsideColor]))) - - rl.DrawText("-", leftButtonBound.X+(leftButtonBound.Width/2-(rl.MeasureText("+", textHeight))/2), leftButtonBound.Y+(leftButtonBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerHoverSymbolColor]))) - rl.DrawText("+", rightButtonBound.X+(rightButtonBound.Width/2-(rl.MeasureText("-", textHeight))/2), rightButtonBound.Y+(rightButtonBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerDefaultSymbolColor]))) - } else if buttonSide == 2 { - rl.DrawRectangle(leftButtonBound.X, leftButtonBound.Y, leftButtonBound.Width, leftButtonBound.Height, rl.GetColor(uint(style[SpinnerDefaultButtonBorderColor]))) - rl.DrawRectangle(leftButtonBound.X+2, leftButtonBound.Y+2, leftButtonBound.Width-4, leftButtonBound.Height-4, rl.GetColor(uint(style[SpinnerDefaultButtonInsideColor]))) - - rl.DrawRectangle(rightButtonBound.X, rightButtonBound.Y, rightButtonBound.Width, rightButtonBound.Height, rl.GetColor(uint(style[SpinnerHoverButtonBorderColor]))) - rl.DrawRectangle(rightButtonBound.X+2, rightButtonBound.Y+2, rightButtonBound.Width-4, rightButtonBound.Height-4, rl.GetColor(uint(style[SpinnerHoverButtonInsideColor]))) - - rl.DrawText("-", leftButtonBound.X+(leftButtonBound.Width/2-(rl.MeasureText("+", textHeight))/2), leftButtonBound.Y+(leftButtonBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerDefaultSymbolColor]))) - rl.DrawText("+", rightButtonBound.X+(rightButtonBound.Width/2-(rl.MeasureText("-", textHeight))/2), rightButtonBound.Y+(rightButtonBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerHoverSymbolColor]))) - } - - rl.DrawRectangle(labelBoxBound.X, labelBoxBound.Y, labelBoxBound.Width, labelBoxBound.Height, rl.GetColor(uint(style[SpinnerLabelBorderColor]))) - rl.DrawRectangle(labelBoxBound.X+1, labelBoxBound.Y+1, labelBoxBound.Width-2, labelBoxBound.Height-2, rl.GetColor(uint(style[SpinnerLabelInsideColor]))) - - rl.DrawText(fmt.Sprintf("%d", value), labelBoxBound.X+(labelBoxBound.Width/2-textWidth/2), labelBoxBound.Y+(labelBoxBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerHoverTextColor]))) - break - case Pressed: - if buttonSide == 1 { - rl.DrawRectangle(leftButtonBound.X, leftButtonBound.Y, leftButtonBound.Width, leftButtonBound.Height, rl.GetColor(uint(style[SpinnerPressedButtonBorderColor]))) - rl.DrawRectangle(leftButtonBound.X+2, leftButtonBound.Y+2, leftButtonBound.Width-4, leftButtonBound.Height-4, rl.GetColor(uint(style[SpinnerPressedButtonInsideColor]))) - - rl.DrawRectangle(rightButtonBound.X, rightButtonBound.Y, rightButtonBound.Width, rightButtonBound.Height, rl.GetColor(uint(style[SpinnerDefaultButtonBorderColor]))) - rl.DrawRectangle(rightButtonBound.X+2, rightButtonBound.Y+2, rightButtonBound.Width-4, rightButtonBound.Height-4, rl.GetColor(uint(style[SpinnerDefaultButtonInsideColor]))) - - rl.DrawText("-", leftButtonBound.X+(leftButtonBound.Width/2-(rl.MeasureText("+", textHeight))/2), leftButtonBound.Y+(leftButtonBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerPressedSymbolColor]))) - rl.DrawText("+", rightButtonBound.X+(rightButtonBound.Width/2-(rl.MeasureText("-", textHeight))/2), rightButtonBound.Y+(rightButtonBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerDefaultSymbolColor]))) - } else if buttonSide == 2 { - rl.DrawRectangle(leftButtonBound.X, leftButtonBound.Y, leftButtonBound.Width, leftButtonBound.Height, rl.GetColor(uint(style[SpinnerDefaultButtonBorderColor]))) - rl.DrawRectangle(leftButtonBound.X+2, leftButtonBound.Y+2, leftButtonBound.Width-4, leftButtonBound.Height-4, rl.GetColor(uint(style[SpinnerDefaultButtonInsideColor]))) - - rl.DrawRectangle(rightButtonBound.X, rightButtonBound.Y, rightButtonBound.Width, rightButtonBound.Height, rl.GetColor(uint(style[SpinnerPressedButtonBorderColor]))) - rl.DrawRectangle(rightButtonBound.X+2, rightButtonBound.Y+2, rightButtonBound.Width-4, rightButtonBound.Height-4, rl.GetColor(uint(style[SpinnerPressedButtonInsideColor]))) - - rl.DrawText("-", leftButtonBound.X+(leftButtonBound.Width/2-(rl.MeasureText("+", textHeight))/2), leftButtonBound.Y+(leftButtonBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerDefaultSymbolColor]))) - rl.DrawText("+", rightButtonBound.X+(rightButtonBound.Width/2-(rl.MeasureText("-", textHeight))/2), rightButtonBound.Y+(rightButtonBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerPressedSymbolColor]))) - } - - rl.DrawRectangle(labelBoxBound.X, labelBoxBound.Y, labelBoxBound.Width, labelBoxBound.Height, rl.GetColor(uint(style[SpinnerLabelBorderColor]))) - rl.DrawRectangle(labelBoxBound.X+1, labelBoxBound.Y+1, labelBoxBound.Width-2, labelBoxBound.Height-2, rl.GetColor(uint(style[SpinnerLabelInsideColor]))) - - rl.DrawText(fmt.Sprintf("%d", value), labelBoxBound.X+(labelBoxBound.Width/2-textWidth/2), labelBoxBound.Y+(labelBoxBound.Height/2-(textHeight/2)), textHeight, rl.GetColor(uint(style[SpinnerPressedTextColor]))) - break - default: - break - } - - return value -} diff --git a/raygui/style.go b/raygui/style.go deleted file mode 100644 index 2a76b0a..0000000 --- a/raygui/style.go +++ /dev/null @@ -1,419 +0,0 @@ -// GUI element appearance can be dynamically configured through Property values, the set of which -// forms a theme called the Style. -package raygui - -import ( - "bufio" - "fmt" - "io/ioutil" - "strconv" - "strings" - - rl "github.com/gen2brain/raylib-go/raylib" -) - -// Property - GUI property -type Property int32 - -// GUI properties enumeration -const ( - GlobalBaseColor Property = iota - GlobalBorderColor - GlobalTextColor - GlobalTextFontsize - GlobalBorderWidth - GlobalBackgroundColor - GlobalLinesColor - LabelBorderWidth - LabelTextColor - LabelTextPadding - ButtonBorderWidth - ButtonTextPadding - ButtonDefaultBorderColor - ButtonDefaultInsideColor - ButtonDefaultTextColor - ButtonHoverBorderColor - ButtonHoverInsideColor - ButtonHoverTextColor - ButtonPressedBorderColor - ButtonPressedInsideColor - ButtonPressedTextColor - ToggleTextPadding - ToggleBorderWidth - ToggleDefaultBorderColor - ToggleDefaultInsideColor - ToggleDefaultTextColor - ToggleHoverBorderColor - ToggleHoverInsideColor - ToggleHoverTextColor - TogglePressedBorderColor - TogglePressedInsideColor - TogglePressedTextColor - ToggleActiveBorderColor - ToggleActiveInsideColor - ToggleActiveTextColor - TogglegroupPadding - SliderBorderWidth - SliderButtonBorderWidth - SliderBorderColor - SliderInsideColor - SliderDefaultColor - SliderHoverColor - SliderActiveColor - SliderbarBorderColor - SliderbarInsideColor - SliderbarDefaultColor - SliderbarHoverColor - SliderbarActiveColor - SliderbarZeroLineColor - ProgressbarBorderColor - ProgressbarInsideColor - ProgressbarProgressColor - ProgressbarBorderWidth - SpinnerLabelBorderColor - SpinnerLabelInsideColor - SpinnerDefaultButtonBorderColor - SpinnerDefaultButtonInsideColor - SpinnerDefaultSymbolColor - SpinnerDefaultTextColor - SpinnerHoverButtonBorderColor - SpinnerHoverButtonInsideColor - SpinnerHoverSymbolColor - SpinnerHoverTextColor - SpinnerPressedButtonBorderColor - SpinnerPressedButtonInsideColor - SpinnerPressedSymbolColor - SpinnerPressedTextColor - ComboboxPadding - boundsWidth - boundsHeight - ComboboxBorderWidth - ComboboxDefaultBorderColor - ComboboxDefaultInsideColor - ComboboxDefaultTextColor - ComboboxDefaultListTextColor - ComboboxHoverBorderColor - ComboboxHoverInsideColor - ComboboxHoverTextColor - ComboboxHoverListTextColor - ComboboxPressedBorderColor - ComboboxPressedInsideColor - ComboboxPressedTextColor - ComboboxPressedListBorderColor - ComboboxPressedListInsideColor - ComboboxPressedListTextColor - CheckboxDefaultBorderColor - CheckboxDefaultInsideColor - CheckboxHoverBorderColor - CheckboxHoverInsideColor - CheckboxClickBorderColor - CheckboxClickInsideColor - CheckboxDefaultActiveColor - CheckboxInsideWidth - TextboxBorderWidth - TextboxBorderColor - TextboxInsideColor - TextboxTextColor - TextboxLineColor - TextboxTextFontsize - - // Add new properties above. - NumProperties -) - -// GUI property names (to read/write style text files) -var propertyName = [NumProperties]string{ - "GLOBAL_BASE_COLOR", - "GLOBAL_BORDER_COLOR", - "GLOBAL_TEXT_COLOR", - "GLOBAL_TEXT_FONTSIZE", - "GLOBAL_BORDER_WIDTH", - "BACKGROUND_COLOR", - "LINES_COLOR", - "LABEL_BORDER_WIDTH", - "LABEL_TEXT_COLOR", - "LABEL_TEXT_PADDING", - "BUTTON_BORDER_WIDTH", - "BUTTON_TEXT_PADDING", - "BUTTON_DEFAULT_BORDER_COLOR", - "BUTTON_DEFAULT_INSIDE_COLOR", - "BUTTON_DEFAULT_TEXT_COLOR", - "BUTTON_HOVER_BORDER_COLOR", - "BUTTON_HOVER_INSIDE_COLOR", - "BUTTON_HOVER_TEXT_COLOR", - "BUTTON_PRESSED_BORDER_COLOR", - "BUTTON_PRESSED_INSIDE_COLOR", - "BUTTON_PRESSED_TEXT_COLOR", - "TOGGLE_TEXT_PADDING", - "TOGGLE_BORDER_WIDTH", - "TOGGLE_DEFAULT_BORDER_COLOR", - "TOGGLE_DEFAULT_INSIDE_COLOR", - "TOGGLE_DEFAULT_TEXT_COLOR", - "TOGGLE_HOVER_BORDER_COLOR", - "TOGGLE_HOVER_INSIDE_COLOR", - "TOGGLE_HOVER_TEXT_COLOR", - "TOGGLE_PRESSED_BORDER_COLOR", - "TOGGLE_PRESSED_INSIDE_COLOR", - "TOGGLE_PRESSED_TEXT_COLOR", - "TOGGLE_ACTIVE_BORDER_COLOR", - "TOGGLE_ACTIVE_INSIDE_COLOR", - "TOGGLE_ACTIVE_TEXT_COLOR", - "TOGGLEGROUP_PADDING", - "SLIDER_BORDER_WIDTH", - "SLIDER_BUTTON_BORDER_WIDTH", - "SLIDER_BORDER_COLOR", - "SLIDER_INSIDE_COLOR", - "SLIDER_DEFAULT_COLOR", - "SLIDER_HOVER_COLOR", - "SLIDER_ACTIVE_COLOR", - "SLIDERBAR_BORDER_COLOR", - "SLIDERBAR_INSIDE_COLOR", - "SLIDERBAR_DEFAULT_COLOR", - "SLIDERBAR_HOVER_COLOR", - "SLIDERBAR_ACTIVE_COLOR", - "SLIDERBAR_ZERO_LINE_COLOR", - "PROGRESSBAR_BORDER_COLOR", - "PROGRESSBAR_INSIDE_COLOR", - "PROGRESSBAR_PROGRESS_COLOR", - "PROGRESSBAR_BORDER_WIDTH", - "SPINNER_LABEL_BORDER_COLOR", - "SPINNER_LABEL_INSIDE_COLOR", - "SPINNER_DEFAULT_BUTTON_BORDER_COLOR", - "SPINNER_DEFAULT_BUTTON_INSIDE_COLOR", - "SPINNER_DEFAULT_SYMBOL_COLOR", - "SPINNER_DEFAULT_TEXT_COLOR", - "SPINNER_HOVER_BUTTON_BORDER_COLOR", - "SPINNER_HOVER_BUTTON_INSIDE_COLOR", - "SPINNER_HOVER_SYMBOL_COLOR", - "SPINNER_HOVER_TEXT_COLOR", - "SPINNER_PRESSED_BUTTON_BORDER_COLOR", - "SPINNER_PRESSED_BUTTON_INSIDE_COLOR", - "SPINNER_PRESSED_SYMBOL_COLOR", - "SPINNER_PRESSED_TEXT_COLOR", - "COMBOBOX_PADDING", - "COMBOBOX_BUTTON_WIDTH", - "COMBOBOX_BUTTON_HEIGHT", - "COMBOBOX_BORDER_WIDTH", - "COMBOBOX_DEFAULT_BORDER_COLOR", - "COMBOBOX_DEFAULT_INSIDE_COLOR", - "COMBOBOX_DEFAULT_TEXT_COLOR", - "COMBOBOX_DEFAULT_LIST_TEXT_COLOR", - "COMBOBOX_HOVER_BORDER_COLOR", - "COMBOBOX_HOVER_INSIDE_COLOR", - "COMBOBOX_HOVER_TEXT_COLOR", - "COMBOBOX_HOVER_LIST_TEXT_COLOR", - "COMBOBOX_PRESSED_BORDER_COLOR", - "COMBOBOX_PRESSED_INSIDE_COLOR", - "COMBOBOX_PRESSED_TEXT_COLOR", - "COMBOBOX_PRESSED_LIST_BORDER_COLOR", - "COMBOBOX_PRESSED_LIST_INSIDE_COLOR", - "COMBOBOX_PRESSED_LIST_TEXT_COLOR", - "CHECKBOX_DEFAULT_BORDER_COLOR", - "CHECKBOX_DEFAULT_INSIDE_COLOR", - "CHECKBOX_HOVER_BORDER_COLOR", - "CHECKBOX_HOVER_INSIDE_COLOR", - "CHECKBOX_CLICK_BORDER_COLOR", - "CHECKBOX_CLICK_INSIDE_COLOR", - "CHECKBOX_STATUS_ACTIVE_COLOR", - "CHECKBOX_INSIDE_WIDTH", - "TEXTBOX_BORDER_WIDTH", - "TEXTBOX_BORDER_COLOR", - "TEXTBOX_INSIDE_COLOR", - "TEXTBOX_TEXT_COLOR", - "TEXTBOX_LINE_COLOR", - "TEXTBOX_TEXT_FONTSIZE", -} - -// Current GUI style (default light). -var style = [NumProperties]int64{ - 0xf5f5f5ff, // GLOBAL_BASE_COLOR - 0xf5f5f5ff, // GLOBAL_BORDER_COLOR - 0xf5f5f5ff, // GLOBAL_TEXT_COLOR - 10, // GLOBAL_TEXT_FONTSIZE - 1, // GLOBAL_BORDER_WIDTH - 0xf5f5f5ff, // BACKGROUND_COLOR - 0x90abb5ff, // LINES_COLOR - 1, // LABEL_BORDER_WIDTH - 0x4d4d4dff, // LABEL_TEXT_COLOR - 20, // LABEL_TEXT_PADDING - 2, // BUTTON_BORDER_WIDTH - 20, // BUTTON_TEXT_PADDING - 0x828282ff, // BUTTON_DEFAULT_BORDER_COLOR - 0xc8c8c8ff, // BUTTON_DEFAULT_INSIDE_COLOR - 0x4d4d4dff, // BUTTON_DEFAULT_TEXT_COLOR - 0xc8c8c8ff, // BUTTON_HOVER_BORDER_COLOR - 0xffffffff, // BUTTON_HOVER_INSIDE_COLOR - 0x868686ff, // BUTTON_HOVER_TEXT_COLOR - 0x7bb0d6ff, // BUTTON_PRESSED_BORDER_COLOR - 0xbcecffff, // BUTTON_PRESSED_INSIDE_COLOR - 0x5f9aa7ff, // BUTTON_PRESSED_TEXT_COLOR - 20, // TOGGLE_TEXT_PADDING - 1, // TOGGLE_BORDER_WIDTH - 0x828282ff, // TOGGLE_DEFAULT_BORDER_COLOR - 0xc8c8c8ff, // TOGGLE_DEFAULT_INSIDE_COLOR - 0x828282ff, // TOGGLE_DEFAULT_TEXT_COLOR - 0xc8c8c8ff, // TOGGLE_HOVER_BORDER_COLOR - 0xffffffff, // TOGGLE_HOVER_INSIDE_COLOR - 0x828282ff, // TOGGLE_HOVER_TEXT_COLOR - 0xbdd7eaff, // TOGGLE_PRESSED_BORDER_COLOR - 0xddf5ffff, // TOGGLE_PRESSED_INSIDE_COLOR - 0xafccd3ff, // TOGGLE_PRESSED_TEXT_COLOR - 0x7bb0d6ff, // TOGGLE_ACTIVE_BORDER_COLOR - 0xbcecffff, // TOGGLE_ACTIVE_INSIDE_COLOR - 0x5f9aa7ff, // TOGGLE_ACTIVE_TEXT_COLOR - 3, // TOGGLEGROUP_PADDING - 1, // SLIDER_BORDER_WIDTH - 1, // SLIDER_BUTTON_BORDER_WIDTH - 0x828282ff, // SLIDER_BORDER_COLOR - 0xc8c8c8ff, // SLIDER_INSIDE_COLOR - 0xbcecffff, // SLIDER_DEFAULT_COLOR - 0xffffffff, // SLIDER_HOVER_COLOR - 0xddf5ffff, // SLIDER_ACTIVE_COLOR - 0x828282ff, // SLIDERBAR_BORDER_COLOR - 0xc8c8c8ff, // SLIDERBAR_INSIDE_COLOR - 0xbcecffff, // SLIDERBAR_DEFAULT_COLOR - 0xffffffff, // SLIDERBAR_HOVER_COLOR - 0xddf5ffff, // SLIDERBAR_ACTIVE_COLOR - 0x828282ff, // SLIDERBAR_ZERO_LINE_COLOR - 0x828282ff, // PROGRESSBAR_BORDER_COLOR - 0xc8c8c8ff, // PROGRESSBAR_INSIDE_COLOR - 0xbcecffff, // PROGRESSBAR_PROGRESS_COLOR - 2, // PROGRESSBAR_BORDER_WIDTH - 0x828282ff, // SPINNER_LABEL_BORDER_COLOR - 0xc8c8c8ff, // SPINNER_LABEL_INSIDE_COLOR - 0x828282ff, // SPINNER_DEFAULT_BUTTON_BORDER_COLOR - 0xc8c8c8ff, // SPINNER_DEFAULT_BUTTON_INSIDE_COLOR - 0x000000ff, // SPINNER_DEFAULT_SYMBOL_COLOR - 0x000000ff, // SPINNER_DEFAULT_TEXT_COLOR - 0xc8c8c8ff, // SPINNER_HOVER_BUTTON_BORDER_COLOR - 0xffffffff, // SPINNER_HOVER_BUTTON_INSIDE_COLOR - 0x000000ff, // SPINNER_HOVER_SYMBOL_COLOR - 0x000000ff, // SPINNER_HOVER_TEXT_COLOR - 0x7bb0d6ff, // SPINNER_PRESSED_BUTTON_BORDER_COLOR - 0xbcecffff, // SPINNER_PRESSED_BUTTON_INSIDE_COLOR - 0x5f9aa7ff, // SPINNER_PRESSED_SYMBOL_COLOR - 0x000000ff, // SPINNER_PRESSED_TEXT_COLOR - 1, // COMBOBOX_PADDING - 30, // COMBOBOX_BUTTON_WIDTH - 20, // COMBOBOX_BUTTON_HEIGHT - 1, // COMBOBOX_BORDER_WIDTH - 0x828282ff, // COMBOBOX_DEFAULT_BORDER_COLOR - 0xc8c8c8ff, // COMBOBOX_DEFAULT_INSIDE_COLOR - 0x828282ff, // COMBOBOX_DEFAULT_TEXT_COLOR - 0x828282ff, // COMBOBOX_DEFAULT_LIST_TEXT_COLOR - 0xc8c8c8ff, // COMBOBOX_HOVER_BORDER_COLOR - 0xffffffff, // COMBOBOX_HOVER_INSIDE_COLOR - 0x828282ff, // COMBOBOX_HOVER_TEXT_COLOR - 0x828282ff, // COMBOBOX_HOVER_LIST_TEXT_COLOR - 0x7bb0d6ff, // COMBOBOX_PRESSED_BORDER_COLOR - 0xbcecffff, // COMBOBOX_PRESSED_INSIDE_COLOR - 0x5f9aa7ff, // COMBOBOX_PRESSED_TEXT_COLOR - 0x0078acff, // COMBOBOX_PRESSED_LIST_BORDER_COLOR - 0x66e7ffff, // COMBOBOX_PRESSED_LIST_INSIDE_COLOR - 0x0078acff, // COMBOBOX_PRESSED_LIST_TEXT_COLOR - 0x828282ff, // CHECKBOX_DEFAULT_BORDER_COLOR - 0xffffffff, // CHECKBOX_DEFAULT_INSIDE_COLOR - 0xc8c8c8ff, // CHECKBOX_HOVER_BORDER_COLOR - 0xffffffff, // CHECKBOX_HOVER_INSIDE_COLOR - 0x66e7ffff, // CHECKBOX_CLICK_BORDER_COLOR - 0xddf5ffff, // CHECKBOX_CLICK_INSIDE_COLOR - 0xbcecffff, // CHECKBOX_STATUS_ACTIVE_COLOR - 1, // CHECKBOX_INSIDE_WIDTH - 1, // TEXTBOX_BORDER_WIDTH - 0x828282ff, // TEXTBOX_BORDER_COLOR - 0xf5f5f5ff, // TEXTBOX_INSIDE_COLOR - 0x000000ff, // TEXTBOX_TEXT_COLOR - 0x000000ff, // TEXTBOX_LINE_COLOR - 10, // TEXTBOX_TEXT_FONTSIZE -} - -// LoadGuiStyle will load a GUI style from a file. See SaveGuiStyle. -func LoadGuiStyle(fileName string) { - file, err := rl.OpenAsset(fileName) - if err != nil { - rl.TraceLog(rl.LogWarning, "[%s] GUI style file could not be opened: %w", fileName, err) - return - } - defer file.Close() - - var lines []string - scanner := bufio.NewScanner(file) - for scanner.Scan() { - lines = append(lines, scanner.Text()) - } - - for _, line := range lines { - fields := strings.Fields(line) - if len(fields) != 2 { - continue - } - - id := fields[0] - value := fields[1] - - for i := 0; i < len(propertyName); i++ { - if id == propertyName[i] { - if strings.HasPrefix(value, "0x") { - value = value[2:] - } - - v, err := strconv.ParseInt(value, 16, 64) - if err == nil { - style[i] = int64(v) - } - } - } - } -} - -// SaveGuiStyle will write the current GUI style to a file in a format suitable for loading via LoadGuiStyle. -func SaveGuiStyle(fileName string) { - var styleFile string - for i := 0; i < len(propertyName); i++ { - styleFile += fmt.Sprintf("%-40s0x%x\n", propertyName[i], GetStyleProperty(Property(i))) - } - - if err := ioutil.WriteFile(fileName, []byte(styleFile), 0644); err != nil { - rl.TraceLog(rl.LogWarning, "[%s] GUI style file could not be written: %w", fileName, err) - } -} - -// SetStyleProperty - Set one style property -func SetStyleProperty(guiProperty Property, value int64) { - style[guiProperty] = value -} - -// SetStyleColor - Set one style property to a color value -func SetStyleColor(guiProperty Property, value rl.Color) { - style[guiProperty] = int64(rl.ColorToInt(value)) -} - -// GetStyleProperty - Get one style property -func GetStyleProperty(guiProperty Property) int64 { - return style[int(guiProperty)] -} - -// BackgroundColor will return the current background color -func BackgroundColor() rl.Color { - return rl.GetColor(uint(style[GlobalBackgroundColor])) -} - -// LinesColor will return the current color for lines -func LinesColor() rl.Color { - return rl.GetColor(uint(style[GlobalLinesColor])) -} - -// TextColor will return the current color for normal state -func TextColor() rl.Color { - return rl.GetColor(uint(style[GlobalTextColor])) -} - -// GetStyle32 will return the int32 for a given property of the current style -func GetStyle32(property Property) int32 { - return int32(style[property]) -} - -// GetPropColor will return the Color value for a given property of the current style -func GetStyleColor(property Property) rl.Color { - return rl.GetColor(uint(style[property])) -} diff --git a/raygui/textbox.go b/raygui/textbox.go deleted file mode 100644 index 69b9dd4..0000000 --- a/raygui/textbox.go +++ /dev/null @@ -1,64 +0,0 @@ -package raygui - -import ( - "fmt" - "time" - - rl "github.com/gen2brain/raylib-go/raylib" -) - -var backspaceHeld = false -var nextBackspace = time.Now() - -// BackspaceRepeatDelay controls the time backspace must be held down before it will repeat. -var BackspaceRepeatDelay = 300 * time.Millisecond - -// BackspaceRepeatInterval controls how frequently backspace registers after the initial delay. -var BackspaceRepeatInterval = 60 * time.Millisecond - -// TextBox - Text Box element, updates input text -func TextBox(bounds rl.Rectangle, text string) string { - b := bounds.ToInt32() - - letter := int32(-1) - - // Update control - state := GetInteractionState(bounds) - borderColor := TextboxBorderColor - if state == Pressed || state == Focused { - borderColor = ToggleActiveBorderColor - - framesCounter2++ - letter = rl.GetKeyPressed() - if letter != -1 { - if letter >= 32 && letter < 127 { - text = fmt.Sprintf("%s%c", text, letter) - } - } - - backspacing := rl.IsKeyPressed(rl.KeyBackspace) - if backspacing { - nextBackspace = time.Now().Add(BackspaceRepeatDelay) - } else if rl.IsKeyDown(rl.KeyBackspace) { - backspacing = time.Since(nextBackspace) >= 0 - if backspacing { - nextBackspace = time.Now().Add(BackspaceRepeatInterval) - } - } - if backspacing && len(text) > 0 { - text = text[:len(text)-1] - } - } - - DrawBorderedRectangle(b, GetStyle32(TextboxBorderWidth), GetStyleColor(borderColor), GetStyleColor(TextboxInsideColor)) - rl.DrawText(text, b.X+2, b.Y+int32(style[TextboxBorderWidth])+b.Height/2-int32(style[TextboxTextFontsize])/2, int32(style[TextboxTextFontsize]), GetStyleColor(TextboxTextColor)) - - if state == Focused || state == Pressed { - // Draw a cursor, when focused. - if (framesCounter2/20)%2 == 0 { - rl.DrawRectangle(b.X+4+rl.MeasureText(text, int32(style[GlobalTextFontsize])), b.Y+2, 1, b.Height-4, rl.GetColor(uint(style[TextboxLineColor]))) - } - } - - return text -} diff --git a/raygui/togglebutton.go b/raygui/togglebutton.go deleted file mode 100644 index 3848b62..0000000 --- a/raygui/togglebutton.go +++ /dev/null @@ -1,48 +0,0 @@ -package raygui - -import "github.com/gen2brain/raylib-go/raylib" - -// togglebuttonColoring describes the per-state colors for a ToggleBox control. -type togglebuttonColoring struct { - Border, Inside, Text Property -} - -// togglebuttonColors lists the styling for each supported state. -var togglebuttonColors = map[ControlState]togglebuttonColoring{ - Normal: {ToggleDefaultBorderColor, ToggleDefaultInsideColor, ToggleDefaultTextColor}, - // Hijacking 'Clicked' for the 'active' state. - Clicked: {ToggleActiveBorderColor, ToggleActiveInsideColor, ToggleDefaultTextColor}, - Pressed: {TogglePressedBorderColor, TogglePressedInsideColor, TogglePressedTextColor}, - Focused: {ToggleHoverBorderColor, ToggleHoverInsideColor, ToggleHoverTextColor}, -} - -// ToggleButton - Toggle Button element, returns true when active -func ToggleButton(bounds rl.Rectangle, text string, active bool) bool { - textHeight := int32(style[GlobalTextFontsize]) - textWidth := rl.MeasureText(text, textHeight) - - ConstrainRectangle(&bounds, textWidth, textWidth+GetStyle32(ToggleTextPadding), textHeight, textHeight+GetStyle32(ToggleTextPadding)) - - state := GetInteractionState(bounds) - if state == Clicked { - active = !active - state = Normal - } - - // Hijack 'Clicked' as the 'active' state - if state == Normal && active { - state = Clicked - } - - colors, exists := togglebuttonColors[state] - if !exists { - return active - } - - // Draw control - b := bounds.ToInt32() - DrawBorderedRectangle(b, GetStyle32(ToggleBorderWidth), GetStyleColor(colors.Border), GetStyleColor(colors.Inside)) - rl.DrawText(text, b.X+((b.Width/2)-(rl.MeasureText(text, textHeight)/2)), b.Y+((b.Height/2)-(textHeight/2)), textHeight, GetStyleColor(colors.Text)) - - return active -} diff --git a/raygui/togglegroup.go b/raygui/togglegroup.go deleted file mode 100644 index 33ccaa1..0000000 --- a/raygui/togglegroup.go +++ /dev/null @@ -1,17 +0,0 @@ -package raygui - -import "github.com/gen2brain/raylib-go/raylib" - -// ToggleGroup - Toggle Group element, returns toggled button index -func ToggleGroup(bounds rl.Rectangle, toggleText []string, active int) int { - padding := float32(style[TogglegroupPadding]) - for i := 0; i < len(toggleText); i++ { - if i == active { - ToggleButton(rl.NewRectangle(bounds.X+float32(i)*(bounds.Width+padding), bounds.Y, bounds.Width, bounds.Height), toggleText[i], true) - } else if ToggleButton(rl.NewRectangle(bounds.X+float32(i)*(bounds.Width+padding), bounds.Y, bounds.Width, bounds.Height), toggleText[i], false) { - active = i - } - } - - return active -}