Custom raygui bindings
This commit is contained in:
parent
655df25616
commit
4396f1d624
6 changed files with 888 additions and 476 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,17 +0,0 @@
|
|||
## raygui history
|
||||
|
||||
raygui development started on December 2014 by two internship students (Kevin and Daniel) guided by me, objective was creating a simple and easy-to-use immediate-mode-gui module for raylib, intended for tools development. On June 2015, library was mostly functional (including basic controls) and we started working in the styling posibilities for the library, focusing on an easy way to style controls properties. Consequently, development of [rGuiStyler](https://raylibtech.itch.io/rguistyler) also started at that point... but resources were quite limited and project was stopped for several months, most of the time was invested in [raylib](https://github.com/raysan5/raylib) development.
|
||||
|
||||
On June 2016, project was picked up again and raygui 1.0 was released by the end of that month. During August 2016, raygui was used to develop [rFXGen](https://github.com/raysan5/rfxgen) and also an early protoype of [rGuiLayout](https://raylibtech.itch.io/rguilayout), those tools were a testbed for the library. By the end of 2016, raygui project development was stopped again for several months.
|
||||
|
||||
On June 2017, a complete redesign of the library started, almost from scratch, all functions were reviewed and mostly rewritten and a brand new styling system was developed. The objective was using raygui professionally in several tools. It was the beginning of raygui 2.0.
|
||||
|
||||
On January 2018, two students (Adria and Jordi) started working on raygui and related tools; library evolved considerably in the following months. [rGuiStyler](https://raylibtech.itch.io/rguistyler) was completely redesigned and rewritten from scratch (rGuiStyler v2.0). [rGuiLayout](https://raylibtech.itch.io/rguilayout) turned from a protoype into a professional software and raygui reached version 2.0 with plenty of new controls and features.
|
||||
|
||||
On July 2018, I started working full time on raygui and its tools, improving the library considerably. On October 2018 [Sergio](https://github.com/anidealgift) joined the project and focused efforts on [rGuiLayout](https://raylibtech.itch.io/rguilayout) tool redesign. We reached 2019 with continuous improvement and redesigns of mostly all raygui functions along rGuiLayout 2.0 and rGuiStyler 3.0.
|
||||
|
||||
On March 2019, the first set of new raygui tools was published: [rFXGen 2.0](https://raylibtech.itch.io/rfxgen), [rTexViewer 1.0](https://raylibtech.itch.io/rtexviewer) and [rIconPacker 1.0](https://raylibtech.itch.io/riconpacker).
|
||||
|
||||
From March 2019 to June 2019 raygui development decelerated, Sergio left the project and efforts were focused on raylib 2.5, during this time one external contributor, [Vlad Adrian](https://github.com/Demizdor), completely redesigned `GuiTextBox()` and related controls and version was bumped to raygui 2.5.
|
||||
|
||||
During summer 2019 lots of raygui functions were reviewed, breaking compatibility to any previous version and pointing to a **raygui 2.6** update.
|
||||
10
src/libraries/raylib/raygui/bindgen.sh
Executable file
10
src/libraries/raylib/raygui/bindgen.sh
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
# Currently not cross compiling for windows and darwin
|
||||
set -euo pipefail
|
||||
|
||||
# This is supposed to use Karl Zylinski's odin-c-bindgen
|
||||
# https://github.com/karl-zylinski/odin-c-bindgen
|
||||
odin-c-bindgen bindgen.sjson
|
||||
rm -f ../raygui.odin
|
||||
cp bindgen_output/raygui.odin ../
|
||||
rm -r bindgen_output
|
||||
18
src/libraries/raylib/raygui/bindgen.sjson
Normal file
18
src/libraries/raylib/raygui/bindgen.sjson
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
inputs = [
|
||||
"raygui.h"
|
||||
]
|
||||
|
||||
imports_file = "imports.txt"
|
||||
|
||||
output_folder = "bindgen_output"
|
||||
|
||||
package_name = "raylib"
|
||||
|
||||
clang_include_paths = [
|
||||
"../raylib/src"
|
||||
]
|
||||
|
||||
procedure_type_overrides = {
|
||||
"GuiSetStyle.control" = "GuiControl"
|
||||
"GuiGetStyle.control" = "GuiControl"
|
||||
}
|
||||
28
src/libraries/raylib/raygui/imports.txt
Normal file
28
src/libraries/raylib/raygui/imports.txt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
RAYGUI_SHARED :: #config(RAYGUI_SHARED, false)
|
||||
RAYGUI_WASM_LIB :: #config(RAYGUI_WASM_LIB, "wasm/libraygui.a")
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib {
|
||||
"windows/rayguidll.lib" when RAYGUI_SHARED else "windows/raygui.lib",
|
||||
}
|
||||
} else when ODIN_OS == .Linux {
|
||||
foreign import lib {
|
||||
"linux/libraygui.so" when RAYGUI_SHARED else "linux/libraygui.a",
|
||||
}
|
||||
} else when ODIN_OS == .Darwin {
|
||||
when ODIN_ARCH == .arm64 {
|
||||
foreign import lib {
|
||||
"macos/libraygui-arm64.dylib" when RAYGUI_SHARED else "macos/libraygui-arm64.a",
|
||||
}
|
||||
} else {
|
||||
foreign import lib {
|
||||
"macos/libraygui.dylib" when RAYGUI_SHARED else "macos/libraygui.a",
|
||||
}
|
||||
}
|
||||
} else when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
foreign import lib {
|
||||
RAYGUI_WASM_LIB,
|
||||
}
|
||||
} else {
|
||||
foreign import lib "system:raygui"
|
||||
}
|
||||
|
|
@ -1585,8 +1585,6 @@ static void UnloadCodepoints(int *codepoints); // -- GuiLoadStyle(
|
|||
static unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // -- GuiLoadStyle()
|
||||
|
||||
static Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
|
||||
|
||||
static void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint)
|
||||
//-------------------------------------------------------------------------------
|
||||
|
||||
// raylib functions already implemented in raygui
|
||||
|
|
@ -3348,7 +3346,19 @@ int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float
|
|||
{
|
||||
if (GuiGetTextWidth(textValue) < bounds.width)
|
||||
{
|
||||
int key = GUI_INPUT_KEY;
|
||||
int key = 0;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (GUI_KEY_PRESSED(KEY_ZERO + i)) {
|
||||
key = KEY_ZERO + i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (key == 0 && GUI_KEY_PRESSED(KEY_MINUS)) {
|
||||
key = '-';
|
||||
}
|
||||
if (key == 0 && GUI_KEY_PRESSED(KEY_PERIOD)) {
|
||||
key = '.';
|
||||
}
|
||||
if (((key >= 48) && (key <= 57)) ||
|
||||
(key == '.') ||
|
||||
((keyCount == 0) && (key == '+')) || // NOTE: Sign can only be in first position
|
||||
|
|
@ -5807,7 +5817,6 @@ static void GuiTooltip(Rectangle controlRec)
|
|||
{
|
||||
if (!guiLocked && guiTooltip && (guiTooltipPtr != NULL) && !guiControlExclusiveMode)
|
||||
{
|
||||
// TODO: Remove MeasureTextEx(), implement logic directly or add custom GuiMeasureText()
|
||||
Vector2 textSize = MeasureTextEx(guiFont, guiTooltipPtr, (float)GuiGetStyle(DEFAULT, TEXT_SIZE),
|
||||
(float)GuiGetStyle(DEFAULT, TEXT_SPACING));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue