Adding support for raygui (#95)

* updated build.zig and generate_functions.py to add raygui

* added raygui.h and manually coded some structs & enums in raygui prelude WIP

* ported all the structs, enums and globals to zig till raygui implementation

* imported types from raylib in raygui

* re-encoded raygui-prelude.zig. I don't know for some reason it was showing up as UTF-16 unicode text file. re-encoded it to UTF-8

* fixed imports in prelude to work properly with generated files

* updated generate_functions.py file to generate for raygui [text type error not fixed]

* simple temporary patch for mentioned text type issue

* removed unused imports from raylib in raygui

* added generated files

* Manually define raygui functions for slice arguments

* Manually define raygui functions with pointer return values

---------

Co-authored-by: Not-Nik <nik.wipper@gmx.de>
This commit is contained in:
Mohanavel S K 2024-05-31 22:54:05 +05:30 committed by GitHub
parent 39909cdcb3
commit efb7b736db
Failed to generate hash of commit
7 changed files with 6874 additions and 2 deletions

View file

@ -25,6 +25,8 @@ IGNORE_TYPES = [
"[*c]Color",
"[*c]GlyphInfo",
"[*c]c_int",
"[*c]c_uint",
"[*c][*c]u8",
"[*c][*c]const u8",
"[*c]Material",
"[*c]ModelAnimation",
@ -53,7 +55,8 @@ def ziggify_type(name: str, t: str) -> str:
"position", "mesh", "materialCount", "material", "model", "animCount",
"wave", "v1", "v2", "outAxis", "outAngle", "fileSize",
"AutomationEventList", "list", "batch", "glInternalFormat", "glFormat",
"glType", "mipmaps"
"glType", "mipmaps", "active", "scroll", "view", "checked", "mouseCell",
"scrollIndex", "focus", "secretViewActive", "color", "alpha", "colorHsv"
]
multi = [
"data", "compData", "points", "fileData", "colors", "pixels",
@ -62,10 +65,13 @@ def ziggify_type(name: str, t: str) -> str:
"LoadFontData", "LoadCodepoints", "TextSplit", "LoadMaterials",
"LoadModelAnimations", "LoadWaveSamples", "images",
"LoadRandomSequence", "sequence", "kernel", "GlyphInfo", "glyphs", "glyphRecs",
"matf", "rlGetShaderLocsDefault", "locs"
"matf", "rlGetShaderLocsDefault", "locs", "GuiGetIcons", "GuiLoadIcons"
]
string = False
if name == "text" and t == "[*c][*c]const u8":
return "[][:0]const u8"
if t.startswith("[*c]") and name not in single and name not in multi:
if (t == "[*c]const u8" or t == "[*c]u8") and name not in NO_STRINGS: # Strings are multis.
string = True
@ -303,6 +309,8 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
"DrawTriangleFan",
"DrawTriangleStrip",
"DrawTriangleStrip3D",
"GuiTabBar",
"GuiListViewEx"
]
if func_name in manual or "FromMemory" in func_name:
@ -358,3 +366,12 @@ if __name__ == "__main__":
"preludes/rlgl-ext-prelude.zig",
"#if defined(RLGL_IMPLEMENTATION)\n"
)
parse_header(
"raygui.h",
"raygui.zig",
"raygui-ext.zig",
"RAYGUIAPI ",
"preludes/raygui-prelude.zig",
"preludes/raygui-ext-prelude.zig",
"#if defined(RAYGUI_IMPLEMENTATION)\n"
)