From b893cd4dbf243b53a004c9c080e3aaa965526f60 Mon Sep 17 00:00:00 2001 From: pedro-bento Date: Thu, 22 Oct 2026 19:49:43 +0100 Subject: [PATCH] Add raylib --- .forgejo/scripts/freebsd-build.sh | 21 +- .forgejo/workflows/apple.yml | 49 +- .forgejo/workflows/release.yml | 25 +- .gitignore | 5 +- .gitmodules | 3 + .luarc.json | 6 + Makefile | 259 +- README.md | 145 +- build.bat | 66 +- gen-hate-no-d.lua | 1185 +++ hate-no-d.lua | 11140 ++++++++++++++++++++++++++++ submodules/raylib | 1 + 12 files changed, 12718 insertions(+), 187 deletions(-) create mode 100644 .luarc.json create mode 100644 gen-hate-no-d.lua create mode 100644 hate-no-d.lua create mode 160000 submodules/raylib diff --git a/.forgejo/scripts/freebsd-build.sh b/.forgejo/scripts/freebsd-build.sh index 690395d..92ec772 100644 --- a/.forgejo/scripts/freebsd-build.sh +++ b/.forgejo/scripts/freebsd-build.sh @@ -1,11 +1,8 @@ #!/bin/sh -# Build hate-no-d inside a FreeBSD VM and copy the binary and the static -# library back. +# Build hate-no-d inside a FreeBSD VM and copy the binary back. # # freebsd-build.sh [source-dir] # -# The archive lands next to as libhate-no-d.a. -# # Needs qemu-system-x86, cloud-image-utils, openssh-client, xz and curl, plus # /dev/kvm (act_runner: options: "--device /dev/kvm"); under TCG the boot takes # many minutes. The guest runs with -snapshot, so nothing persists. @@ -24,9 +21,6 @@ fi OUT_DIR=$(dirname "$1") mkdir -p "$OUT_DIR" OUT=$(cd "$OUT_DIR" && pwd)/$(basename "$1") -# Absolute: the script cd's into $WORK below, so a relative path would land there -# instead of next to $OUT. -LIB_OUT=$(dirname "$OUT")/libhate-no-d.a SRC=$(cd "${2:-.}" && pwd) WORK="${FBSD_WORK:-${TMPDIR:-/tmp}/fbsd-ci}" @@ -116,12 +110,12 @@ log "guest up after ~$((i * 2))s: $(ssh_vm 'uname -sr')" # --- build ------------------------------------------------------------------- log "installing gmake in guest" -ssh_vm 'set -e; env ASSUME_ALWAYS_YES=yes pkg install -y gmake >/dev/null 2>&1; gmake --version | head -1' +ssh_vm 'set -e; env ASSUME_ALWAYS_YES=yes pkg install -y gmake luajit >/dev/null 2>&1; gmake --version | head -1' log "transferring source" tar czf "$WORK/src.tar.gz" -C "$SRC" \ - --exclude=.git --exclude=.build --exclude=hate-no-d \ - --exclude='*.o' --exclude='*.a' --exclude='*.so' . + --exclude=.git --exclude=.build --exclude=build --exclude=hate-no-d \ + --exclude=hate-no-d.lua --exclude='*.o' --exclude='*.a' --exclude='*.so' . scp $SCP_OPTS "$WORK/src.tar.gz" "root@127.0.0.1:/root/src.tar.gz" # FreeBSD has no gcc: CC must be on the command line to reach the sub-make. @@ -131,11 +125,10 @@ ssh_vm 'set -e tar xzf /root/src.tar.gz -C /root/src cd /root/src gmake CC=cc clean >/dev/null 2>&1 || true - gmake CC=cc all lib' + gmake CC=cc all' -log "fetching artifacts" +log "fetching artifact" scp $SCP_OPTS "root@127.0.0.1:/root/src/hate-no-d" "$OUT" -scp $SCP_OPTS "root@127.0.0.1:/root/src/libhate-no-d.a" "$LIB_OUT" +scp $SCP_OPTS "root@127.0.0.1:/root/src/hate-no-d.lua" "$OUT_DIR/hate-no-d.lua" log "built $OUT ($(wc -c < "$OUT") bytes)" -log "built $LIB_OUT ($(wc -c < "$LIB_OUT") bytes)" diff --git a/.forgejo/workflows/apple.yml b/.forgejo/workflows/apple.yml index b506f82..16419ca 100644 --- a/.forgejo/workflows/apple.yml +++ b/.forgejo/workflows/apple.yml @@ -1,7 +1,7 @@ -# Apple targets (macOS + iOS), kept out of release.yml: they need a `macos` -# runner. Gating them there with `if: vars.*` does not work -- Forgejo does not -# evaluate `vars` in `if:`, so the jobs queued forever and the run never -# finished. Manual dispatch only, until a Mac runner exists. +# macOS, kept out of release.yml: it needs a `macos` runner. Gating it there +# with `if: vars.*` does not work -- Forgejo does not evaluate `vars` in `if:`, +# so the job queued forever and the run never finished. Manual dispatch only, +# until a Mac runner exists. name: apple on: @@ -40,12 +40,15 @@ jobs: - name: Fetch submodules run: git submodule update --init --recursive + - name: Install LuaJIT + run: brew install luajit + - name: Build run: | make \ CFLAGS="-O2 -Wall -arch ${{ matrix.arch }}" \ LUAJIT_EXTRA="TARGET_FLAGS=-arch ${{ matrix.arch }}" \ - all lib + all - name: Verify architecture run: | @@ -56,42 +59,8 @@ jobs: - name: Package run: | sh .forgejo/scripts/make-archive.sh "hate-no-d-macos-${{ matrix.arch }}" tar.gz \ - ./hate-no-d ./libhate-no-d.a + ./hate-no-d ./hate-no-d.lua - name: Attach to release if: github.event.inputs.tag != '' run: sh .forgejo/scripts/release-asset.sh "./hate-no-d-macos-${{ matrix.arch }}.tar.gz" - - # --------------------------------------------------------------------------- - # iOS. Builds only the archive (JIT compiled out) for an Xcode app target. - # --------------------------------------------------------------------------- - ios: - name: ios/arm64 - runs-on: macos - steps: - - name: Checkout - uses: https://data.forgejo.org/actions/checkout@v4 - with: - submodules: false - - - name: Fetch submodules - run: git submodule update --init --recursive - - - name: Build static library - run: make PLATFORM=iOS IOS_ARCH=arm64 all lib - - - name: Verify archive - run: | - set -eu - # libhate-no-d.a is what ships; it must be single-arch arm64 Mach-O. - lipo -info ./libhate-no-d.a - lipo -info ./libhate-no-d.a | grep -q arm64 - - - name: Package - # Only a static archive ships here: iOS forbids JIT, so libhate-no-d.a is - # the deliverable to link into an Xcode target. There is no binary. - run: sh .forgejo/scripts/make-archive.sh hate-no-d-ios-arm64 tar.gz ./libhate-no-d.a - - - name: Attach to release - if: github.event.inputs.tag != '' - run: sh .forgejo/scripts/release-asset.sh ./hate-no-d-ios-arm64.tar.gz diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 69a4fb2..1f1e369 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -7,7 +7,7 @@ # Windows), each unpacking to a directory of the same name holding the binary # plus LICENSE and README.md. Release attachments are a flat list with no # folders, so the archive is what groups a target's files together. -# macOS/iOS live in apple.yml; everything here builds on the Linux runner. +# macOS lives in apple.yml; everything here builds on the Linux runner. name: release on: @@ -87,10 +87,10 @@ jobs: fi apt-get update -qq apt-get install -y --no-install-recommends \ - make gcc libc6-dev binutils jq curl ca-certificates ${{ matrix.packages }} + make gcc libc6-dev binutils jq curl ca-certificates luajit ${{ matrix.packages }} - name: Build - run: make ${{ matrix.make_args }} all lib + run: make ${{ matrix.make_args }} all # A mis-set CC silently yields a host binary, so check the ELF machine. - name: Verify architecture @@ -100,7 +100,7 @@ jobs: echo "architecture ok: ${{ matrix.machine }}" - name: Package - run: sh .forgejo/scripts/make-archive.sh "hate-no-d-linux-${{ matrix.arch }}" tar.gz ./hate-no-d ./libhate-no-d.a + run: sh .forgejo/scripts/make-archive.sh "hate-no-d-linux-${{ matrix.arch }}" tar.gz ./hate-no-d ./hate-no-d.lua - name: Attach to release if: startsWith(github.ref, 'refs/tags/') @@ -134,7 +134,7 @@ jobs: set -eu apt-get update -qq apt-get install -y --no-install-recommends \ - make gcc libc6-dev binutils jq curl ca-certificates unzip \ + make gcc libc6-dev binutils jq curl ca-certificates unzip luajit \ gcc-multilib libc6-dev-i386 - name: Install NDK r27c @@ -155,15 +155,14 @@ jobs: make clean >/dev/null 2>&1 || true if [ "$abi" = armeabi-v7a ]; then make PLATFORM=Android ANDROID_NDK="$ANDROID_NDK" ANDROID_API="$ANDROID_API" \ - ANDROID_ABI="$abi" HOST_CC="gcc -m32" all lib + ANDROID_ABI="$abi" HOST_CC="gcc -m32" all else make PLATFORM=Android ANDROID_NDK="$ANDROID_NDK" ANDROID_API="$ANDROID_API" \ - ANDROID_ABI="$abi" HOST_CC=gcc all lib + ANDROID_ABI="$abi" HOST_CC=gcc all fi readelf -h ./hate-no-d | grep -F 'Machine:' | grep -E 'AArch64|ARM|X86-64' mkdir -p "dist/$abi" cp ./hate-no-d "dist/$abi/hate-no-d" - cp ./libhate-no-d.a "dist/$abi/libhate-no-d.a" done - name: Package @@ -171,7 +170,7 @@ jobs: set -eu for abi in arm64-v8a armeabi-v7a x86_64; do sh .forgejo/scripts/make-archive.sh "hate-no-d-android-$abi" tar.gz \ - "dist/$abi/hate-no-d" "dist/$abi/libhate-no-d.a" + "dist/$abi/hate-no-d" ./hate-no-d.lua done - name: Attach to release @@ -218,7 +217,7 @@ jobs: - name: Package run: | sh .forgejo/scripts/make-archive.sh hate-no-d-freebsd-x86_64 tar.gz \ - dist/hate-no-d dist/libhate-no-d.a + dist/hate-no-d ./hate-no-d.lua - name: Attach to release if: startsWith(github.ref, 'refs/tags/') @@ -259,10 +258,10 @@ jobs: set -eu apt-get update -qq apt-get install -y --no-install-recommends \ - make gcc libc6-dev gcc-multilib mingw-w64 jq zip + make gcc libc6-dev gcc-multilib mingw-w64 jq zip luajit - name: Build - run: make PLATFORM=Windows WIN_ARCH=${{ matrix.arch }} HOST_CC="${{ matrix.host_cc }}" all lib + run: make PLATFORM=Windows WIN_ARCH=${{ matrix.arch }} HOST_CC="${{ matrix.host_cc }}" all - name: Verify executable run: | @@ -277,7 +276,7 @@ jobs: - name: Package run: | sh .forgejo/scripts/make-archive.sh "hate-no-d-windows-${{ matrix.arch }}" zip \ - ./hate-no-d.exe ./libhate-no-d.a + ./hate-no-d.exe ./hate-no-d.lua - name: Attach to release if: startsWith(github.ref, 'refs/tags/') diff --git a/.gitignore b/.gitignore index bd96ad9..298f7e7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ hate-no-d-*/ hate-no-d-*.tar.gz hate-no-d-*.zip -# Build artifacts (make lib). +# Build artifacts. *.o -*.mri -libhate-no-d.a +*.obj diff --git a/.gitmodules b/.gitmodules index e7491eb..5c85dcb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "submodules/luajit"] path = submodules/luajit url = https://luajit.org/git/luajit.git +[submodule "submodules/raylib"] + path = submodules/raylib + url = https://github.com/raysan5/raylib.git diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..9847220 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "runtime.version": "LuaJIT", + "workspace.checkThirdParty": false, + "workspace.library": ["./hate-no-d.lua"] +} diff --git a/Makefile b/Makefile index d83826b..ea470b5 100644 --- a/Makefile +++ b/Makefile @@ -4,15 +4,16 @@ # make # make PLATFORM=Android ANDROID_NDK=/opt/android-ndk # make PLATFORM=Android ANDROID_NDK=... ANDROID_ABI=armeabi-v7a ANDROID_API=21 -# make PLATFORM=iOS IOS_ARCH=arm64 IOS_MIN=12.0 # make PLATFORM=Windows WIN_ARCH=x86_64 (cross build with mingw-w64) # # Targets: -# make the CLI (hate-no-d, or hate-no-d.exe / libluajit.a on iOS) -# make lib libhate-no-d.a, for embedding into another program +# make the CLI (hate-no-d or hate-no-d.exe) # make help every target and option +# +# raylib is linked into the CLI. # luajit requires GNU Make (use `gmake` on FreeBSD/OpenBSD/NetBSD). +# The guard below only runs under GNU make; BSD make fails earlier. ifndef .FEATURES $(error This build requires GNU Make -- on BSD use 'gmake') endif @@ -22,21 +23,18 @@ endif LUAJIT_DIR := submodules/luajit LUAJIT_SRC := $(LUAJIT_DIR)/src LUAJIT_AR := $(LUAJIT_SRC)/libluajit.a +RAYLIB_DIR := submodules/raylib +RAYLIB_SRC := $(RAYLIB_DIR)/src +RAYLIB_AR := $(RAYLIB_SRC)/libraylib.a +RAYLIB_API := $(RAYLIB_DIR)/tools/rlparser/output/raylib_api.lua +RLPARSER_DIR := $(RAYLIB_DIR)/tools/rlparser +RLPARSER := $(RLPARSER_DIR)/rlparser +API_DIR := $(RLPARSER_DIR)/output +BINDING := hate-no-d.lua OBJ := hate-no-d.o BIN := hate-no-d -LIB := libhate-no-d.a -# Everything that goes into $(LIB) besides LuaJIT itself. Empty today: the only -# C in the tree is the CLI driver, and its main() belongs to the executable an -# embedder already has, not to a library (a -all_load/--whole-archive link would -# collide). Runtime modules added later get listed here, e.g. -# LIB_OBJS += hnod.o -# and are merged into the archive automatically -- that is why the archive has -# a name of its own instead of just being LuaJIT's. -LIB_OBJS := - -# Archiver used to merge $(LIB). Cross toolchains ship their own; Apple has no -# `ar -M`, so those targets use libtool instead (see the $(LIB) rule). +# Archiver passed to raylib's build. Cross toolchains ship their own. AR ?= ar LUAJIT_XCFLAGS := -DLUAJIT_ENABLE_LUA52COMPAT @@ -51,35 +49,43 @@ else ifeq ($(PLATFORM),Android) OS_KIND := android else ifeq ($(PLATFORM),Darwin) OS_KIND := macos -else ifeq ($(PLATFORM),iOS) - OS_KIND := ios else ifeq ($(PLATFORM),Windows) OS_KIND := windows -else ifneq (,$(filter $(PLATFORM),FreeBSD OpenBSD NetBSD DragonFly GNU/kFreeBSD)) +else ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(PLATFORM))) + # Native MinGW/MSYS2/Cygwin shell: uname reports e.g. MINGW64_NT-10.0. + OS_KIND := windows + PLATFORM := Windows + MINGW_ARCH := $(shell uname -m) + ifeq ($(MINGW_ARCH),amd64) + WIN_ARCH ?= x86_64 + else ifeq ($(MINGW_ARCH),x86) + WIN_ARCH ?= i686 + else + WIN_ARCH ?= $(MINGW_ARCH) + endif +else ifneq (,$(filter $(PLATFORM),FreeBSD OpenBSD NetBSD DragonFly)) OS_KIND := bsd -else - OS_KIND := posix endif +# raylib build args; per-platform overrides follow. +RAYLIB_MAKE_ARGS := PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC +RAYLIB_LINK := -Wl,--whole-archive $(RAYLIB_AR) -Wl,--no-whole-archive + # Linux (ELF) ifeq ($(OS_KIND),linux) EXPORT_LDFLAGS := -Wl,-E - PLAT_LIBS := -lm -ldl + PLAT_LIBS := -lm -ldl -lGL -lX11 -lpthread -lrt LINK_TARGET := $(BIN) endif -# BSD (ELF or Mach-O, dlopen lives in libc) +# BSD (ELF, dlopen lives in libc) ifeq ($(OS_KIND),bsd) EXPORT_LDFLAGS := -Wl,-E - PLAT_LIBS := -lm - LINK_TARGET := $(BIN) -endif - -# Generic POSIX fallback (Solaris/illumos, AIX, Haiku, ...). -# Note: Solaris ld's -E is NOT --export-dynamic, so it is deliberately off. -ifeq ($(OS_KIND),posix) - EXPORT_LDFLAGS := - PLAT_LIBS := -lm + # raylib's own BSD list lacks the X11 set its examples link. + PLAT_LIBS := -lm -lGL -lpthread -lX11 -lXrandr -lXinerama -lXi -lXcursor + ifneq (,$(filter $(PLATFORM),OpenBSD NetBSD)) + PLAT_LIBS += -lossaudio + endif LINK_TARGET := $(BIN) endif @@ -91,9 +97,6 @@ endif # compiler, because LuaJIT's buildvm runs natively and its pointer size must # match the target: # make PLATFORM=Windows WIN_ARCH=i686 HOST_CC="gcc -m32" -# -# No export table: ffi.C resolves through msvcrt/kernel32 handles on Windows, -# unlike ELF where the Lua API has to be exported with -Wl,-E. ifeq ($(OS_KIND),windows) WIN_ARCH ?= x86_64 @@ -104,10 +107,16 @@ ifeq ($(OS_KIND),windows) CC := $(WIN_ARCH)-w64-mingw32-gcc AR := $(WIN_ARCH)-w64-mingw32-ar HOST_CC ?= gcc - PLAT_LIBS := -lm + PLAT_LIBS := -lm -lopengl32 -lgdi32 -lwinmm BIN := $(BIN).exe LINK_TARGET := $(BIN) + # raylib detects the host's OS, so pin the target for cross builds. + RAYLIB_MAKE_ARGS := PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC PLATFORM_OS=WINDOWS + + # Export the exe's symbols so ffi.C can resolve raylib on Windows. + EXPORT_LDFLAGS := -Wl,--export-all-symbols + # LuaJIT derives HOST_CC from CC, so label both to the sub-make: otherwise # the host tools (minilua, buildvm) are compiled with the cross compiler. LUAJIT_EXTRA := "CC=$(CC)" "HOST_CC=$(HOST_CC)" TARGET_SYS=Windows @@ -127,9 +136,13 @@ ifeq ($(OS_KIND),macos) export MACOSX_DEPLOYMENT_TARGET EXPORT_LDFLAGS := -Wl,-export_dynamic - PLAT_LIBS := -lm + PLAT_LIBS := -lm -framework OpenGL -framework Cocoa -framework IOKit \ + -framework CoreAudio -framework CoreVideo -framework QuartzCore LINK_TARGET := $(BIN) + # ld64 has no --whole-archive. + RAYLIB_LINK := -Wl,-force_load,$(RAYLIB_AR) + # MAP_JIT path: needed for the hardened runtime (and therefore notarization). # Requires MACOSX_DEPLOYMENT_TARGET >= 11.0 or LuaJIT compiles it back out. MACOSX_HRT ?= 1 @@ -151,6 +164,10 @@ ifeq ($(OS_KIND),android) $(error PLATFORM=Android requires ANDROID_NDK (or ANDROID_NDK_HOME) to be set) endif + ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell uname -s))) + $(error PLATFORM=Android must be built from a Linux or macOS host) + endif + ifeq ($(ANDROID_ABI),arm64-v8a) ANDROID_TRIPLET := aarch64-linux-android else ifeq ($(ANDROID_ABI),armeabi-v7a) @@ -172,46 +189,48 @@ ifeq ($(OS_KIND),android) ANDROID_BIN := $(ANDROID_NDK)/toolchains/llvm/prebuilt/$(ANDROID_HOST_TAG)/bin ANDROID_CC := $(ANDROID_BIN)/$(ANDROID_TRIPLET)$(ANDROID_API)-clang + ifeq ($(ANDROID_ABI),arm64-v8a) + RAYLIB_ANDROID_ARCH := arm64 + else ifeq ($(ANDROID_ABI),armeabi-v7a) + RAYLIB_ANDROID_ARCH := arm + else ifeq ($(ANDROID_ABI),x86_64) + RAYLIB_ANDROID_ARCH := x86_64 + else + RAYLIB_ANDROID_ARCH := x86 + endif + RAYLIB_MAKE_ARGS := PLATFORM=PLATFORM_ANDROID RAYLIB_LIBTYPE=STATIC \ + ANDROID_NDK=$(ANDROID_NDK) ANDROID_ARCH=$(RAYLIB_ANDROID_ARCH) \ + ANDROID_API_VERSION=$(ANDROID_API) + CC := $(ANDROID_CC) AR := $(ANDROID_BIN)/llvm-ar EXPORT_LDFLAGS := -Wl,-E - PLAT_LIBS := -lm + # -Wl,--wrap=fopen is raylib's APK asset hook. + PLAT_LIBS := -lm -llog -landroid -lEGL -lGLESv2 -lOpenSLES -ldl -Wl,--wrap=fopen LINK_TARGET := $(BIN) - LUAJIT_EXTRA := CROSS=$(ANDROID_BIN)/$(ANDROID_TRIPLET)- STATIC_CC=$(ANDROID_CC) TARGET_LD=$(ANDROID_CC) "TARGET_AR=$(ANDROID_BIN)/llvm-ar rcus" TARGET_STRIP=$(ANDROID_BIN)/llvm-strip -endif - -# iOS (Mach-O, ARM64 only) -# -# There is no runnable binary: link libluajit.a into your Xcode app target. -# The JIT is compiled out by LuaJIT itself (no runtime code generation is -# allowed on iOS), so you get the fast interpreter only. -ifeq ($(OS_KIND),ios) - IOS_SDK ?= $(shell xcrun --sdk iphoneos --show-sdk-path 2>/dev/null) - IOS_CC ?= $(shell xcrun --sdk iphoneos --find clang 2>/dev/null) - IOS_ARCH ?= arm64 - IOS_MIN ?= 12.0 - - ifeq ($(strip $(IOS_SDK)),) - $(error PLATFORM=iOS requires Xcode/xcrun on the build host) - endif - - IOS_FLAGS := -arch $(IOS_ARCH) -isysroot $(IOS_SDK) -mios-version-min=$(IOS_MIN) - - CC := $(IOS_CC) - EXPORT_LDFLAGS := - PLAT_LIBS := - LINK_TARGET := $(LUAJIT_AR) - - # DEFAULT_CC keeps the host toolchain (minilua/buildvm) native; CROSS - # switches only the target objects to the iOS SDK. - LUAJIT_EXTRA := DEFAULT_CC=clang CROSS=$(dir $(IOS_CC)) TARGET_SYS=iOS "TARGET_FLAGS=$(IOS_FLAGS)" + LUAJIT_EXTRA := CROSS=$(ANDROID_BIN)/$(ANDROID_TRIPLET)- \ + STATIC_CC=$(ANDROID_CC) TARGET_LD=$(ANDROID_CC) \ + "TARGET_AR=$(ANDROID_BIN)/llvm-ar rcus" \ + TARGET_STRIP=$(ANDROID_BIN)/llvm-strip TARGET_SYS=Linux endif ifndef LINK_TARGET - $(error Unsupported platform '$(PLATFORM)') +$(error Unsupported platform '$(PLATFORM)' -- supported: Linux, Android, Darwin, Windows, BSD) endif +# Host compiler for build-time tools (rlparser). The Windows branch above +# already pins gcc; everywhere else 'cc' is the native compiler. +HOST_CC ?= cc +LUAJIT ?= luajit + +# raylib's RELEASE desktop build appends -O1. -O2 is a large win for CPU-bound +# code (measured 0.83s -> 0.47s on image generation here); -O3 adds nothing. +# Override with RAYLIB_OPT=..., then run `make clean` (objects are not +# flag-aware, so raylib will not rebuild by itself). +RAYLIB_OPT ?= -O2 +RAYLIB_MAKE_ARGS += CUSTOM_CFLAGS="$(RAYLIB_OPT)" + # Compiler / linker flags CFLAGS ?= -O2 -Wall CPPFLAGS += -I$(LUAJIT_SRC) @@ -222,72 +241,89 @@ LUAJIT_MAKE_ARGS := BUILDMODE=static XCFLAGS="$(LUAJIT_XCFLAGS)" $(LUAJIT_EXTRA) $(LUAJIT_AR): $(MAKE) -C $(LUAJIT_SRC) $(LUAJIT_MAKE_ARGS) "LJCORE_O=ljamalg.o" libluajit.a +# raylib: static archive only; CC/AR are pinned because its Makefile defaults to +# native gcc/ar. +$(RAYLIB_AR): + $(MAKE) -C $(RAYLIB_SRC) $(RAYLIB_MAKE_ARGS) CC="$(CC)" AR="$(AR)" + # Targets help: @echo "hate-no-d -- LuaJIT-based Lua runtime" @echo "" @echo "Targets:" - @echo " make [all] CLI for the auto-detected platform (hate-no-d," - @echo " hate-no-d.exe, or libluajit.a on iOS)" - @echo " make lib libhate-no-d.a: LuaJIT plus LIB_OBJS, for embedding" - @echo " make luajit LuaJIT static archive only" + @echo " make [all] CLI for the current platform + hate-no-d.lua" + @echo " make bindings regenerate hate-no-d.lua only" + @echo " make check-bindings verify hate-no-d.lua is reproducible and loads" @echo " make print-config resolved configuration for the current target" - @echo " make clean remove build artifacts, LuaJIT's included" + @echo " make clean remove build artifacts, submodules included" @echo " make help this text" @echo "" @echo "Options (pass as VAR=value):" - @echo " PLATFORM= Linux | Android | Darwin | iOS | Windows | a BSD" + @echo " PLATFORM= Linux | Android | Darwin | Windows | a BSD" @echo " (default: uname -s)" @echo " WIN_ARCH= x86_64 | i686 [Windows]" @echo " ANDROID_NDK= NDK root, or export ANDROID_NDK_HOME [Android]" @echo " ANDROID_ABI= arm64-v8a | armeabi-v7a | x86_64 | x86 [Android]" @echo " ANDROID_API= target API level, default 21 [Android]" - @echo " IOS_ARCH= IOS_MIN= arm64 / 12.0 [iOS]" - @echo " IOS_SDK= IOS_CC= Xcode paths, default from xcrun [iOS]" @echo " MACOSX_HRT= hardened-runtime JIT, default 1 [macOS]" @echo " MACOSX_DEPLOYMENT_TARGET= default 11.0 [macOS]" @echo " HOST_CC= host compiler for minilua/buildvm; needed" @echo " when the target is 32-bit and the host is not" + @echo " LUAJIT= host LuaJIT for the generator, default luajit" @echo " CFLAGS= default -O2 -Wall" + @echo " RAYLIB_OPT= raylib optimization flags, default -O2" @echo " LDFLAGS= extra linker flags" - @echo " LIB_OBJS= extra objects merged into libhate-no-d.a" - @echo " AR= archiver used to merge libhate-no-d.a" + @echo " AR= archiver for raylib's build" -all: $(LINK_TARGET) +all: $(LINK_TARGET) $(BINDING) $(OBJ): hate-no-d.c $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ hate-no-d.c -$(BIN): $(OBJ) $(LUAJIT_AR) +# raylib must be pulled in whole: nothing references it, so the linker would +# otherwise drop it and ffi.C would have nothing to resolve. +$(BIN): $(OBJ) $(LUAJIT_AR) $(RAYLIB_AR) $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(OBJ) \ - $(LUAJIT_AR) $(EXPORT_LDFLAGS) $(LDFLAGS) $(PLAT_LIBS) + $(RAYLIB_LINK) $(LUAJIT_AR) $(EXPORT_LDFLAGS) $(LDFLAGS) $(PLAT_LIBS) -luajit: $(LUAJIT_AR) +# --------------------------------------------------------------------------- +# Lua bindings (hate-no-d.lua) +# +# rlparser emits plain Lua tables; gen-hate-no-d.lua turns raylib.h + rlgl.h + +# raymath.h into one ffi.cdef block, constants, wrappers and LuaCATS comments. +# The tables live in raylib's own tools output directory, next to the committed +# raylib_api.lua; there is no second copy of the parser in this repo. +# +# rlparser is built for the host with HOST_CC, never with the target CC: cross +# builds still have to execute it while generating the platform-independent +# hate-no-d.lua. +# --------------------------------------------------------------------------- +# raylib gitignores this binary; its own Makefile builds it in place when a +# fresh checkout does not have one yet. CFLAGS is pinned so a cross/target +# build's command-line flags never leak into the host tool. +$(RLPARSER): $(RLPARSER_DIR)/rlparser.c + $(MAKE) -C $(RLPARSER_DIR) CC="$(HOST_CC)" CFLAGS="-O2 -Wall -std=c99" rlparser -# Static library for embedding: $(LIB_OBJS) plus LuaJIT, merged into one archive -# so a host program links a single file, and modules added to $(LIB_OBJS) later -# join it without the host's link line changing. -lib: $(LIB) +$(API_DIR)/rlgl_api.lua: $(RLPARSER) $(RAYLIB_SRC)/rlgl.h + $(RLPARSER) -i $(RAYLIB_SRC)/rlgl.h -o $@ -f LUA -d RLAPI -t "RLGL IMPLEMENTATION" -# Apple's ar (cctools) has no MRI script mode, so archives are merged with -# libtool there. Everywhere else GNU ar, binutils ar and llvm-ar all parse MRI -# scripts (ADDMOD for objects, ADDLIB for another archive). -APPLE := $(filter macos ios,$(OS_KIND)) +$(API_DIR)/raymath_api.lua: $(RLPARSER) $(RAYLIB_SRC)/raymath.h + $(RLPARSER) -i $(RAYLIB_SRC)/raymath.h -o $@ -f LUA -d RMAPI -$(LIB): $(LIB_OBJS) $(LUAJIT_AR) -ifeq ($(APPLE),) - @rm -f $@ $@.mri - @{ echo "CREATE $@"; \ - for o in $(LIB_OBJS); do echo "ADDMOD $$o"; done; \ - echo "ADDLIB $(LUAJIT_AR)"; \ - echo "SAVE"; echo "END"; } > $@.mri - $(AR) -M < $@.mri - @rm -f $@.mri -else - @rm -f $@ - libtool -static -o $@ $(LIB_OBJS) $(LUAJIT_AR) -endif - @echo "lib: built $@ ($$($(AR) t $@ | wc -l | tr -d ' ') members)" +$(BINDING): gen-hate-no-d.lua $(API_DIR)/rlgl_api.lua $(API_DIR)/raymath_api.lua $(RAYLIB_API) + @command -v $(LUAJIT) >/dev/null 2>&1 || { \ + echo "hate-no-d: cannot run '$(LUAJIT)' -- install LuaJIT or set LUAJIT=..." >&2; exit 1; } + $(LUAJIT) gen-hate-no-d.lua --out=$@ + +bindings: $(BINDING) + +# Fail if regeneration is not byte-identical or the module does not load; also +# checks the three API families are present. +check-bindings: $(BINDING) + $(LUAJIT) gen-hate-no-d.lua --out=hate-no-d.lua.tmp + cmp $(BINDING) hate-no-d.lua.tmp + rm -f hate-no-d.lua.tmp + $(LUAJIT) -e 'local M = dofile("$(BINDING)"); assert(type(M) == "table"); assert(type(M.GetMousePosition) == "function", "raylib"); assert(type(M.rlLoadIdentity) == "function", "rlgl"); assert(type(M.Vector2Add) == "function", "raymath"); print("bindings ok")' # Show the resolved configuration for the current (or selected) platform. # Useful for checking a cross build before committing to it. @@ -296,19 +332,28 @@ print-config: @echo "OS_KIND = $(OS_KIND)" @echo "CC / AR = $(CC) / $(AR)" @echo "CFLAGS = $(CFLAGS)" + @echo "RAYLIB_OPT = $(RAYLIB_OPT)" @echo "CPPFLAGS = $(CPPFLAGS)" @echo "EXPORT_LDFLAGS = $(EXPORT_LDFLAGS)" @echo "PLAT_LIBS = $(PLAT_LIBS)" @echo "LINK_TARGET = $(LINK_TARGET)" - @echo "OBJ / LIB = $(OBJ) / $(LIB) [$(LIB_OBJS)]" + @echo "OBJ = $(OBJ)" + @echo "HOST_CC = $(HOST_CC)" + @echo "LUAJIT = $(LUAJIT)" + @echo "API_DIR = $(API_DIR)" + @echo "BINDING = $(BINDING)" @echo "LUAJIT_MAKE_ARGS = $(LUAJIT_MAKE_ARGS)" + @echo "RAYLIB_AR = $(RAYLIB_AR)" + @echo "RAYLIB_MAKE_ARGS = $(RAYLIB_MAKE_ARGS)" @echo "MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET) (HRT=$(MACOSX_HRT))" @echo "ANDROID_ABI / API = $(ANDROID_ABI) / $(ANDROID_API)" - @echo "IOS_ARCH / MIN = $(IOS_ARCH) / $(IOS_MIN)" @echo "WIN_ARCH = $(WIN_ARCH) (HOST_CC=$(HOST_CC))" clean: - $(MAKE) -C $(LUAJIT_DIR) clean - rm -f $(BIN) $(OBJ) $(LIB) $(LIB).mri + @if [ -f $(LUAJIT_DIR)/Makefile ]; then $(MAKE) -C $(LUAJIT_DIR) clean; fi + @if [ -f $(RAYLIB_SRC)/Makefile ]; then $(MAKE) -C $(RAYLIB_SRC) clean; fi + rm -f $(BIN) hate-no-d.exe $(OBJ) libhate-no-d.a libhate-no-d.a.mri $(LUAJIT_AR) $(RAYLIB_AR) + rm -f $(BINDING) hate-no-d.lua.tmp + rm -f $(API_DIR)/rlgl_api.lua $(API_DIR)/raymath_api.lua -.PHONY: all clean luajit print-config lib help +.PHONY: all clean print-config help bindings check-bindings diff --git a/README.md b/README.md index 85e4b7a..0156764 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,141 @@ A [Love2D](https://www.love2d.org/) antagonist. +A glorified [Makefile](./Makefile), plus a small `build.bat` for MSVC. + +Should work on: + +- Linux (x86, x86_64, ARM, ARM64) +- Android (armeabi-v7a, arm64-v8a, x86, x86_64) +- macOS (x86_64, ARM64) +- Windows (x86, x86_64 via MinGW; ARM64 via MSVC) +- FreeBSD, OpenBSD, NetBSD (x86, x86_64) or DragonFly BSD (x86_64) + ## Quick Start -### On Linux, macOS, BSD, POSIX or Windows-MinGW +Once you have the binary, save this as `quick-start.lua`: + +```lua +local hnd = require("hate-no-d") + +hnd.InitWindow(1280, 720, "hate-no-d") + +local text = "Your first hate-no-d application!" +local fontSize = 48 + +local spacing = fontSize / hnd.GetFontDefault().baseSize +local textSize = hnd.MeasureTextEx(hnd.GetFontDefault(), text, fontSize, spacing) + +local posX = (hnd.GetRenderWidth() / 2) - (textSize.x / 2) +local posY = (hnd.GetRenderHeight() / 2) - (textSize.y / 2) + +while not hnd.WindowShouldClose() do + hnd.ClearBackground(hnd.SKYBLUE) + + hnd.BeginDrawing() + hnd.DrawText(text, posX, posY, fontSize, hnd.DARKBLUE) + hnd.EndDrawing() +end + +hnd.CloseWindow() +``` + +Then run it: ```sh -echo -e 'print("Hey! I am hate-no-d!")' > quick-start.lua ./hate-no-d quick-start.lua ``` -### On Windows MSVC +`hate-no-d.lua` is the generated raylib/rlgl/raymath binding module. Release +archives include it next to the binary; when building from source, `make` +generates it automatically. + +On Windows, use `cmd` or PowerShell: ```bat -echo print("Hey! I am hate-no-d!") > quick-start.lua hate-no-d.exe quick-start.lua ``` -## Build +## Building -### On Linux, macOS, BSD, POSIX or Windows-MinGW +You can download precompiled builds from the [releases page](https://git.pbento.pt/pedro-bento/hate-no-d/releases). + +### Linux prerequisites + +Install a C toolchain, `git` and the OpenGL/X11 development headers: + +Debian/Ubuntu: + +```sh +sudo apt install build-essential git luajit libgl1-mesa-dev libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev +``` + +Fedora: + +```sh +sudo dnf install gcc make git luajit mesa-libGL-devel libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel +``` + +Arch: + +```sh +sudo pacman -S --needed base-devel git luajit mesa libx11 libxrandr libxinerama libxcursor libxi +``` + +Void: + +```sh +sudo xbps-install -S base-devel git luajit MesaLib-devel libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel +``` + +Gentoo: + +```sh +sudo emerge --ask sys-devel/gcc dev-build/make dev-vcs/git dev-lang/luajit media-libs/mesa x11-libs/libX11 x11-libs/libXrandr x11-libs/libXinerama x11-libs/libXcursor x11-libs/libXi +``` + +### macOS prerequisites + +Install the Xcode Command Line Tools: + +```sh +xcode-select --install +``` + +`make` and `clang` come with them. Install the host LuaJIT used by the binding +generator: + +```sh +brew install luajit +``` + +### BSD prerequisites + +Install GNU Make and the X11 development headers. FreeBSD: + +```sh +sudo pkg install gmake luajit libX11 libXrandr libXinerama libXi libXcursor +``` + +On OpenBSD, NetBSD and DragonFly, install `gmake` and `luajit` with the system +package manager (`pkg_add gmake luajit`, `pkgin install gmake luajit` or +`pkg install gmake luajit`); X11 headers are usually in the base X sets, but +install the X11 libraries if they are missing. Use `gmake` instead of `make`. + +### Android prerequisites + +Android builds cross-compile from Linux or macOS. Install the Android NDK and +pass its path with `ANDROID_NDK`, or set `ANDROID_NDK_HOME`. + +### Windows prerequisites + +For MSVC, install Visual Studio 2022 with the "Desktop development with C++" workload. `build.bat` locates it automatically and uses the bundled CMake when available; raylib requires CMake 3.22 or newer, so install CMake if your VS2022 copy bundles an older version. + +For MinGW, use MSYS2 with the mingw-w64 toolchain and `make`. A native MSYS2 build is auto-detected; when cross-compiling from another host, pass `PLATFORM=Windows` (and `WIN_ARCH=i686` for 32-bit). + +### Building from source + +To build manually on Linux, macOS or a BSD, run: ```sh git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git @@ -28,10 +144,25 @@ cd hate-no-d make ``` -### On Windows MSVC +`make` builds the CLI and regenerates `hate-no-d.lua`; the generator needs a +host `luajit` in `PATH` (override with `make LUAJIT=/path/to/luajit`). On the +BSDs, use `gmake` instead of `make`. + +On Windows with MinGW (MSYS2), run `make` in the MSYS2 MINGW shell. To cross-compile +from another host, run `make PLATFORM=Windows` (add `WIN_ARCH=i686` for 32-bit). + +On Windows with MSVC: ```bat git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git cd hate-no-d build.bat ``` + +To build for Android from Linux or macOS, pass your NDK path (or set `ANDROID_NDK_HOME`): + +```sh +make PLATFORM=Android ANDROID_NDK=/path/to/ndk +``` + +`ANDROID_ABI` defaults to `arm64-v8a` and `ANDROID_API` to `21`; see `make help` for the other ABIs. Building `armeabi-v7a` on a 64-bit host also needs `HOST_CC="gcc -m32"`. diff --git a/build.bat b/build.bat index bffa91d..3831531 100644 --- a/build.bat +++ b/build.bat @@ -7,7 +7,8 @@ @rem @rem Works from a plain cmd.exe (locates Visual Studio itself) or from an @rem existing Developer Command Prompt. Produces hate-no-d.exe in this -@rem directory, statically linked against LuaJIT. +@rem directory, statically linked against LuaJIT and raylib. raylib is built +@rem with CMake (shipped with Visual Studio) and linked in whole. @echo off setlocal EnableExtensions @@ -41,12 +42,18 @@ if not exist "submodules\luajit\src\msvcbuild.bat" ( @rem msvcbuild.bat only ever appends options in a fixed order and deletes its @rem own .obj files at the end, so every run is a full rebuild anyway. +@rem Pin /MT through the CL environment so LuaJIT's static CRT matches raylib's +@rem below; the static branch of msvcbuild.bat does not choose a runtime itself. echo === Building LuaJIT (static, lua52compat) for Windows/%ARCH% === if exist "submodules\luajit\src\lua51.lib" del /q "submodules\luajit\src\lua51.lib" +set "HNOD_CL=%CL%" +set "CL=/MT" pushd "submodules\luajit\src" >nul call msvcbuild.bat lua52compat static popd >nul +set "CL=%HNOD_CL%" +set "HNOD_CL=" @rem msvcbuild.bat does not set errorlevel when it fails, so the artifact is @rem the only trustworthy signal. @@ -56,15 +63,67 @@ if not exist "submodules\luajit\src\lua51.lib" ( goto :fail ) +@rem raylib is built through CMake, which ships with Visual Studio. +@rem It uses the static CRT to match LuaJIT's default msvcbuild output, and +@rem defines BUILD_LIBTYPE_SHARED so its RLAPI functions carry dllexport and +@rem land in the exe's export table -- MSVC has no --export-dynamic, and ffi.C +@rem resolves C symbols through that table at runtime. +if not exist "submodules\raylib\CMakeLists.txt" ( + echo build.bat: submodules\raylib is missing. + echo Fetch it with: git submodule update --init submodules/raylib + goto :fail +) + +where cmake >nul 2>&1 +if errorlevel 1 ( + echo build.bat: cmake not found - install CMake 3.22+ or use a Developer Command Prompt. + goto :fail +) + +if /I "%ARCH%"=="x64" set "CMAKE_ARCH=x64" +if /I "%ARCH%"=="x86" set "CMAKE_ARCH=Win32" +if /I "%ARCH%"=="arm64" set "CMAKE_ARCH=ARM64" + +@rem One build tree per arch: CMake refuses to reuse a cache configured for +@rem another -A platform, so `build.bat x86` after x64 must not share it. +set "RAYLIB_BUILD=build\raylib-%ARCH%" + +echo === Building raylib (static) for Windows/%ARCH% === +cmake -S "submodules\raylib" -B "%RAYLIB_BUILD%" -A %CMAKE_ARCH% ^ + -DBUILD_SHARED_LIBS=OFF ^ + -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ^ + -DCMAKE_C_FLAGS_RELEASE="/O2 /Ob2 /DNDEBUG /DBUILD_LIBTYPE_SHARED" ^ + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE="%CD%\%RAYLIB_BUILD%\lib" ^ + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG="%CD%\%RAYLIB_BUILD%\lib" +if errorlevel 1 goto :fail + +cmake --build "%RAYLIB_BUILD%" --config Release --target raylib +if errorlevel 1 goto :fail + +if not exist "%RAYLIB_BUILD%\lib\raylib.lib" ( + echo build.bat: raylib.lib was not produced. + goto :fail +) + echo === Building hate-no-d.exe === if exist hate-no-d.obj del /q hate-no-d.obj -cl /nologo /c /O2 /W4 /D_CRT_SECURE_NO_WARNINGS ^ +cl /nologo /c /O2 /W4 /MT /D_CRT_SECURE_NO_WARNINGS ^ /I "submodules\luajit\src" /Fo"hate-no-d.obj" hate-no-d.c if errorlevel 1 goto :fail -link /nologo /OUT:hate-no-d.exe hate-no-d.obj "submodules\luajit\src\lua51.lib" +link /nologo /OUT:hate-no-d.exe hate-no-d.obj ^ + "/WHOLEARCHIVE:%CD%\%RAYLIB_BUILD%\lib\raylib.lib" ^ + "submodules\luajit\src\lua51.lib" ^ + opengl32.lib gdi32.lib winmm.lib user32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib advapi32.lib if errorlevel 1 goto :fail +@rem ffi.C reads the exe's export table, so verify raylib really got exported. +dumpbin /nologo /exports hate-no-d.exe | findstr /C:"InitWindow" >nul +if errorlevel 1 ( + echo build.bat: hate-no-d.exe does not export raylib - ffi.C would not find it. + goto :fail +) + del /q hate-no-d.obj echo. @@ -84,6 +143,7 @@ if exist "submodules\luajit\src" ( del /q *.obj host\*.obj *.manifest >nul 2>&1 popd >nul ) +if exist "build" rmdir /s /q "build" popd >nul endlocal exit /b 0 diff --git a/gen-hate-no-d.lua b/gen-hate-no-d.lua new file mode 100644 index 0000000..566cd39 --- /dev/null +++ b/gen-hate-no-d.lua @@ -0,0 +1,1185 @@ +#!/usr/bin/env luajit +--[[ +gen-hate-no-d.lua - generate hate-no-d.lua from raylib's own parser output. + +The generated file contains: + * one ffi.cdef block with every typedef/struct/alias/callback/prototype + * Lua constants (enums, #defines, colors) + * one Lua wrapper per C function, with ffi.string() handling for char* + returns, array conversions for const T* params, in/out helpers for + asset structs (Image*, Mesh*, ...) and callback pinning + * complete LuaCATS annotations (---@class / @field / @param / @return) + +Inputs are plain Lua tables produced by raylib's tools/rlparser: + + rlparser -i raylib.h -o submodules/raylib/tools/rlparser/output/raylib_api.lua -f LUA + rlparser -i rlgl.h -o submodules/raylib/tools/rlparser/output/rlgl_api.lua -f LUA -d RLAPI -t "RLGL IMPLEMENTATION" + rlparser -i raymath.h -o submodules/raylib/tools/rlparser/output/raymath_api.lua -f LUA -d RMAPI + +Usage: + luajit gen-hate-no-d.lua [--out=hate-no-d.lua] [--no-rlgl] [--no-raymath] + [--raylib=path] [--rlgl=path] [--raymath=path] + +raymath needs no extra translation unit: raylib's own rcore.c defines +RAYMATH_IMPLEMENTATION before including raymath.h, so libraylib.a already +contains all 146 raymath symbols (verified with nm). Linking the library +with --whole-archive exposes them to ffi.C. +]] + +local CFG = { + raylib = "submodules/raylib/tools/rlparser/output/raylib_api.lua", + rlgl = "submodules/raylib/tools/rlparser/output/rlgl_api.lua", + raymath = "submodules/raylib/tools/rlparser/output/raymath_api.lua", + out = "hate-no-d.lua", + use_rlgl = true, + use_raymath = true, +} + +local USAGE = [[ +usage: luajit gen-hate-no-d.lua [options] + + --out=PATH output file (default: hate-no-d.lua) + --raylib=PATH raylib parser table (default: submodules/.../raylib_api.lua) + --rlgl=PATH rlgl parser table (default: submodules/.../rlgl_api.lua) + --raymath=PATH raymath parser table(default: submodules/.../raymath_api.lua) + --no-rlgl skip rlgl + --no-raymath skip raymath + -h, --help this text +]] + +local function die(fmt, ...) + io.stderr:write("gen-hate-no-d: " .. string.format(fmt, ...) .. "\n") + os.exit(1) +end + +local function warn(fmt, ...) + io.stderr:write("gen-hate-no-d: warning: " .. string.format(fmt, ...) .. "\n") +end + +for i = 1, #arg do + local a = arg[i] + local key, value = a:match("^%-%-([%w]+)=(.*)$") + if key == "out" then + CFG.out = value + elseif key == "raylib" then + CFG.raylib = value + elseif key == "rlgl" then + CFG.rlgl = value + elseif key == "raymath" then + CFG.raymath = value + elseif key then + die("unknown option --%s", key) + elseif a == "--no-rlgl" then + CFG.use_rlgl = false + elseif a == "--no-raymath" then + CFG.use_raymath = false + elseif a == "-h" or a == "--help" then + io.write(USAGE) + os.exit(0) + else + die("unknown argument %s", a) + end +end + +---------------------------------------------------------------------------- +-- loading +---------------------------------------------------------------------------- + +local function load_api(path, optional) + local chunk, err = loadfile(path) + if not chunk then + if optional then + warn("skipping %s (%s)", path, err) + return nil + end + die("cannot load %s: %s", path, err) + return nil + end + local ok, data = pcall(chunk) + if not ok then + die("cannot run %s: %s", path, data) + end + if type(data) ~= "table" then + die("%s did not return a table", path) + end + return data +end + +local apis = {} + +local raylib_api = load_api(CFG.raylib) +apis[#apis + 1] = { tag = "raylib", data = raylib_api } + +if CFG.use_rlgl then + local data = load_api(CFG.rlgl, false) + if data then + apis[#apis + 1] = { tag = "rlgl", data = data } + else + warn("rlgl API table missing, building raylib.h only") + end +end + +if CFG.use_raymath then + local data = load_api(CFG.raymath, false) + if data then + apis[#apis + 1] = { tag = "raymath", data = data } + else + warn("raymath API table missing, building without raymath") + end +end + +---------------------------------------------------------------------------- +-- type model +---------------------------------------------------------------------------- + +local SCALAR = { + ["void"] = true, bool = true, char = true, short = true, int = true, + long = true, float = true, double = true, + ["unsigned char"] = true, ["unsigned short"] = true, + ["unsigned int"] = true, ["unsigned long"] = true, + ["signed char"] = true, ["long long"] = true, ["size_t"] = true, +} + +local INTEGER = { + char = true, short = true, int = true, long = true, + ["unsigned char"] = true, ["unsigned short"] = true, + ["unsigned int"] = true, ["unsigned long"] = true, + ["signed char"] = true, ["long long"] = true, ["size_t"] = true, +} + +local NUMBER = { float = true, double = true } + +local STRUCTS, ALIASES, CALLBACKS = {}, {}, {} +local DEFS = {} + +local function norm(s) + return (s:gsub("%s+", " "):gsub("^ ", ""):gsub(" $", "")) +end + +-- Parse a raylib parser type string into base / pointer depth / const / array. +local function parse_type(t) + local s = norm(t) + local array = s:match("%[(%d+)%]%s*$") + if array then + s = s:gsub("%[%d+%]%s*$", "") + s = norm(s) + end + local is_const = false + if s:match("^const ") then + is_const = true + s = norm(s:sub(7)) + end + local ptr = select(2, s:gsub("%*", "")) + s = norm((s:gsub("%*", ""))) + return { base = s, ptr = ptr, const = is_const, array = tonumber(array) } +end + +local function is_structish(base) + return STRUCTS[base] ~= nil or ALIASES[base] ~= nil +end + +---------------------------------------------------------------------------- +-- merge the three API tables +---------------------------------------------------------------------------- + +local FUNCS = {} + +-- rlparser is line-oriented and does not evaluate the preprocessor: rlgl.h +-- struct fields guarded by #if/#endif leak into the output as bogus fields +-- ("#endif indices", "#if defined(...) unsigned int * indices"). Drop those +-- and keep the first real field with a given name. +local function sanitize_fields(fields) + local clean, seen = {}, {} + for _, f in ipairs(fields) do + local ftype = norm(f.type or "") + local fname = norm(f.name or "") + if fname ~= "" and not fname:match("^#") and not ftype:match("^#") and not seen[fname] then + seen[fname] = true + clean[#clean + 1] = f + end + end + return clean +end + +local function add_api(tag) + local data + for _, item in ipairs(apis) do + if item.tag == tag then + data = item.data + break + end + end + if not data then + return + end + + for _, s in ipairs(data.structs or {}) do + if not STRUCTS[s.name] and not ALIASES[s.name] then + STRUCTS[s.name] = { + kind = "struct", + name = s.name, + fields = sanitize_fields(s.fields or {}), + description = s.description, + } + DEFS[#DEFS + 1] = STRUCTS[s.name] + end + end + + for _, a in ipairs(data.aliases or {}) do + if not ALIASES[a.name] and not STRUCTS[a.name] then + -- rlparser stores the target in `type` and the new name in `name`. + ALIASES[a.name] = { + kind = "alias", + name = a.name, + target = a.type, + description = a.description, + } + DEFS[#DEFS + 1] = ALIASES[a.name] + end + end + + for _, c in ipairs(data.callbacks or {}) do + if not CALLBACKS[c.name] then + CALLBACKS[c.name] = c + end + end + + for _, f in ipairs(data.functions or {}) do + f._tag = tag + FUNCS[#FUNCS + 1] = f + end +end + +for _, item in ipairs(apis) do + add_api(item.tag) +end + +-- TraceLogCallback carries va_list, which LuaJIT cannot pass to a Lua +-- callback; drop the callback and the single function using it. +CALLBACKS.TraceLogCallback = nil + +local SKIP = { + SetTraceLogCallback = true, +} + +local function params_of(f) + return f.params or {} +end + +local function is_skipped(f) + if SKIP[f.name] then + return true + end + for _, p in ipairs(params_of(f)) do + if norm(p.type) == "va_list" then + return true + end + end + return false +end + +---------------------------------------------------------------------------- +-- validation +---------------------------------------------------------------------------- + +local function check_type(t, where) + local p = parse_type(t) + if p.base == "..." or p.base == "va_list" then + return + end + if SCALAR[p.base] or is_structish(p.base) or CALLBACKS[p.base] then + return + end + if p.ptr > 0 then + return -- opaque pointer (rAudioBuffer *, ...) + end + die("unknown type %q in %s", p.base, where) +end + +local func_names = {} +for _, f in ipairs(FUNCS) do + if func_names[f.name] then + die("duplicate function name %s", f.name) + end + func_names[f.name] = true + if not is_skipped(f) then + check_type(f.returnType, f.name .. " return") + for _, p in ipairs(params_of(f)) do + check_type(p.type, f.name .. " param " .. p.name) + end + end +end + +for _, def in ipairs(DEFS) do + if def.kind == "struct" then + for _, f in ipairs(def.fields) do + check_type(f.type, def.name .. "." .. f.name) + end + else + check_type(def.target, def.name .. " alias") + end +end + +-- Opaque struct names (forward declarations in the cdef). +local OPAQUE = {} +local function scan_opaque(t) + local p = parse_type(t) + if p.base == "..." or p.base == "va_list" then + return + end + if SCALAR[p.base] or is_structish(p.base) or CALLBACKS[p.base] then + return + end + OPAQUE[p.base] = true +end + +for _, def in ipairs(DEFS) do + if def.kind == "struct" then + for _, f in ipairs(def.fields) do + scan_opaque(f.type) + end + end +end +for _, f in ipairs(FUNCS) do + if not is_skipped(f) then + scan_opaque(f.returnType) + for _, p in ipairs(params_of(f)) do + scan_opaque(p.type) + end + end +end + +local opaque_names = {} +for name in pairs(OPAQUE) do + opaque_names[#opaque_names + 1] = name +end +table.sort(opaque_names) + +---------------------------------------------------------------------------- +-- dependency order (typedefs must be declared before use) +---------------------------------------------------------------------------- + +local function deps_of(def) + local deps = {} + local function add(t) + local p = parse_type(t) + if is_structish(p.base) and p.base ~= def.name then + deps[#deps + 1] = p.base + end + end + if def.kind == "struct" then + for _, f in ipairs(def.fields) do + add(f.type) + end + else + add(def.target) + end + return deps +end + +local ordered = {} +local state = {} + +local function visit(name) + if state[name] == "done" then + return + end + if state[name] == "active" then + die("cyclic typedef involving %s", name) + end + local def = STRUCTS[name] or ALIASES[name] + if not def then + return + end + state[name] = "active" + for _, dep in ipairs(deps_of(def)) do + visit(dep) + end + state[name] = "done" + ordered[#ordered + 1] = def +end + +for _, def in ipairs(DEFS) do + visit(def.name) +end + +---------------------------------------------------------------------------- +-- C rendering +---------------------------------------------------------------------------- + +local function c_base(base) + if SCALAR[base] or is_structish(base) or CALLBACKS[base] then + return base + end + return "struct " .. base +end + +local function c_type(t) + local p = parse_type(t) + if p.base == "..." then + return "..." + end + local s = c_base(p.base) + if p.ptr > 0 then + s = s .. " " .. string.rep("*", p.ptr) + end + if p.const then + s = "const " .. s + end + return s +end + +local function c_field(ftype, fname) + local p = parse_type(ftype) + local base = c_base(p.base) + if p.array then + return base .. " " .. fname .. "[" .. p.array .. "]" + end + if p.ptr > 0 then + return base .. " " .. string.rep("*", p.ptr) .. fname + end + return base .. " " .. fname +end + +---------------------------------------------------------------------------- +-- LuaCATS rendering +---------------------------------------------------------------------------- + +local CHAR_BUFFER = "raylib.char_buffer" +local CSTRING_ARRAY = "raylib.cstring_array" + +local function ann_scalar(base) + if base == "bool" then + return "boolean" + end + if INTEGER[base] then + return "integer" + end + if NUMBER[base] then + return "number" + end + return nil +end + +local function ann_value(base) + local scalar = ann_scalar(base) + if scalar then + return scalar + end + if is_structish(base) then + return "raylib." .. base + end + return "ffi.cdata*" +end + +local function ann_field(ftype) + local p = parse_type(ftype) + if p.array then + if p.base == "char" then + return CHAR_BUFFER + end + local elem = ann_scalar(p.base) + if elem then + return elem .. "[]" + end + if is_structish(p.base) then + return "raylib." .. p.base .. "[]" + end + return "ffi.cdata*" + end + if p.ptr > 0 then + if p.base == "char" then + return p.ptr == 1 and CHAR_BUFFER or CSTRING_ARRAY + end + if p.base == "void" then + return "ffi.cdata*" + end + if INTEGER[p.base] then + return "integer[]" + end + if NUMBER[p.base] then + return "number[]" + end + if is_structish(p.base) then + return "raylib." .. p.base .. "[]" + end + return "ffi.cdata*" + end + return ann_value(p.base) +end + +-- Struct pointers that are genuinely in/out: the caller passes the handle and +-- gets the (possibly mutated) handle back. +local OUT_STRUCT = { + Image = true, Texture2D = true, Mesh = true, Wave = true, Material = true, + Model = true, RenderTexture2D = true, Camera = true, AutomationEventList = true, +} + +-- Functions whose struct-pointer parameters are pure outputs. Those params are +-- optional on the Lua side and become extra return values. +local OUT_OVERRIDES = { + MatrixDecompose = { 2, 3, 4 }, +} + +local function ann_param(p, is_out) + local pt = parse_type(p.type) + if pt.base == "..." then + return "any" + end + if CALLBACKS[pt.base] then + return "raylib." .. pt.base + end + if pt.ptr == 0 then + return ann_value(pt.base) + end + if is_out then + return "raylib." .. pt.base + end + if pt.base == "char" then + if pt.ptr == 1 then + return pt.const and "string" or (CHAR_BUFFER .. "|string") + end + return "string[]|" .. CSTRING_ARRAY + end + if pt.base == "void" then + return "ffi.cdata*|string" + end + if pt.base == "unsigned char" and pt.const then + return "string|integer[]" + end + if pt.const then + local elem = ann_scalar(pt.base) + if elem then + return elem .. "[]" + end + if is_structish(pt.base) then + return "raylib." .. pt.base .. "[]" + end + end + return "ffi.cdata*" +end + +local function ann_return(t) + local p = parse_type(t) + if p.base == "void" and p.ptr == 0 then + return "nil" + end + if p.ptr == 0 then + return ann_value(p.base) + end + if p.base == "char" and p.ptr == 1 then + return "string|nil" + end + return "ffi.cdata*" +end + +---------------------------------------------------------------------------- +-- out-params / array conversions +---------------------------------------------------------------------------- + +local function out_params(f) + local out = {} + local ret = parse_type(f.returnType) + if ret.base ~= "void" or ret.ptr ~= 0 then + return out + end + if OUT_OVERRIDES[f.name] then + for _, i in ipairs(OUT_OVERRIDES[f.name]) do + out[i] = "out" + end + return out + end + local params = params_of(f) + for i, p in ipairs(params) do + local pt = parse_type(p.type) + if pt.ptr == 1 and not pt.const and OUT_STRUCT[pt.base] then + out[i] = "inout" + end + end + return out +end + +-- Convert Lua-friendly argument forms (string / table) to cdata without +-- reassigning the annotated parameter: doing that makes LuaLS warn with +-- cast-local-type. The result goes into an untyped local instead. +local function conversion_for(name, ptype, idx) + local pt = parse_type(ptype) + local var = "_a" .. idx + if pt.base == "unsigned char" and pt.ptr == 1 and pt.const then + return { arg = var, lines = { + "local " .. var, + 'if type(' .. name .. ') == "string" then ' .. var .. ' = ffi.cast("const unsigned char *", ' .. name .. ")", + 'elseif type(' .. name .. ') == "table" then ' .. var .. ' = to_array("unsigned char", ' .. name .. ")", + "else " .. var .. " = " .. name .. " end", + } } + end + if pt.base == "void" and pt.ptr == 1 then + return { arg = var, lines = { + "local " .. var, + 'if type(' .. name .. ') == "string" then ' .. var .. ' = ffi.cast("const void *", ' .. name .. ")", + "else " .. var .. " = " .. name .. " end", + } } + end + if pt.base == "char" and pt.ptr == 2 then + -- raylib takes char** (non-const), but an array of const char* is what a + -- Lua table naturally builds; the cast is safe because these parameters + -- are read-only in practice. + local array = 'to_array("const char *", ' .. name .. ")" + if not pt.const then + array = 'ffi.cast("char **", ' .. array .. ")" + end + return { arg = var, lines = { + "local " .. var, + 'if type(' .. name .. ') == "table" then ' .. var .. " = " .. array, + "else " .. var .. " = " .. name .. " end", + } } + end + if pt.const and pt.ptr == 1 and pt.base ~= "char" and pt.base ~= "void" then + return { arg = var, lines = { + "local " .. var, + 'if type(' .. name .. ') == "table" then ' .. var .. ' = to_array("' .. pt.base .. '", ' .. name .. ")", + "else " .. var .. " = " .. name .. " end", + } } + end + return nil +end + +---------------------------------------------------------------------------- +-- emitted source +---------------------------------------------------------------------------- + +local out = {} +local function w(line) + out[#out + 1] = line or "" +end + +local function clean_description(s) + if not s or s == "" then + return nil + end + s = s:gsub("%s+", " "):gsub("^ ", ""):gsub(" $", "") + return s +end + +local version = "unknown" +local function find_define(data, name) + for _, d in ipairs(data.defines or {}) do + if d.name == name then + return d.value + end + end + return nil +end + +version = tostring(find_define(raylib_api, "RAYLIB_VERSION") or "unknown") + +w("--[[") +w(" hate-no-d.lua - generated by gen-hate-no-d.lua, do not edit.") +w("") +w(" raylib " .. version .. " / rlgl / raymath") +w(" Functions: " .. tostring(#FUNCS)) +w("") +w(" raymath symbols come from rcore.o (RAYMATH_IMPLEMENTATION) in libraylib.a.") +w("]]") +w("") +w('local ffi = require("ffi")') +w("") +w("ffi.cdef[[") +for _, name in ipairs(opaque_names) do + w("struct " .. name .. ";") +end +if #opaque_names > 0 then + w("") +end + +for _, def in ipairs(ordered) do + if def.kind == "struct" then + w("typedef struct " .. def.name .. " {") + for _, f in ipairs(def.fields) do + w(" " .. c_field(f.type, f.name) .. ";") + end + w("} " .. def.name .. ";") + else + w("typedef " .. c_type(def.target) .. " " .. def.name .. ";") + end + w("") +end + +for _, cb in ipairs({ CALLBACKS.AudioCallback, CALLBACKS.LoadFileDataCallback, + CALLBACKS.SaveFileDataCallback, CALLBACKS.LoadFileTextCallback, + CALLBACKS.SaveFileTextCallback }) do + if cb then + local args = {} + for _, p in ipairs(params_of(cb)) do + if parse_type(p.type).base == "..." then + args[#args + 1] = "..." + else + args[#args + 1] = c_type(p.type) .. " " .. p.name + end + end + if #args == 0 then + args[1] = "void" + end + w("typedef " .. c_type(cb.returnType) .. " (*" .. cb.name .. ")(" .. table.concat(args, ", ") .. ");") + w("") + end +end + +for _, f in ipairs(FUNCS) do + if not is_skipped(f) then + local args = {} + for _, p in ipairs(params_of(f)) do + if parse_type(p.type).base == "..." then + args[#args + 1] = "..." + else + args[#args + 1] = c_type(p.type) .. " " .. p.name + end + end + if #args == 0 then + args[1] = "void" + end + w(c_type(f.returnType) .. " " .. f.name .. "(" .. table.concat(args, ", ") .. ");") + end +end + +w("]]") +w("") +w("local C = ffi.C") +w("local string_format = string.format") +w("local ffi_string = ffi.string") +w("local type, select = type, select") +w("") +w("local M = {}") +w("") +w("-- Raw namespace for hot paths that want to skip the Lua wrapper.") +w("---@type ffi.namespace*") +w("M.C = C") +w("") +w("---@class raylib.char_buffer") +w("---@field [integer] integer") +w("") +w("---@class raylib.cstring_array") +w("---@field [integer] ffi.cdata*") +w("") +w("local pinned = {}") +w("local callback_cache = {}") +w("local function pin(ctype, fn)") +w(" if fn == nil then") +w(" return nil") +w(" end") +w(" local by_type = callback_cache[fn]") +w(" if by_type == nil then") +w(" by_type = {}") +w(" callback_cache[fn] = by_type") +w(" end") +w(" local cb = by_type[ctype]") +w(" if cb == nil then") +w(" cb = ffi.cast(ctype, fn)") +w(" by_type[ctype] = cb") +w(" pinned[#pinned + 1] = cb") +w(" end") +w(" return cb") +w("end") +w("") +w("local function to_array(ct, t, n)") +w(" n = n or #t") +w(' local a = ffi.new(ct .. "[?]", n)') +w(" for i = 1, n do") +w(" a[i - 1] = t[i]") +w(" end") +w(" return a") +w("end") +w("") + +---------------------------------------------------------------------------- +-- constants +---------------------------------------------------------------------------- + +local enum_constants = {} +local seen_const = {} + +for _, item in ipairs(apis) do + for _, enum in ipairs(item.data.enums or {}) do + w("---@enum raylib." .. enum.name) + w("M." .. enum.name .. " = {") + for _, v in ipairs(enum.values or {}) do + local value + if type(v.value) == "number" then + value = tostring(v.value) + elseif type(v.value) == "string" then + value = string.format("%q", v.value) + else + value = tostring(v.value) + end + w(" " .. v.name .. " = " .. value .. ",") + enum_constants[v.name] = enum.name + seen_const[v.name] = true + end + w("}") + w("") + end +end + +for _, item in ipairs(apis) do + for _, enum in ipairs(item.data.enums or {}) do + for _, v in ipairs(enum.values or {}) do + w("---@type raylib." .. enum.name) + w("M." .. v.name .. " = M." .. enum.name .. "." .. v.name) + end + end +end +w("") + +local alias_defines = {} +local pi_value = nil + +local function eval_float_math(expr) + expr = expr:gsub("PI", tostring(pi_value or math.pi)) + expr = expr:gsub("(%d)f", "%1") + local chunk = load("return " .. expr) + if not chunk then + return nil + end + local ok, value = pcall(chunk) + if not ok or type(value) ~= "number" then + return nil + end + return value +end + +for _, item in ipairs(apis) do + for _, d in ipairs(item.data.defines or {}) do + if not seen_const[d.name] then + local dtype = d.type + local emitted = false + if dtype == "FLOAT" or dtype == "INT" then + if type(d.value) == "number" then + if d.name == "PI" then + pi_value = d.value + end + w("M." .. d.name .. " = " .. tostring(d.value)) + emitted = true + end + elseif dtype == "FLOAT_MATH" then + local value = eval_float_math(tostring(d.value)) + if value then + w("M." .. d.name .. " = " .. tostring(value)) + emitted = true + end + elseif dtype == "STRING" then + w("M." .. d.name .. " = " .. string.format("%q", tostring(d.value))) + emitted = true + elseif dtype == "COLOR" then + local r, g, b, a = tostring(d.value):match("{%s*(%d+)%s*,%s*(%d+)%s*,%s*(%d+)%s*,%s*(%d+)%s*}") + if r then + w("---@type raylib.Color") + w(string.format('M.%s = ffi.new("Color", { r = %s, g = %s, b = %s, a = %s })', + d.name, r, g, b, a)) + emitted = true + end + elseif dtype == "UNKNOWN" then + local target = tostring(d.value) + if target:match("^[A-Z_][A-Z0-9_]*$") then + alias_defines[#alias_defines + 1] = { name = d.name, target = target } + end + end + if emitted then + seen_const[d.name] = true + end + end + end +end + +for _, a in ipairs(alias_defines) do + if seen_const[a.target] then + local enum = enum_constants[a.target] + if enum then + w("---@type raylib." .. enum) + end + w("M." .. a.name .. " = M." .. a.target) + end +end +w("") + +---------------------------------------------------------------------------- +-- struct / alias / callback annotations +---------------------------------------------------------------------------- + +for _, def in ipairs(ordered) do + local desc = clean_description(def.description) + if def.kind == "struct" then + if desc then + w("---" .. desc) + end + w("---@class raylib." .. def.name) + for _, f in ipairs(def.fields) do + local fdesc = clean_description(f.description) + local line = "---@field " .. f.name .. " " .. ann_field(f.type) + if fdesc then + line = line .. " " .. fdesc + end + w(line) + end + else + local pt = parse_type(def.target) + if pt.ptr > 0 then + w("---@alias raylib." .. def.name .. " ffi.cdata*") + else + w("---@alias raylib." .. def.name .. " raylib." .. pt.base) + end + end + w("") +end + +for _, cb in ipairs({ CALLBACKS.AudioCallback, CALLBACKS.LoadFileDataCallback, + CALLBACKS.SaveFileDataCallback, CALLBACKS.LoadFileTextCallback, + CALLBACKS.SaveFileTextCallback }) do + if cb then + local parts = {} + for _, p in ipairs(params_of(cb)) do + local pt = parse_type(p.type) + local ann + if pt.base == "char" and pt.ptr == 1 then + ann = "string" + elseif pt.base == "void" and pt.ptr == 1 then + ann = "ffi.cdata*" + else + ann = ann_value(pt.base) + end + parts[#parts + 1] = (p.name or "arg") .. ": " .. ann + end + local ret = parse_type(cb.returnType) + local ret_ann = "" + if ret.base ~= "void" then + if ret.base == "char" and ret.ptr == 1 then + ret_ann = ": string" + else + ret_ann = ": " .. ann_return(cb.returnType) + end + end + w("---@alias raylib." .. cb.name .. " fun(" .. table.concat(parts, ", ") .. ")" .. ret_ann) + w("") + end +end + +---------------------------------------------------------------------------- +-- wrappers +---------------------------------------------------------------------------- + +local LUA_KEYWORDS = { + ["and"] = true, ["break"] = true, ["do"] = true, ["else"] = true, + ["elseif"] = true, ["end"] = true, ["false"] = true, ["for"] = true, + ["function"] = true, ["if"] = true, ["in"] = true, ["local"] = true, + ["nil"] = true, ["not"] = true, ["or"] = true, ["repeat"] = true, + ["return"] = true, ["then"] = true, ["true"] = true, ["until"] = true, + ["while"] = true, +} + +local function lua_name(name) + if LUA_KEYWORDS[name] then + return name .. "_" + end + return name +end + +local RET_OWNER = { + LoadFileText = "UnloadFileText", + LoadUTF8 = "UnloadUTF8", + EncodeDataBase64 = "MemFree", + TextReplaceAlloc = "MemFree", + TextReplaceBetweenAlloc = "MemFree", + TextInsertAlloc = "MemFree", +} + +local SPECIAL = { + TextFormat = true, + TraceLog = true, + CodepointToUTF8 = true, +} + +local emitted_wrappers = 0 + +local function emit_special(f) + if f.name == "TextFormat" then + w("---" .. (clean_description(f.description) or "Text formatting")) + w("---@param fmt string") + w("---@param ... any") + w("---@return string") + w("function M.TextFormat(fmt, ...)") + w(' if select("#", ...) == 0 then') + w(" return fmt") + w(" end") + w(" return string_format(fmt, ...)") + w("end") + w("") + elseif f.name == "TraceLog" then + w("---" .. (clean_description(f.description) or "Show trace log messages")) + w("---@param level integer") + w("---@param fmt string") + w("---@param ... any") + w("---@return nil") + w("function M.TraceLog(level, fmt, ...)") + w(' if select("#", ...) == 0 then') + w(' C.TraceLog(level, "%s", fmt)') + w(" else") + w(' C.TraceLog(level, "%s", string_format(fmt, ...))') + w(" end") + w("end") + w("") + elseif f.name == "CodepointToUTF8" then + w("---" .. (clean_description(f.description) or "Encode a codepoint")) + w("---@param codepoint integer") + w("---@return string|nil") + w("function M.CodepointToUTF8(codepoint)") + w(' local size = ffi.new("int[1]")') + w(" local p = C.CodepointToUTF8(codepoint, size)") + w(" if p == nil then return nil end") + w(" return ffi_string(p, size[0])") + w("end") + w("") + end + emitted_wrappers = emitted_wrappers + 1 +end + +local function emit_function(f) + local params = params_of(f) + local outs = out_params(f) + + local sig = {} + local pre = {} + local args = {} + local arg_ann = {} + local out_vars = {} + local out_ann = {} + + for i, p in ipairs(params) do + local pt = parse_type(p.type) + local name = lua_name(p.name) + if pt.base == "..." then + sig[#sig + 1] = "..." + args[#args + 1] = "..." + arg_ann[#arg_ann + 1] = "---@param ... any" + elseif outs[i] then + local var = "_o" .. i + if outs[i] == "inout" then + pre[#pre + 1] = 'local ' .. var .. ' = ffi.new("' .. pt.base .. '[1]", ' .. name .. ')' + arg_ann[#arg_ann + 1] = "---@param " .. name .. " raylib." .. pt.base + else + pre[#pre + 1] = 'local ' .. var .. ' = ffi.new("' .. pt.base .. '[1]")' + pre[#pre + 1] = "if " .. name .. " ~= nil then " .. var .. "[0] = " .. name .. " end" + arg_ann[#arg_ann + 1] = "---@param " .. name .. "? raylib." .. pt.base + end + args[#args + 1] = var + out_vars[#out_vars + 1] = var .. "[0]" + out_ann[#out_ann + 1] = "---@return raylib." .. pt.base + sig[#sig + 1] = name + else + sig[#sig + 1] = name + arg_ann[#arg_ann + 1] = "---@param " .. name .. " " .. ann_param(p, false) + + if CALLBACKS[pt.base] then + local var = "_cb" .. i + pre[#pre + 1] = "local " .. var .. ' = pin("' .. pt.base .. '", ' .. name .. ")" + args[#args + 1] = var + else + local conv = conversion_for(name, p.type, i) + if conv then + for _, line in ipairs(conv.lines) do + pre[#pre + 1] = line + end + args[#args + 1] = conv.arg + else + args[#args + 1] = name + end + end + end + end + + local desc = clean_description(f.description) + if desc then + w("---" .. desc) + end + for _, line in ipairs(arg_ann) do + w(line) + end + if #out_vars > 0 then + for _, line in ipairs(out_ann) do + w(line) + end + elseif parse_type(f.returnType).base == "void" and parse_type(f.returnType).ptr == 0 then + w("---@return nil") + else + w("---@return " .. ann_return(f.returnType)) + end + + w("function M." .. f.name .. "(" .. table.concat(sig, ", ") .. ")") + for _, line in ipairs(pre) do + w(" " .. line) + end + + local call = "C." .. f.name .. "(" .. table.concat(args, ", ") .. ")" + local ret = parse_type(f.returnType) + + if #out_vars > 0 then + w(" " .. call) + w(" return " .. table.concat(out_vars, ", ")) + elseif ret.base == "void" and ret.ptr == 0 then + w(" " .. call) + elseif ret.base == "char" and ret.ptr == 1 then + local owner = RET_OWNER[f.name] + w(" local _p = " .. call) + w(" if _p == nil then") + w(" return nil") + w(" end") + w(" local _s = ffi_string(_p)") + if owner then + w(" C." .. owner .. "(_p)") + end + w(" return _s") + else + w(" return " .. call) + end + w("end") + w("") + emitted_wrappers = emitted_wrappers + 1 +end + +for _, f in ipairs(FUNCS) do + if not is_skipped(f) then + if SPECIAL[f.name] then + emit_special(f) + else + emit_function(f) + end + end +end + +w("return M") + +---------------------------------------------------------------------------- +-- write +---------------------------------------------------------------------------- + +local text = table.concat(out, "\n") .. "\n" +local file, err = io.open(CFG.out, "wb") +if not file then + die("cannot write %s: %s", CFG.out, err) + return +end +file:write(text) +file:close() + +local n_struct, n_alias, n_cb = 0, 0, 0 +for _, d in ipairs(ordered) do + if d.kind == "struct" then + n_struct = n_struct + 1 + else + n_alias = n_alias + 1 + end +end +for _ in pairs(CALLBACKS) do + n_cb = n_cb + 1 +end +io.stderr:write(string.format( + "gen-hate-no-d: wrote %s (%d functions, %d structs, %d aliases, %d callbacks, %d lines)\n", + CFG.out, emitted_wrappers, n_struct, n_alias, n_cb, #out)) diff --git a/hate-no-d.lua b/hate-no-d.lua new file mode 100644 index 0000000..a544708 --- /dev/null +++ b/hate-no-d.lua @@ -0,0 +1,11140 @@ +--[[ + hate-no-d.lua - generated by gen-hate-no-d.lua, do not edit. + + raylib 6.5-dev / rlgl / raymath + Functions: 928 + + raymath symbols come from rcore.o (RAYMATH_IMPLEMENTATION) in libraylib.a. +]] + +local ffi = require("ffi") + +ffi.cdef[[ +struct rAudioBuffer; +struct rAudioProcessor; + +typedef struct Vector2 { + float x; + float y; +} Vector2; + +typedef struct Vector3 { + float x; + float y; + float z; +} Vector3; + +typedef struct Vector4 { + float x; + float y; + float z; + float w; +} Vector4; + +typedef struct Matrix { + float m0; + float m4; + float m8; + float m12; + float m1; + float m5; + float m9; + float m13; + float m2; + float m6; + float m10; + float m14; + float m3; + float m7; + float m11; + float m15; +} Matrix; + +typedef struct Color { + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char a; +} Color; + +typedef struct Rectangle { + float x; + float y; + float width; + float height; +} Rectangle; + +typedef struct Image { + void *data; + int width; + int height; + int mipmaps; + int format; +} Image; + +typedef struct Texture { + unsigned int id; + int width; + int height; + int mipmaps; + int format; +} Texture; + +typedef struct RenderTexture { + unsigned int id; + Texture texture; + Texture depth; +} RenderTexture; + +typedef struct NPatchInfo { + Rectangle source; + int left; + int top; + int right; + int bottom; + int layout; +} NPatchInfo; + +typedef struct GlyphInfo { + int value; + int offsetX; + int offsetY; + int advanceX; + Image image; +} GlyphInfo; + +typedef Texture Texture2D; + +typedef struct Font { + int baseSize; + int glyphCount; + int glyphPadding; + Texture2D texture; + Rectangle *recs; + GlyphInfo *glyphs; +} Font; + +typedef struct Camera3D { + Vector3 position; + Vector3 target; + Vector3 up; + float fovy; + int projection; +} Camera3D; + +typedef struct Camera2D { + Vector2 offset; + Vector2 target; + float rotation; + float zoom; +} Camera2D; + +typedef struct Mesh { + int vertexCount; + int triangleCount; + float *vertices; + float *texcoords; + float *texcoords2; + float *normals; + float *tangents; + unsigned char *colors; + unsigned short *indices; + int boneCount; + unsigned char *boneIndices; + float *boneWeights; + float *animVertices; + float *animNormals; + unsigned int vaoId; + unsigned int *vboId; +} Mesh; + +typedef struct Shader { + unsigned int id; + int *locs; +} Shader; + +typedef struct MaterialMap { + Texture2D texture; + Color color; + float value; +} MaterialMap; + +typedef struct Material { + Shader shader; + MaterialMap *maps; + float params[4]; +} Material; + +typedef Vector4 Quaternion; + +typedef struct Transform { + Vector3 translation; + Quaternion rotation; + Vector3 scale; +} Transform; + +typedef struct BoneInfo { + char name[32]; + int parent; +} BoneInfo; + +typedef Transform * ModelAnimPose; + +typedef struct ModelSkeleton { + unsigned int boneCount; + BoneInfo *bones; + ModelAnimPose bindPose; +} ModelSkeleton; + +typedef struct Model { + Matrix transform; + int meshCount; + int materialCount; + Mesh *meshes; + Material *materials; + int *meshMaterial; + ModelSkeleton skeleton; + ModelAnimPose currentPose; + Matrix *boneMatrices; +} Model; + +typedef struct ModelAnimation { + char name[32]; + unsigned int boneCount; + int keyframeCount; + ModelAnimPose *keyframePoses; +} ModelAnimation; + +typedef struct Ray { + Vector3 position; + Vector3 direction; +} Ray; + +typedef struct RayCollision { + bool hit; + float distance; + Vector3 point; + Vector3 normal; +} RayCollision; + +typedef struct BoundingBox { + Vector3 min; + Vector3 max; +} BoundingBox; + +typedef struct Wave { + unsigned int frameCount; + unsigned int sampleRate; + unsigned int sampleSize; + unsigned int channels; + void *data; +} Wave; + +typedef struct AudioStream { + struct rAudioBuffer *buffer; + struct rAudioProcessor *processor; + unsigned int sampleRate; + unsigned int sampleSize; + unsigned int channels; +} AudioStream; + +typedef struct Sound { + AudioStream stream; + unsigned int frameCount; +} Sound; + +typedef struct Music { + AudioStream stream; + unsigned int frameCount; + bool looping; + int ctxType; + void *ctxData; +} Music; + +typedef struct VrDeviceInfo { + int hResolution; + int vResolution; + float hScreenSize; + float vScreenSize; + float eyeToScreenDistance; + float lensSeparationDistance; + float interpupillaryDistance; + float lensDistortionValues[4]; + float chromaAbCorrection[4]; +} VrDeviceInfo; + +typedef struct VrStereoConfig { + Matrix projection[2]; + Matrix viewOffset[2]; + float leftLensCenter[2]; + float rightLensCenter[2]; + float leftScreenCenter[2]; + float rightScreenCenter[2]; + float scale[2]; + float scaleIn[2]; +} VrStereoConfig; + +typedef struct FilePathList { + unsigned int count; + char **paths; +} FilePathList; + +typedef struct AutomationEvent { + unsigned int frame; + unsigned int type; + int params[4]; +} AutomationEvent; + +typedef struct AutomationEventList { + unsigned int capacity; + unsigned int count; + AutomationEvent *events; +} AutomationEventList; + +typedef Texture TextureCubemap; + +typedef RenderTexture RenderTexture2D; + +typedef Camera3D Camera; + +typedef struct rlVertexBuffer { + int elementCount; + float *vertices; + float *texcoords; + float *normals; + unsigned char *colors; + unsigned int *indices; + unsigned int vaoId; + unsigned int vboId[5]; +} rlVertexBuffer; + +typedef struct rlDrawCall { + int mode; + int vertexCount; + int vertexAlignment; + unsigned int textureId; +} rlDrawCall; + +typedef struct rlRenderBatch { + int bufferCount; + int currentBuffer; + rlVertexBuffer *vertexBuffer; + rlDrawCall *draws; + int drawCounter; + float currentDepth; +} rlRenderBatch; + +typedef struct float3 { + float v[3]; +} float3; + +typedef struct float16 { + float v[16]; +} float16; + +typedef void (*AudioCallback)(void * bufferData, unsigned int frames); + +typedef unsigned char * (*LoadFileDataCallback)(const char * fileName, int * dataSize); + +typedef bool (*SaveFileDataCallback)(const char * fileName, const void * data, int dataSize); + +typedef char * (*LoadFileTextCallback)(const char * fileName); + +typedef bool (*SaveFileTextCallback)(const char * fileName, const char * text); + +void InitWindow(int width, int height, const char * title); +void CloseWindow(void); +bool WindowShouldClose(void); +bool IsWindowReady(void); +bool IsWindowFullscreen(void); +bool IsWindowHidden(void); +bool IsWindowMinimized(void); +bool IsWindowMaximized(void); +bool IsWindowFocused(void); +bool IsWindowResized(void); +bool IsWindowState(unsigned int flag); +void SetWindowState(unsigned int flags); +void ClearWindowState(unsigned int flags); +void ToggleFullscreen(void); +void ToggleBorderlessWindowed(void); +void MaximizeWindow(void); +void MinimizeWindow(void); +void RestoreWindow(void); +void SetWindowIcon(Image image); +void SetWindowIcons(Image * images, int count); +void SetWindowTitle(const char * title); +void SetWindowPosition(int x, int y); +void SetWindowMonitor(int monitor); +void SetWindowMinSize(int width, int height); +void SetWindowMaxSize(int width, int height); +void SetWindowSize(int width, int height); +void SetWindowOpacity(float opacity); +void SetWindowFocused(void); +void * GetWindowHandle(void); +int GetScreenWidth(void); +int GetScreenHeight(void); +int GetRenderWidth(void); +int GetRenderHeight(void); +int GetMonitorCount(void); +int GetCurrentMonitor(void); +Vector2 GetMonitorPosition(int monitor); +int GetMonitorWidth(int monitor); +int GetMonitorHeight(int monitor); +int GetMonitorPhysicalWidth(int monitor); +int GetMonitorPhysicalHeight(int monitor); +int GetMonitorRefreshRate(int monitor); +Vector2 GetWindowPosition(void); +Vector2 GetWindowScaleDPI(void); +const char * GetMonitorName(int monitor); +void SetClipboardText(const char * text); +const char * GetClipboardText(void); +Image GetClipboardImage(void); +void EnableEventWaiting(void); +void DisableEventWaiting(void); +void ShowCursor(void); +void HideCursor(void); +bool IsCursorHidden(void); +void EnableCursor(void); +void DisableCursor(void); +bool IsCursorOnScreen(void); +void ClearBackground(Color color); +void BeginDrawing(void); +void EndDrawing(void); +void BeginMode2D(Camera2D camera); +void EndMode2D(void); +void BeginMode3D(Camera3D camera); +void EndMode3D(void); +void BeginTextureMode(RenderTexture2D target); +void EndTextureMode(void); +void BeginShaderMode(Shader shader); +void EndShaderMode(void); +void BeginBlendMode(int mode); +void EndBlendMode(void); +void BeginScissorMode(int x, int y, int width, int height); +void EndScissorMode(void); +void BeginVrStereoMode(VrStereoConfig config); +void EndVrStereoMode(void); +VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device); +void UnloadVrStereoConfig(VrStereoConfig config); +Shader LoadShader(const char * vsFileName, const char * fsFileName); +Shader LoadShaderFromMemory(const char * vsCode, const char * fsCode); +bool IsShaderValid(Shader shader); +int GetShaderLocation(Shader shader, const char * uniformName); +int GetShaderLocationAttrib(Shader shader, const char * attribName); +void SetShaderValue(Shader shader, int locIndex, const void * value, int uniformType); +void SetShaderValueV(Shader shader, int locIndex, const void * value, int uniformType, int count); +void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); +void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); +void UnloadShader(Shader shader); +Ray GetScreenToWorldRay(Vector2 position, Camera camera); +Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height); +Vector2 GetWorldToScreen(Vector3 position, Camera camera); +Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); +Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); +Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); +Matrix GetCameraMatrix(Camera camera); +Matrix GetCameraMatrix2D(Camera2D camera); +void SetTargetFPS(int fps); +float GetFrameTime(void); +double GetTime(void); +int GetFPS(void); +void SwapScreenBuffer(void); +void PollInputEvents(void); +void WaitTime(double seconds); +void SetRandomSeed(unsigned int seed); +int GetRandomValue(int min, int max); +int * LoadRandomSequence(unsigned int count, int min, int max); +void UnloadRandomSequence(int * sequence); +void TakeScreenshot(const char * fileName); +void SetConfigFlags(unsigned int flags); +void OpenURL(const char * url); +void SetTraceLogLevel(int logLevel); +void TraceLog(int logLevel, const char * text, ...); +void * MemAlloc(unsigned int size); +void * MemRealloc(void * ptr, unsigned int size); +void MemFree(void * ptr); +unsigned char * LoadFileData(const char * fileName, int * dataSize); +void UnloadFileData(unsigned char * data); +bool SaveFileData(const char * fileName, const void * data, int dataSize); +bool ExportDataAsCode(const unsigned char * data, int dataSize, const char * fileName); +char * LoadFileText(const char * fileName); +void UnloadFileText(char * text); +bool SaveFileText(const char * fileName, const char * text); +void SetLoadFileDataCallback(LoadFileDataCallback callback); +void SetSaveFileDataCallback(SaveFileDataCallback callback); +void SetLoadFileTextCallback(LoadFileTextCallback callback); +void SetSaveFileTextCallback(SaveFileTextCallback callback); +int FileRename(const char * fileName, const char * fileRename); +int FileRemove(const char * fileName); +int FileCopy(const char * srcPath, const char * dstPath); +int FileMove(const char * srcPath, const char * dstPath); +int FileTextReplace(const char * fileName, const char * search, const char * replacement); +int FileTextFindIndex(const char * fileName, const char * search); +bool FileExists(const char * fileName); +bool DirectoryExists(const char * dirPath); +bool IsFileExtension(const char * fileName, const char * ext); +bool IsFileHidden(const char * filePath); +int GetFileLength(const char * fileName); +long GetFileModTime(const char * fileName); +const char * GetFileExtension(const char * fileName); +const char * GetFileName(const char * filePath); +const char * GetFileNameWithoutExt(const char * filePath); +const char * GetDirectoryPath(const char * filePath); +const char * GetPrevDirectoryPath(const char * dirPath); +const char * GetWorkingDirectory(void); +const char * GetApplicationDirectory(void); +int MakeDirectory(const char * dirPath); +int ChangeDirectory(const char * dirPath); +bool IsPathFile(const char * path); +bool IsPathDirectory(const char * path); +bool IsPathAbsolute(const char * path); +bool IsFileNameValid(const char * fileName); +FilePathList LoadDirectoryFiles(const char * dirPath); +FilePathList LoadDirectoryFilesEx(const char * basePath, const char * filter, bool scanSubdirs); +void UnloadDirectoryFiles(FilePathList files); +bool IsFileDropped(void); +FilePathList LoadDroppedFiles(void); +void UnloadDroppedFiles(FilePathList files); +unsigned int GetDirectoryFileCount(const char * dirPath); +unsigned int GetDirectoryFileCountEx(const char * basePath, const char * filter, bool scanSubdirs); +unsigned char * CompressData(const unsigned char * data, int dataSize, int * compDataSize); +unsigned char * DecompressData(const unsigned char * compData, int compDataSize, int * dataSize); +char * EncodeDataBase64(const unsigned char * data, int dataSize, int * outputSize); +unsigned char * DecodeDataBase64(const char * text, int * outputSize); +unsigned int ComputeCRC32(const unsigned char * data, int dataSize); +unsigned int * ComputeMD5(const unsigned char * data, int dataSize); +unsigned int * ComputeSHA1(const unsigned char * data, int dataSize); +unsigned int * ComputeSHA256(const unsigned char * data, int dataSize); +AutomationEventList LoadAutomationEventList(const char * fileName); +void UnloadAutomationEventList(AutomationEventList list); +bool ExportAutomationEventList(AutomationEventList list, const char * fileName); +void SetAutomationEventList(AutomationEventList * list); +void SetAutomationEventBaseFrame(int frame); +void StartAutomationEventRecording(void); +void StopAutomationEventRecording(void); +void PlayAutomationEvent(AutomationEvent event); +bool IsKeyPressed(int key); +bool IsKeyPressedRepeat(int key); +bool IsKeyDown(int key); +bool IsKeyReleased(int key); +bool IsKeyUp(int key); +int GetKeyPressed(void); +int GetCharPressed(void); +const char * GetKeyName(int key); +void SetExitKey(int key); +bool IsGamepadAvailable(int gamepad); +const char * GetGamepadName(int gamepad); +bool IsGamepadButtonPressed(int gamepad, int button); +bool IsGamepadButtonDown(int gamepad, int button); +bool IsGamepadButtonReleased(int gamepad, int button); +bool IsGamepadButtonUp(int gamepad, int button); +int GetGamepadButtonPressed(void); +int GetGamepadAxisCount(int gamepad); +float GetGamepadAxisMovement(int gamepad, int axis); +int SetGamepadMappings(const char * mappings); +void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); +bool IsMouseButtonPressed(int button); +bool IsMouseButtonDown(int button); +bool IsMouseButtonReleased(int button); +bool IsMouseButtonUp(int button); +int GetMouseX(void); +int GetMouseY(void); +Vector2 GetMousePosition(void); +Vector2 GetMouseDelta(void); +void SetMousePosition(int x, int y); +void SetMouseOffset(int offsetX, int offsetY); +void SetMouseScale(float scaleX, float scaleY); +float GetMouseWheelMove(void); +Vector2 GetMouseWheelMoveV(void); +void SetMouseCursor(int cursor); +int GetTouchX(void); +int GetTouchY(void); +Vector2 GetTouchPosition(int index); +int GetTouchPointId(int index); +int GetTouchPointCount(void); +void SetGesturesEnabled(unsigned int flags); +bool IsGestureDetected(unsigned int gesture); +int GetGestureDetected(void); +float GetGestureHoldDuration(void); +Vector2 GetGestureDragVector(void); +float GetGestureDragAngle(void); +Vector2 GetGesturePinchVector(void); +float GetGesturePinchAngle(void); +void UpdateCamera(Camera * camera, int mode); +void UpdateCameraPro(Camera * camera, Vector3 movement, Vector3 rotation, float zoom); +void SetShapesTexture(Texture2D texture, Rectangle rec); +Texture2D GetShapesTexture(void); +Rectangle GetShapesTextureRectangle(void); +void DrawPixel(int posX, int posY, Color color); +void DrawPixelV(Vector2 position, Color color); +void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); +void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); +void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); +void DrawLineStrip(const Vector2 * points, int pointCount, Color color); +void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); +void DrawLineDashed(Vector2 startPos, Vector2 endPos, int dashSize, int spaceSize, Color color); +void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); +void DrawTriangleGradient(Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); +void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); +void DrawTriangleLinesEx(Vector2 v1, Vector2 v2, Vector2 v3, float thick, Color color); +void DrawTriangleFan(const Vector2 * points, int pointCount, Color color); +void DrawTriangleStrip(const Vector2 * points, int pointCount, Color color); +void DrawRectangle(int posX, int posY, int width, int height, Color color); +void DrawRectangleV(Vector2 position, Vector2 size, Color color); +void DrawRectangleRec(Rectangle rec, Color color); +void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); +void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); +void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); +void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); +void DrawRectangleLines(int posX, int posY, int width, int height, Color color); +void DrawRectangleLinesEx(Rectangle rec, float thick, Color color); +void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); +void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, Color color); +void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, float thick, Color color); +void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); +void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); +void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float thick, Color color); +void DrawCircle(int centerX, int centerY, float radius, Color color); +void DrawCircleV(Vector2 center, float radius, Color color); +void DrawCircleGradient(Vector2 center, float radius, Color inner, Color outer); +void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); +void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); +void DrawCircleSectorLinesEx(Vector2 center, float radius, float startAngle, float endAngle, int segments, float thick, Color color); +void DrawCircleLines(int centerX, int centerY, float radius, Color color); +void DrawCircleLinesV(Vector2 center, float radius, Color color); +void DrawCircleLinesEx(Vector2 center, float radius, float thick, Color color); +void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); +void DrawEllipseV(Vector2 center, float radiusH, float radiusV, Color color); +void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); +void DrawEllipseLinesV(Vector2 center, float radiusH, float radiusV, Color color); +void DrawEllipseLinesEx(Vector2 center, float radiusH, float radiusV, float thick, Color color); +void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); +void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); +void DrawRingLinesEx(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, float thick, Color color); +void DrawSplineLinear(const Vector2 * points, int pointCount, float thick, Color color); +void DrawSplineBasis(const Vector2 * points, int pointCount, float thick, Color color); +void DrawSplineCatmullRom(const Vector2 * points, int pointCount, float thick, Color color); +void DrawSplineBezierQuadratic(const Vector2 * points, int pointCount, float thick, Color color); +void DrawSplineBezierCubic(const Vector2 * points, int pointCount, float thick, Color color); +void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); +void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); +void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); +void DrawSplineSegmentBezierQuadratic(Vector2 p1, Vector2 c2, Vector2 p3, float thick, Color color); +void DrawSplineSegmentBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float thick, Color color); +Vector2 GetSplinePointLinear(Vector2 startPos, Vector2 endPos, float t); +Vector2 GetSplinePointBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float t); +Vector2 GetSplinePointCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float t); +Vector2 GetSplinePointBezierQuadratic(Vector2 p1, Vector2 c2, Vector2 p3, float t); +Vector2 GetSplinePointBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float t); +bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); +bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); +bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); +bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2); +bool CheckCollisionPointRec(Vector2 point, Rectangle rec); +bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); +bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); +bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); +bool CheckCollisionPointPoly(Vector2 point, const Vector2 * points, int pointCount); +bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 * collisionPoint); +Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); +Image LoadImage(const char * fileName); +Image LoadImageRaw(const char * fileName, int width, int height, int format, int headerSize); +Image LoadImageAnim(const char * fileName, int * frames); +Image LoadImageAnimFromMemory(const char * fileType, const unsigned char * fileData, int dataSize, int * frames); +Image LoadImageFromMemory(const char * fileType, const unsigned char * fileData, int dataSize); +Image LoadImageFromTexture(Texture2D texture); +Image LoadImageFromScreen(void); +bool IsImageValid(Image image); +void UnloadImage(Image image); +bool ExportImage(Image image, const char * fileName); +unsigned char * ExportImageToMemory(Image image, const char * fileType, int * fileSize); +bool ExportImageAsCode(Image image, const char * fileName); +Image GenImageColor(int width, int height, Color color); +Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end); +Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); +Image GenImageGradientSquare(int width, int height, float density, Color inner, Color outer); +Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); +Image GenImageWhiteNoise(int width, int height, float factor); +Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); +Image GenImageCellular(int width, int height, int tileSize); +Image GenImageText(int width, int height, const char * text); +Image ImageCopy(Image image); +Image ImageFromImage(Image image, Rectangle rec); +Image ImageFromChannel(Image image, int selectedChannel); +Image ImageText(const char * text, int fontSize, Color color); +Image ImageTextEx(Font font, const char * text, float fontSize, float spacing, Color tint); +void ImageFormat(Image * image, int newFormat); +void ImageToPOT(Image * image, Color fill); +void ImageCrop(Image * image, Rectangle crop); +void ImageAlphaCrop(Image * image, float threshold); +void ImageAlphaClear(Image * image, Color color, float threshold); +void ImageAlphaMask(Image * image, Image alphaMask); +void ImageAlphaPremultiply(Image * image); +void ImageBlurGaussian(Image * image, int blurSize); +void ImageKernelConvolution(Image * image, const float * kernel, int kernelSize); +void ImageResize(Image * image, int newWidth, int newHeight); +void ImageResizeNN(Image * image, int newWidth, int newHeight); +void ImageResizeCanvas(Image * image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); +void ImageMipmaps(Image * image); +void ImageDither(Image * image, int rBpp, int gBpp, int bBpp, int aBpp); +void ImageFlipVertical(Image * image); +void ImageFlipHorizontal(Image * image); +void ImageRotate(Image * image, int degrees); +void ImageRotateCW(Image * image); +void ImageRotateCCW(Image * image); +void ImageColorTint(Image * image, Color color); +void ImageColorInvert(Image * image); +void ImageColorGrayscale(Image * image); +void ImageColorContrast(Image * image, int contrast); +void ImageColorBrightness(Image * image, int brightness); +void ImageColorReplace(Image * image, Color color, Color replace); +Color * LoadImageColors(Image image); +Color * LoadImagePalette(Image image, int maxPaletteSize, int * colorCount); +void UnloadImageColors(Color * colors); +void UnloadImagePalette(Color * colors); +Rectangle GetImageAlphaBorder(Image image, float threshold); +Color GetImageColor(Image image, int x, int y); +void ImageClearBackground(Image * dst, Color color); +void ImageDrawPixel(Image * dst, int posX, int posY, Color color); +void ImageDrawPixelV(Image * dst, Vector2 position, Color color); +void ImageDrawLine(Image * dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); +void ImageDrawLineV(Image * dst, Vector2 start, Vector2 end, Color color); +void ImageDrawLineEx(Image * dst, Vector2 start, Vector2 end, int thick, Color color); +void ImageDrawLineStrip(Image * dst, const Vector2 * points, int pointCount, Color color); +void ImageDrawTriangle(Image * dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); +void ImageDrawTriangleGradient(Image * dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); +void ImageDrawTriangleLines(Image * dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); +void ImageDrawTriangleFan(Image * dst, const Vector2 * points, int pointCount, Color color); +void ImageDrawTriangleStrip(Image * dst, const Vector2 * points, int pointCount, Color color); +void ImageDrawRectangle(Image * dst, int posX, int posY, int width, int height, Color color); +void ImageDrawRectangleV(Image * dst, Vector2 position, Vector2 size, Color color); +void ImageDrawRectangleRec(Image * dst, Rectangle rec, Color color); +void ImageDrawRectanglePro(Image * dst, Rectangle rec, Vector2 origin, float rotation, Color color); +void ImageDrawRectangleLines(Image * dst, int posX, int posY, int width, int height, Color color); +void ImageDrawRectangleLinesEx(Image * dst, Rectangle rec, int thick, Color color); +void ImageDrawRectangleGradientEx(Image * dst, Rectangle rec, Color col1, Color col2, Color col3, Color col4); +void ImageDrawCircle(Image * dst, int centerX, int centerY, int radius, Color color); +void ImageDrawCircleV(Image * dst, Vector2 center, int radius, Color color); +void ImageDrawCircleLines(Image * dst, int centerX, int centerY, int radius, Color color); +void ImageDrawCircleLinesV(Image * dst, Vector2 center, int radius, Color color); +void ImageDrawCircleGradient(Image * dst, Vector2 center, float radius, Color inner, Color outer); +void ImageDrawImage(Image * dst, Image src, int posX, int posY, Color tint); +void ImageDrawImageEx(Image * dst, Image src, Vector2 position, float rotation, float scale, Color tint); +void ImageDrawImageRec(Image * dst, Image src, Rectangle srcRec, Vector2 position, Color tint); +void ImageDrawImagePro(Image * dst, Image src, Rectangle srcRec, Rectangle dstRec, Vector2 origin, float rotation, Color tint); +void ImageDrawText(Image * dst, const char * text, int posX, int posY, int fontSize, Color color); +void ImageDrawTextEx(Image * dst, Font font, const char * text, Vector2 position, float fontSize, float spacing, Color tint); +void ImageDrawTextPro(Image * dst, Font font, const char * text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); +Texture2D LoadTexture(const char * fileName); +Texture2D LoadTextureFromImage(Image image); +TextureCubemap LoadTextureCubemap(Image image, int layout); +RenderTexture2D LoadRenderTexture(int width, int height); +RenderTexture2D LoadRenderTextureEx(int width, int height, int format); +bool IsTextureValid(Texture2D texture); +void UnloadTexture(Texture2D texture); +bool IsRenderTextureValid(RenderTexture2D target); +void UnloadRenderTexture(RenderTexture2D target); +void UpdateTexture(Texture2D texture, const void * pixels); +void UpdateTextureRec(Texture2D texture, Rectangle rec, const void * pixels); +void GenTextureMipmaps(Texture2D * texture); +void SetTextureFilter(Texture2D texture, int filter); +void SetTextureWrap(Texture2D texture, int wrap); +void DrawTexture(Texture2D texture, int posX, int posY, Color tint); +void DrawTextureV(Texture2D texture, Vector2 position, Color tint); +void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); +void DrawTextureRec(Texture2D texture, Rectangle rec, Vector2 position, Color tint); +void DrawTexturePro(Texture2D texture, Rectangle srcrec, Rectangle dstrec, Vector2 origin, float rotation, Color tint); +void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dstrec, Vector2 origin, float rotation, Color tint); +bool ColorIsEqual(Color col1, Color col2); +Color Fade(Color color, float alpha); +int ColorToInt(Color color); +Vector4 ColorNormalize(Color color); +Color ColorFromNormalized(Vector4 normalized); +Vector3 ColorToHSV(Color color); +Color ColorFromHSV(float hue, float saturation, float value); +Color ColorTint(Color color, Color tint); +Color ColorBrightness(Color color, float factor); +Color ColorContrast(Color color, float contrast); +Color ColorAlpha(Color color, float alpha); +Color ColorAlphaBlend(Color dst, Color src, Color tint); +Color ColorLerp(Color color1, Color color2, float factor); +Color GetColor(unsigned int hexValue); +Color GetPixelColor(const void * srcPtr, int format); +void SetPixelColor(void * dstPtr, Color color, int format); +int GetPixelDataSize(int width, int height, int format); +Font GetFontDefault(void); +Font LoadFont(const char * fileName); +Font LoadFontEx(const char * fileName, int fontSize, const int * codepoints, int codepointCount); +Font LoadFontFromImage(Image image, Color key, int firstChar); +Font LoadFontFromMemory(const char * fileType, const unsigned char * fileData, int dataSize, int fontSize, const int * codepoints, int codepointCount); +bool IsFontValid(Font font); +GlyphInfo * LoadFontData(const unsigned char * fileData, int dataSize, int fontSize, const int * codepoints, int codepointCount, int type, int * glyphCount); +Image GenImageFontAtlas(const GlyphInfo * glyphs, Rectangle ** glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); +void UnloadFontData(GlyphInfo * glyphs, int glyphCount); +void UnloadFont(Font font); +bool ExportFontAsCode(Font font, const char * fileName); +void DrawFPS(int posX, int posY); +void DrawText(const char * text, int posX, int posY, int fontSize, Color color); +void DrawTextEx(Font font, const char * text, Vector2 position, float fontSize, float spacing, Color tint); +void DrawTextPro(Font font, const char * text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); +void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); +void DrawTextCodepoints(Font font, const int * codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint); +void SetTextLineSpacing(int spacing); +int MeasureText(const char * text, int fontSize); +Vector2 MeasureTextEx(Font font, const char * text, float fontSize, float spacing); +Vector2 MeasureTextCodepoints(Font font, const int * codepoints, int length, float fontSize, float spacing); +int GetGlyphIndex(Font font, int codepoint); +GlyphInfo GetGlyphInfo(Font font, int codepoint); +Rectangle GetGlyphAtlasRec(Font font, int codepoint); +char * LoadUTF8(const int * codepoints, int length); +void UnloadUTF8(char * text); +int * LoadCodepoints(const char * text, int * count); +void UnloadCodepoints(int * codepoints); +int GetCodepointCount(const char * text); +int GetCodepoint(const char * text, int * codepointSize); +int GetCodepointNext(const char * text, int * codepointSize); +int GetCodepointPrevious(const char * text, int * codepointSize); +const char * CodepointToUTF8(int codepoint, int * utf8Size); +char ** LoadTextLines(const char * text, int * count); +void UnloadTextLines(char ** text, int lineCount); +int TextCopy(char * dst, const char * src); +bool TextIsEqual(const char * text1, const char * text2); +unsigned int TextLength(const char * text); +const char * TextFormat(const char * text, ...); +const char * TextSubtext(const char * text, int position, int length); +const char * TextRemoveSpaces(const char * text); +char * GetTextBetween(const char * text, const char * begin, const char * end); +char * TextReplace(const char * text, const char * search, const char * replacement); +char * TextReplaceAlloc(const char * text, const char * search, const char * replacement); +char * TextReplaceBetween(const char * text, const char * begin, const char * end, const char * replacement); +char * TextReplaceBetweenAlloc(const char * text, const char * begin, const char * end, const char * replacement); +char * TextInsert(const char * text, const char * insert, int position); +char * TextInsertAlloc(const char * text, const char * insert, int position); +char * TextJoin(char ** textList, int count, const char * delimiter); +char ** TextSplit(const char * text, char delimiter, int * count); +void TextAppend(char * text, const char * append, int * position); +int TextFindIndex(const char * text, const char * search); +char * TextToUpper(const char * text); +char * TextToLower(const char * text); +char * TextToPascal(const char * text); +char * TextToSnake(const char * text); +char * TextToCamel(const char * text); +int TextToInteger(const char * text); +float TextToFloat(const char * text); +void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); +void DrawPoint3D(Vector3 position, Color color); +void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); +void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); +void DrawTriangleStrip3D(const Vector3 * points, int pointCount, Color color); +void DrawCube(Vector3 position, float width, float height, float length, Color color); +void DrawCubeV(Vector3 position, Vector3 size, Color color); +void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); +void DrawCubeWiresV(Vector3 position, Vector3 size, Color color); +void DrawSphere(Vector3 centerPos, float radius, Color color); +void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); +void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); +void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int sides, Color color); +void DrawCylinderEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); +void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int sides, Color color); +void DrawCylinderWiresEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); +void DrawCapsule(Vector3 startPos, Vector3 endPos, float radius, int rings, int slices, Color color); +void DrawCapsuleWires(Vector3 startPos, Vector3 endPos, float radius, int rings, int slices, Color color); +void DrawPlane(Vector3 centerPos, Vector2 size, Color color); +void DrawRay(Ray ray, Color color); +void DrawGrid(int slices, float spacing); +Model LoadModel(const char * fileName); +Model LoadModelFromMesh(Mesh mesh); +bool IsModelValid(Model model); +void UnloadModel(Model model); +BoundingBox GetModelBoundingBox(Model model); +void DrawModel(Model model, Vector3 position, float scale, Color tint); +void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); +void DrawModelWires(Model model, Vector3 position, float scale, Color tint); +void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); +void DrawBoundingBox(BoundingBox box, Color color); +void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint); +void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle rec, Vector3 position, Vector2 size, Color tint); +void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle rec, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); +void UploadMesh(Mesh * mesh, bool dynamic); +void UpdateMeshBuffer(Mesh mesh, int index, const void * data, int dataSize, int offset); +void UnloadMesh(Mesh mesh); +void DrawMesh(Mesh mesh, Material material, Matrix transform); +void DrawMeshInstanced(Mesh mesh, Material material, const Matrix * transforms, int instances); +BoundingBox GetMeshBoundingBox(Mesh mesh); +void GenMeshTangents(Mesh * mesh); +bool ExportMesh(Mesh mesh, const char * fileName); +bool ExportMeshAsCode(Mesh mesh, const char * fileName); +Mesh GenMeshPoly(int sides, float radius); +Mesh GenMeshPlane(float width, float length, int resX, int resZ); +Mesh GenMeshCube(float width, float height, float length); +Mesh GenMeshSphere(float radius, int rings, int slices); +Mesh GenMeshHemiSphere(float radius, int rings, int slices); +Mesh GenMeshCylinder(float radius, float height, int slices); +Mesh GenMeshCone(float radius, float height, int slices); +Mesh GenMeshTorus(float radius, float size, int radSeg, int sides); +Mesh GenMeshKnot(float radius, float size, int radSeg, int sides); +Mesh GenMeshHeightmap(Image heightmap, Vector3 size); +Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); +Material * LoadMaterials(const char * fileName, int * materialCount); +Material LoadMaterialDefault(void); +bool IsMaterialValid(Material material); +void UnloadMaterial(Material material); +void SetMaterialTexture(Material * material, int mapType, Texture2D texture); +void SetModelMeshMaterial(Model * model, int meshId, int materialId); +ModelAnimation * LoadModelAnimations(const char * fileName, int * animCount); +void UpdateModelAnimation(Model model, ModelAnimation anim, float frame); +void UpdateModelAnimationEx(Model model, ModelAnimation animA, float frameA, ModelAnimation animB, float frameB, float blend); +void UnloadModelAnimations(ModelAnimation * animations, int animCount); +bool IsModelAnimationValid(Model model, ModelAnimation anim); +bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); +bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); +bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); +RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius); +RayCollision GetRayCollisionBox(Ray ray, BoundingBox box); +RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix transform); +RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); +RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4); +void InitAudioDevice(void); +void CloseAudioDevice(void); +bool IsAudioDeviceReady(void); +void SetMasterVolume(float volume); +float GetMasterVolume(void); +Wave LoadWave(const char * fileName); +Wave LoadWaveFromMemory(const char * fileType, const unsigned char * fileData, int dataSize); +bool IsWaveValid(Wave wave); +Sound LoadSound(const char * fileName); +Sound LoadSoundFromWave(Wave wave); +Sound LoadSoundAlias(Sound source); +bool IsSoundValid(Sound sound); +void UpdateSound(Sound sound, const void * data, int frameCount); +void UnloadWave(Wave wave); +void UnloadSound(Sound sound); +void UnloadSoundAlias(Sound alias); +bool ExportWave(Wave wave, const char * fileName); +bool ExportWaveAsCode(Wave wave, const char * fileName); +void PlaySound(Sound sound); +void StopSound(Sound sound); +void PauseSound(Sound sound); +void ResumeSound(Sound sound); +bool IsSoundPlaying(Sound sound); +void SetSoundVolume(Sound sound, float volume); +void SetSoundPitch(Sound sound, float pitch); +void SetSoundPan(Sound sound, float pan); +Wave WaveCopy(Wave wave); +void WaveCrop(Wave * wave, int initFrame, int finalFrame); +void WaveFormat(Wave * wave, int sampleRate, int sampleSize, int channels); +float * LoadWaveSamples(Wave wave); +void UnloadWaveSamples(float * samples); +Music LoadMusicStream(const char * fileName); +Music LoadMusicStreamFromMemory(const char * fileType, const unsigned char * data, int dataSize); +bool IsMusicValid(Music music); +void UnloadMusicStream(Music music); +void PlayMusicStream(Music music); +bool IsMusicStreamPlaying(Music music); +void UpdateMusicStream(Music music); +void StopMusicStream(Music music); +void PauseMusicStream(Music music); +void ResumeMusicStream(Music music); +void SeekMusicStream(Music music, float position); +void SetMusicVolume(Music music, float volume); +void SetMusicPitch(Music music, float pitch); +void SetMusicPan(Music music, float pan); +float GetMusicTimeLength(Music music); +float GetMusicTimePlayed(Music music); +AudioStream LoadAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); +bool IsAudioStreamValid(AudioStream stream); +void UnloadAudioStream(AudioStream stream); +void UpdateAudioStream(AudioStream stream, const void * data, int frameCount); +bool IsAudioStreamProcessed(AudioStream stream); +void PlayAudioStream(AudioStream stream); +void PauseAudioStream(AudioStream stream); +void ResumeAudioStream(AudioStream stream); +bool IsAudioStreamPlaying(AudioStream stream); +void StopAudioStream(AudioStream stream); +void SetAudioStreamVolume(AudioStream stream, float volume); +void SetAudioStreamPitch(AudioStream stream, float pitch); +void SetAudioStreamPan(AudioStream stream, float pan); +void SetAudioStreamBufferSizeDefault(int size); +void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); +void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); +void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); +void AttachAudioMixedProcessor(AudioCallback processor); +void DetachAudioMixedProcessor(AudioCallback processor); +void rlMatrixMode(int mode); +void rlPushMatrix(void); +void rlPopMatrix(void); +void rlLoadIdentity(void); +void rlTranslatef(float x, float y, float z); +void rlRotatef(float angle, float x, float y, float z); +void rlScalef(float x, float y, float z); +void rlMultMatrixf(const float * matf); +void rlFrustum(float left, float right, float bottom, float top, float znear, float zfar); +void rlOrtho(float left, float right, float bottom, float top, float znear, float zfar); +void rlViewport(int x, int y, int width, int height); +void rlSetClipPlanes(float nearPlane, float farPlane); +float rlGetCullDistanceNear(void); +float rlGetCullDistanceFar(void); +void rlBegin(int mode); +void rlEnd(void); +void rlVertex2i(int x, int y); +void rlVertex2f(float x, float y); +void rlVertex3f(float x, float y, float z); +void rlTexCoord2f(float x, float y); +void rlNormal3f(float x, float y, float z); +void rlColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a); +void rlColor3f(float x, float y, float z); +void rlColor4f(float x, float y, float z, float w); +bool rlEnableVertexArray(unsigned int vaoId); +void rlDisableVertexArray(void); +void rlEnableVertexBuffer(unsigned int id); +void rlDisableVertexBuffer(void); +void rlEnableVertexBufferElement(unsigned int id); +void rlDisableVertexBufferElement(void); +void rlEnableVertexAttribute(unsigned int index); +void rlDisableVertexAttribute(unsigned int index); +void rlEnableStatePointer(int vertexAttribType, void * buffer); +void rlDisableStatePointer(int vertexAttribType); +void rlActiveTextureSlot(int slot); +void rlEnableTexture(unsigned int id); +void rlDisableTexture(void); +void rlEnableTextureCubemap(unsigned int id); +void rlDisableTextureCubemap(void); +void rlTextureParameters(unsigned int id, int param, int value); +void rlCubemapParameters(unsigned int id, int param, int value); +void rlEnableShader(unsigned int id); +void rlDisableShader(void); +void rlEnableFramebuffer(unsigned int id); +void rlDisableFramebuffer(void); +unsigned int rlGetActiveFramebuffer(void); +void rlActiveDrawBuffers(int count); +void rlBlitFramebuffer(int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY, int dstWidth, int dstHeight, int bufferMask); +void rlBindFramebuffer(unsigned int target, unsigned int framebuffer); +void rlEnableColorBlend(void); +void rlDisableColorBlend(void); +void rlEnableDepthTest(void); +void rlDisableDepthTest(void); +void rlEnableDepthMask(void); +void rlDisableDepthMask(void); +void rlEnableBackfaceCulling(void); +void rlDisableBackfaceCulling(void); +void rlColorMask(bool r, bool g, bool b, bool a); +void rlSetCullFace(int mode); +void rlEnableScissorTest(void); +void rlDisableScissorTest(void); +void rlScissor(int x, int y, int width, int height); +void rlEnablePointMode(void); +void rlDisablePointMode(void); +void rlSetPointSize(float size); +float rlGetPointSize(void); +void rlEnableWireMode(void); +void rlDisableWireMode(void); +void rlSetLineWidth(float width); +float rlGetLineWidth(void); +void rlEnableSmoothLines(void); +void rlDisableSmoothLines(void); +void rlEnableStereoRender(void); +void rlDisableStereoRender(void); +bool rlIsStereoRenderEnabled(void); +void rlClearColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a); +void rlClearScreenBuffers(void); +void rlCheckErrors(void); +void rlSetBlendMode(int mode); +void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation); +void rlSetBlendFactorsSeparate(int glSrcRGB, int glDstRGB, int glSrcAlpha, int glDstAlpha, int glEqRGB, int glEqAlpha); +void rlglInit(int width, int height); +void rlglClose(void); +void rlLoadExtensions(void * loader); +void * rlGetProcAddress(const char * procName); +int rlGetVersion(void); +void rlSetFramebufferWidth(int width); +int rlGetFramebufferWidth(void); +void rlSetFramebufferHeight(int height); +int rlGetFramebufferHeight(void); +unsigned int rlGetTextureIdDefault(void); +unsigned int rlGetShaderIdDefault(void); +int * rlGetShaderLocsDefault(void); +rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements); +void rlUnloadRenderBatch(rlRenderBatch batch); +void rlDrawRenderBatch(rlRenderBatch * batch); +void rlSetRenderBatchActive(rlRenderBatch * batch); +void rlDrawRenderBatchActive(void); +bool rlCheckRenderBatchLimit(int vCount); +void rlSetTexture(unsigned int id); +unsigned int rlLoadVertexArray(void); +unsigned int rlLoadVertexBuffer(const void * buffer, int size, bool dynamic); +unsigned int rlLoadVertexBufferElement(const void * buffer, int size, bool dynamic); +void rlUpdateVertexBuffer(unsigned int bufferId, const void * data, int dataSize, int offset); +void rlUpdateVertexBufferElements(unsigned int id, const void * data, int dataSize, int offset); +void rlUnloadVertexArray(unsigned int vaoId); +void rlUnloadVertexBuffer(unsigned int vboId); +void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, int offset); +void rlSetVertexAttributeDivisor(unsigned int index, int divisor); +void rlSetVertexAttributeDefault(int locIndex, const void * value, int attribType, int count); +void rlDrawVertexArray(int offset, int count); +void rlDrawVertexArrayElements(int offset, int count, const void * buffer); +void rlDrawVertexArrayInstanced(int offset, int count, int instances); +void rlDrawVertexArrayElementsInstanced(int offset, int count, const void * buffer, int instances); +unsigned int rlLoadTexture(const void * data, int width, int height, int format, int mipmapCount); +unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); +unsigned int rlLoadTextureCubemap(const void * data, int size, int format, int mipmapCount); +void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void * data); +void rlGetGlTextureFormats(int format, unsigned int * glInternalFormat, unsigned int * glFormat, unsigned int * glType); +const char * rlGetPixelFormatName(unsigned int format); +void rlUnloadTexture(unsigned int id); +void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int * mipmaps); +void * rlReadTexturePixels(unsigned int id, int width, int height, int format); +unsigned char * rlReadScreenPixels(int width, int height); +unsigned int rlLoadFramebuffer(void); +void rlFramebufferAttach(unsigned int id, unsigned int texId, int attachType, int texType, int mipLevel); +bool rlFramebufferComplete(unsigned int id); +void rlUnloadFramebuffer(unsigned int id); +void rlCopyFramebuffer(int x, int y, int width, int height, int format, void * pixels); +void rlResizeFramebuffer(int width, int height); +unsigned int rlLoadShader(const char * code, int type); +unsigned int rlLoadShaderProgram(const char * vsCode, const char * fsCode); +unsigned int rlLoadShaderProgramEx(unsigned int vsId, unsigned int fsId); +unsigned int rlLoadShaderProgramCompute(unsigned int csId); +void rlUnloadShader(unsigned int id); +void rlUnloadShaderProgram(unsigned int id); +int rlGetLocationUniform(unsigned int id, const char * uniformName); +int rlGetLocationAttrib(unsigned int id, const char * attribName); +void rlSetUniform(int locIndex, const void * value, int uniformType, int count); +void rlSetUniformMatrix(int locIndex, Matrix mat); +void rlSetUniformMatrices(int locIndex, const Matrix * mat, int count); +void rlSetUniformSampler(int locIndex, unsigned int textureId); +void rlSetShader(unsigned int id, int * locs); +void rlComputeShaderDispatch(unsigned int groupX, unsigned int groupY, unsigned int groupZ); +unsigned int rlLoadShaderBuffer(unsigned int size, const void * data, int usageHint); +void rlUnloadShaderBuffer(unsigned int ssboId); +void rlUpdateShaderBuffer(unsigned int id, const void * data, unsigned int dataSize, unsigned int offset); +void rlBindShaderBuffer(unsigned int id, unsigned int index); +void rlReadShaderBuffer(unsigned int id, void * dest, unsigned int count, unsigned int offset); +void rlCopyShaderBuffer(unsigned int destId, unsigned int srcId, unsigned int destOffset, unsigned int srcOffset, unsigned int count); +unsigned int rlGetShaderBufferSize(unsigned int id); +void rlBindImageTexture(unsigned int id, unsigned int index, int format, bool readonly); +Matrix rlGetMatrixModelview(void); +Matrix rlGetMatrixProjection(void); +Matrix rlGetMatrixTransform(void); +Matrix rlGetMatrixProjectionStereo(int eye); +Matrix rlGetMatrixViewOffsetStereo(int eye); +void rlSetMatrixProjection(Matrix proj); +void rlSetMatrixModelview(Matrix view); +void rlSetMatrixProjectionStereo(Matrix right, Matrix left); +void rlSetMatrixViewOffsetStereo(Matrix right, Matrix left); +void rlLoadDrawCube(void); +void rlLoadDrawQuad(void); +float Clamp(float value, float min, float max); +float Lerp(float start, float end, float amount); +float Normalize(float value, float start, float end); +float Remap(float value, float inputStart, float inputEnd, float outputStart, float outputEnd); +float Wrap(float value, float min, float max); +int FloatEquals(float x, float y); +Vector2 Vector2Zero(void); +Vector2 Vector2One(void); +Vector2 Vector2Add(Vector2 v1, Vector2 v2); +Vector2 Vector2AddValue(Vector2 v, float add); +Vector2 Vector2Subtract(Vector2 v1, Vector2 v2); +Vector2 Vector2SubtractValue(Vector2 v, float sub); +float Vector2Length(Vector2 v); +float Vector2LengthSqr(Vector2 v); +float Vector2DotProduct(Vector2 v1, Vector2 v2); +float Vector2CrossProduct(Vector2 v1, Vector2 v2); +float Vector2Distance(Vector2 v1, Vector2 v2); +float Vector2DistanceSqr(Vector2 v1, Vector2 v2); +float Vector2Angle(Vector2 v1, Vector2 v2); +float Vector2LineAngle(Vector2 start, Vector2 end); +Vector2 Vector2Scale(Vector2 v, float scale); +Vector2 Vector2Multiply(Vector2 v1, Vector2 v2); +Vector2 Vector2Negate(Vector2 v); +Vector2 Vector2Divide(Vector2 v1, Vector2 v2); +Vector2 Vector2Normalize(Vector2 v); +Vector2 Vector2Transform(Vector2 v, Matrix mat); +Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount); +Vector2 Vector2Reflect(Vector2 v, Vector2 normal); +Vector2 Vector2Min(Vector2 v1, Vector2 v2); +Vector2 Vector2Max(Vector2 v1, Vector2 v2); +Vector2 Vector2Rotate(Vector2 v, float angle); +Vector2 Vector2MoveTowards(Vector2 v, Vector2 target, float maxDistance); +Vector2 Vector2Invert(Vector2 v); +Vector2 Vector2Clamp(Vector2 v, Vector2 min, Vector2 max); +Vector2 Vector2ClampValue(Vector2 v, float min, float max); +int Vector2Equals(Vector2 p, Vector2 q); +Vector2 Vector2Refract(Vector2 v, Vector2 n, float r); +Vector3 Vector3Zero(void); +Vector3 Vector3One(void); +Vector3 Vector3Add(Vector3 v1, Vector3 v2); +Vector3 Vector3AddValue(Vector3 v, float add); +Vector3 Vector3Subtract(Vector3 v1, Vector3 v2); +Vector3 Vector3SubtractValue(Vector3 v, float sub); +Vector3 Vector3Scale(Vector3 v, float scalar); +Vector3 Vector3Multiply(Vector3 v1, Vector3 v2); +Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2); +Vector3 Vector3Perpendicular(Vector3 v); +float Vector3Length(const Vector3 v); +float Vector3LengthSqr(const Vector3 v); +float Vector3DotProduct(Vector3 v1, Vector3 v2); +float Vector3Distance(Vector3 v1, Vector3 v2); +float Vector3DistanceSqr(Vector3 v1, Vector3 v2); +float Vector3Angle(Vector3 v1, Vector3 v2); +Vector3 Vector3Negate(Vector3 v); +Vector3 Vector3Divide(Vector3 v1, Vector3 v2); +Vector3 Vector3Normalize(Vector3 v); +Vector3 Vector3Project(Vector3 v1, Vector3 v2); +Vector3 Vector3Reject(Vector3 v1, Vector3 v2); +void Vector3OrthoNormalize(Vector3 * v1, Vector3 * v2); +Vector3 Vector3Transform(Vector3 v, Matrix mat); +Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q); +Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle); +Vector3 Vector3MoveTowards(Vector3 v, Vector3 target, float maxDistance); +Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount); +Vector3 Vector3CubicHermite(Vector3 v1, Vector3 tangent1, Vector3 v2, Vector3 tangent2, float amount); +Vector3 Vector3Reflect(Vector3 v, Vector3 normal); +Vector3 Vector3Min(Vector3 v1, Vector3 v2); +Vector3 Vector3Max(Vector3 v1, Vector3 v2); +Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c); +Vector3 Vector3Unproject(Vector3 source, Matrix projection, Matrix view); +float3 Vector3ToFloatV(Vector3 v); +Vector3 Vector3Invert(Vector3 v); +Vector3 Vector3Clamp(Vector3 v, Vector3 min, Vector3 max); +Vector3 Vector3ClampValue(Vector3 v, float min, float max); +int Vector3Equals(Vector3 p, Vector3 q); +Vector3 Vector3Refract(Vector3 v, Vector3 n, float r); +Vector4 Vector4Zero(void); +Vector4 Vector4One(void); +Vector4 Vector4Add(Vector4 v1, Vector4 v2); +Vector4 Vector4AddValue(Vector4 v, float add); +Vector4 Vector4Subtract(Vector4 v1, Vector4 v2); +Vector4 Vector4SubtractValue(Vector4 v, float add); +float Vector4Length(Vector4 v); +float Vector4LengthSqr(Vector4 v); +float Vector4DotProduct(Vector4 v1, Vector4 v2); +float Vector4Distance(Vector4 v1, Vector4 v2); +float Vector4DistanceSqr(Vector4 v1, Vector4 v2); +Vector4 Vector4Scale(Vector4 v, float scale); +Vector4 Vector4Multiply(Vector4 v1, Vector4 v2); +Vector4 Vector4Negate(Vector4 v); +Vector4 Vector4Divide(Vector4 v1, Vector4 v2); +Vector4 Vector4Normalize(Vector4 v); +Vector4 Vector4Min(Vector4 v1, Vector4 v2); +Vector4 Vector4Max(Vector4 v1, Vector4 v2); +Vector4 Vector4Lerp(Vector4 v1, Vector4 v2, float amount); +Vector4 Vector4MoveTowards(Vector4 v, Vector4 target, float maxDistance); +Vector4 Vector4Invert(Vector4 v); +int Vector4Equals(Vector4 p, Vector4 q); +float MatrixDeterminant(Matrix mat); +float MatrixTrace(Matrix mat); +Matrix MatrixTranspose(Matrix mat); +Matrix MatrixInvert(Matrix mat); +Matrix MatrixIdentity(void); +Matrix MatrixAdd(Matrix left, Matrix right); +Matrix MatrixSubtract(Matrix left, Matrix right); +Matrix MatrixMultiply(Matrix left, Matrix right); +Matrix MatrixMultiplyValue(Matrix left, float value); +Matrix MatrixTranslate(float x, float y, float z); +Matrix MatrixRotate(Vector3 axis, float angle); +Matrix MatrixRotateX(float angle); +Matrix MatrixRotateY(float angle); +Matrix MatrixRotateZ(float angle); +Matrix MatrixRotateXYZ(Vector3 angle); +Matrix MatrixRotateZYX(Vector3 angle); +Matrix MatrixScale(float x, float y, float z); +Matrix MatrixFrustum(float left, float right, float bottom, float top, float nearPlane, float farPlane); +Matrix MatrixPerspective(float fovY, float aspect, float nearPlane, float farPlane); +Matrix MatrixOrtho(float left, float right, float bottom, float top, float nearPlane, float farPlane); +Matrix MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up); +float16 MatrixToFloatV(Matrix mat); +Quaternion QuaternionAdd(Quaternion q1, Quaternion q2); +Quaternion QuaternionAddValue(Quaternion q, float add); +Quaternion QuaternionSubtract(Quaternion q1, Quaternion q2); +Quaternion QuaternionSubtractValue(Quaternion q, float sub); +Quaternion QuaternionIdentity(void); +float QuaternionLength(Quaternion q); +Quaternion QuaternionNormalize(Quaternion q); +Quaternion QuaternionInvert(Quaternion q); +Quaternion QuaternionMultiply(Quaternion q1, Quaternion q2); +Quaternion QuaternionScale(Quaternion q, float mul); +Quaternion QuaternionDivide(Quaternion q1, Quaternion q2); +Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount); +Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount); +Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount); +Quaternion QuaternionCubicHermiteSpline(Quaternion q1, Quaternion outTangent1, Quaternion q2, Quaternion inTangent2, float t); +Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to); +Quaternion QuaternionFromMatrix(Matrix mat); +Matrix QuaternionToMatrix(Quaternion q); +Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle); +void QuaternionToAxisAngle(Quaternion q, Vector3 * outAxis, float * outAngle); +Quaternion QuaternionFromEuler(float pitch, float yaw, float roll); +Vector3 QuaternionToEuler(Quaternion q); +Quaternion QuaternionTransform(Quaternion q, Matrix mat); +int QuaternionEquals(Quaternion p, Quaternion q); +Matrix MatrixCompose(Vector3 translation, Quaternion rotation, Vector3 scale); +void MatrixDecompose(Matrix mat, Vector3 * translation, Quaternion * rotation, Vector3 * scale); +]] + +local C = ffi.C +local string_format = string.format +local ffi_string = ffi.string +local type, select = type, select + +local M = {} + +-- Raw namespace for hot paths that want to skip the Lua wrapper. +---@type ffi.namespace* +M.C = C + +---@class raylib.char_buffer +---@field [integer] integer + +---@class raylib.cstring_array +---@field [integer] ffi.cdata* + +local pinned = {} +local callback_cache = {} +local function pin(ctype, fn) + if fn == nil then + return nil + end + local by_type = callback_cache[fn] + if by_type == nil then + by_type = {} + callback_cache[fn] = by_type + end + local cb = by_type[ctype] + if cb == nil then + cb = ffi.cast(ctype, fn) + by_type[ctype] = cb + pinned[#pinned + 1] = cb + end + return cb +end + +local function to_array(ct, t, n) + n = n or #t + local a = ffi.new(ct .. "[?]", n) + for i = 1, n do + a[i - 1] = t[i] + end + return a +end + +---@enum raylib.ConfigFlags +M.ConfigFlags = { + FLAG_VSYNC_HINT = 64, + FLAG_FULLSCREEN_MODE = 2, + FLAG_WINDOW_RESIZABLE = 4, + FLAG_WINDOW_UNDECORATED = 8, + FLAG_WINDOW_HIDDEN = 128, + FLAG_WINDOW_MINIMIZED = 512, + FLAG_WINDOW_MAXIMIZED = 1024, + FLAG_WINDOW_UNFOCUSED = 2048, + FLAG_WINDOW_TOPMOST = 4096, + FLAG_WINDOW_ALWAYS_RUN = 256, + FLAG_WINDOW_TRANSPARENT = 16, + FLAG_WINDOW_HIGHDPI = 8192, + FLAG_WINDOW_MOUSE_PASSTHROUGH = 16384, + FLAG_BORDERLESS_WINDOWED_MODE = 32768, + FLAG_MSAA_4X_HINT = 32, + FLAG_INTERLACED_HINT = 65536, +} + +---@enum raylib.TraceLogLevel +M.TraceLogLevel = { + LOG_ALL = 0, + LOG_TRACE = 1, + LOG_DEBUG = 2, + LOG_INFO = 3, + LOG_WARNING = 4, + LOG_ERROR = 5, + LOG_FATAL = 6, + LOG_NONE = 7, +} + +---@enum raylib.KeyboardKey +M.KeyboardKey = { + KEY_NULL = 0, + KEY_APOSTROPHE = 39, + KEY_COMMA = 44, + KEY_MINUS = 45, + KEY_PERIOD = 46, + KEY_SLASH = 47, + KEY_ZERO = 48, + KEY_ONE = 49, + KEY_TWO = 50, + KEY_THREE = 51, + KEY_FOUR = 52, + KEY_FIVE = 53, + KEY_SIX = 54, + KEY_SEVEN = 55, + KEY_EIGHT = 56, + KEY_NINE = 57, + KEY_SEMICOLON = 59, + KEY_EQUAL = 61, + KEY_A = 65, + KEY_B = 66, + KEY_C = 67, + KEY_D = 68, + KEY_E = 69, + KEY_F = 70, + KEY_G = 71, + KEY_H = 72, + KEY_I = 73, + KEY_J = 74, + KEY_K = 75, + KEY_L = 76, + KEY_M = 77, + KEY_N = 78, + KEY_O = 79, + KEY_P = 80, + KEY_Q = 81, + KEY_R = 82, + KEY_S = 83, + KEY_T = 84, + KEY_U = 85, + KEY_V = 86, + KEY_W = 87, + KEY_X = 88, + KEY_Y = 89, + KEY_Z = 90, + KEY_LEFT_BRACKET = 91, + KEY_BACKSLASH = 92, + KEY_RIGHT_BRACKET = 93, + KEY_GRAVE = 96, + KEY_SPACE = 32, + KEY_ESCAPE = 256, + KEY_ENTER = 257, + KEY_TAB = 258, + KEY_BACKSPACE = 259, + KEY_INSERT = 260, + KEY_DELETE = 261, + KEY_RIGHT = 262, + KEY_LEFT = 263, + KEY_DOWN = 264, + KEY_UP = 265, + KEY_PAGE_UP = 266, + KEY_PAGE_DOWN = 267, + KEY_HOME = 268, + KEY_END = 269, + KEY_CAPS_LOCK = 280, + KEY_SCROLL_LOCK = 281, + KEY_NUM_LOCK = 282, + KEY_PRINT_SCREEN = 283, + KEY_PAUSE = 284, + KEY_F1 = 290, + KEY_F2 = 291, + KEY_F3 = 292, + KEY_F4 = 293, + KEY_F5 = 294, + KEY_F6 = 295, + KEY_F7 = 296, + KEY_F8 = 297, + KEY_F9 = 298, + KEY_F10 = 299, + KEY_F11 = 300, + KEY_F12 = 301, + KEY_LEFT_SHIFT = 340, + KEY_LEFT_CONTROL = 341, + KEY_LEFT_ALT = 342, + KEY_LEFT_SUPER = 343, + KEY_RIGHT_SHIFT = 344, + KEY_RIGHT_CONTROL = 345, + KEY_RIGHT_ALT = 346, + KEY_RIGHT_SUPER = 347, + KEY_KB_MENU = 348, + KEY_KP_0 = 320, + KEY_KP_1 = 321, + KEY_KP_2 = 322, + KEY_KP_3 = 323, + KEY_KP_4 = 324, + KEY_KP_5 = 325, + KEY_KP_6 = 326, + KEY_KP_7 = 327, + KEY_KP_8 = 328, + KEY_KP_9 = 329, + KEY_KP_DECIMAL = 330, + KEY_KP_DIVIDE = 331, + KEY_KP_MULTIPLY = 332, + KEY_KP_SUBTRACT = 333, + KEY_KP_ADD = 334, + KEY_KP_ENTER = 335, + KEY_KP_EQUAL = 336, + KEY_BACK = 4, + KEY_MENU = 5, + KEY_VOLUME_UP = 24, + KEY_VOLUME_DOWN = 25, +} + +---@enum raylib.MouseButton +M.MouseButton = { + MOUSE_BUTTON_LEFT = 0, + MOUSE_BUTTON_RIGHT = 1, + MOUSE_BUTTON_MIDDLE = 2, + MOUSE_BUTTON_SIDE = 3, + MOUSE_BUTTON_EXTRA = 4, + MOUSE_BUTTON_FORWARD = 5, + MOUSE_BUTTON_BACK = 6, +} + +---@enum raylib.MouseCursor +M.MouseCursor = { + MOUSE_CURSOR_DEFAULT = 0, + MOUSE_CURSOR_ARROW = 1, + MOUSE_CURSOR_IBEAM = 2, + MOUSE_CURSOR_CROSSHAIR = 3, + MOUSE_CURSOR_POINTING_HAND = 4, + MOUSE_CURSOR_RESIZE_EW = 5, + MOUSE_CURSOR_RESIZE_NS = 6, + MOUSE_CURSOR_RESIZE_NWSE = 7, + MOUSE_CURSOR_RESIZE_NESW = 8, + MOUSE_CURSOR_RESIZE_ALL = 9, + MOUSE_CURSOR_NOT_ALLOWED = 10, +} + +---@enum raylib.GamepadButton +M.GamepadButton = { + GAMEPAD_BUTTON_UNKNOWN = 0, + GAMEPAD_BUTTON_LEFT_FACE_UP = 1, + GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2, + GAMEPAD_BUTTON_LEFT_FACE_DOWN = 3, + GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4, + GAMEPAD_BUTTON_RIGHT_FACE_UP = 5, + GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6, + GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7, + GAMEPAD_BUTTON_RIGHT_FACE_LEFT = 8, + GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9, + GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10, + GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = 11, + GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = 12, + GAMEPAD_BUTTON_MIDDLE_LEFT = 13, + GAMEPAD_BUTTON_MIDDLE = 14, + GAMEPAD_BUTTON_MIDDLE_RIGHT = 15, + GAMEPAD_BUTTON_LEFT_THUMB = 16, + GAMEPAD_BUTTON_RIGHT_THUMB = 17, +} + +---@enum raylib.GamepadAxis +M.GamepadAxis = { + GAMEPAD_AXIS_LEFT_X = 0, + GAMEPAD_AXIS_LEFT_Y = 1, + GAMEPAD_AXIS_RIGHT_X = 2, + GAMEPAD_AXIS_RIGHT_Y = 3, + GAMEPAD_AXIS_LEFT_TRIGGER = 4, + GAMEPAD_AXIS_RIGHT_TRIGGER = 5, +} + +---@enum raylib.MaterialMapIndex +M.MaterialMapIndex = { + MATERIAL_MAP_ALBEDO = 0, + MATERIAL_MAP_METALNESS = 1, + MATERIAL_MAP_NORMAL = 2, + MATERIAL_MAP_ROUGHNESS = 3, + MATERIAL_MAP_OCCLUSION = 4, + MATERIAL_MAP_EMISSION = 5, + MATERIAL_MAP_HEIGHT = 6, + MATERIAL_MAP_CUBEMAP = 7, + MATERIAL_MAP_IRRADIANCE = 8, + MATERIAL_MAP_PREFILTER = 9, + MATERIAL_MAP_BRDF = 10, +} + +---@enum raylib.ShaderLocationIndex +M.ShaderLocationIndex = { + SHADER_LOC_VERTEX_POSITION = 0, + SHADER_LOC_VERTEX_TEXCOORD01 = 1, + SHADER_LOC_VERTEX_TEXCOORD02 = 2, + SHADER_LOC_VERTEX_NORMAL = 3, + SHADER_LOC_VERTEX_TANGENT = 4, + SHADER_LOC_VERTEX_COLOR = 5, + SHADER_LOC_MATRIX_MVP = 6, + SHADER_LOC_MATRIX_VIEW = 7, + SHADER_LOC_MATRIX_PROJECTION = 8, + SHADER_LOC_MATRIX_MODEL = 9, + SHADER_LOC_MATRIX_NORMAL = 10, + SHADER_LOC_VECTOR_VIEW = 11, + SHADER_LOC_COLOR_DIFFUSE = 12, + SHADER_LOC_COLOR_SPECULAR = 13, + SHADER_LOC_COLOR_AMBIENT = 14, + SHADER_LOC_MAP_ALBEDO = 15, + SHADER_LOC_MAP_METALNESS = 16, + SHADER_LOC_MAP_NORMAL = 17, + SHADER_LOC_MAP_ROUGHNESS = 18, + SHADER_LOC_MAP_OCCLUSION = 19, + SHADER_LOC_MAP_EMISSION = 20, + SHADER_LOC_MAP_HEIGHT = 21, + SHADER_LOC_MAP_CUBEMAP = 22, + SHADER_LOC_MAP_IRRADIANCE = 23, + SHADER_LOC_MAP_PREFILTER = 24, + SHADER_LOC_MAP_BRDF = 25, + SHADER_LOC_VERTEX_BONEIDS = 26, + SHADER_LOC_VERTEX_BONEWEIGHTS = 27, + SHADER_LOC_MATRIX_BONETRANSFORMS = 28, + SHADER_LOC_VERTEX_INSTANCETRANSFORM = 29, +} + +---@enum raylib.ShaderUniformDataType +M.ShaderUniformDataType = { + SHADER_UNIFORM_FLOAT = 0, + SHADER_UNIFORM_VEC2 = 1, + SHADER_UNIFORM_VEC3 = 2, + SHADER_UNIFORM_VEC4 = 3, + SHADER_UNIFORM_INT = 4, + SHADER_UNIFORM_IVEC2 = 5, + SHADER_UNIFORM_IVEC3 = 6, + SHADER_UNIFORM_IVEC4 = 7, + SHADER_UNIFORM_UINT = 8, + SHADER_UNIFORM_UIVEC2 = 9, + SHADER_UNIFORM_UIVEC3 = 10, + SHADER_UNIFORM_UIVEC4 = 11, + SHADER_UNIFORM_SAMPLER2D = 12, +} + +---@enum raylib.ShaderAttributeDataType +M.ShaderAttributeDataType = { + SHADER_ATTRIB_FLOAT = 0, + SHADER_ATTRIB_VEC2 = 1, + SHADER_ATTRIB_VEC3 = 2, + SHADER_ATTRIB_VEC4 = 3, +} + +---@enum raylib.PixelFormat +M.PixelFormat = { + PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, + PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2, + PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3, + PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4, + PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5, + PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6, + PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7, + PIXELFORMAT_UNCOMPRESSED_R32 = 8, + PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9, + PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10, + PIXELFORMAT_UNCOMPRESSED_R16 = 11, + PIXELFORMAT_UNCOMPRESSED_R16G16B16 = 12, + PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = 13, + PIXELFORMAT_COMPRESSED_DXT1_RGB = 14, + PIXELFORMAT_COMPRESSED_DXT1_RGBA = 15, + PIXELFORMAT_COMPRESSED_DXT3_RGBA = 16, + PIXELFORMAT_COMPRESSED_DXT5_RGBA = 17, + PIXELFORMAT_COMPRESSED_ETC1_RGB = 18, + PIXELFORMAT_COMPRESSED_ETC2_RGB = 19, + PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 20, + PIXELFORMAT_COMPRESSED_PVRT_RGB = 21, + PIXELFORMAT_COMPRESSED_PVRT_RGBA = 22, + PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 23, + PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24, +} + +---@enum raylib.TextureFilter +M.TextureFilter = { + TEXTURE_FILTER_POINT = 0, + TEXTURE_FILTER_BILINEAR = 1, + TEXTURE_FILTER_TRILINEAR = 2, + TEXTURE_FILTER_ANISOTROPIC_4X = 3, + TEXTURE_FILTER_ANISOTROPIC_8X = 4, + TEXTURE_FILTER_ANISOTROPIC_16X = 5, +} + +---@enum raylib.TextureWrap +M.TextureWrap = { + TEXTURE_WRAP_REPEAT = 0, + TEXTURE_WRAP_CLAMP = 1, + TEXTURE_WRAP_MIRROR_REPEAT = 2, + TEXTURE_WRAP_MIRROR_CLAMP = 3, +} + +---@enum raylib.CubemapLayout +M.CubemapLayout = { + CUBEMAP_LAYOUT_AUTO_DETECT = 0, + CUBEMAP_LAYOUT_LINE_VERTICAL = 1, + CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2, + CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3, + CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4, +} + +---@enum raylib.FontType +M.FontType = { + FONT_DEFAULT = 0, + FONT_BITMAP = 1, + FONT_SDF = 2, +} + +---@enum raylib.BlendMode +M.BlendMode = { + BLEND_ALPHA = 0, + BLEND_ADDITIVE = 1, + BLEND_MULTIPLIED = 2, + BLEND_ADD_COLORS = 3, + BLEND_SUBTRACT_COLORS = 4, + BLEND_ALPHA_PREMULTIPLY = 5, + BLEND_CUSTOM = 6, + BLEND_CUSTOM_SEPARATE = 7, +} + +---@enum raylib.Gesture +M.Gesture = { + GESTURE_NONE = 0, + GESTURE_TAP = 1, + GESTURE_DOUBLETAP = 2, + GESTURE_HOLD = 4, + GESTURE_DRAG = 8, + GESTURE_SWIPE_RIGHT = 16, + GESTURE_SWIPE_LEFT = 32, + GESTURE_SWIPE_UP = 64, + GESTURE_SWIPE_DOWN = 128, + GESTURE_PINCH_IN = 256, + GESTURE_PINCH_OUT = 512, +} + +---@enum raylib.CameraMode +M.CameraMode = { + CAMERA_CUSTOM = 0, + CAMERA_FREE = 1, + CAMERA_ORBITAL = 2, + CAMERA_FIRST_PERSON = 3, + CAMERA_THIRD_PERSON = 4, +} + +---@enum raylib.CameraProjection +M.CameraProjection = { + CAMERA_PERSPECTIVE = 0, + CAMERA_ORTHOGRAPHIC = 1, +} + +---@enum raylib.NPatchLayout +M.NPatchLayout = { + NPATCH_NINE_PATCH = 0, + NPATCH_THREE_PATCH_VERTICAL = 1, + NPATCH_THREE_PATCH_HORIZONTAL = 2, +} + +---@enum raylib.rlGlVersion +M.rlGlVersion = { + RL_OPENGL_SOFTWARE = 0, + RL_OPENGL_11 = 1, + RL_OPENGL_21 = 2, + RL_OPENGL_33 = 3, + RL_OPENGL_43 = 4, + RL_OPENGL_ES_20 = 5, + RL_OPENGL_ES_30 = 6, +} + +---@enum raylib.rlTraceLogLevel +M.rlTraceLogLevel = { + RL_LOG_ALL = 0, + RL_LOG_TRACE = 1, + RL_LOG_DEBUG = 2, + RL_LOG_INFO = 3, + RL_LOG_WARNING = 4, + RL_LOG_ERROR = 5, + RL_LOG_FATAL = 6, + RL_LOG_NONE = 7, +} + +---@enum raylib.rlPixelFormat +M.rlPixelFormat = { + RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, + RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2, + RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3, + RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4, + RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5, + RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6, + RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7, + RL_PIXELFORMAT_UNCOMPRESSED_R32 = 8, + RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9, + RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10, + RL_PIXELFORMAT_UNCOMPRESSED_R16 = 11, + RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16 = 12, + RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = 13, + RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 14, + RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 15, + RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 16, + RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 17, + RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 18, + RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 19, + RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 20, + RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 21, + RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 22, + RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 23, + RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24, +} + +---@enum raylib.rlTextureFilter +M.rlTextureFilter = { + RL_TEXTURE_FILTER_POINT = 0, + RL_TEXTURE_FILTER_BILINEAR = 1, + RL_TEXTURE_FILTER_TRILINEAR = 2, + RL_TEXTURE_FILTER_ANISOTROPIC_4X = 3, + RL_TEXTURE_FILTER_ANISOTROPIC_8X = 4, + RL_TEXTURE_FILTER_ANISOTROPIC_16X = 5, +} + +---@enum raylib.rlBlendMode +M.rlBlendMode = { + RL_BLEND_ALPHA = 0, + RL_BLEND_ADDITIVE = 1, + RL_BLEND_MULTIPLIED = 2, + RL_BLEND_ADD_COLORS = 3, + RL_BLEND_SUBTRACT_COLORS = 4, + RL_BLEND_ALPHA_PREMULTIPLY = 5, + RL_BLEND_CUSTOM = 6, + RL_BLEND_CUSTOM_SEPARATE = 7, +} + +---@enum raylib.rlShaderLocationIndex +M.rlShaderLocationIndex = { + RL_SHADER_LOC_VERTEX_POSITION = 0, + RL_SHADER_LOC_VERTEX_TEXCOORD01 = 1, + RL_SHADER_LOC_VERTEX_TEXCOORD02 = 2, + RL_SHADER_LOC_VERTEX_NORMAL = 3, + RL_SHADER_LOC_VERTEX_TANGENT = 4, + RL_SHADER_LOC_VERTEX_COLOR = 5, + RL_SHADER_LOC_MATRIX_MVP = 6, + RL_SHADER_LOC_MATRIX_VIEW = 7, + RL_SHADER_LOC_MATRIX_PROJECTION = 8, + RL_SHADER_LOC_MATRIX_MODEL = 9, + RL_SHADER_LOC_MATRIX_NORMAL = 10, + RL_SHADER_LOC_VECTOR_VIEW = 11, + RL_SHADER_LOC_COLOR_DIFFUSE = 12, + RL_SHADER_LOC_COLOR_SPECULAR = 13, + RL_SHADER_LOC_COLOR_AMBIENT = 14, + RL_SHADER_LOC_MAP_ALBEDO = 15, + RL_SHADER_LOC_MAP_METALNESS = 16, + RL_SHADER_LOC_MAP_NORMAL = 17, + RL_SHADER_LOC_MAP_ROUGHNESS = 18, + RL_SHADER_LOC_MAP_OCCLUSION = 19, + RL_SHADER_LOC_MAP_EMISSION = 20, + RL_SHADER_LOC_MAP_HEIGHT = 21, + RL_SHADER_LOC_MAP_CUBEMAP = 22, + RL_SHADER_LOC_MAP_IRRADIANCE = 23, + RL_SHADER_LOC_MAP_PREFILTER = 24, + RL_SHADER_LOC_MAP_BRDF = 25, +} + +---@enum raylib.rlShaderUniformDataType +M.rlShaderUniformDataType = { + RL_SHADER_UNIFORM_FLOAT = 0, + RL_SHADER_UNIFORM_VEC2 = 1, + RL_SHADER_UNIFORM_VEC3 = 2, + RL_SHADER_UNIFORM_VEC4 = 3, + RL_SHADER_UNIFORM_INT = 4, + RL_SHADER_UNIFORM_IVEC2 = 5, + RL_SHADER_UNIFORM_IVEC3 = 6, + RL_SHADER_UNIFORM_IVEC4 = 7, + RL_SHADER_UNIFORM_UINT = 8, + RL_SHADER_UNIFORM_UIVEC2 = 9, + RL_SHADER_UNIFORM_UIVEC3 = 10, + RL_SHADER_UNIFORM_UIVEC4 = 11, + RL_SHADER_UNIFORM_SAMPLER2D = 12, +} + +---@enum raylib.rlShaderAttributeDataType +M.rlShaderAttributeDataType = { + RL_SHADER_ATTRIB_FLOAT = 0, + RL_SHADER_ATTRIB_VEC2 = 1, + RL_SHADER_ATTRIB_VEC3 = 2, + RL_SHADER_ATTRIB_VEC4 = 3, +} + +---@enum raylib.rlFramebufferAttachType +M.rlFramebufferAttachType = { + RL_ATTACHMENT_COLOR_CHANNEL0 = 0, + RL_ATTACHMENT_COLOR_CHANNEL1 = 1, + RL_ATTACHMENT_COLOR_CHANNEL2 = 2, + RL_ATTACHMENT_COLOR_CHANNEL3 = 3, + RL_ATTACHMENT_COLOR_CHANNEL4 = 4, + RL_ATTACHMENT_COLOR_CHANNEL5 = 5, + RL_ATTACHMENT_COLOR_CHANNEL6 = 6, + RL_ATTACHMENT_COLOR_CHANNEL7 = 7, + RL_ATTACHMENT_DEPTH = 100, + RL_ATTACHMENT_STENCIL = 200, +} + +---@enum raylib.rlFramebufferAttachTextureType +M.rlFramebufferAttachTextureType = { + RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_X = 1, + RL_ATTACHMENT_CUBEMAP_POSITIVE_Y = 2, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y = 3, + RL_ATTACHMENT_CUBEMAP_POSITIVE_Z = 4, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z = 5, + RL_ATTACHMENT_TEXTURE2D = 100, + RL_ATTACHMENT_RENDERBUFFER = 200, +} + +---@enum raylib.rlCullMode +M.rlCullMode = { + RL_CULL_FACE_FRONT = 0, + RL_CULL_FACE_BACK = 1, +} + +---@type raylib.ConfigFlags +M.FLAG_VSYNC_HINT = M.ConfigFlags.FLAG_VSYNC_HINT +---@type raylib.ConfigFlags +M.FLAG_FULLSCREEN_MODE = M.ConfigFlags.FLAG_FULLSCREEN_MODE +---@type raylib.ConfigFlags +M.FLAG_WINDOW_RESIZABLE = M.ConfigFlags.FLAG_WINDOW_RESIZABLE +---@type raylib.ConfigFlags +M.FLAG_WINDOW_UNDECORATED = M.ConfigFlags.FLAG_WINDOW_UNDECORATED +---@type raylib.ConfigFlags +M.FLAG_WINDOW_HIDDEN = M.ConfigFlags.FLAG_WINDOW_HIDDEN +---@type raylib.ConfigFlags +M.FLAG_WINDOW_MINIMIZED = M.ConfigFlags.FLAG_WINDOW_MINIMIZED +---@type raylib.ConfigFlags +M.FLAG_WINDOW_MAXIMIZED = M.ConfigFlags.FLAG_WINDOW_MAXIMIZED +---@type raylib.ConfigFlags +M.FLAG_WINDOW_UNFOCUSED = M.ConfigFlags.FLAG_WINDOW_UNFOCUSED +---@type raylib.ConfigFlags +M.FLAG_WINDOW_TOPMOST = M.ConfigFlags.FLAG_WINDOW_TOPMOST +---@type raylib.ConfigFlags +M.FLAG_WINDOW_ALWAYS_RUN = M.ConfigFlags.FLAG_WINDOW_ALWAYS_RUN +---@type raylib.ConfigFlags +M.FLAG_WINDOW_TRANSPARENT = M.ConfigFlags.FLAG_WINDOW_TRANSPARENT +---@type raylib.ConfigFlags +M.FLAG_WINDOW_HIGHDPI = M.ConfigFlags.FLAG_WINDOW_HIGHDPI +---@type raylib.ConfigFlags +M.FLAG_WINDOW_MOUSE_PASSTHROUGH = M.ConfigFlags.FLAG_WINDOW_MOUSE_PASSTHROUGH +---@type raylib.ConfigFlags +M.FLAG_BORDERLESS_WINDOWED_MODE = M.ConfigFlags.FLAG_BORDERLESS_WINDOWED_MODE +---@type raylib.ConfigFlags +M.FLAG_MSAA_4X_HINT = M.ConfigFlags.FLAG_MSAA_4X_HINT +---@type raylib.ConfigFlags +M.FLAG_INTERLACED_HINT = M.ConfigFlags.FLAG_INTERLACED_HINT +---@type raylib.TraceLogLevel +M.LOG_ALL = M.TraceLogLevel.LOG_ALL +---@type raylib.TraceLogLevel +M.LOG_TRACE = M.TraceLogLevel.LOG_TRACE +---@type raylib.TraceLogLevel +M.LOG_DEBUG = M.TraceLogLevel.LOG_DEBUG +---@type raylib.TraceLogLevel +M.LOG_INFO = M.TraceLogLevel.LOG_INFO +---@type raylib.TraceLogLevel +M.LOG_WARNING = M.TraceLogLevel.LOG_WARNING +---@type raylib.TraceLogLevel +M.LOG_ERROR = M.TraceLogLevel.LOG_ERROR +---@type raylib.TraceLogLevel +M.LOG_FATAL = M.TraceLogLevel.LOG_FATAL +---@type raylib.TraceLogLevel +M.LOG_NONE = M.TraceLogLevel.LOG_NONE +---@type raylib.KeyboardKey +M.KEY_NULL = M.KeyboardKey.KEY_NULL +---@type raylib.KeyboardKey +M.KEY_APOSTROPHE = M.KeyboardKey.KEY_APOSTROPHE +---@type raylib.KeyboardKey +M.KEY_COMMA = M.KeyboardKey.KEY_COMMA +---@type raylib.KeyboardKey +M.KEY_MINUS = M.KeyboardKey.KEY_MINUS +---@type raylib.KeyboardKey +M.KEY_PERIOD = M.KeyboardKey.KEY_PERIOD +---@type raylib.KeyboardKey +M.KEY_SLASH = M.KeyboardKey.KEY_SLASH +---@type raylib.KeyboardKey +M.KEY_ZERO = M.KeyboardKey.KEY_ZERO +---@type raylib.KeyboardKey +M.KEY_ONE = M.KeyboardKey.KEY_ONE +---@type raylib.KeyboardKey +M.KEY_TWO = M.KeyboardKey.KEY_TWO +---@type raylib.KeyboardKey +M.KEY_THREE = M.KeyboardKey.KEY_THREE +---@type raylib.KeyboardKey +M.KEY_FOUR = M.KeyboardKey.KEY_FOUR +---@type raylib.KeyboardKey +M.KEY_FIVE = M.KeyboardKey.KEY_FIVE +---@type raylib.KeyboardKey +M.KEY_SIX = M.KeyboardKey.KEY_SIX +---@type raylib.KeyboardKey +M.KEY_SEVEN = M.KeyboardKey.KEY_SEVEN +---@type raylib.KeyboardKey +M.KEY_EIGHT = M.KeyboardKey.KEY_EIGHT +---@type raylib.KeyboardKey +M.KEY_NINE = M.KeyboardKey.KEY_NINE +---@type raylib.KeyboardKey +M.KEY_SEMICOLON = M.KeyboardKey.KEY_SEMICOLON +---@type raylib.KeyboardKey +M.KEY_EQUAL = M.KeyboardKey.KEY_EQUAL +---@type raylib.KeyboardKey +M.KEY_A = M.KeyboardKey.KEY_A +---@type raylib.KeyboardKey +M.KEY_B = M.KeyboardKey.KEY_B +---@type raylib.KeyboardKey +M.KEY_C = M.KeyboardKey.KEY_C +---@type raylib.KeyboardKey +M.KEY_D = M.KeyboardKey.KEY_D +---@type raylib.KeyboardKey +M.KEY_E = M.KeyboardKey.KEY_E +---@type raylib.KeyboardKey +M.KEY_F = M.KeyboardKey.KEY_F +---@type raylib.KeyboardKey +M.KEY_G = M.KeyboardKey.KEY_G +---@type raylib.KeyboardKey +M.KEY_H = M.KeyboardKey.KEY_H +---@type raylib.KeyboardKey +M.KEY_I = M.KeyboardKey.KEY_I +---@type raylib.KeyboardKey +M.KEY_J = M.KeyboardKey.KEY_J +---@type raylib.KeyboardKey +M.KEY_K = M.KeyboardKey.KEY_K +---@type raylib.KeyboardKey +M.KEY_L = M.KeyboardKey.KEY_L +---@type raylib.KeyboardKey +M.KEY_M = M.KeyboardKey.KEY_M +---@type raylib.KeyboardKey +M.KEY_N = M.KeyboardKey.KEY_N +---@type raylib.KeyboardKey +M.KEY_O = M.KeyboardKey.KEY_O +---@type raylib.KeyboardKey +M.KEY_P = M.KeyboardKey.KEY_P +---@type raylib.KeyboardKey +M.KEY_Q = M.KeyboardKey.KEY_Q +---@type raylib.KeyboardKey +M.KEY_R = M.KeyboardKey.KEY_R +---@type raylib.KeyboardKey +M.KEY_S = M.KeyboardKey.KEY_S +---@type raylib.KeyboardKey +M.KEY_T = M.KeyboardKey.KEY_T +---@type raylib.KeyboardKey +M.KEY_U = M.KeyboardKey.KEY_U +---@type raylib.KeyboardKey +M.KEY_V = M.KeyboardKey.KEY_V +---@type raylib.KeyboardKey +M.KEY_W = M.KeyboardKey.KEY_W +---@type raylib.KeyboardKey +M.KEY_X = M.KeyboardKey.KEY_X +---@type raylib.KeyboardKey +M.KEY_Y = M.KeyboardKey.KEY_Y +---@type raylib.KeyboardKey +M.KEY_Z = M.KeyboardKey.KEY_Z +---@type raylib.KeyboardKey +M.KEY_LEFT_BRACKET = M.KeyboardKey.KEY_LEFT_BRACKET +---@type raylib.KeyboardKey +M.KEY_BACKSLASH = M.KeyboardKey.KEY_BACKSLASH +---@type raylib.KeyboardKey +M.KEY_RIGHT_BRACKET = M.KeyboardKey.KEY_RIGHT_BRACKET +---@type raylib.KeyboardKey +M.KEY_GRAVE = M.KeyboardKey.KEY_GRAVE +---@type raylib.KeyboardKey +M.KEY_SPACE = M.KeyboardKey.KEY_SPACE +---@type raylib.KeyboardKey +M.KEY_ESCAPE = M.KeyboardKey.KEY_ESCAPE +---@type raylib.KeyboardKey +M.KEY_ENTER = M.KeyboardKey.KEY_ENTER +---@type raylib.KeyboardKey +M.KEY_TAB = M.KeyboardKey.KEY_TAB +---@type raylib.KeyboardKey +M.KEY_BACKSPACE = M.KeyboardKey.KEY_BACKSPACE +---@type raylib.KeyboardKey +M.KEY_INSERT = M.KeyboardKey.KEY_INSERT +---@type raylib.KeyboardKey +M.KEY_DELETE = M.KeyboardKey.KEY_DELETE +---@type raylib.KeyboardKey +M.KEY_RIGHT = M.KeyboardKey.KEY_RIGHT +---@type raylib.KeyboardKey +M.KEY_LEFT = M.KeyboardKey.KEY_LEFT +---@type raylib.KeyboardKey +M.KEY_DOWN = M.KeyboardKey.KEY_DOWN +---@type raylib.KeyboardKey +M.KEY_UP = M.KeyboardKey.KEY_UP +---@type raylib.KeyboardKey +M.KEY_PAGE_UP = M.KeyboardKey.KEY_PAGE_UP +---@type raylib.KeyboardKey +M.KEY_PAGE_DOWN = M.KeyboardKey.KEY_PAGE_DOWN +---@type raylib.KeyboardKey +M.KEY_HOME = M.KeyboardKey.KEY_HOME +---@type raylib.KeyboardKey +M.KEY_END = M.KeyboardKey.KEY_END +---@type raylib.KeyboardKey +M.KEY_CAPS_LOCK = M.KeyboardKey.KEY_CAPS_LOCK +---@type raylib.KeyboardKey +M.KEY_SCROLL_LOCK = M.KeyboardKey.KEY_SCROLL_LOCK +---@type raylib.KeyboardKey +M.KEY_NUM_LOCK = M.KeyboardKey.KEY_NUM_LOCK +---@type raylib.KeyboardKey +M.KEY_PRINT_SCREEN = M.KeyboardKey.KEY_PRINT_SCREEN +---@type raylib.KeyboardKey +M.KEY_PAUSE = M.KeyboardKey.KEY_PAUSE +---@type raylib.KeyboardKey +M.KEY_F1 = M.KeyboardKey.KEY_F1 +---@type raylib.KeyboardKey +M.KEY_F2 = M.KeyboardKey.KEY_F2 +---@type raylib.KeyboardKey +M.KEY_F3 = M.KeyboardKey.KEY_F3 +---@type raylib.KeyboardKey +M.KEY_F4 = M.KeyboardKey.KEY_F4 +---@type raylib.KeyboardKey +M.KEY_F5 = M.KeyboardKey.KEY_F5 +---@type raylib.KeyboardKey +M.KEY_F6 = M.KeyboardKey.KEY_F6 +---@type raylib.KeyboardKey +M.KEY_F7 = M.KeyboardKey.KEY_F7 +---@type raylib.KeyboardKey +M.KEY_F8 = M.KeyboardKey.KEY_F8 +---@type raylib.KeyboardKey +M.KEY_F9 = M.KeyboardKey.KEY_F9 +---@type raylib.KeyboardKey +M.KEY_F10 = M.KeyboardKey.KEY_F10 +---@type raylib.KeyboardKey +M.KEY_F11 = M.KeyboardKey.KEY_F11 +---@type raylib.KeyboardKey +M.KEY_F12 = M.KeyboardKey.KEY_F12 +---@type raylib.KeyboardKey +M.KEY_LEFT_SHIFT = M.KeyboardKey.KEY_LEFT_SHIFT +---@type raylib.KeyboardKey +M.KEY_LEFT_CONTROL = M.KeyboardKey.KEY_LEFT_CONTROL +---@type raylib.KeyboardKey +M.KEY_LEFT_ALT = M.KeyboardKey.KEY_LEFT_ALT +---@type raylib.KeyboardKey +M.KEY_LEFT_SUPER = M.KeyboardKey.KEY_LEFT_SUPER +---@type raylib.KeyboardKey +M.KEY_RIGHT_SHIFT = M.KeyboardKey.KEY_RIGHT_SHIFT +---@type raylib.KeyboardKey +M.KEY_RIGHT_CONTROL = M.KeyboardKey.KEY_RIGHT_CONTROL +---@type raylib.KeyboardKey +M.KEY_RIGHT_ALT = M.KeyboardKey.KEY_RIGHT_ALT +---@type raylib.KeyboardKey +M.KEY_RIGHT_SUPER = M.KeyboardKey.KEY_RIGHT_SUPER +---@type raylib.KeyboardKey +M.KEY_KB_MENU = M.KeyboardKey.KEY_KB_MENU +---@type raylib.KeyboardKey +M.KEY_KP_0 = M.KeyboardKey.KEY_KP_0 +---@type raylib.KeyboardKey +M.KEY_KP_1 = M.KeyboardKey.KEY_KP_1 +---@type raylib.KeyboardKey +M.KEY_KP_2 = M.KeyboardKey.KEY_KP_2 +---@type raylib.KeyboardKey +M.KEY_KP_3 = M.KeyboardKey.KEY_KP_3 +---@type raylib.KeyboardKey +M.KEY_KP_4 = M.KeyboardKey.KEY_KP_4 +---@type raylib.KeyboardKey +M.KEY_KP_5 = M.KeyboardKey.KEY_KP_5 +---@type raylib.KeyboardKey +M.KEY_KP_6 = M.KeyboardKey.KEY_KP_6 +---@type raylib.KeyboardKey +M.KEY_KP_7 = M.KeyboardKey.KEY_KP_7 +---@type raylib.KeyboardKey +M.KEY_KP_8 = M.KeyboardKey.KEY_KP_8 +---@type raylib.KeyboardKey +M.KEY_KP_9 = M.KeyboardKey.KEY_KP_9 +---@type raylib.KeyboardKey +M.KEY_KP_DECIMAL = M.KeyboardKey.KEY_KP_DECIMAL +---@type raylib.KeyboardKey +M.KEY_KP_DIVIDE = M.KeyboardKey.KEY_KP_DIVIDE +---@type raylib.KeyboardKey +M.KEY_KP_MULTIPLY = M.KeyboardKey.KEY_KP_MULTIPLY +---@type raylib.KeyboardKey +M.KEY_KP_SUBTRACT = M.KeyboardKey.KEY_KP_SUBTRACT +---@type raylib.KeyboardKey +M.KEY_KP_ADD = M.KeyboardKey.KEY_KP_ADD +---@type raylib.KeyboardKey +M.KEY_KP_ENTER = M.KeyboardKey.KEY_KP_ENTER +---@type raylib.KeyboardKey +M.KEY_KP_EQUAL = M.KeyboardKey.KEY_KP_EQUAL +---@type raylib.KeyboardKey +M.KEY_BACK = M.KeyboardKey.KEY_BACK +---@type raylib.KeyboardKey +M.KEY_MENU = M.KeyboardKey.KEY_MENU +---@type raylib.KeyboardKey +M.KEY_VOLUME_UP = M.KeyboardKey.KEY_VOLUME_UP +---@type raylib.KeyboardKey +M.KEY_VOLUME_DOWN = M.KeyboardKey.KEY_VOLUME_DOWN +---@type raylib.MouseButton +M.MOUSE_BUTTON_LEFT = M.MouseButton.MOUSE_BUTTON_LEFT +---@type raylib.MouseButton +M.MOUSE_BUTTON_RIGHT = M.MouseButton.MOUSE_BUTTON_RIGHT +---@type raylib.MouseButton +M.MOUSE_BUTTON_MIDDLE = M.MouseButton.MOUSE_BUTTON_MIDDLE +---@type raylib.MouseButton +M.MOUSE_BUTTON_SIDE = M.MouseButton.MOUSE_BUTTON_SIDE +---@type raylib.MouseButton +M.MOUSE_BUTTON_EXTRA = M.MouseButton.MOUSE_BUTTON_EXTRA +---@type raylib.MouseButton +M.MOUSE_BUTTON_FORWARD = M.MouseButton.MOUSE_BUTTON_FORWARD +---@type raylib.MouseButton +M.MOUSE_BUTTON_BACK = M.MouseButton.MOUSE_BUTTON_BACK +---@type raylib.MouseCursor +M.MOUSE_CURSOR_DEFAULT = M.MouseCursor.MOUSE_CURSOR_DEFAULT +---@type raylib.MouseCursor +M.MOUSE_CURSOR_ARROW = M.MouseCursor.MOUSE_CURSOR_ARROW +---@type raylib.MouseCursor +M.MOUSE_CURSOR_IBEAM = M.MouseCursor.MOUSE_CURSOR_IBEAM +---@type raylib.MouseCursor +M.MOUSE_CURSOR_CROSSHAIR = M.MouseCursor.MOUSE_CURSOR_CROSSHAIR +---@type raylib.MouseCursor +M.MOUSE_CURSOR_POINTING_HAND = M.MouseCursor.MOUSE_CURSOR_POINTING_HAND +---@type raylib.MouseCursor +M.MOUSE_CURSOR_RESIZE_EW = M.MouseCursor.MOUSE_CURSOR_RESIZE_EW +---@type raylib.MouseCursor +M.MOUSE_CURSOR_RESIZE_NS = M.MouseCursor.MOUSE_CURSOR_RESIZE_NS +---@type raylib.MouseCursor +M.MOUSE_CURSOR_RESIZE_NWSE = M.MouseCursor.MOUSE_CURSOR_RESIZE_NWSE +---@type raylib.MouseCursor +M.MOUSE_CURSOR_RESIZE_NESW = M.MouseCursor.MOUSE_CURSOR_RESIZE_NESW +---@type raylib.MouseCursor +M.MOUSE_CURSOR_RESIZE_ALL = M.MouseCursor.MOUSE_CURSOR_RESIZE_ALL +---@type raylib.MouseCursor +M.MOUSE_CURSOR_NOT_ALLOWED = M.MouseCursor.MOUSE_CURSOR_NOT_ALLOWED +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_UNKNOWN = M.GamepadButton.GAMEPAD_BUTTON_UNKNOWN +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_LEFT_FACE_UP = M.GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_UP +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_LEFT_FACE_RIGHT = M.GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_RIGHT +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_LEFT_FACE_DOWN = M.GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_DOWN +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_LEFT_FACE_LEFT = M.GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_LEFT +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_RIGHT_FACE_UP = M.GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_UP +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = M.GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_RIGHT +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_RIGHT_FACE_DOWN = M.GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_DOWN +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_RIGHT_FACE_LEFT = M.GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_LEFT +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_LEFT_TRIGGER_1 = M.GamepadButton.GAMEPAD_BUTTON_LEFT_TRIGGER_1 +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_LEFT_TRIGGER_2 = M.GamepadButton.GAMEPAD_BUTTON_LEFT_TRIGGER_2 +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = M.GamepadButton.GAMEPAD_BUTTON_RIGHT_TRIGGER_1 +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = M.GamepadButton.GAMEPAD_BUTTON_RIGHT_TRIGGER_2 +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_MIDDLE_LEFT = M.GamepadButton.GAMEPAD_BUTTON_MIDDLE_LEFT +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_MIDDLE = M.GamepadButton.GAMEPAD_BUTTON_MIDDLE +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_MIDDLE_RIGHT = M.GamepadButton.GAMEPAD_BUTTON_MIDDLE_RIGHT +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_LEFT_THUMB = M.GamepadButton.GAMEPAD_BUTTON_LEFT_THUMB +---@type raylib.GamepadButton +M.GAMEPAD_BUTTON_RIGHT_THUMB = M.GamepadButton.GAMEPAD_BUTTON_RIGHT_THUMB +---@type raylib.GamepadAxis +M.GAMEPAD_AXIS_LEFT_X = M.GamepadAxis.GAMEPAD_AXIS_LEFT_X +---@type raylib.GamepadAxis +M.GAMEPAD_AXIS_LEFT_Y = M.GamepadAxis.GAMEPAD_AXIS_LEFT_Y +---@type raylib.GamepadAxis +M.GAMEPAD_AXIS_RIGHT_X = M.GamepadAxis.GAMEPAD_AXIS_RIGHT_X +---@type raylib.GamepadAxis +M.GAMEPAD_AXIS_RIGHT_Y = M.GamepadAxis.GAMEPAD_AXIS_RIGHT_Y +---@type raylib.GamepadAxis +M.GAMEPAD_AXIS_LEFT_TRIGGER = M.GamepadAxis.GAMEPAD_AXIS_LEFT_TRIGGER +---@type raylib.GamepadAxis +M.GAMEPAD_AXIS_RIGHT_TRIGGER = M.GamepadAxis.GAMEPAD_AXIS_RIGHT_TRIGGER +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_ALBEDO = M.MaterialMapIndex.MATERIAL_MAP_ALBEDO +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_METALNESS = M.MaterialMapIndex.MATERIAL_MAP_METALNESS +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_NORMAL = M.MaterialMapIndex.MATERIAL_MAP_NORMAL +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_ROUGHNESS = M.MaterialMapIndex.MATERIAL_MAP_ROUGHNESS +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_OCCLUSION = M.MaterialMapIndex.MATERIAL_MAP_OCCLUSION +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_EMISSION = M.MaterialMapIndex.MATERIAL_MAP_EMISSION +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_HEIGHT = M.MaterialMapIndex.MATERIAL_MAP_HEIGHT +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_CUBEMAP = M.MaterialMapIndex.MATERIAL_MAP_CUBEMAP +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_IRRADIANCE = M.MaterialMapIndex.MATERIAL_MAP_IRRADIANCE +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_PREFILTER = M.MaterialMapIndex.MATERIAL_MAP_PREFILTER +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_BRDF = M.MaterialMapIndex.MATERIAL_MAP_BRDF +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_VERTEX_POSITION = M.ShaderLocationIndex.SHADER_LOC_VERTEX_POSITION +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_VERTEX_TEXCOORD01 = M.ShaderLocationIndex.SHADER_LOC_VERTEX_TEXCOORD01 +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_VERTEX_TEXCOORD02 = M.ShaderLocationIndex.SHADER_LOC_VERTEX_TEXCOORD02 +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_VERTEX_NORMAL = M.ShaderLocationIndex.SHADER_LOC_VERTEX_NORMAL +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_VERTEX_TANGENT = M.ShaderLocationIndex.SHADER_LOC_VERTEX_TANGENT +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_VERTEX_COLOR = M.ShaderLocationIndex.SHADER_LOC_VERTEX_COLOR +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MATRIX_MVP = M.ShaderLocationIndex.SHADER_LOC_MATRIX_MVP +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MATRIX_VIEW = M.ShaderLocationIndex.SHADER_LOC_MATRIX_VIEW +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MATRIX_PROJECTION = M.ShaderLocationIndex.SHADER_LOC_MATRIX_PROJECTION +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MATRIX_MODEL = M.ShaderLocationIndex.SHADER_LOC_MATRIX_MODEL +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MATRIX_NORMAL = M.ShaderLocationIndex.SHADER_LOC_MATRIX_NORMAL +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_VECTOR_VIEW = M.ShaderLocationIndex.SHADER_LOC_VECTOR_VIEW +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_COLOR_DIFFUSE = M.ShaderLocationIndex.SHADER_LOC_COLOR_DIFFUSE +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_COLOR_SPECULAR = M.ShaderLocationIndex.SHADER_LOC_COLOR_SPECULAR +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_COLOR_AMBIENT = M.ShaderLocationIndex.SHADER_LOC_COLOR_AMBIENT +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_ALBEDO = M.ShaderLocationIndex.SHADER_LOC_MAP_ALBEDO +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_METALNESS = M.ShaderLocationIndex.SHADER_LOC_MAP_METALNESS +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_NORMAL = M.ShaderLocationIndex.SHADER_LOC_MAP_NORMAL +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_ROUGHNESS = M.ShaderLocationIndex.SHADER_LOC_MAP_ROUGHNESS +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_OCCLUSION = M.ShaderLocationIndex.SHADER_LOC_MAP_OCCLUSION +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_EMISSION = M.ShaderLocationIndex.SHADER_LOC_MAP_EMISSION +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_HEIGHT = M.ShaderLocationIndex.SHADER_LOC_MAP_HEIGHT +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_CUBEMAP = M.ShaderLocationIndex.SHADER_LOC_MAP_CUBEMAP +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_IRRADIANCE = M.ShaderLocationIndex.SHADER_LOC_MAP_IRRADIANCE +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_PREFILTER = M.ShaderLocationIndex.SHADER_LOC_MAP_PREFILTER +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_BRDF = M.ShaderLocationIndex.SHADER_LOC_MAP_BRDF +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_VERTEX_BONEIDS = M.ShaderLocationIndex.SHADER_LOC_VERTEX_BONEIDS +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_VERTEX_BONEWEIGHTS = M.ShaderLocationIndex.SHADER_LOC_VERTEX_BONEWEIGHTS +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MATRIX_BONETRANSFORMS = M.ShaderLocationIndex.SHADER_LOC_MATRIX_BONETRANSFORMS +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_VERTEX_INSTANCETRANSFORM = M.ShaderLocationIndex.SHADER_LOC_VERTEX_INSTANCETRANSFORM +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_FLOAT = M.ShaderUniformDataType.SHADER_UNIFORM_FLOAT +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_VEC2 = M.ShaderUniformDataType.SHADER_UNIFORM_VEC2 +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_VEC3 = M.ShaderUniformDataType.SHADER_UNIFORM_VEC3 +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_VEC4 = M.ShaderUniformDataType.SHADER_UNIFORM_VEC4 +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_INT = M.ShaderUniformDataType.SHADER_UNIFORM_INT +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_IVEC2 = M.ShaderUniformDataType.SHADER_UNIFORM_IVEC2 +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_IVEC3 = M.ShaderUniformDataType.SHADER_UNIFORM_IVEC3 +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_IVEC4 = M.ShaderUniformDataType.SHADER_UNIFORM_IVEC4 +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_UINT = M.ShaderUniformDataType.SHADER_UNIFORM_UINT +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_UIVEC2 = M.ShaderUniformDataType.SHADER_UNIFORM_UIVEC2 +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_UIVEC3 = M.ShaderUniformDataType.SHADER_UNIFORM_UIVEC3 +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_UIVEC4 = M.ShaderUniformDataType.SHADER_UNIFORM_UIVEC4 +---@type raylib.ShaderUniformDataType +M.SHADER_UNIFORM_SAMPLER2D = M.ShaderUniformDataType.SHADER_UNIFORM_SAMPLER2D +---@type raylib.ShaderAttributeDataType +M.SHADER_ATTRIB_FLOAT = M.ShaderAttributeDataType.SHADER_ATTRIB_FLOAT +---@type raylib.ShaderAttributeDataType +M.SHADER_ATTRIB_VEC2 = M.ShaderAttributeDataType.SHADER_ATTRIB_VEC2 +---@type raylib.ShaderAttributeDataType +M.SHADER_ATTRIB_VEC3 = M.ShaderAttributeDataType.SHADER_ATTRIB_VEC3 +---@type raylib.ShaderAttributeDataType +M.SHADER_ATTRIB_VEC4 = M.ShaderAttributeDataType.SHADER_ATTRIB_VEC4 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_GRAYSCALE +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R5G6B5 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R5G6B5 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R8G8B8 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R8G8B8 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R32 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R32 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R32G32B32 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R32G32B32 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R16 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R16 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R16G16B16 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R16G16B16 +---@type raylib.PixelFormat +M.PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = M.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_DXT1_RGB = M.PixelFormat.PIXELFORMAT_COMPRESSED_DXT1_RGB +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_DXT1_RGBA = M.PixelFormat.PIXELFORMAT_COMPRESSED_DXT1_RGBA +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_DXT3_RGBA = M.PixelFormat.PIXELFORMAT_COMPRESSED_DXT3_RGBA +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_DXT5_RGBA = M.PixelFormat.PIXELFORMAT_COMPRESSED_DXT5_RGBA +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_ETC1_RGB = M.PixelFormat.PIXELFORMAT_COMPRESSED_ETC1_RGB +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_ETC2_RGB = M.PixelFormat.PIXELFORMAT_COMPRESSED_ETC2_RGB +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = M.PixelFormat.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_PVRT_RGB = M.PixelFormat.PIXELFORMAT_COMPRESSED_PVRT_RGB +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_PVRT_RGBA = M.PixelFormat.PIXELFORMAT_COMPRESSED_PVRT_RGBA +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = M.PixelFormat.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA +---@type raylib.PixelFormat +M.PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = M.PixelFormat.PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA +---@type raylib.TextureFilter +M.TEXTURE_FILTER_POINT = M.TextureFilter.TEXTURE_FILTER_POINT +---@type raylib.TextureFilter +M.TEXTURE_FILTER_BILINEAR = M.TextureFilter.TEXTURE_FILTER_BILINEAR +---@type raylib.TextureFilter +M.TEXTURE_FILTER_TRILINEAR = M.TextureFilter.TEXTURE_FILTER_TRILINEAR +---@type raylib.TextureFilter +M.TEXTURE_FILTER_ANISOTROPIC_4X = M.TextureFilter.TEXTURE_FILTER_ANISOTROPIC_4X +---@type raylib.TextureFilter +M.TEXTURE_FILTER_ANISOTROPIC_8X = M.TextureFilter.TEXTURE_FILTER_ANISOTROPIC_8X +---@type raylib.TextureFilter +M.TEXTURE_FILTER_ANISOTROPIC_16X = M.TextureFilter.TEXTURE_FILTER_ANISOTROPIC_16X +---@type raylib.TextureWrap +M.TEXTURE_WRAP_REPEAT = M.TextureWrap.TEXTURE_WRAP_REPEAT +---@type raylib.TextureWrap +M.TEXTURE_WRAP_CLAMP = M.TextureWrap.TEXTURE_WRAP_CLAMP +---@type raylib.TextureWrap +M.TEXTURE_WRAP_MIRROR_REPEAT = M.TextureWrap.TEXTURE_WRAP_MIRROR_REPEAT +---@type raylib.TextureWrap +M.TEXTURE_WRAP_MIRROR_CLAMP = M.TextureWrap.TEXTURE_WRAP_MIRROR_CLAMP +---@type raylib.CubemapLayout +M.CUBEMAP_LAYOUT_AUTO_DETECT = M.CubemapLayout.CUBEMAP_LAYOUT_AUTO_DETECT +---@type raylib.CubemapLayout +M.CUBEMAP_LAYOUT_LINE_VERTICAL = M.CubemapLayout.CUBEMAP_LAYOUT_LINE_VERTICAL +---@type raylib.CubemapLayout +M.CUBEMAP_LAYOUT_LINE_HORIZONTAL = M.CubemapLayout.CUBEMAP_LAYOUT_LINE_HORIZONTAL +---@type raylib.CubemapLayout +M.CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = M.CubemapLayout.CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR +---@type raylib.CubemapLayout +M.CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = M.CubemapLayout.CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE +---@type raylib.FontType +M.FONT_DEFAULT = M.FontType.FONT_DEFAULT +---@type raylib.FontType +M.FONT_BITMAP = M.FontType.FONT_BITMAP +---@type raylib.FontType +M.FONT_SDF = M.FontType.FONT_SDF +---@type raylib.BlendMode +M.BLEND_ALPHA = M.BlendMode.BLEND_ALPHA +---@type raylib.BlendMode +M.BLEND_ADDITIVE = M.BlendMode.BLEND_ADDITIVE +---@type raylib.BlendMode +M.BLEND_MULTIPLIED = M.BlendMode.BLEND_MULTIPLIED +---@type raylib.BlendMode +M.BLEND_ADD_COLORS = M.BlendMode.BLEND_ADD_COLORS +---@type raylib.BlendMode +M.BLEND_SUBTRACT_COLORS = M.BlendMode.BLEND_SUBTRACT_COLORS +---@type raylib.BlendMode +M.BLEND_ALPHA_PREMULTIPLY = M.BlendMode.BLEND_ALPHA_PREMULTIPLY +---@type raylib.BlendMode +M.BLEND_CUSTOM = M.BlendMode.BLEND_CUSTOM +---@type raylib.BlendMode +M.BLEND_CUSTOM_SEPARATE = M.BlendMode.BLEND_CUSTOM_SEPARATE +---@type raylib.Gesture +M.GESTURE_NONE = M.Gesture.GESTURE_NONE +---@type raylib.Gesture +M.GESTURE_TAP = M.Gesture.GESTURE_TAP +---@type raylib.Gesture +M.GESTURE_DOUBLETAP = M.Gesture.GESTURE_DOUBLETAP +---@type raylib.Gesture +M.GESTURE_HOLD = M.Gesture.GESTURE_HOLD +---@type raylib.Gesture +M.GESTURE_DRAG = M.Gesture.GESTURE_DRAG +---@type raylib.Gesture +M.GESTURE_SWIPE_RIGHT = M.Gesture.GESTURE_SWIPE_RIGHT +---@type raylib.Gesture +M.GESTURE_SWIPE_LEFT = M.Gesture.GESTURE_SWIPE_LEFT +---@type raylib.Gesture +M.GESTURE_SWIPE_UP = M.Gesture.GESTURE_SWIPE_UP +---@type raylib.Gesture +M.GESTURE_SWIPE_DOWN = M.Gesture.GESTURE_SWIPE_DOWN +---@type raylib.Gesture +M.GESTURE_PINCH_IN = M.Gesture.GESTURE_PINCH_IN +---@type raylib.Gesture +M.GESTURE_PINCH_OUT = M.Gesture.GESTURE_PINCH_OUT +---@type raylib.CameraMode +M.CAMERA_CUSTOM = M.CameraMode.CAMERA_CUSTOM +---@type raylib.CameraMode +M.CAMERA_FREE = M.CameraMode.CAMERA_FREE +---@type raylib.CameraMode +M.CAMERA_ORBITAL = M.CameraMode.CAMERA_ORBITAL +---@type raylib.CameraMode +M.CAMERA_FIRST_PERSON = M.CameraMode.CAMERA_FIRST_PERSON +---@type raylib.CameraMode +M.CAMERA_THIRD_PERSON = M.CameraMode.CAMERA_THIRD_PERSON +---@type raylib.CameraProjection +M.CAMERA_PERSPECTIVE = M.CameraProjection.CAMERA_PERSPECTIVE +---@type raylib.CameraProjection +M.CAMERA_ORTHOGRAPHIC = M.CameraProjection.CAMERA_ORTHOGRAPHIC +---@type raylib.NPatchLayout +M.NPATCH_NINE_PATCH = M.NPatchLayout.NPATCH_NINE_PATCH +---@type raylib.NPatchLayout +M.NPATCH_THREE_PATCH_VERTICAL = M.NPatchLayout.NPATCH_THREE_PATCH_VERTICAL +---@type raylib.NPatchLayout +M.NPATCH_THREE_PATCH_HORIZONTAL = M.NPatchLayout.NPATCH_THREE_PATCH_HORIZONTAL +---@type raylib.rlGlVersion +M.RL_OPENGL_SOFTWARE = M.rlGlVersion.RL_OPENGL_SOFTWARE +---@type raylib.rlGlVersion +M.RL_OPENGL_11 = M.rlGlVersion.RL_OPENGL_11 +---@type raylib.rlGlVersion +M.RL_OPENGL_21 = M.rlGlVersion.RL_OPENGL_21 +---@type raylib.rlGlVersion +M.RL_OPENGL_33 = M.rlGlVersion.RL_OPENGL_33 +---@type raylib.rlGlVersion +M.RL_OPENGL_43 = M.rlGlVersion.RL_OPENGL_43 +---@type raylib.rlGlVersion +M.RL_OPENGL_ES_20 = M.rlGlVersion.RL_OPENGL_ES_20 +---@type raylib.rlGlVersion +M.RL_OPENGL_ES_30 = M.rlGlVersion.RL_OPENGL_ES_30 +---@type raylib.rlTraceLogLevel +M.RL_LOG_ALL = M.rlTraceLogLevel.RL_LOG_ALL +---@type raylib.rlTraceLogLevel +M.RL_LOG_TRACE = M.rlTraceLogLevel.RL_LOG_TRACE +---@type raylib.rlTraceLogLevel +M.RL_LOG_DEBUG = M.rlTraceLogLevel.RL_LOG_DEBUG +---@type raylib.rlTraceLogLevel +M.RL_LOG_INFO = M.rlTraceLogLevel.RL_LOG_INFO +---@type raylib.rlTraceLogLevel +M.RL_LOG_WARNING = M.rlTraceLogLevel.RL_LOG_WARNING +---@type raylib.rlTraceLogLevel +M.RL_LOG_ERROR = M.rlTraceLogLevel.RL_LOG_ERROR +---@type raylib.rlTraceLogLevel +M.RL_LOG_FATAL = M.rlTraceLogLevel.RL_LOG_FATAL +---@type raylib.rlTraceLogLevel +M.RL_LOG_NONE = M.rlTraceLogLevel.RL_LOG_NONE +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R32 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R32 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R16 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R16 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = M.rlPixelFormat.RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_DXT1_RGB +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_ETC1_RGB +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_ETC2_RGB +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_PVRT_RGB +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA +---@type raylib.rlPixelFormat +M.RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = M.rlPixelFormat.RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA +---@type raylib.rlTextureFilter +M.RL_TEXTURE_FILTER_POINT = M.rlTextureFilter.RL_TEXTURE_FILTER_POINT +---@type raylib.rlTextureFilter +M.RL_TEXTURE_FILTER_BILINEAR = M.rlTextureFilter.RL_TEXTURE_FILTER_BILINEAR +---@type raylib.rlTextureFilter +M.RL_TEXTURE_FILTER_TRILINEAR = M.rlTextureFilter.RL_TEXTURE_FILTER_TRILINEAR +---@type raylib.rlTextureFilter +M.RL_TEXTURE_FILTER_ANISOTROPIC_4X = M.rlTextureFilter.RL_TEXTURE_FILTER_ANISOTROPIC_4X +---@type raylib.rlTextureFilter +M.RL_TEXTURE_FILTER_ANISOTROPIC_8X = M.rlTextureFilter.RL_TEXTURE_FILTER_ANISOTROPIC_8X +---@type raylib.rlTextureFilter +M.RL_TEXTURE_FILTER_ANISOTROPIC_16X = M.rlTextureFilter.RL_TEXTURE_FILTER_ANISOTROPIC_16X +---@type raylib.rlBlendMode +M.RL_BLEND_ALPHA = M.rlBlendMode.RL_BLEND_ALPHA +---@type raylib.rlBlendMode +M.RL_BLEND_ADDITIVE = M.rlBlendMode.RL_BLEND_ADDITIVE +---@type raylib.rlBlendMode +M.RL_BLEND_MULTIPLIED = M.rlBlendMode.RL_BLEND_MULTIPLIED +---@type raylib.rlBlendMode +M.RL_BLEND_ADD_COLORS = M.rlBlendMode.RL_BLEND_ADD_COLORS +---@type raylib.rlBlendMode +M.RL_BLEND_SUBTRACT_COLORS = M.rlBlendMode.RL_BLEND_SUBTRACT_COLORS +---@type raylib.rlBlendMode +M.RL_BLEND_ALPHA_PREMULTIPLY = M.rlBlendMode.RL_BLEND_ALPHA_PREMULTIPLY +---@type raylib.rlBlendMode +M.RL_BLEND_CUSTOM = M.rlBlendMode.RL_BLEND_CUSTOM +---@type raylib.rlBlendMode +M.RL_BLEND_CUSTOM_SEPARATE = M.rlBlendMode.RL_BLEND_CUSTOM_SEPARATE +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_VERTEX_POSITION = M.rlShaderLocationIndex.RL_SHADER_LOC_VERTEX_POSITION +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_VERTEX_TEXCOORD01 = M.rlShaderLocationIndex.RL_SHADER_LOC_VERTEX_TEXCOORD01 +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_VERTEX_TEXCOORD02 = M.rlShaderLocationIndex.RL_SHADER_LOC_VERTEX_TEXCOORD02 +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_VERTEX_NORMAL = M.rlShaderLocationIndex.RL_SHADER_LOC_VERTEX_NORMAL +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_VERTEX_TANGENT = M.rlShaderLocationIndex.RL_SHADER_LOC_VERTEX_TANGENT +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_VERTEX_COLOR = M.rlShaderLocationIndex.RL_SHADER_LOC_VERTEX_COLOR +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MATRIX_MVP = M.rlShaderLocationIndex.RL_SHADER_LOC_MATRIX_MVP +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MATRIX_VIEW = M.rlShaderLocationIndex.RL_SHADER_LOC_MATRIX_VIEW +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MATRIX_PROJECTION = M.rlShaderLocationIndex.RL_SHADER_LOC_MATRIX_PROJECTION +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MATRIX_MODEL = M.rlShaderLocationIndex.RL_SHADER_LOC_MATRIX_MODEL +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MATRIX_NORMAL = M.rlShaderLocationIndex.RL_SHADER_LOC_MATRIX_NORMAL +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_VECTOR_VIEW = M.rlShaderLocationIndex.RL_SHADER_LOC_VECTOR_VIEW +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_COLOR_DIFFUSE = M.rlShaderLocationIndex.RL_SHADER_LOC_COLOR_DIFFUSE +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_COLOR_SPECULAR = M.rlShaderLocationIndex.RL_SHADER_LOC_COLOR_SPECULAR +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_COLOR_AMBIENT = M.rlShaderLocationIndex.RL_SHADER_LOC_COLOR_AMBIENT +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_ALBEDO = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_ALBEDO +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_METALNESS = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_METALNESS +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_NORMAL = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_NORMAL +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_ROUGHNESS = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_ROUGHNESS +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_OCCLUSION = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_OCCLUSION +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_EMISSION = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_EMISSION +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_HEIGHT = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_HEIGHT +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_CUBEMAP = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_CUBEMAP +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_IRRADIANCE = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_IRRADIANCE +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_PREFILTER = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_PREFILTER +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_BRDF = M.rlShaderLocationIndex.RL_SHADER_LOC_MAP_BRDF +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_FLOAT = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_FLOAT +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_VEC2 = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_VEC2 +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_VEC3 = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_VEC3 +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_VEC4 = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_VEC4 +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_INT = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_INT +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_IVEC2 = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_IVEC2 +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_IVEC3 = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_IVEC3 +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_IVEC4 = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_IVEC4 +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_UINT = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_UINT +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_UIVEC2 = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_UIVEC2 +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_UIVEC3 = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_UIVEC3 +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_UIVEC4 = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_UIVEC4 +---@type raylib.rlShaderUniformDataType +M.RL_SHADER_UNIFORM_SAMPLER2D = M.rlShaderUniformDataType.RL_SHADER_UNIFORM_SAMPLER2D +---@type raylib.rlShaderAttributeDataType +M.RL_SHADER_ATTRIB_FLOAT = M.rlShaderAttributeDataType.RL_SHADER_ATTRIB_FLOAT +---@type raylib.rlShaderAttributeDataType +M.RL_SHADER_ATTRIB_VEC2 = M.rlShaderAttributeDataType.RL_SHADER_ATTRIB_VEC2 +---@type raylib.rlShaderAttributeDataType +M.RL_SHADER_ATTRIB_VEC3 = M.rlShaderAttributeDataType.RL_SHADER_ATTRIB_VEC3 +---@type raylib.rlShaderAttributeDataType +M.RL_SHADER_ATTRIB_VEC4 = M.rlShaderAttributeDataType.RL_SHADER_ATTRIB_VEC4 +---@type raylib.rlFramebufferAttachType +M.RL_ATTACHMENT_COLOR_CHANNEL0 = M.rlFramebufferAttachType.RL_ATTACHMENT_COLOR_CHANNEL0 +---@type raylib.rlFramebufferAttachType +M.RL_ATTACHMENT_COLOR_CHANNEL1 = M.rlFramebufferAttachType.RL_ATTACHMENT_COLOR_CHANNEL1 +---@type raylib.rlFramebufferAttachType +M.RL_ATTACHMENT_COLOR_CHANNEL2 = M.rlFramebufferAttachType.RL_ATTACHMENT_COLOR_CHANNEL2 +---@type raylib.rlFramebufferAttachType +M.RL_ATTACHMENT_COLOR_CHANNEL3 = M.rlFramebufferAttachType.RL_ATTACHMENT_COLOR_CHANNEL3 +---@type raylib.rlFramebufferAttachType +M.RL_ATTACHMENT_COLOR_CHANNEL4 = M.rlFramebufferAttachType.RL_ATTACHMENT_COLOR_CHANNEL4 +---@type raylib.rlFramebufferAttachType +M.RL_ATTACHMENT_COLOR_CHANNEL5 = M.rlFramebufferAttachType.RL_ATTACHMENT_COLOR_CHANNEL5 +---@type raylib.rlFramebufferAttachType +M.RL_ATTACHMENT_COLOR_CHANNEL6 = M.rlFramebufferAttachType.RL_ATTACHMENT_COLOR_CHANNEL6 +---@type raylib.rlFramebufferAttachType +M.RL_ATTACHMENT_COLOR_CHANNEL7 = M.rlFramebufferAttachType.RL_ATTACHMENT_COLOR_CHANNEL7 +---@type raylib.rlFramebufferAttachType +M.RL_ATTACHMENT_DEPTH = M.rlFramebufferAttachType.RL_ATTACHMENT_DEPTH +---@type raylib.rlFramebufferAttachType +M.RL_ATTACHMENT_STENCIL = M.rlFramebufferAttachType.RL_ATTACHMENT_STENCIL +---@type raylib.rlFramebufferAttachTextureType +M.RL_ATTACHMENT_CUBEMAP_POSITIVE_X = M.rlFramebufferAttachTextureType.RL_ATTACHMENT_CUBEMAP_POSITIVE_X +---@type raylib.rlFramebufferAttachTextureType +M.RL_ATTACHMENT_CUBEMAP_NEGATIVE_X = M.rlFramebufferAttachTextureType.RL_ATTACHMENT_CUBEMAP_NEGATIVE_X +---@type raylib.rlFramebufferAttachTextureType +M.RL_ATTACHMENT_CUBEMAP_POSITIVE_Y = M.rlFramebufferAttachTextureType.RL_ATTACHMENT_CUBEMAP_POSITIVE_Y +---@type raylib.rlFramebufferAttachTextureType +M.RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y = M.rlFramebufferAttachTextureType.RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y +---@type raylib.rlFramebufferAttachTextureType +M.RL_ATTACHMENT_CUBEMAP_POSITIVE_Z = M.rlFramebufferAttachTextureType.RL_ATTACHMENT_CUBEMAP_POSITIVE_Z +---@type raylib.rlFramebufferAttachTextureType +M.RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z = M.rlFramebufferAttachTextureType.RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z +---@type raylib.rlFramebufferAttachTextureType +M.RL_ATTACHMENT_TEXTURE2D = M.rlFramebufferAttachTextureType.RL_ATTACHMENT_TEXTURE2D +---@type raylib.rlFramebufferAttachTextureType +M.RL_ATTACHMENT_RENDERBUFFER = M.rlFramebufferAttachTextureType.RL_ATTACHMENT_RENDERBUFFER +---@type raylib.rlCullMode +M.RL_CULL_FACE_FRONT = M.rlCullMode.RL_CULL_FACE_FRONT +---@type raylib.rlCullMode +M.RL_CULL_FACE_BACK = M.rlCullMode.RL_CULL_FACE_BACK + +M.RAYLIB_VERSION_MAJOR = 6 +M.RAYLIB_VERSION_MINOR = 5 +M.RAYLIB_VERSION_PATCH = 0 +M.RAYLIB_VERSION = "6.5-dev" +M.PI = 3.1415926535898 +M.DEG2RAD = 0.017453292519943 +M.RAD2DEG = 57.295779513082 +---@type raylib.Color +M.LIGHTGRAY = ffi.new("Color", { r = 200, g = 200, b = 200, a = 255 }) +---@type raylib.Color +M.GRAY = ffi.new("Color", { r = 130, g = 130, b = 130, a = 255 }) +---@type raylib.Color +M.DARKGRAY = ffi.new("Color", { r = 80, g = 80, b = 80, a = 255 }) +---@type raylib.Color +M.YELLOW = ffi.new("Color", { r = 253, g = 249, b = 0, a = 255 }) +---@type raylib.Color +M.GOLD = ffi.new("Color", { r = 255, g = 203, b = 0, a = 255 }) +---@type raylib.Color +M.ORANGE = ffi.new("Color", { r = 255, g = 161, b = 0, a = 255 }) +---@type raylib.Color +M.PINK = ffi.new("Color", { r = 255, g = 109, b = 194, a = 255 }) +---@type raylib.Color +M.RED = ffi.new("Color", { r = 230, g = 41, b = 55, a = 255 }) +---@type raylib.Color +M.MAROON = ffi.new("Color", { r = 190, g = 33, b = 55, a = 255 }) +---@type raylib.Color +M.GREEN = ffi.new("Color", { r = 0, g = 228, b = 48, a = 255 }) +---@type raylib.Color +M.LIME = ffi.new("Color", { r = 0, g = 158, b = 47, a = 255 }) +---@type raylib.Color +M.DARKGREEN = ffi.new("Color", { r = 0, g = 117, b = 44, a = 255 }) +---@type raylib.Color +M.SKYBLUE = ffi.new("Color", { r = 102, g = 191, b = 255, a = 255 }) +---@type raylib.Color +M.BLUE = ffi.new("Color", { r = 0, g = 121, b = 241, a = 255 }) +---@type raylib.Color +M.DARKBLUE = ffi.new("Color", { r = 0, g = 82, b = 172, a = 255 }) +---@type raylib.Color +M.PURPLE = ffi.new("Color", { r = 200, g = 122, b = 255, a = 255 }) +---@type raylib.Color +M.VIOLET = ffi.new("Color", { r = 135, g = 60, b = 190, a = 255 }) +---@type raylib.Color +M.DARKPURPLE = ffi.new("Color", { r = 112, g = 31, b = 126, a = 255 }) +---@type raylib.Color +M.BEIGE = ffi.new("Color", { r = 211, g = 176, b = 131, a = 255 }) +---@type raylib.Color +M.BROWN = ffi.new("Color", { r = 127, g = 106, b = 79, a = 255 }) +---@type raylib.Color +M.DARKBROWN = ffi.new("Color", { r = 76, g = 63, b = 47, a = 255 }) +---@type raylib.Color +M.WHITE = ffi.new("Color", { r = 255, g = 255, b = 255, a = 255 }) +---@type raylib.Color +M.BLACK = ffi.new("Color", { r = 0, g = 0, b = 0, a = 255 }) +---@type raylib.Color +M.BLANK = ffi.new("Color", { r = 0, g = 0, b = 0, a = 0 }) +---@type raylib.Color +M.MAGENTA = ffi.new("Color", { r = 255, g = 0, b = 255, a = 255 }) +---@type raylib.Color +M.RAYWHITE = ffi.new("Color", { r = 245, g = 245, b = 245, a = 255 }) +M.RLGL_VERSION = "6.0" +M.RL_DEFAULT_BATCH_BUFFER_ELEMENTS = 8192 +M.RL_DEFAULT_BATCH_BUFFERS = 1 +M.RL_DEFAULT_BATCH_DRAWCALLS = 256 +M.RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS = 4 +M.RL_MAX_MATRIX_STACK_SIZE = 32 +M.RL_MAX_SHADER_LOCATIONS = 32 +M.RL_CULL_DISTANCE_NEAR = 0.05 +M.RL_CULL_DISTANCE_FAR = 4000 +M.RL_TEXTURE_WRAP_S = 10242 +M.RL_TEXTURE_WRAP_T = 10243 +M.RL_TEXTURE_MAG_FILTER = 10240 +M.RL_TEXTURE_MIN_FILTER = 10241 +M.RL_TEXTURE_FILTER_NEAREST = 9728 +M.RL_TEXTURE_FILTER_LINEAR = 9729 +M.RL_TEXTURE_FILTER_MIP_NEAREST = 9984 +M.RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR = 9986 +M.RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST = 9985 +M.RL_TEXTURE_FILTER_MIP_LINEAR = 9987 +M.RL_TEXTURE_FILTER_ANISOTROPIC = 12288 +M.RL_TEXTURE_MIPMAP_BIAS_RATIO = 16384 +M.RL_TEXTURE_WRAP_REPEAT = 10497 +M.RL_TEXTURE_WRAP_CLAMP = 33071 +M.RL_TEXTURE_WRAP_MIRROR_REPEAT = 33648 +M.RL_TEXTURE_WRAP_MIRROR_CLAMP = 34626 +M.RL_MODELVIEW = 5888 +M.RL_PROJECTION = 5889 +M.RL_TEXTURE = 5890 +M.RL_LINES = 1 +M.RL_TRIANGLES = 4 +M.RL_QUADS = 7 +M.RL_UNSIGNED_BYTE = 5121 +M.RL_FLOAT = 5126 +M.RL_STREAM_DRAW = 35040 +M.RL_STREAM_READ = 35041 +M.RL_STREAM_COPY = 35042 +M.RL_STATIC_DRAW = 35044 +M.RL_STATIC_READ = 35045 +M.RL_STATIC_COPY = 35046 +M.RL_DYNAMIC_DRAW = 35048 +M.RL_DYNAMIC_READ = 35049 +M.RL_DYNAMIC_COPY = 35050 +M.RL_FRAGMENT_SHADER = 35632 +M.RL_VERTEX_SHADER = 35633 +M.RL_COMPUTE_SHADER = 37305 +M.RL_ZERO = 0 +M.RL_ONE = 1 +M.RL_SRC_COLOR = 768 +M.RL_ONE_MINUS_SRC_COLOR = 769 +M.RL_SRC_ALPHA = 770 +M.RL_ONE_MINUS_SRC_ALPHA = 771 +M.RL_DST_ALPHA = 772 +M.RL_ONE_MINUS_DST_ALPHA = 773 +M.RL_DST_COLOR = 774 +M.RL_ONE_MINUS_DST_COLOR = 775 +M.RL_SRC_ALPHA_SATURATE = 776 +M.RL_CONSTANT_COLOR = 32769 +M.RL_ONE_MINUS_CONSTANT_COLOR = 32770 +M.RL_CONSTANT_ALPHA = 32771 +M.RL_ONE_MINUS_CONSTANT_ALPHA = 32772 +M.RL_FUNC_ADD = 32774 +M.RL_MIN = 32775 +M.RL_MAX = 32776 +M.RL_FUNC_SUBTRACT = 32778 +M.RL_FUNC_REVERSE_SUBTRACT = 32779 +M.RL_BLEND_EQUATION = 32777 +M.RL_BLEND_EQUATION_RGB = 32777 +M.RL_BLEND_EQUATION_ALPHA = 34877 +M.RL_BLEND_DST_RGB = 32968 +M.RL_BLEND_SRC_RGB = 32969 +M.RL_BLEND_DST_ALPHA = 32970 +M.RL_BLEND_SRC_ALPHA = 32971 +M.RL_BLEND_COLOR = 32773 +M.RL_READ_FRAMEBUFFER = 36008 +M.RL_DRAW_FRAMEBUFFER = 36009 +M.RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION = 0 +M.RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD = 1 +M.RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL = 2 +M.RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR = 3 +M.RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT = 4 +M.RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 = 5 +M.RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES = 6 +M.RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES = 7 +M.RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS = 8 +M.RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM = 9 +M.EPSILON = 1e-06 +---@type raylib.MouseButton +M.MOUSE_LEFT_BUTTON = M.MOUSE_BUTTON_LEFT +---@type raylib.MouseButton +M.MOUSE_RIGHT_BUTTON = M.MOUSE_BUTTON_RIGHT +---@type raylib.MouseButton +M.MOUSE_MIDDLE_BUTTON = M.MOUSE_BUTTON_MIDDLE +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_DIFFUSE = M.MATERIAL_MAP_ALBEDO +---@type raylib.MaterialMapIndex +M.MATERIAL_MAP_SPECULAR = M.MATERIAL_MAP_METALNESS +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_DIFFUSE = M.SHADER_LOC_MAP_ALBEDO +---@type raylib.ShaderLocationIndex +M.SHADER_LOC_MAP_SPECULAR = M.SHADER_LOC_MAP_METALNESS +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_DIFFUSE = M.RL_SHADER_LOC_MAP_ALBEDO +---@type raylib.rlShaderLocationIndex +M.RL_SHADER_LOC_MAP_SPECULAR = M.RL_SHADER_LOC_MAP_METALNESS + +---Vector2, 2 components +---@class raylib.Vector2 +---@field x number Vector x component +---@field y number Vector y component + +---Vector3, 3 components +---@class raylib.Vector3 +---@field x number Vector x component +---@field y number Vector y component +---@field z number Vector z component + +---Vector4, 4 components +---@class raylib.Vector4 +---@field x number Vector x component +---@field y number Vector y component +---@field z number Vector z component +---@field w number Vector w component + +---Matrix, 4x4 components, column major, OpenGL style, right-handed +---@class raylib.Matrix +---@field m0 number Matrix first row (4 components) +---@field m4 number Matrix first row (4 components) +---@field m8 number Matrix first row (4 components) +---@field m12 number Matrix first row (4 components) +---@field m1 number Matrix second row (4 components) +---@field m5 number Matrix second row (4 components) +---@field m9 number Matrix second row (4 components) +---@field m13 number Matrix second row (4 components) +---@field m2 number Matrix third row (4 components) +---@field m6 number Matrix third row (4 components) +---@field m10 number Matrix third row (4 components) +---@field m14 number Matrix third row (4 components) +---@field m3 number Matrix fourth row (4 components) +---@field m7 number Matrix fourth row (4 components) +---@field m11 number Matrix fourth row (4 components) +---@field m15 number Matrix fourth row (4 components) + +---Color, 4 components, R8G8B8A8 (32bit) +---@class raylib.Color +---@field r integer Color red value +---@field g integer Color green value +---@field b integer Color blue value +---@field a integer Color alpha value + +---Rectangle, 4 components +---@class raylib.Rectangle +---@field x number Rectangle top-left corner position x +---@field y number Rectangle top-left corner position y +---@field width number Rectangle width +---@field height number Rectangle height + +---Image, pixel data stored in CPU memory (RAM) +---@class raylib.Image +---@field data ffi.cdata* Image raw data +---@field width integer Image base width +---@field height integer Image base height +---@field mipmaps integer Mipmap levels, 1 by default +---@field format integer Data format (PixelFormat type) + +---Texture, tex data stored in GPU memory (VRAM) +---@class raylib.Texture +---@field id integer OpenGL texture id +---@field width integer Texture base width +---@field height integer Texture base height +---@field mipmaps integer Mipmap levels, 1 by default +---@field format integer Data format (PixelFormat type) + +---RenderTexture, fbo for texture rendering +---@class raylib.RenderTexture +---@field id integer OpenGL framebuffer object id +---@field texture raylib.Texture Color buffer attachment texture +---@field depth raylib.Texture Depth buffer attachment texture + +---NPatchInfo, n-patch layout info +---@class raylib.NPatchInfo +---@field source raylib.Rectangle Texture source rectangle +---@field left integer Left border offset +---@field top integer Top border offset +---@field right integer Right border offset +---@field bottom integer Bottom border offset +---@field layout integer Layout of the n-patch: 3x3, 1x3 or 3x1 + +---GlyphInfo, font characters glyphs info +---@class raylib.GlyphInfo +---@field value integer Character value (Unicode) +---@field offsetX integer Character offset X when drawing +---@field offsetY integer Character offset Y when drawing +---@field advanceX integer Character advance position X +---@field image raylib.Image Character image data + +---@alias raylib.Texture2D raylib.Texture + +---Font, font texture and GlyphInfo array data +---@class raylib.Font +---@field baseSize integer Base size (default chars height) +---@field glyphCount integer Number of glyph characters +---@field glyphPadding integer Padding around the glyph characters +---@field texture raylib.Texture2D Texture atlas containing the glyphs +---@field recs raylib.Rectangle[] Rectangles in texture for the glyphs +---@field glyphs raylib.GlyphInfo[] Glyphs info data + +---Camera, defines position/orientation in 3d space +---@class raylib.Camera3D +---@field position raylib.Vector3 Camera position +---@field target raylib.Vector3 Camera target it looks-at +---@field up raylib.Vector3 Camera up vector (rotation over its axis) +---@field fovy number Camera field-of-view aperture in Y (degrees) in perspective, used as near plane height in world units in orthographic +---@field projection integer Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC + +---Camera2D, defines position/orientation in 2d space +---@class raylib.Camera2D +---@field offset raylib.Vector2 Camera offset (screen space offset from window origin, unscaled by DPI, real pixel size) +---@field target raylib.Vector2 Camera target (world space target point that is mapped to screen space offset) +---@field rotation number Camera rotation in degrees (pivots around target) +---@field zoom number Camera zoom (scaling around target), must not be set to 0, set to 1.0f for no scale + +---Mesh, vertex data and vao/vbo +---@class raylib.Mesh +---@field vertexCount integer Number of vertices stored in arrays +---@field triangleCount integer Number of triangles stored (indexed or not) +---@field vertices number[] Vertex position (XYZ - 3 components per vertex) (shader-location = 0) +---@field texcoords number[] Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) +---@field texcoords2 number[] Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5) +---@field normals number[] Vertex normals (XYZ - 3 components per vertex) (shader-location = 2) +---@field tangents number[] Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4) +---@field colors integer[] Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) +---@field indices integer[] Vertex indices (in case vertex data comes indexed) +---@field boneCount integer Number of bones (MAX: 256 bones) +---@field boneIndices integer[] Vertex bone indices, up to 4 bones influence by vertex (skinning) (shader-location = 6) +---@field boneWeights number[] Vertex bone weight, up to 4 bones influence by vertex (skinning) (shader-location = 7) +---@field animVertices number[] Animated vertex positions (after bones transformations) +---@field animNormals number[] Animated normals (after bones transformations) +---@field vaoId integer OpenGL Vertex Array Object id +---@field vboId integer[] OpenGL Vertex Buffer Objects id (default vertex data) + +---Shader +---@class raylib.Shader +---@field id integer Shader program id +---@field locs integer[] Shader locations array (RL_MAX_SHADER_LOCATIONS) + +---MaterialMap +---@class raylib.MaterialMap +---@field texture raylib.Texture2D Material map texture +---@field color raylib.Color Material map color +---@field value number Material map value + +---Material, includes shader and maps +---@class raylib.Material +---@field shader raylib.Shader Material shader +---@field maps raylib.MaterialMap[] Material maps array (MAX_MATERIAL_MAPS) +---@field params number[] Material generic parameters (if required) + +---@alias raylib.Quaternion raylib.Vector4 + +---Transform, vertex transformation data +---@class raylib.Transform +---@field translation raylib.Vector3 Translation +---@field rotation raylib.Quaternion Rotation +---@field scale raylib.Vector3 Scale + +---Bone, skeletal animation bone +---@class raylib.BoneInfo +---@field name raylib.char_buffer Bone name +---@field parent integer Bone parent + +---@alias raylib.ModelAnimPose ffi.cdata* + +---Skeleton, animation bones hierarchy +---@class raylib.ModelSkeleton +---@field boneCount integer Number of bones +---@field bones raylib.BoneInfo[] Bones information (skeleton) +---@field bindPose raylib.ModelAnimPose Bones base transformation (Transform[]) + +---Model, meshes, materials and animation data +---@class raylib.Model +---@field transform raylib.Matrix Local transform matrix +---@field meshCount integer Number of meshes +---@field materialCount integer Number of materials +---@field meshes raylib.Mesh[] Meshes array +---@field materials raylib.Material[] Materials array +---@field meshMaterial integer[] Mesh material number +---@field skeleton raylib.ModelSkeleton Skeleton for animation +---@field currentPose raylib.ModelAnimPose Current animation pose (Transform[]) +---@field boneMatrices raylib.Matrix[] Bones animated transformation matrices + +---ModelAnimation, contains a full animation sequence +---@class raylib.ModelAnimation +---@field name raylib.char_buffer Animation name +---@field boneCount integer Number of bones (per pose) +---@field keyframeCount integer Number of animation key frames +---@field keyframePoses raylib.ModelAnimPose[] Animation sequence keyframe poses [keyframe][pose] + +---Ray, ray for raycasting +---@class raylib.Ray +---@field position raylib.Vector3 Ray position (origin) +---@field direction raylib.Vector3 Ray direction (normalized) + +---RayCollision, ray hit information +---@class raylib.RayCollision +---@field hit boolean Did the ray hit something? +---@field distance number Distance to the nearest hit +---@field point raylib.Vector3 Point of the nearest hit +---@field normal raylib.Vector3 Surface normal of hit + +---BoundingBox +---@class raylib.BoundingBox +---@field min raylib.Vector3 Minimum vertex box-corner +---@field max raylib.Vector3 Maximum vertex box-corner + +---Wave, audio wave data +---@class raylib.Wave +---@field frameCount integer Total number of frames (considering channels) +---@field sampleRate integer Frequency (samples per second) +---@field sampleSize integer Bit depth (bits per sample): 8, 16, 32 (24 not supported) +---@field channels integer Number of channels (1-mono, 2-stereo, ...) +---@field data ffi.cdata* Buffer data pointer + +---AudioStream, custom audio stream +---@class raylib.AudioStream +---@field buffer ffi.cdata* Pointer to internal data used by the audio system +---@field processor ffi.cdata* Pointer to internal data processor, useful for audio effects +---@field sampleRate integer Frequency (samples per second) +---@field sampleSize integer Bit depth (bits per sample): 8, 16, 32 (24 not supported) +---@field channels integer Number of channels (1-mono, 2-stereo, ...) + +---Sound +---@class raylib.Sound +---@field stream raylib.AudioStream Audio stream +---@field frameCount integer Total number of frames (considering channels) + +---Music, audio stream, anything longer than ~10 seconds should be streamed +---@class raylib.Music +---@field stream raylib.AudioStream Audio stream +---@field frameCount integer Total number of frames (considering channels) +---@field looping boolean Music looping enable +---@field ctxType integer Type of music context (audio filetype) +---@field ctxData ffi.cdata* Audio context data, depends on type + +---VrDeviceInfo, Head-Mounted-Display device parameters +---@class raylib.VrDeviceInfo +---@field hResolution integer Horizontal resolution in pixels +---@field vResolution integer Vertical resolution in pixels +---@field hScreenSize number Horizontal size in meters +---@field vScreenSize number Vertical size in meters +---@field eyeToScreenDistance number Distance between eye and display in meters +---@field lensSeparationDistance number Lens separation distance in meters +---@field interpupillaryDistance number IPD (distance between pupils) in meters +---@field lensDistortionValues number[] Lens distortion constant parameters +---@field chromaAbCorrection number[] Chromatic aberration correction parameters + +---VrStereoConfig, VR stereo rendering configuration for simulator +---@class raylib.VrStereoConfig +---@field projection raylib.Matrix[] VR projection matrices (per eye) +---@field viewOffset raylib.Matrix[] VR view offset matrices (per eye) +---@field leftLensCenter number[] VR left lens center +---@field rightLensCenter number[] VR right lens center +---@field leftScreenCenter number[] VR left screen center +---@field rightScreenCenter number[] VR right screen center +---@field scale number[] VR distortion scale +---@field scaleIn number[] VR distortion scale in + +---File path list +---@class raylib.FilePathList +---@field count integer Filepaths entries count +---@field paths raylib.cstring_array Filepaths entries + +---Automation event +---@class raylib.AutomationEvent +---@field frame integer Event frame +---@field type integer Event type (AutomationEventType) +---@field params integer[] Event parameters (if required) + +---Automation event list +---@class raylib.AutomationEventList +---@field capacity integer Events max entries (MAX_AUTOMATION_EVENTS) +---@field count integer Events entries count +---@field events raylib.AutomationEvent[] Events entries + +---@alias raylib.TextureCubemap raylib.Texture + +---@alias raylib.RenderTexture2D raylib.RenderTexture + +---@alias raylib.Camera raylib.Camera3D + +---Dynamic vertex buffers (position + texcoords + colors + indices arrays) +---@class raylib.rlVertexBuffer +---@field elementCount integer Number of elements in the buffer (QUADS) +---@field vertices number[] Vertex position (XYZ - 3 components per vertex) (shader-location = 0) +---@field texcoords number[] Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) +---@field normals number[] Vertex normal (XYZ - 3 components per vertex) (shader-location = 2) +---@field colors integer[] Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) +---@field indices integer[] Vertex indices (in case vertex data comes indexed) (6 indices per quad) +---@field vaoId integer OpenGL Vertex Array Object id +---@field vboId integer[] OpenGL Vertex Buffer Objects id (5 types of vertex data) + +---of those state-change happens (this is done in core module) +---@class raylib.rlDrawCall +---@field mode integer Drawing mode: LINES, TRIANGLES, QUADS +---@field vertexCount integer Number of vertex of the draw +---@field vertexAlignment integer Number of vertex required for index alignment (LINES, TRIANGLES) +---@field textureId integer Texture id to be used on the draw -> Use to create new draw call if changes + +---rlRenderBatch type +---@class raylib.rlRenderBatch +---@field bufferCount integer Number of vertex buffers (multi-buffering support) +---@field currentBuffer integer Current buffer tracking in case of multi-buffering +---@field vertexBuffer raylib.rlVertexBuffer[] Dynamic buffer(s) for vertex data +---@field draws raylib.rlDrawCall[] Draw calls array, depends on textureId +---@field drawCounter integer Draw calls counter +---@field currentDepth number Current depth value for next draw + +---@class raylib.float3 +---@field v number[] + +---@class raylib.float16 +---@field v number[] + +---@alias raylib.AudioCallback fun(bufferData: ffi.cdata*, frames: integer) + +---@alias raylib.LoadFileDataCallback fun(fileName: string, dataSize: integer): ffi.cdata* + +---@alias raylib.SaveFileDataCallback fun(fileName: string, data: ffi.cdata*, dataSize: integer): boolean + +---@alias raylib.LoadFileTextCallback fun(fileName: string): string + +---@alias raylib.SaveFileTextCallback fun(fileName: string, text: string): boolean + +---Initialize window and OpenGL context +---@param width integer +---@param height integer +---@param title string +---@return nil +function M.InitWindow(width, height, title) + C.InitWindow(width, height, title) +end + +---Close window and unload OpenGL context +---@return nil +function M.CloseWindow() + C.CloseWindow() +end + +---Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) +---@return boolean +function M.WindowShouldClose() + return C.WindowShouldClose() +end + +---Check if window has been initialized successfully +---@return boolean +function M.IsWindowReady() + return C.IsWindowReady() +end + +---Check if window is currently fullscreen +---@return boolean +function M.IsWindowFullscreen() + return C.IsWindowFullscreen() +end + +---Check if window is currently hidden +---@return boolean +function M.IsWindowHidden() + return C.IsWindowHidden() +end + +---Check if window is currently minimized +---@return boolean +function M.IsWindowMinimized() + return C.IsWindowMinimized() +end + +---Check if window is currently maximized +---@return boolean +function M.IsWindowMaximized() + return C.IsWindowMaximized() +end + +---Check if window is currently focused +---@return boolean +function M.IsWindowFocused() + return C.IsWindowFocused() +end + +---Check if window has been resized last frame +---@return boolean +function M.IsWindowResized() + return C.IsWindowResized() +end + +---Check if one specific window flag is enabled +---@param flag integer +---@return boolean +function M.IsWindowState(flag) + return C.IsWindowState(flag) +end + +---Set window configuration state using flags +---@param flags integer +---@return nil +function M.SetWindowState(flags) + C.SetWindowState(flags) +end + +---Clear window configuration state flags +---@param flags integer +---@return nil +function M.ClearWindowState(flags) + C.ClearWindowState(flags) +end + +---Toggle window state: fullscreen/windowed, resizes monitor to match window resolution +---@return nil +function M.ToggleFullscreen() + C.ToggleFullscreen() +end + +---Toggle window state: borderless windowed, resizes window to match monitor resolution +---@return nil +function M.ToggleBorderlessWindowed() + C.ToggleBorderlessWindowed() +end + +---Set window state: maximized, if resizable +---@return nil +function M.MaximizeWindow() + C.MaximizeWindow() +end + +---Set window state: minimized, if resizable +---@return nil +function M.MinimizeWindow() + C.MinimizeWindow() +end + +---Restore window from being minimized/maximized +---@return nil +function M.RestoreWindow() + C.RestoreWindow() +end + +---Set icon for window (single image, RGBA 32bit) +---@param image raylib.Image +---@return nil +function M.SetWindowIcon(image) + C.SetWindowIcon(image) +end + +---Set icon for window (multiple images, RGBA 32bit) +---@param images raylib.Image +---@param count integer +---@return raylib.Image +function M.SetWindowIcons(images, count) + local _o1 = ffi.new("Image[1]", images) + C.SetWindowIcons(_o1, count) + return _o1[0] +end + +---Set title for window +---@param title string +---@return nil +function M.SetWindowTitle(title) + C.SetWindowTitle(title) +end + +---Set window position on screen +---@param x integer +---@param y integer +---@return nil +function M.SetWindowPosition(x, y) + C.SetWindowPosition(x, y) +end + +---Set monitor for the current window +---@param monitor integer +---@return nil +function M.SetWindowMonitor(monitor) + C.SetWindowMonitor(monitor) +end + +---Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) +---@param width integer +---@param height integer +---@return nil +function M.SetWindowMinSize(width, height) + C.SetWindowMinSize(width, height) +end + +---Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) +---@param width integer +---@param height integer +---@return nil +function M.SetWindowMaxSize(width, height) + C.SetWindowMaxSize(width, height) +end + +---Set window dimensions +---@param width integer +---@param height integer +---@return nil +function M.SetWindowSize(width, height) + C.SetWindowSize(width, height) +end + +---Set window opacity [0.0f..1.0f] +---@param opacity number +---@return nil +function M.SetWindowOpacity(opacity) + C.SetWindowOpacity(opacity) +end + +---Set window focused +---@return nil +function M.SetWindowFocused() + C.SetWindowFocused() +end + +---Get native window handle +---@return ffi.cdata* +function M.GetWindowHandle() + return C.GetWindowHandle() +end + +---Get current screen width +---@return integer +function M.GetScreenWidth() + return C.GetScreenWidth() +end + +---Get current screen height +---@return integer +function M.GetScreenHeight() + return C.GetScreenHeight() +end + +---Get current render width (it considers HiDPI) +---@return integer +function M.GetRenderWidth() + return C.GetRenderWidth() +end + +---Get current render height (it considers HiDPI) +---@return integer +function M.GetRenderHeight() + return C.GetRenderHeight() +end + +---Get number of connected monitors +---@return integer +function M.GetMonitorCount() + return C.GetMonitorCount() +end + +---Get current monitor where window is placed +---@return integer +function M.GetCurrentMonitor() + return C.GetCurrentMonitor() +end + +---Get specified monitor position +---@param monitor integer +---@return raylib.Vector2 +function M.GetMonitorPosition(monitor) + return C.GetMonitorPosition(monitor) +end + +---Get specified monitor width (current video mode used by monitor) +---@param monitor integer +---@return integer +function M.GetMonitorWidth(monitor) + return C.GetMonitorWidth(monitor) +end + +---Get specified monitor height (current video mode used by monitor) +---@param monitor integer +---@return integer +function M.GetMonitorHeight(monitor) + return C.GetMonitorHeight(monitor) +end + +---Get specified monitor physical width in millimetres +---@param monitor integer +---@return integer +function M.GetMonitorPhysicalWidth(monitor) + return C.GetMonitorPhysicalWidth(monitor) +end + +---Get specified monitor physical height in millimetres +---@param monitor integer +---@return integer +function M.GetMonitorPhysicalHeight(monitor) + return C.GetMonitorPhysicalHeight(monitor) +end + +---Get specified monitor refresh rate +---@param monitor integer +---@return integer +function M.GetMonitorRefreshRate(monitor) + return C.GetMonitorRefreshRate(monitor) +end + +---Get window position XY on monitor +---@return raylib.Vector2 +function M.GetWindowPosition() + return C.GetWindowPosition() +end + +---Get window scale DPI factor +---@return raylib.Vector2 +function M.GetWindowScaleDPI() + return C.GetWindowScaleDPI() +end + +---Get the human-readable, UTF-8 encoded name of the specified monitor +---@param monitor integer +---@return string|nil +function M.GetMonitorName(monitor) + local _p = C.GetMonitorName(monitor) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Set clipboard text content +---@param text string +---@return nil +function M.SetClipboardText(text) + C.SetClipboardText(text) +end + +---Get clipboard text content +---@return string|nil +function M.GetClipboardText() + local _p = C.GetClipboardText() + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get clipboard image content +---@return raylib.Image +function M.GetClipboardImage() + return C.GetClipboardImage() +end + +---Enable waiting for events on EndDrawing(), no automatic event polling +---@return nil +function M.EnableEventWaiting() + C.EnableEventWaiting() +end + +---Disable waiting for events on EndDrawing(), automatic events polling +---@return nil +function M.DisableEventWaiting() + C.DisableEventWaiting() +end + +---Show cursor +---@return nil +function M.ShowCursor() + C.ShowCursor() +end + +---Hide cursor +---@return nil +function M.HideCursor() + C.HideCursor() +end + +---Check if cursor is not visible +---@return boolean +function M.IsCursorHidden() + return C.IsCursorHidden() +end + +---Enable cursor (unlock cursor) +---@return nil +function M.EnableCursor() + C.EnableCursor() +end + +---Disable cursor (lock cursor) +---@return nil +function M.DisableCursor() + C.DisableCursor() +end + +---Check if cursor is on the screen +---@return boolean +function M.IsCursorOnScreen() + return C.IsCursorOnScreen() +end + +---Clear background (framebuffer) to color +---@param color raylib.Color +---@return nil +function M.ClearBackground(color) + C.ClearBackground(color) +end + +---Begin canvas (framebuffer) drawing +---@return nil +function M.BeginDrawing() + C.BeginDrawing() +end + +---End canvas (framebuffer) drawing and swap buffers (double buffering) +---@return nil +function M.EndDrawing() + C.EndDrawing() +end + +---Begin 2D mode with custom camera (2D) +---@param camera raylib.Camera2D +---@return nil +function M.BeginMode2D(camera) + C.BeginMode2D(camera) +end + +---End 2D mode with custom camera +---@return nil +function M.EndMode2D() + C.EndMode2D() +end + +---Begin 3D mode with custom camera (3D) +---@param camera raylib.Camera3D +---@return nil +function M.BeginMode3D(camera) + C.BeginMode3D(camera) +end + +---End 3D mode and returns to default 2D orthographic mode +---@return nil +function M.EndMode3D() + C.EndMode3D() +end + +---Begin drawing to render texture +---@param target raylib.RenderTexture2D +---@return nil +function M.BeginTextureMode(target) + C.BeginTextureMode(target) +end + +---End drawing to render texture +---@return nil +function M.EndTextureMode() + C.EndTextureMode() +end + +---Begin custom shader drawing +---@param shader raylib.Shader +---@return nil +function M.BeginShaderMode(shader) + C.BeginShaderMode(shader) +end + +---End custom shader drawing (use default shader) +---@return nil +function M.EndShaderMode() + C.EndShaderMode() +end + +---Begin blending mode (alpha, additive, multiplied, subtract, custom) +---@param mode integer +---@return nil +function M.BeginBlendMode(mode) + C.BeginBlendMode(mode) +end + +---End blending mode (reset to default: alpha blending) +---@return nil +function M.EndBlendMode() + C.EndBlendMode() +end + +---Begin scissor mode (define screen area for following drawing) +---@param x integer +---@param y integer +---@param width integer +---@param height integer +---@return nil +function M.BeginScissorMode(x, y, width, height) + C.BeginScissorMode(x, y, width, height) +end + +---End scissor mode +---@return nil +function M.EndScissorMode() + C.EndScissorMode() +end + +---Begin stereo rendering (requires VR simulator) +---@param config raylib.VrStereoConfig +---@return nil +function M.BeginVrStereoMode(config) + C.BeginVrStereoMode(config) +end + +---End stereo rendering (requires VR simulator) +---@return nil +function M.EndVrStereoMode() + C.EndVrStereoMode() +end + +---Load VR stereo config for VR simulator device parameters +---@param device raylib.VrDeviceInfo +---@return raylib.VrStereoConfig +function M.LoadVrStereoConfig(device) + return C.LoadVrStereoConfig(device) +end + +---Unload VR stereo config +---@param config raylib.VrStereoConfig +---@return nil +function M.UnloadVrStereoConfig(config) + C.UnloadVrStereoConfig(config) +end + +---Load shader from files and bind default locations +---@param vsFileName string +---@param fsFileName string +---@return raylib.Shader +function M.LoadShader(vsFileName, fsFileName) + return C.LoadShader(vsFileName, fsFileName) +end + +---Load shader from code strings and bind default locations +---@param vsCode string +---@param fsCode string +---@return raylib.Shader +function M.LoadShaderFromMemory(vsCode, fsCode) + return C.LoadShaderFromMemory(vsCode, fsCode) +end + +---Check if shader is valid (loaded on GPU) +---@param shader raylib.Shader +---@return boolean +function M.IsShaderValid(shader) + return C.IsShaderValid(shader) +end + +---Get shader uniform location +---@param shader raylib.Shader +---@param uniformName string +---@return integer +function M.GetShaderLocation(shader, uniformName) + return C.GetShaderLocation(shader, uniformName) +end + +---Get shader attribute location +---@param shader raylib.Shader +---@param attribName string +---@return integer +function M.GetShaderLocationAttrib(shader, attribName) + return C.GetShaderLocationAttrib(shader, attribName) +end + +---Set shader uniform value +---@param shader raylib.Shader +---@param locIndex integer +---@param value ffi.cdata*|string +---@param uniformType integer +---@return nil +function M.SetShaderValue(shader, locIndex, value, uniformType) + local _a3 + if type(value) == "string" then _a3 = ffi.cast("const void *", value) + else _a3 = value end + C.SetShaderValue(shader, locIndex, _a3, uniformType) +end + +---Set shader uniform value vector +---@param shader raylib.Shader +---@param locIndex integer +---@param value ffi.cdata*|string +---@param uniformType integer +---@param count integer +---@return nil +function M.SetShaderValueV(shader, locIndex, value, uniformType, count) + local _a3 + if type(value) == "string" then _a3 = ffi.cast("const void *", value) + else _a3 = value end + C.SetShaderValueV(shader, locIndex, _a3, uniformType, count) +end + +---Set shader uniform value (matrix 4x4) +---@param shader raylib.Shader +---@param locIndex integer +---@param mat raylib.Matrix +---@return nil +function M.SetShaderValueMatrix(shader, locIndex, mat) + C.SetShaderValueMatrix(shader, locIndex, mat) +end + +---Set shader uniform value and bind the texture (sampler2d) +---@param shader raylib.Shader +---@param locIndex integer +---@param texture raylib.Texture2D +---@return nil +function M.SetShaderValueTexture(shader, locIndex, texture) + C.SetShaderValueTexture(shader, locIndex, texture) +end + +---Unload shader from GPU memory (VRAM) +---@param shader raylib.Shader +---@return nil +function M.UnloadShader(shader) + C.UnloadShader(shader) +end + +---Get a ray trace from screen position (i.e mouse) +---@param position raylib.Vector2 +---@param camera raylib.Camera +---@return raylib.Ray +function M.GetScreenToWorldRay(position, camera) + return C.GetScreenToWorldRay(position, camera) +end + +---Get a ray trace from screen position (i.e mouse) in a viewport +---@param position raylib.Vector2 +---@param camera raylib.Camera +---@param width integer +---@param height integer +---@return raylib.Ray +function M.GetScreenToWorldRayEx(position, camera, width, height) + return C.GetScreenToWorldRayEx(position, camera, width, height) +end + +---Get screen space position for a 3d world space position +---@param position raylib.Vector3 +---@param camera raylib.Camera +---@return raylib.Vector2 +function M.GetWorldToScreen(position, camera) + return C.GetWorldToScreen(position, camera) +end + +---Get sized screen space position for a 3d world space position +---@param position raylib.Vector3 +---@param camera raylib.Camera +---@param width integer +---@param height integer +---@return raylib.Vector2 +function M.GetWorldToScreenEx(position, camera, width, height) + return C.GetWorldToScreenEx(position, camera, width, height) +end + +---Get screen space position for a 2d camera world space position +---@param position raylib.Vector2 +---@param camera raylib.Camera2D +---@return raylib.Vector2 +function M.GetWorldToScreen2D(position, camera) + return C.GetWorldToScreen2D(position, camera) +end + +---Get world space position for a 2d camera screen space position +---@param position raylib.Vector2 +---@param camera raylib.Camera2D +---@return raylib.Vector2 +function M.GetScreenToWorld2D(position, camera) + return C.GetScreenToWorld2D(position, camera) +end + +---Get camera transform matrix (view matrix) +---@param camera raylib.Camera +---@return raylib.Matrix +function M.GetCameraMatrix(camera) + return C.GetCameraMatrix(camera) +end + +---Get camera 2d transform matrix +---@param camera raylib.Camera2D +---@return raylib.Matrix +function M.GetCameraMatrix2D(camera) + return C.GetCameraMatrix2D(camera) +end + +---Set target FPS (maximum) +---@param fps integer +---@return nil +function M.SetTargetFPS(fps) + C.SetTargetFPS(fps) +end + +---Get time in seconds for last frame drawn (delta time) +---@return number +function M.GetFrameTime() + return C.GetFrameTime() +end + +---Get elapsed time in seconds since InitWindow() +---@return number +function M.GetTime() + return C.GetTime() +end + +---Get current FPS +---@return integer +function M.GetFPS() + return C.GetFPS() +end + +---Swap back buffer with front buffer (screen drawing) +---@return nil +function M.SwapScreenBuffer() + C.SwapScreenBuffer() +end + +---Register all input events +---@return nil +function M.PollInputEvents() + C.PollInputEvents() +end + +---Wait for some time (halt program execution) +---@param seconds number +---@return nil +function M.WaitTime(seconds) + C.WaitTime(seconds) +end + +---Set the seed for the random number generator +---@param seed integer +---@return nil +function M.SetRandomSeed(seed) + C.SetRandomSeed(seed) +end + +---Get a random value between min and max (both included) +---@param min integer +---@param max integer +---@return integer +function M.GetRandomValue(min, max) + return C.GetRandomValue(min, max) +end + +---Load random values sequence, no values repeated +---@param count integer +---@param min integer +---@param max integer +---@return ffi.cdata* +function M.LoadRandomSequence(count, min, max) + return C.LoadRandomSequence(count, min, max) +end + +---Unload random values sequence +---@param sequence ffi.cdata* +---@return nil +function M.UnloadRandomSequence(sequence) + C.UnloadRandomSequence(sequence) +end + +---Takes a screenshot of current screen (filename extension defines format) +---@param fileName string +---@return nil +function M.TakeScreenshot(fileName) + C.TakeScreenshot(fileName) +end + +---Set init configuration flags (view FLAGS) +---@param flags integer +---@return nil +function M.SetConfigFlags(flags) + C.SetConfigFlags(flags) +end + +---Open URL with default system browser (if available) +---@param url string +---@return nil +function M.OpenURL(url) + C.OpenURL(url) +end + +---Set the current threshold (minimum) log level +---@param logLevel integer +---@return nil +function M.SetTraceLogLevel(logLevel) + C.SetTraceLogLevel(logLevel) +end + +---Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) +---@param level integer +---@param fmt string +---@param ... any +---@return nil +function M.TraceLog(level, fmt, ...) + if select("#", ...) == 0 then + C.TraceLog(level, "%s", fmt) + else + C.TraceLog(level, "%s", string_format(fmt, ...)) + end +end + +---Internal memory allocator +---@param size integer +---@return ffi.cdata* +function M.MemAlloc(size) + return C.MemAlloc(size) +end + +---Internal memory reallocator +---@param ptr ffi.cdata*|string +---@param size integer +---@return ffi.cdata* +function M.MemRealloc(ptr, size) + local _a1 + if type(ptr) == "string" then _a1 = ffi.cast("const void *", ptr) + else _a1 = ptr end + return C.MemRealloc(_a1, size) +end + +---Internal memory free +---@param ptr ffi.cdata*|string +---@return nil +function M.MemFree(ptr) + local _a1 + if type(ptr) == "string" then _a1 = ffi.cast("const void *", ptr) + else _a1 = ptr end + C.MemFree(_a1) +end + +---Load file data as byte array (read) +---@param fileName string +---@param dataSize ffi.cdata* +---@return ffi.cdata* +function M.LoadFileData(fileName, dataSize) + return C.LoadFileData(fileName, dataSize) +end + +---Unload file data allocated by LoadFileData() +---@param data ffi.cdata* +---@return nil +function M.UnloadFileData(data) + C.UnloadFileData(data) +end + +---Save data to file from byte array (write), returns true on success +---@param fileName string +---@param data ffi.cdata*|string +---@param dataSize integer +---@return boolean +function M.SaveFileData(fileName, data, dataSize) + local _a2 + if type(data) == "string" then _a2 = ffi.cast("const void *", data) + else _a2 = data end + return C.SaveFileData(fileName, _a2, dataSize) +end + +---Export data to code (.h), returns true on success +---@param data string|integer[] +---@param dataSize integer +---@param fileName string +---@return boolean +function M.ExportDataAsCode(data, dataSize, fileName) + local _a1 + if type(data) == "string" then _a1 = ffi.cast("const unsigned char *", data) + elseif type(data) == "table" then _a1 = to_array("unsigned char", data) + else _a1 = data end + return C.ExportDataAsCode(_a1, dataSize, fileName) +end + +---Load text data from file (read), returns a '\0' terminated string +---@param fileName string +---@return string|nil +function M.LoadFileText(fileName) + local _p = C.LoadFileText(fileName) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + C.UnloadFileText(_p) + return _s +end + +---Unload file text data allocated by LoadFileText() +---@param text raylib.char_buffer|string +---@return nil +function M.UnloadFileText(text) + C.UnloadFileText(text) +end + +---Save text data to file (write), string must be '\0' terminated, returns true on success +---@param fileName string +---@param text string +---@return boolean +function M.SaveFileText(fileName, text) + return C.SaveFileText(fileName, text) +end + +---Set custom file binary data loader +---@param callback raylib.LoadFileDataCallback +---@return nil +function M.SetLoadFileDataCallback(callback) + local _cb1 = pin("LoadFileDataCallback", callback) + C.SetLoadFileDataCallback(_cb1) +end + +---Set custom file binary data saver +---@param callback raylib.SaveFileDataCallback +---@return nil +function M.SetSaveFileDataCallback(callback) + local _cb1 = pin("SaveFileDataCallback", callback) + C.SetSaveFileDataCallback(_cb1) +end + +---Set custom file text data loader +---@param callback raylib.LoadFileTextCallback +---@return nil +function M.SetLoadFileTextCallback(callback) + local _cb1 = pin("LoadFileTextCallback", callback) + C.SetLoadFileTextCallback(_cb1) +end + +---Set custom file text data saver +---@param callback raylib.SaveFileTextCallback +---@return nil +function M.SetSaveFileTextCallback(callback) + local _cb1 = pin("SaveFileTextCallback", callback) + C.SetSaveFileTextCallback(_cb1) +end + +---Rename file (if exists), returns 0 on success +---@param fileName string +---@param fileRename string +---@return integer +function M.FileRename(fileName, fileRename) + return C.FileRename(fileName, fileRename) +end + +---Remove file (if exists), returns 0 on success +---@param fileName string +---@return integer +function M.FileRemove(fileName) + return C.FileRemove(fileName) +end + +---Copy file from one path to another, dstPath created if it doesn't exist, returns 0 on success +---@param srcPath string +---@param dstPath string +---@return integer +function M.FileCopy(srcPath, dstPath) + return C.FileCopy(srcPath, dstPath) +end + +---Move file from one directory to another, dstPath created if it doesn't exist, returns 0 on success +---@param srcPath string +---@param dstPath string +---@return integer +function M.FileMove(srcPath, dstPath) + return C.FileMove(srcPath, dstPath) +end + +---Replace text in an existing file, returns 0 on success +---@param fileName string +---@param search string +---@param replacement string +---@return integer +function M.FileTextReplace(fileName, search, replacement) + return C.FileTextReplace(fileName, search, replacement) +end + +---Find text in existing file, returns -1 if index not found or index otherwise +---@param fileName string +---@param search string +---@return integer +function M.FileTextFindIndex(fileName, search) + return C.FileTextFindIndex(fileName, search) +end + +---Check if file exists +---@param fileName string +---@return boolean +function M.FileExists(fileName) + return C.FileExists(fileName) +end + +---Check if directory path exists +---@param dirPath string +---@return boolean +function M.DirectoryExists(dirPath) + return C.DirectoryExists(dirPath) +end + +---Check file extension (recommended include point: .png, .wav) +---@param fileName string +---@param ext string +---@return boolean +function M.IsFileExtension(fileName, ext) + return C.IsFileExtension(fileName, ext) +end + +---Check if file path (file or directory) is hidden by OS +---@param filePath string +---@return boolean +function M.IsFileHidden(filePath) + return C.IsFileHidden(filePath) +end + +---Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) +---@param fileName string +---@return integer +function M.GetFileLength(fileName) + return C.GetFileLength(fileName) +end + +---Get file modification time (last write time) +---@param fileName string +---@return integer +function M.GetFileModTime(fileName) + return C.GetFileModTime(fileName) +end + +---Get pointer to extension for a filename string (includes dot: '.png') +---@param fileName string +---@return string|nil +function M.GetFileExtension(fileName) + local _p = C.GetFileExtension(fileName) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get pointer to filename for a path string +---@param filePath string +---@return string|nil +function M.GetFileName(filePath) + local _p = C.GetFileName(filePath) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get filename string without extension (uses static string) +---@param filePath string +---@return string|nil +function M.GetFileNameWithoutExt(filePath) + local _p = C.GetFileNameWithoutExt(filePath) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get full path for a provided fileName with path (uses static string) +---@param filePath string +---@return string|nil +function M.GetDirectoryPath(filePath) + local _p = C.GetDirectoryPath(filePath) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get previous directory path for a provided path (uses static string) +---@param dirPath string +---@return string|nil +function M.GetPrevDirectoryPath(dirPath) + local _p = C.GetPrevDirectoryPath(dirPath) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get current working directory (uses static string) +---@return string|nil +function M.GetWorkingDirectory() + local _p = C.GetWorkingDirectory() + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get the directory of the running application (uses static string) +---@return string|nil +function M.GetApplicationDirectory() + local _p = C.GetApplicationDirectory() + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Create directories (including full path requested), returns 0 on success +---@param dirPath string +---@return integer +function M.MakeDirectory(dirPath) + return C.MakeDirectory(dirPath) +end + +---Change working directory, returns 0 on success +---@param dirPath string +---@return integer +function M.ChangeDirectory(dirPath) + return C.ChangeDirectory(dirPath) +end + +---Check if provided path points to a file +---@param path string +---@return boolean +function M.IsPathFile(path) + return C.IsPathFile(path) +end + +---Check if provided path points to a directory +---@param path string +---@return boolean +function M.IsPathDirectory(path) + return C.IsPathDirectory(path) +end + +---Check if provided path is an absolute path +---@param path string +---@return boolean +function M.IsPathAbsolute(path) + return C.IsPathAbsolute(path) +end + +---Check if fileName is valid for the platform/OS +---@param fileName string +---@return boolean +function M.IsFileNameValid(fileName) + return C.IsFileNameValid(fileName) +end + +---Load directory filepaths, files and directories, no subdirs scan +---@param dirPath string +---@return raylib.FilePathList +function M.LoadDirectoryFiles(dirPath) + return C.LoadDirectoryFiles(dirPath) +end + +---Load directory filepaths with extension filtering and subdir scan; some filters available: '*.*','FILES*','DIRS*' +---@param basePath string +---@param filter string +---@param scanSubdirs boolean +---@return raylib.FilePathList +function M.LoadDirectoryFilesEx(basePath, filter, scanSubdirs) + return C.LoadDirectoryFilesEx(basePath, filter, scanSubdirs) +end + +---Unload filepaths +---@param files raylib.FilePathList +---@return nil +function M.UnloadDirectoryFiles(files) + C.UnloadDirectoryFiles(files) +end + +---Check if file has been dropped into window +---@return boolean +function M.IsFileDropped() + return C.IsFileDropped() +end + +---Load dropped filepaths +---@return raylib.FilePathList +function M.LoadDroppedFiles() + return C.LoadDroppedFiles() +end + +---Unload dropped filepaths +---@param files raylib.FilePathList +---@return nil +function M.UnloadDroppedFiles(files) + C.UnloadDroppedFiles(files) +end + +---Get the file count in a directory +---@param dirPath string +---@return integer +function M.GetDirectoryFileCount(dirPath) + return C.GetDirectoryFileCount(dirPath) +end + +---Get the file count in a directory with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result +---@param basePath string +---@param filter string +---@param scanSubdirs boolean +---@return integer +function M.GetDirectoryFileCountEx(basePath, filter, scanSubdirs) + return C.GetDirectoryFileCountEx(basePath, filter, scanSubdirs) +end + +---Compress data (DEFLATE algorithm), memory must be MemFree() +---@param data string|integer[] +---@param dataSize integer +---@param compDataSize ffi.cdata* +---@return ffi.cdata* +function M.CompressData(data, dataSize, compDataSize) + local _a1 + if type(data) == "string" then _a1 = ffi.cast("const unsigned char *", data) + elseif type(data) == "table" then _a1 = to_array("unsigned char", data) + else _a1 = data end + return C.CompressData(_a1, dataSize, compDataSize) +end + +---Decompress data (DEFLATE algorithm), memory must be MemFree() +---@param compData string|integer[] +---@param compDataSize integer +---@param dataSize ffi.cdata* +---@return ffi.cdata* +function M.DecompressData(compData, compDataSize, dataSize) + local _a1 + if type(compData) == "string" then _a1 = ffi.cast("const unsigned char *", compData) + elseif type(compData) == "table" then _a1 = to_array("unsigned char", compData) + else _a1 = compData end + return C.DecompressData(_a1, compDataSize, dataSize) +end + +---Encode data to Base64 string (includes NULL terminator), memory must be MemFree() +---@param data string|integer[] +---@param dataSize integer +---@param outputSize ffi.cdata* +---@return string|nil +function M.EncodeDataBase64(data, dataSize, outputSize) + local _a1 + if type(data) == "string" then _a1 = ffi.cast("const unsigned char *", data) + elseif type(data) == "table" then _a1 = to_array("unsigned char", data) + else _a1 = data end + local _p = C.EncodeDataBase64(_a1, dataSize, outputSize) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + C.MemFree(_p) + return _s +end + +---Decode Base64 string (expected NULL terminated), memory must be MemFree() +---@param text string +---@param outputSize ffi.cdata* +---@return ffi.cdata* +function M.DecodeDataBase64(text, outputSize) + return C.DecodeDataBase64(text, outputSize) +end + +---Compute CRC32 hash code +---@param data string|integer[] +---@param dataSize integer +---@return integer +function M.ComputeCRC32(data, dataSize) + local _a1 + if type(data) == "string" then _a1 = ffi.cast("const unsigned char *", data) + elseif type(data) == "table" then _a1 = to_array("unsigned char", data) + else _a1 = data end + return C.ComputeCRC32(_a1, dataSize) +end + +---Compute MD5 hash code, returns static int[4] (16 bytes) +---@param data string|integer[] +---@param dataSize integer +---@return ffi.cdata* +function M.ComputeMD5(data, dataSize) + local _a1 + if type(data) == "string" then _a1 = ffi.cast("const unsigned char *", data) + elseif type(data) == "table" then _a1 = to_array("unsigned char", data) + else _a1 = data end + return C.ComputeMD5(_a1, dataSize) +end + +---Compute SHA1 hash code, returns static int[5] (20 bytes) +---@param data string|integer[] +---@param dataSize integer +---@return ffi.cdata* +function M.ComputeSHA1(data, dataSize) + local _a1 + if type(data) == "string" then _a1 = ffi.cast("const unsigned char *", data) + elseif type(data) == "table" then _a1 = to_array("unsigned char", data) + else _a1 = data end + return C.ComputeSHA1(_a1, dataSize) +end + +---Compute SHA256 hash code, returns static int[8] (32 bytes) +---@param data string|integer[] +---@param dataSize integer +---@return ffi.cdata* +function M.ComputeSHA256(data, dataSize) + local _a1 + if type(data) == "string" then _a1 = ffi.cast("const unsigned char *", data) + elseif type(data) == "table" then _a1 = to_array("unsigned char", data) + else _a1 = data end + return C.ComputeSHA256(_a1, dataSize) +end + +---Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS +---@param fileName string +---@return raylib.AutomationEventList +function M.LoadAutomationEventList(fileName) + return C.LoadAutomationEventList(fileName) +end + +---Unload automation events list from file +---@param list raylib.AutomationEventList +---@return nil +function M.UnloadAutomationEventList(list) + C.UnloadAutomationEventList(list) +end + +---Export automation events list as text file +---@param list raylib.AutomationEventList +---@param fileName string +---@return boolean +function M.ExportAutomationEventList(list, fileName) + return C.ExportAutomationEventList(list, fileName) +end + +---Set automation event list to record to +---@param list raylib.AutomationEventList +---@return raylib.AutomationEventList +function M.SetAutomationEventList(list) + local _o1 = ffi.new("AutomationEventList[1]", list) + C.SetAutomationEventList(_o1) + return _o1[0] +end + +---Set automation event internal base frame to start recording +---@param frame integer +---@return nil +function M.SetAutomationEventBaseFrame(frame) + C.SetAutomationEventBaseFrame(frame) +end + +---Start recording automation events (AutomationEventList must be set) +---@return nil +function M.StartAutomationEventRecording() + C.StartAutomationEventRecording() +end + +---Stop recording automation events +---@return nil +function M.StopAutomationEventRecording() + C.StopAutomationEventRecording() +end + +---Play a recorded automation event +---@param event raylib.AutomationEvent +---@return nil +function M.PlayAutomationEvent(event) + C.PlayAutomationEvent(event) +end + +---Check if key has been pressed once +---@param key integer +---@return boolean +function M.IsKeyPressed(key) + return C.IsKeyPressed(key) +end + +---Check if key has been pressed again +---@param key integer +---@return boolean +function M.IsKeyPressedRepeat(key) + return C.IsKeyPressedRepeat(key) +end + +---Check if key is being pressed +---@param key integer +---@return boolean +function M.IsKeyDown(key) + return C.IsKeyDown(key) +end + +---Check if key has been released once +---@param key integer +---@return boolean +function M.IsKeyReleased(key) + return C.IsKeyReleased(key) +end + +---Check if key is NOT being pressed +---@param key integer +---@return boolean +function M.IsKeyUp(key) + return C.IsKeyUp(key) +end + +---Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty +---@return integer +function M.GetKeyPressed() + return C.GetKeyPressed() +end + +---Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty +---@return integer +function M.GetCharPressed() + return C.GetCharPressed() +end + +---Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard) +---@param key integer +---@return string|nil +function M.GetKeyName(key) + local _p = C.GetKeyName(key) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Set a custom key to exit program (default is ESC) +---@param key integer +---@return nil +function M.SetExitKey(key) + C.SetExitKey(key) +end + +---Check if gamepad is available +---@param gamepad integer +---@return boolean +function M.IsGamepadAvailable(gamepad) + return C.IsGamepadAvailable(gamepad) +end + +---Get gamepad internal name id +---@param gamepad integer +---@return string|nil +function M.GetGamepadName(gamepad) + local _p = C.GetGamepadName(gamepad) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Check if gamepad button has been pressed once +---@param gamepad integer +---@param button integer +---@return boolean +function M.IsGamepadButtonPressed(gamepad, button) + return C.IsGamepadButtonPressed(gamepad, button) +end + +---Check if gamepad button is being pressed +---@param gamepad integer +---@param button integer +---@return boolean +function M.IsGamepadButtonDown(gamepad, button) + return C.IsGamepadButtonDown(gamepad, button) +end + +---Check if gamepad button has been released once +---@param gamepad integer +---@param button integer +---@return boolean +function M.IsGamepadButtonReleased(gamepad, button) + return C.IsGamepadButtonReleased(gamepad, button) +end + +---Check if gamepad button is NOT being pressed +---@param gamepad integer +---@param button integer +---@return boolean +function M.IsGamepadButtonUp(gamepad, button) + return C.IsGamepadButtonUp(gamepad, button) +end + +---Get the last gamepad button pressed +---@return integer +function M.GetGamepadButtonPressed() + return C.GetGamepadButtonPressed() +end + +---Get axis count for a gamepad +---@param gamepad integer +---@return integer +function M.GetGamepadAxisCount(gamepad) + return C.GetGamepadAxisCount(gamepad) +end + +---Get movement value for a gamepad axis +---@param gamepad integer +---@param axis integer +---@return number +function M.GetGamepadAxisMovement(gamepad, axis) + return C.GetGamepadAxisMovement(gamepad, axis) +end + +---Set internal gamepad mappings (SDL_GameControllerDB) +---@param mappings string +---@return integer +function M.SetGamepadMappings(mappings) + return C.SetGamepadMappings(mappings) +end + +---Set gamepad vibration for both motors (duration in seconds) +---@param gamepad integer +---@param leftMotor number +---@param rightMotor number +---@param duration number +---@return nil +function M.SetGamepadVibration(gamepad, leftMotor, rightMotor, duration) + C.SetGamepadVibration(gamepad, leftMotor, rightMotor, duration) +end + +---Check if mouse button has been pressed once +---@param button integer +---@return boolean +function M.IsMouseButtonPressed(button) + return C.IsMouseButtonPressed(button) +end + +---Check if mouse button is being pressed +---@param button integer +---@return boolean +function M.IsMouseButtonDown(button) + return C.IsMouseButtonDown(button) +end + +---Check if mouse button has been released once +---@param button integer +---@return boolean +function M.IsMouseButtonReleased(button) + return C.IsMouseButtonReleased(button) +end + +---Check if mouse button is NOT being pressed +---@param button integer +---@return boolean +function M.IsMouseButtonUp(button) + return C.IsMouseButtonUp(button) +end + +---Get mouse position X +---@return integer +function M.GetMouseX() + return C.GetMouseX() +end + +---Get mouse position Y +---@return integer +function M.GetMouseY() + return C.GetMouseY() +end + +---Get mouse position XY +---@return raylib.Vector2 +function M.GetMousePosition() + return C.GetMousePosition() +end + +---Get mouse delta between frames +---@return raylib.Vector2 +function M.GetMouseDelta() + return C.GetMouseDelta() +end + +---Set mouse position XY +---@param x integer +---@param y integer +---@return nil +function M.SetMousePosition(x, y) + C.SetMousePosition(x, y) +end + +---Set mouse offset +---@param offsetX integer +---@param offsetY integer +---@return nil +function M.SetMouseOffset(offsetX, offsetY) + C.SetMouseOffset(offsetX, offsetY) +end + +---Set mouse scaling +---@param scaleX number +---@param scaleY number +---@return nil +function M.SetMouseScale(scaleX, scaleY) + C.SetMouseScale(scaleX, scaleY) +end + +---Get mouse wheel movement for X or Y, whichever is larger +---@return number +function M.GetMouseWheelMove() + return C.GetMouseWheelMove() +end + +---Get mouse wheel movement for both X and Y +---@return raylib.Vector2 +function M.GetMouseWheelMoveV() + return C.GetMouseWheelMoveV() +end + +---Set mouse cursor +---@param cursor integer +---@return nil +function M.SetMouseCursor(cursor) + C.SetMouseCursor(cursor) +end + +---Get touch position X for touch point 0 (relative to screen size) +---@return integer +function M.GetTouchX() + return C.GetTouchX() +end + +---Get touch position Y for touch point 0 (relative to screen size) +---@return integer +function M.GetTouchY() + return C.GetTouchY() +end + +---Get touch position XY for a touch point index (relative to screen size) +---@param index integer +---@return raylib.Vector2 +function M.GetTouchPosition(index) + return C.GetTouchPosition(index) +end + +---Get touch point identifier for provided index +---@param index integer +---@return integer +function M.GetTouchPointId(index) + return C.GetTouchPointId(index) +end + +---Get number of touch points +---@return integer +function M.GetTouchPointCount() + return C.GetTouchPointCount() +end + +---Enable a set of gestures using flags +---@param flags integer +---@return nil +function M.SetGesturesEnabled(flags) + C.SetGesturesEnabled(flags) +end + +---Check if gesture has been detected +---@param gesture integer +---@return boolean +function M.IsGestureDetected(gesture) + return C.IsGestureDetected(gesture) +end + +---Get latest detected gesture +---@return integer +function M.GetGestureDetected() + return C.GetGestureDetected() +end + +---Get gesture hold time in seconds +---@return number +function M.GetGestureHoldDuration() + return C.GetGestureHoldDuration() +end + +---Get gesture drag vector +---@return raylib.Vector2 +function M.GetGestureDragVector() + return C.GetGestureDragVector() +end + +---Get gesture drag angle +---@return number +function M.GetGestureDragAngle() + return C.GetGestureDragAngle() +end + +---Get gesture pinch delta +---@return raylib.Vector2 +function M.GetGesturePinchVector() + return C.GetGesturePinchVector() +end + +---Get gesture pinch angle +---@return number +function M.GetGesturePinchAngle() + return C.GetGesturePinchAngle() +end + +---Update camera position for selected mode +---@param camera raylib.Camera +---@param mode integer +---@return raylib.Camera +function M.UpdateCamera(camera, mode) + local _o1 = ffi.new("Camera[1]", camera) + C.UpdateCamera(_o1, mode) + return _o1[0] +end + +---Update camera movement/rotation +---@param camera raylib.Camera +---@param movement raylib.Vector3 +---@param rotation raylib.Vector3 +---@param zoom number +---@return raylib.Camera +function M.UpdateCameraPro(camera, movement, rotation, zoom) + local _o1 = ffi.new("Camera[1]", camera) + C.UpdateCameraPro(_o1, movement, rotation, zoom) + return _o1[0] +end + +---Set texture and rectangle to be used on shapes drawing +---@param texture raylib.Texture2D +---@param rec raylib.Rectangle +---@return nil +function M.SetShapesTexture(texture, rec) + C.SetShapesTexture(texture, rec) +end + +---Get texture that is used for shapes drawing +---@return raylib.Texture2D +function M.GetShapesTexture() + return C.GetShapesTexture() +end + +---Get texture source rectangle that is used for shapes drawing +---@return raylib.Rectangle +function M.GetShapesTextureRectangle() + return C.GetShapesTextureRectangle() +end + +---Draw a pixel using geometry [Can be slow, use with care] +---@param posX integer +---@param posY integer +---@param color raylib.Color +---@return nil +function M.DrawPixel(posX, posY, color) + C.DrawPixel(posX, posY, color) +end + +---Draw a pixel using geometry (Vector version) [Can be slow, use with care] +---@param position raylib.Vector2 +---@param color raylib.Color +---@return nil +function M.DrawPixelV(position, color) + C.DrawPixelV(position, color) +end + +---Draw a line +---@param startPosX integer +---@param startPosY integer +---@param endPosX integer +---@param endPosY integer +---@param color raylib.Color +---@return nil +function M.DrawLine(startPosX, startPosY, endPosX, endPosY, color) + C.DrawLine(startPosX, startPosY, endPosX, endPosY, color) +end + +---Draw a line (using gl lines) +---@param startPos raylib.Vector2 +---@param endPos raylib.Vector2 +---@param color raylib.Color +---@return nil +function M.DrawLineV(startPos, endPos, color) + C.DrawLineV(startPos, endPos, color) +end + +---Draw a line (using triangles/quads) +---@param startPos raylib.Vector2 +---@param endPos raylib.Vector2 +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawLineEx(startPos, endPos, thick, color) + C.DrawLineEx(startPos, endPos, thick, color) +end + +---Draw lines sequence (using gl lines) +---@param points raylib.Vector2[] +---@param pointCount integer +---@param color raylib.Color +---@return nil +function M.DrawLineStrip(points, pointCount, color) + local _a1 + if type(points) == "table" then _a1 = to_array("Vector2", points) + else _a1 = points end + C.DrawLineStrip(_a1, pointCount, color) +end + +---Draw line segment cubic-bezier in-out interpolation +---@param startPos raylib.Vector2 +---@param endPos raylib.Vector2 +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawLineBezier(startPos, endPos, thick, color) + C.DrawLineBezier(startPos, endPos, thick, color) +end + +---Draw a dashed line +---@param startPos raylib.Vector2 +---@param endPos raylib.Vector2 +---@param dashSize integer +---@param spaceSize integer +---@param color raylib.Color +---@return nil +function M.DrawLineDashed(startPos, endPos, dashSize, spaceSize, color) + C.DrawLineDashed(startPos, endPos, dashSize, spaceSize, color) +end + +---Draw a color-filled triangle, counter-clockwise vertex order +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@param v3 raylib.Vector2 +---@param color raylib.Color +---@return nil +function M.DrawTriangle(v1, v2, v3, color) + C.DrawTriangle(v1, v2, v3, color) +end + +---Draw triangle with interpolated colors, counter-clockwise vertex/color order +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@param v3 raylib.Vector2 +---@param c1 raylib.Color +---@param c2 raylib.Color +---@param c3 raylib.Color +---@return nil +function M.DrawTriangleGradient(v1, v2, v3, c1, c2, c3) + C.DrawTriangleGradient(v1, v2, v3, c1, c2, c3) +end + +---Draw triangle outline, counter-clockwise vertex order +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@param v3 raylib.Vector2 +---@param color raylib.Color +---@return nil +function M.DrawTriangleLines(v1, v2, v3, color) + C.DrawTriangleLines(v1, v2, v3, color) +end + +---Draw triangle outline with line thickness, counter-clockwise vertex order +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@param v3 raylib.Vector2 +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawTriangleLinesEx(v1, v2, v3, thick, color) + C.DrawTriangleLinesEx(v1, v2, v3, thick, color) +end + +---Draw a triangle fan defined by points (first vertex is the center) +---@param points raylib.Vector2[] +---@param pointCount integer +---@param color raylib.Color +---@return nil +function M.DrawTriangleFan(points, pointCount, color) + local _a1 + if type(points) == "table" then _a1 = to_array("Vector2", points) + else _a1 = points end + C.DrawTriangleFan(_a1, pointCount, color) +end + +---Draw a triangle strip defined by points +---@param points raylib.Vector2[] +---@param pointCount integer +---@param color raylib.Color +---@return nil +function M.DrawTriangleStrip(points, pointCount, color) + local _a1 + if type(points) == "table" then _a1 = to_array("Vector2", points) + else _a1 = points end + C.DrawTriangleStrip(_a1, pointCount, color) +end + +---Draw a color-filled rectangle +---@param posX integer +---@param posY integer +---@param width integer +---@param height integer +---@param color raylib.Color +---@return nil +function M.DrawRectangle(posX, posY, width, height, color) + C.DrawRectangle(posX, posY, width, height, color) +end + +---Draw a color-filled rectangle (Vector version) +---@param position raylib.Vector2 +---@param size raylib.Vector2 +---@param color raylib.Color +---@return nil +function M.DrawRectangleV(position, size, color) + C.DrawRectangleV(position, size, color) +end + +---Draw a color-filled rectangle +---@param rec raylib.Rectangle +---@param color raylib.Color +---@return nil +function M.DrawRectangleRec(rec, color) + C.DrawRectangleRec(rec, color) +end + +---Draw a color-filled rectangle with pro parameters +---@param rec raylib.Rectangle +---@param origin raylib.Vector2 +---@param rotation number +---@param color raylib.Color +---@return nil +function M.DrawRectanglePro(rec, origin, rotation, color) + C.DrawRectanglePro(rec, origin, rotation, color) +end + +---Draw a vertical-gradient-filled rectangle +---@param posX integer +---@param posY integer +---@param width integer +---@param height integer +---@param top raylib.Color +---@param bottom raylib.Color +---@return nil +function M.DrawRectangleGradientV(posX, posY, width, height, top, bottom) + C.DrawRectangleGradientV(posX, posY, width, height, top, bottom) +end + +---Draw a horizontal-gradient-filled rectangle +---@param posX integer +---@param posY integer +---@param width integer +---@param height integer +---@param left raylib.Color +---@param right raylib.Color +---@return nil +function M.DrawRectangleGradientH(posX, posY, width, height, left, right) + C.DrawRectangleGradientH(posX, posY, width, height, left, right) +end + +---Draw a gradient-filled rectangle with custom vertex colors, counter-clockwise color order +---@param rec raylib.Rectangle +---@param col1 raylib.Color +---@param col2 raylib.Color +---@param col3 raylib.Color +---@param col4 raylib.Color +---@return nil +function M.DrawRectangleGradientEx(rec, col1, col2, col3, col4) + C.DrawRectangleGradientEx(rec, col1, col2, col3, col4) +end + +---Draw rectangle outline +---@param posX integer +---@param posY integer +---@param width integer +---@param height integer +---@param color raylib.Color +---@return nil +function M.DrawRectangleLines(posX, posY, width, height, color) + C.DrawRectangleLines(posX, posY, width, height, color) +end + +---Draw rectangle outline with line thickness +---@param rec raylib.Rectangle +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawRectangleLinesEx(rec, thick, color) + C.DrawRectangleLinesEx(rec, thick, color) +end + +---Draw rectangle with rounded edges +---@param rec raylib.Rectangle +---@param roundness number +---@param segments integer +---@param color raylib.Color +---@return nil +function M.DrawRectangleRounded(rec, roundness, segments, color) + C.DrawRectangleRounded(rec, roundness, segments, color) +end + +---Draw rectangle lines with rounded edges +---@param rec raylib.Rectangle +---@param roundness number +---@param segments integer +---@param color raylib.Color +---@return nil +function M.DrawRectangleRoundedLines(rec, roundness, segments, color) + C.DrawRectangleRoundedLines(rec, roundness, segments, color) +end + +---Draw rectangle lines with rounded edges outline and line thickness +---@param rec raylib.Rectangle +---@param roundness number +---@param segments integer +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawRectangleRoundedLinesEx(rec, roundness, segments, thick, color) + C.DrawRectangleRoundedLinesEx(rec, roundness, segments, thick, color) +end + +---Draw a polygon of n sides +---@param center raylib.Vector2 +---@param sides integer +---@param radius number +---@param rotation number +---@param color raylib.Color +---@return nil +function M.DrawPoly(center, sides, radius, rotation, color) + C.DrawPoly(center, sides, radius, rotation, color) +end + +---Draw a polygon outline of n sides +---@param center raylib.Vector2 +---@param sides integer +---@param radius number +---@param rotation number +---@param color raylib.Color +---@return nil +function M.DrawPolyLines(center, sides, radius, rotation, color) + C.DrawPolyLines(center, sides, radius, rotation, color) +end + +---Draw a polygon outline of n sides with line thickness +---@param center raylib.Vector2 +---@param sides integer +---@param radius number +---@param rotation number +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawPolyLinesEx(center, sides, radius, rotation, thick, color) + C.DrawPolyLinesEx(center, sides, radius, rotation, thick, color) +end + +---Draw a color-filled circle +---@param centerX integer +---@param centerY integer +---@param radius number +---@param color raylib.Color +---@return nil +function M.DrawCircle(centerX, centerY, radius, color) + C.DrawCircle(centerX, centerY, radius, color) +end + +---Draw a color-filled circle (Vector version) +---@param center raylib.Vector2 +---@param radius number +---@param color raylib.Color +---@return nil +function M.DrawCircleV(center, radius, color) + C.DrawCircleV(center, radius, color) +end + +---Draw a gradient-filled circle +---@param center raylib.Vector2 +---@param radius number +---@param inner raylib.Color +---@param outer raylib.Color +---@return nil +function M.DrawCircleGradient(center, radius, inner, outer) + C.DrawCircleGradient(center, radius, inner, outer) +end + +---Draw a piece of a circle +---@param center raylib.Vector2 +---@param radius number +---@param startAngle number +---@param endAngle number +---@param segments integer +---@param color raylib.Color +---@return nil +function M.DrawCircleSector(center, radius, startAngle, endAngle, segments, color) + C.DrawCircleSector(center, radius, startAngle, endAngle, segments, color) +end + +---Draw circle sector outline +---@param center raylib.Vector2 +---@param radius number +---@param startAngle number +---@param endAngle number +---@param segments integer +---@param color raylib.Color +---@return nil +function M.DrawCircleSectorLines(center, radius, startAngle, endAngle, segments, color) + C.DrawCircleSectorLines(center, radius, startAngle, endAngle, segments, color) +end + +---Draw circle sector outline with thickness +---@param center raylib.Vector2 +---@param radius number +---@param startAngle number +---@param endAngle number +---@param segments integer +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawCircleSectorLinesEx(center, radius, startAngle, endAngle, segments, thick, color) + C.DrawCircleSectorLinesEx(center, radius, startAngle, endAngle, segments, thick, color) +end + +---Draw circle outline +---@param centerX integer +---@param centerY integer +---@param radius number +---@param color raylib.Color +---@return nil +function M.DrawCircleLines(centerX, centerY, radius, color) + C.DrawCircleLines(centerX, centerY, radius, color) +end + +---Draw circle outline (Vector version) +---@param center raylib.Vector2 +---@param radius number +---@param color raylib.Color +---@return nil +function M.DrawCircleLinesV(center, radius, color) + C.DrawCircleLinesV(center, radius, color) +end + +---Draw circle outline with line thickness +---@param center raylib.Vector2 +---@param radius number +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawCircleLinesEx(center, radius, thick, color) + C.DrawCircleLinesEx(center, radius, thick, color) +end + +---Draw ellipse +---@param centerX integer +---@param centerY integer +---@param radiusH number +---@param radiusV number +---@param color raylib.Color +---@return nil +function M.DrawEllipse(centerX, centerY, radiusH, radiusV, color) + C.DrawEllipse(centerX, centerY, radiusH, radiusV, color) +end + +---Draw ellipse (Vector version) +---@param center raylib.Vector2 +---@param radiusH number +---@param radiusV number +---@param color raylib.Color +---@return nil +function M.DrawEllipseV(center, radiusH, radiusV, color) + C.DrawEllipseV(center, radiusH, radiusV, color) +end + +---Draw ellipse outline +---@param centerX integer +---@param centerY integer +---@param radiusH number +---@param radiusV number +---@param color raylib.Color +---@return nil +function M.DrawEllipseLines(centerX, centerY, radiusH, radiusV, color) + C.DrawEllipseLines(centerX, centerY, radiusH, radiusV, color) +end + +---Draw ellipse outline (Vector version) +---@param center raylib.Vector2 +---@param radiusH number +---@param radiusV number +---@param color raylib.Color +---@return nil +function M.DrawEllipseLinesV(center, radiusH, radiusV, color) + C.DrawEllipseLinesV(center, radiusH, radiusV, color) +end + +---Draw ellipse outline with line thickness +---@param center raylib.Vector2 +---@param radiusH number +---@param radiusV number +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawEllipseLinesEx(center, radiusH, radiusV, thick, color) + C.DrawEllipseLinesEx(center, radiusH, radiusV, thick, color) +end + +---Draw ring +---@param center raylib.Vector2 +---@param innerRadius number +---@param outerRadius number +---@param startAngle number +---@param endAngle number +---@param segments integer +---@param color raylib.Color +---@return nil +function M.DrawRing(center, innerRadius, outerRadius, startAngle, endAngle, segments, color) + C.DrawRing(center, innerRadius, outerRadius, startAngle, endAngle, segments, color) +end + +---Draw ring outline +---@param center raylib.Vector2 +---@param innerRadius number +---@param outerRadius number +---@param startAngle number +---@param endAngle number +---@param segments integer +---@param color raylib.Color +---@return nil +function M.DrawRingLines(center, innerRadius, outerRadius, startAngle, endAngle, segments, color) + C.DrawRingLines(center, innerRadius, outerRadius, startAngle, endAngle, segments, color) +end + +---Draw ring outline with line thickness +---@param center raylib.Vector2 +---@param innerRadius number +---@param outerRadius number +---@param startAngle number +---@param endAngle number +---@param segments integer +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawRingLinesEx(center, innerRadius, outerRadius, startAngle, endAngle, segments, thick, color) + C.DrawRingLinesEx(center, innerRadius, outerRadius, startAngle, endAngle, segments, thick, color) +end + +---Draw spline: Linear, minimum 2 points +---@param points raylib.Vector2[] +---@param pointCount integer +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawSplineLinear(points, pointCount, thick, color) + local _a1 + if type(points) == "table" then _a1 = to_array("Vector2", points) + else _a1 = points end + C.DrawSplineLinear(_a1, pointCount, thick, color) +end + +---Draw spline: B-Spline, minimum 4 points +---@param points raylib.Vector2[] +---@param pointCount integer +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawSplineBasis(points, pointCount, thick, color) + local _a1 + if type(points) == "table" then _a1 = to_array("Vector2", points) + else _a1 = points end + C.DrawSplineBasis(_a1, pointCount, thick, color) +end + +---Draw spline: Catmull-Rom, minimum 4 points +---@param points raylib.Vector2[] +---@param pointCount integer +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawSplineCatmullRom(points, pointCount, thick, color) + local _a1 + if type(points) == "table" then _a1 = to_array("Vector2", points) + else _a1 = points end + C.DrawSplineCatmullRom(_a1, pointCount, thick, color) +end + +---Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] +---@param points raylib.Vector2[] +---@param pointCount integer +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawSplineBezierQuadratic(points, pointCount, thick, color) + local _a1 + if type(points) == "table" then _a1 = to_array("Vector2", points) + else _a1 = points end + C.DrawSplineBezierQuadratic(_a1, pointCount, thick, color) +end + +---Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] +---@param points raylib.Vector2[] +---@param pointCount integer +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawSplineBezierCubic(points, pointCount, thick, color) + local _a1 + if type(points) == "table" then _a1 = to_array("Vector2", points) + else _a1 = points end + C.DrawSplineBezierCubic(_a1, pointCount, thick, color) +end + +---Draw spline segment: Linear, 2 points +---@param p1 raylib.Vector2 +---@param p2 raylib.Vector2 +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawSplineSegmentLinear(p1, p2, thick, color) + C.DrawSplineSegmentLinear(p1, p2, thick, color) +end + +---Draw spline segment: B-Spline, 4 points +---@param p1 raylib.Vector2 +---@param p2 raylib.Vector2 +---@param p3 raylib.Vector2 +---@param p4 raylib.Vector2 +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawSplineSegmentBasis(p1, p2, p3, p4, thick, color) + C.DrawSplineSegmentBasis(p1, p2, p3, p4, thick, color) +end + +---Draw spline segment: Catmull-Rom, 4 points +---@param p1 raylib.Vector2 +---@param p2 raylib.Vector2 +---@param p3 raylib.Vector2 +---@param p4 raylib.Vector2 +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawSplineSegmentCatmullRom(p1, p2, p3, p4, thick, color) + C.DrawSplineSegmentCatmullRom(p1, p2, p3, p4, thick, color) +end + +---Draw spline segment: Quadratic Bezier, 2 points, 1 control point +---@param p1 raylib.Vector2 +---@param c2 raylib.Vector2 +---@param p3 raylib.Vector2 +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawSplineSegmentBezierQuadratic(p1, c2, p3, thick, color) + C.DrawSplineSegmentBezierQuadratic(p1, c2, p3, thick, color) +end + +---Draw spline segment: Cubic Bezier, 2 points, 2 control points +---@param p1 raylib.Vector2 +---@param c2 raylib.Vector2 +---@param c3 raylib.Vector2 +---@param p4 raylib.Vector2 +---@param thick number +---@param color raylib.Color +---@return nil +function M.DrawSplineSegmentBezierCubic(p1, c2, c3, p4, thick, color) + C.DrawSplineSegmentBezierCubic(p1, c2, c3, p4, thick, color) +end + +---Get (evaluate) spline point: Linear +---@param startPos raylib.Vector2 +---@param endPos raylib.Vector2 +---@param t number +---@return raylib.Vector2 +function M.GetSplinePointLinear(startPos, endPos, t) + return C.GetSplinePointLinear(startPos, endPos, t) +end + +---Get (evaluate) spline point: B-Spline +---@param p1 raylib.Vector2 +---@param p2 raylib.Vector2 +---@param p3 raylib.Vector2 +---@param p4 raylib.Vector2 +---@param t number +---@return raylib.Vector2 +function M.GetSplinePointBasis(p1, p2, p3, p4, t) + return C.GetSplinePointBasis(p1, p2, p3, p4, t) +end + +---Get (evaluate) spline point: Catmull-Rom +---@param p1 raylib.Vector2 +---@param p2 raylib.Vector2 +---@param p3 raylib.Vector2 +---@param p4 raylib.Vector2 +---@param t number +---@return raylib.Vector2 +function M.GetSplinePointCatmullRom(p1, p2, p3, p4, t) + return C.GetSplinePointCatmullRom(p1, p2, p3, p4, t) +end + +---Get (evaluate) spline point: Quadratic Bezier +---@param p1 raylib.Vector2 +---@param c2 raylib.Vector2 +---@param p3 raylib.Vector2 +---@param t number +---@return raylib.Vector2 +function M.GetSplinePointBezierQuadratic(p1, c2, p3, t) + return C.GetSplinePointBezierQuadratic(p1, c2, p3, t) +end + +---Get (evaluate) spline point: Cubic Bezier +---@param p1 raylib.Vector2 +---@param c2 raylib.Vector2 +---@param c3 raylib.Vector2 +---@param p4 raylib.Vector2 +---@param t number +---@return raylib.Vector2 +function M.GetSplinePointBezierCubic(p1, c2, c3, p4, t) + return C.GetSplinePointBezierCubic(p1, c2, c3, p4, t) +end + +---Check collision between two rectangles +---@param rec1 raylib.Rectangle +---@param rec2 raylib.Rectangle +---@return boolean +function M.CheckCollisionRecs(rec1, rec2) + return C.CheckCollisionRecs(rec1, rec2) +end + +---Check collision between two circles +---@param center1 raylib.Vector2 +---@param radius1 number +---@param center2 raylib.Vector2 +---@param radius2 number +---@return boolean +function M.CheckCollisionCircles(center1, radius1, center2, radius2) + return C.CheckCollisionCircles(center1, radius1, center2, radius2) +end + +---Check collision between circle and rectangle +---@param center raylib.Vector2 +---@param radius number +---@param rec raylib.Rectangle +---@return boolean +function M.CheckCollisionCircleRec(center, radius, rec) + return C.CheckCollisionCircleRec(center, radius, rec) +end + +---Check if circle collides with a line created between two points [p1] and [p2] +---@param center raylib.Vector2 +---@param radius number +---@param p1 raylib.Vector2 +---@param p2 raylib.Vector2 +---@return boolean +function M.CheckCollisionCircleLine(center, radius, p1, p2) + return C.CheckCollisionCircleLine(center, radius, p1, p2) +end + +---Check if point is inside rectangle +---@param point raylib.Vector2 +---@param rec raylib.Rectangle +---@return boolean +function M.CheckCollisionPointRec(point, rec) + return C.CheckCollisionPointRec(point, rec) +end + +---Check if point is inside circle +---@param point raylib.Vector2 +---@param center raylib.Vector2 +---@param radius number +---@return boolean +function M.CheckCollisionPointCircle(point, center, radius) + return C.CheckCollisionPointCircle(point, center, radius) +end + +---Check if point is inside a triangle +---@param point raylib.Vector2 +---@param p1 raylib.Vector2 +---@param p2 raylib.Vector2 +---@param p3 raylib.Vector2 +---@return boolean +function M.CheckCollisionPointTriangle(point, p1, p2, p3) + return C.CheckCollisionPointTriangle(point, p1, p2, p3) +end + +---Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] +---@param point raylib.Vector2 +---@param p1 raylib.Vector2 +---@param p2 raylib.Vector2 +---@param threshold integer +---@return boolean +function M.CheckCollisionPointLine(point, p1, p2, threshold) + return C.CheckCollisionPointLine(point, p1, p2, threshold) +end + +---Check if point is within a polygon described by array of vertices +---@param point raylib.Vector2 +---@param points raylib.Vector2[] +---@param pointCount integer +---@return boolean +function M.CheckCollisionPointPoly(point, points, pointCount) + local _a2 + if type(points) == "table" then _a2 = to_array("Vector2", points) + else _a2 = points end + return C.CheckCollisionPointPoly(point, _a2, pointCount) +end + +---Check the collision between two lines defined by two points each, returns collision point by reference +---@param startPos1 raylib.Vector2 +---@param endPos1 raylib.Vector2 +---@param startPos2 raylib.Vector2 +---@param endPos2 raylib.Vector2 +---@param collisionPoint ffi.cdata* +---@return boolean +function M.CheckCollisionLines(startPos1, endPos1, startPos2, endPos2, collisionPoint) + return C.CheckCollisionLines(startPos1, endPos1, startPos2, endPos2, collisionPoint) +end + +---Get collision rectangle for two rectangles collision +---@param rec1 raylib.Rectangle +---@param rec2 raylib.Rectangle +---@return raylib.Rectangle +function M.GetCollisionRec(rec1, rec2) + return C.GetCollisionRec(rec1, rec2) +end + +---Load image from file into CPU memory (RAM) +---@param fileName string +---@return raylib.Image +function M.LoadImage(fileName) + return C.LoadImage(fileName) +end + +---Load image from RAW file data +---@param fileName string +---@param width integer +---@param height integer +---@param format integer +---@param headerSize integer +---@return raylib.Image +function M.LoadImageRaw(fileName, width, height, format, headerSize) + return C.LoadImageRaw(fileName, width, height, format, headerSize) +end + +---Load image sequence from file (frames appended to image.data) +---@param fileName string +---@param frames ffi.cdata* +---@return raylib.Image +function M.LoadImageAnim(fileName, frames) + return C.LoadImageAnim(fileName, frames) +end + +---Load image sequence from memory buffer +---@param fileType string +---@param fileData string|integer[] +---@param dataSize integer +---@param frames ffi.cdata* +---@return raylib.Image +function M.LoadImageAnimFromMemory(fileType, fileData, dataSize, frames) + local _a2 + if type(fileData) == "string" then _a2 = ffi.cast("const unsigned char *", fileData) + elseif type(fileData) == "table" then _a2 = to_array("unsigned char", fileData) + else _a2 = fileData end + return C.LoadImageAnimFromMemory(fileType, _a2, dataSize, frames) +end + +---Load image from memory buffer, fileType refers to extension: i.e. '.png' +---@param fileType string +---@param fileData string|integer[] +---@param dataSize integer +---@return raylib.Image +function M.LoadImageFromMemory(fileType, fileData, dataSize) + local _a2 + if type(fileData) == "string" then _a2 = ffi.cast("const unsigned char *", fileData) + elseif type(fileData) == "table" then _a2 = to_array("unsigned char", fileData) + else _a2 = fileData end + return C.LoadImageFromMemory(fileType, _a2, dataSize) +end + +---Load image from GPU texture data +---@param texture raylib.Texture2D +---@return raylib.Image +function M.LoadImageFromTexture(texture) + return C.LoadImageFromTexture(texture) +end + +---Load image from screen buffer (screenshot) +---@return raylib.Image +function M.LoadImageFromScreen() + return C.LoadImageFromScreen() +end + +---Check if an image is valid (data and parameters) +---@param image raylib.Image +---@return boolean +function M.IsImageValid(image) + return C.IsImageValid(image) +end + +---Unload image from CPU memory (RAM) +---@param image raylib.Image +---@return nil +function M.UnloadImage(image) + C.UnloadImage(image) +end + +---Export image data to file, returns true on success +---@param image raylib.Image +---@param fileName string +---@return boolean +function M.ExportImage(image, fileName) + return C.ExportImage(image, fileName) +end + +---Export image to memory buffer, memory must be MemFree() +---@param image raylib.Image +---@param fileType string +---@param fileSize ffi.cdata* +---@return ffi.cdata* +function M.ExportImageToMemory(image, fileType, fileSize) + return C.ExportImageToMemory(image, fileType, fileSize) +end + +---Export image as code file defining an array of bytes, returns true on success +---@param image raylib.Image +---@param fileName string +---@return boolean +function M.ExportImageAsCode(image, fileName) + return C.ExportImageAsCode(image, fileName) +end + +---Generate image: plain color +---@param width integer +---@param height integer +---@param color raylib.Color +---@return raylib.Image +function M.GenImageColor(width, height, color) + return C.GenImageColor(width, height, color) +end + +---Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient +---@param width integer +---@param height integer +---@param direction integer +---@param start raylib.Color +---@param end_ raylib.Color +---@return raylib.Image +function M.GenImageGradientLinear(width, height, direction, start, end_) + return C.GenImageGradientLinear(width, height, direction, start, end_) +end + +---Generate image: radial gradient +---@param width integer +---@param height integer +---@param density number +---@param inner raylib.Color +---@param outer raylib.Color +---@return raylib.Image +function M.GenImageGradientRadial(width, height, density, inner, outer) + return C.GenImageGradientRadial(width, height, density, inner, outer) +end + +---Generate image: square gradient +---@param width integer +---@param height integer +---@param density number +---@param inner raylib.Color +---@param outer raylib.Color +---@return raylib.Image +function M.GenImageGradientSquare(width, height, density, inner, outer) + return C.GenImageGradientSquare(width, height, density, inner, outer) +end + +---Generate image: checked +---@param width integer +---@param height integer +---@param checksX integer +---@param checksY integer +---@param col1 raylib.Color +---@param col2 raylib.Color +---@return raylib.Image +function M.GenImageChecked(width, height, checksX, checksY, col1, col2) + return C.GenImageChecked(width, height, checksX, checksY, col1, col2) +end + +---Generate image: white noise +---@param width integer +---@param height integer +---@param factor number +---@return raylib.Image +function M.GenImageWhiteNoise(width, height, factor) + return C.GenImageWhiteNoise(width, height, factor) +end + +---Generate image: perlin noise +---@param width integer +---@param height integer +---@param offsetX integer +---@param offsetY integer +---@param scale number +---@return raylib.Image +function M.GenImagePerlinNoise(width, height, offsetX, offsetY, scale) + return C.GenImagePerlinNoise(width, height, offsetX, offsetY, scale) +end + +---Generate image: cellular algorithm, bigger tileSize means bigger cells +---@param width integer +---@param height integer +---@param tileSize integer +---@return raylib.Image +function M.GenImageCellular(width, height, tileSize) + return C.GenImageCellular(width, height, tileSize) +end + +---Generate image: grayscale image from text data +---@param width integer +---@param height integer +---@param text string +---@return raylib.Image +function M.GenImageText(width, height, text) + return C.GenImageText(width, height, text) +end + +---Create an image duplicate (useful for transformations) +---@param image raylib.Image +---@return raylib.Image +function M.ImageCopy(image) + return C.ImageCopy(image) +end + +---Create an image from another image piece +---@param image raylib.Image +---@param rec raylib.Rectangle +---@return raylib.Image +function M.ImageFromImage(image, rec) + return C.ImageFromImage(image, rec) +end + +---Create an image from a selected channel of another image (GRAYSCALE) +---@param image raylib.Image +---@param selectedChannel integer +---@return raylib.Image +function M.ImageFromChannel(image, selectedChannel) + return C.ImageFromChannel(image, selectedChannel) +end + +---Create an image from text (default font) +---@param text string +---@param fontSize integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageText(text, fontSize, color) + return C.ImageText(text, fontSize, color) +end + +---Create an image from text (custom sprite font) +---@param font raylib.Font +---@param text string +---@param fontSize number +---@param spacing number +---@param tint raylib.Color +---@return raylib.Image +function M.ImageTextEx(font, text, fontSize, spacing, tint) + return C.ImageTextEx(font, text, fontSize, spacing, tint) +end + +---Convert image data to desired format +---@param image raylib.Image +---@param newFormat integer +---@return raylib.Image +function M.ImageFormat(image, newFormat) + local _o1 = ffi.new("Image[1]", image) + C.ImageFormat(_o1, newFormat) + return _o1[0] +end + +---Convert image to POT (power-of-two) +---@param image raylib.Image +---@param fill raylib.Color +---@return raylib.Image +function M.ImageToPOT(image, fill) + local _o1 = ffi.new("Image[1]", image) + C.ImageToPOT(_o1, fill) + return _o1[0] +end + +---Crop an image to a defined rectangle +---@param image raylib.Image +---@param crop raylib.Rectangle +---@return raylib.Image +function M.ImageCrop(image, crop) + local _o1 = ffi.new("Image[1]", image) + C.ImageCrop(_o1, crop) + return _o1[0] +end + +---Crop image depending on alpha value +---@param image raylib.Image +---@param threshold number +---@return raylib.Image +function M.ImageAlphaCrop(image, threshold) + local _o1 = ffi.new("Image[1]", image) + C.ImageAlphaCrop(_o1, threshold) + return _o1[0] +end + +---Clear alpha channel to desired color +---@param image raylib.Image +---@param color raylib.Color +---@param threshold number +---@return raylib.Image +function M.ImageAlphaClear(image, color, threshold) + local _o1 = ffi.new("Image[1]", image) + C.ImageAlphaClear(_o1, color, threshold) + return _o1[0] +end + +---Apply alpha mask to image +---@param image raylib.Image +---@param alphaMask raylib.Image +---@return raylib.Image +function M.ImageAlphaMask(image, alphaMask) + local _o1 = ffi.new("Image[1]", image) + C.ImageAlphaMask(_o1, alphaMask) + return _o1[0] +end + +---Premultiply alpha channel +---@param image raylib.Image +---@return raylib.Image +function M.ImageAlphaPremultiply(image) + local _o1 = ffi.new("Image[1]", image) + C.ImageAlphaPremultiply(_o1) + return _o1[0] +end + +---Apply Gaussian blur using a box blur approximation +---@param image raylib.Image +---@param blurSize integer +---@return raylib.Image +function M.ImageBlurGaussian(image, blurSize) + local _o1 = ffi.new("Image[1]", image) + C.ImageBlurGaussian(_o1, blurSize) + return _o1[0] +end + +---Apply custom square convolution kernel to image +---@param image raylib.Image +---@param kernel number[] +---@param kernelSize integer +---@return raylib.Image +function M.ImageKernelConvolution(image, kernel, kernelSize) + local _o1 = ffi.new("Image[1]", image) + local _a2 + if type(kernel) == "table" then _a2 = to_array("float", kernel) + else _a2 = kernel end + C.ImageKernelConvolution(_o1, _a2, kernelSize) + return _o1[0] +end + +---Resize image (Bicubic scaling algorithm) +---@param image raylib.Image +---@param newWidth integer +---@param newHeight integer +---@return raylib.Image +function M.ImageResize(image, newWidth, newHeight) + local _o1 = ffi.new("Image[1]", image) + C.ImageResize(_o1, newWidth, newHeight) + return _o1[0] +end + +---Resize image (Nearest-Neighbor scaling algorithm) +---@param image raylib.Image +---@param newWidth integer +---@param newHeight integer +---@return raylib.Image +function M.ImageResizeNN(image, newWidth, newHeight) + local _o1 = ffi.new("Image[1]", image) + C.ImageResizeNN(_o1, newWidth, newHeight) + return _o1[0] +end + +---Resize canvas and fill with color +---@param image raylib.Image +---@param newWidth integer +---@param newHeight integer +---@param offsetX integer +---@param offsetY integer +---@param fill raylib.Color +---@return raylib.Image +function M.ImageResizeCanvas(image, newWidth, newHeight, offsetX, offsetY, fill) + local _o1 = ffi.new("Image[1]", image) + C.ImageResizeCanvas(_o1, newWidth, newHeight, offsetX, offsetY, fill) + return _o1[0] +end + +---Compute all mipmap levels for a provided image +---@param image raylib.Image +---@return raylib.Image +function M.ImageMipmaps(image) + local _o1 = ffi.new("Image[1]", image) + C.ImageMipmaps(_o1) + return _o1[0] +end + +---Dither image data to 16bpp or lower (Floyd-Steinberg dithering) +---@param image raylib.Image +---@param rBpp integer +---@param gBpp integer +---@param bBpp integer +---@param aBpp integer +---@return raylib.Image +function M.ImageDither(image, rBpp, gBpp, bBpp, aBpp) + local _o1 = ffi.new("Image[1]", image) + C.ImageDither(_o1, rBpp, gBpp, bBpp, aBpp) + return _o1[0] +end + +---Flip image vertically +---@param image raylib.Image +---@return raylib.Image +function M.ImageFlipVertical(image) + local _o1 = ffi.new("Image[1]", image) + C.ImageFlipVertical(_o1) + return _o1[0] +end + +---Flip image horizontally +---@param image raylib.Image +---@return raylib.Image +function M.ImageFlipHorizontal(image) + local _o1 = ffi.new("Image[1]", image) + C.ImageFlipHorizontal(_o1) + return _o1[0] +end + +---Rotate image by input angle in degrees (-359 to 359) +---@param image raylib.Image +---@param degrees integer +---@return raylib.Image +function M.ImageRotate(image, degrees) + local _o1 = ffi.new("Image[1]", image) + C.ImageRotate(_o1, degrees) + return _o1[0] +end + +---Rotate image clockwise 90deg +---@param image raylib.Image +---@return raylib.Image +function M.ImageRotateCW(image) + local _o1 = ffi.new("Image[1]", image) + C.ImageRotateCW(_o1) + return _o1[0] +end + +---Rotate image counter-clockwise 90deg +---@param image raylib.Image +---@return raylib.Image +function M.ImageRotateCCW(image) + local _o1 = ffi.new("Image[1]", image) + C.ImageRotateCCW(_o1) + return _o1[0] +end + +---Modify image color: tint +---@param image raylib.Image +---@param color raylib.Color +---@return raylib.Image +function M.ImageColorTint(image, color) + local _o1 = ffi.new("Image[1]", image) + C.ImageColorTint(_o1, color) + return _o1[0] +end + +---Modify image color: invert +---@param image raylib.Image +---@return raylib.Image +function M.ImageColorInvert(image) + local _o1 = ffi.new("Image[1]", image) + C.ImageColorInvert(_o1) + return _o1[0] +end + +---Modify image color: grayscale +---@param image raylib.Image +---@return raylib.Image +function M.ImageColorGrayscale(image) + local _o1 = ffi.new("Image[1]", image) + C.ImageColorGrayscale(_o1) + return _o1[0] +end + +---Modify image color: contrast (-100 to 100) +---@param image raylib.Image +---@param contrast integer +---@return raylib.Image +function M.ImageColorContrast(image, contrast) + local _o1 = ffi.new("Image[1]", image) + C.ImageColorContrast(_o1, contrast) + return _o1[0] +end + +---Modify image color: brightness (-255 to 255) +---@param image raylib.Image +---@param brightness integer +---@return raylib.Image +function M.ImageColorBrightness(image, brightness) + local _o1 = ffi.new("Image[1]", image) + C.ImageColorBrightness(_o1, brightness) + return _o1[0] +end + +---Modify image color: replace color +---@param image raylib.Image +---@param color raylib.Color +---@param replace raylib.Color +---@return raylib.Image +function M.ImageColorReplace(image, color, replace) + local _o1 = ffi.new("Image[1]", image) + C.ImageColorReplace(_o1, color, replace) + return _o1[0] +end + +---Load color data from image as a Color array (RGBA - 32bit) +---@param image raylib.Image +---@return ffi.cdata* +function M.LoadImageColors(image) + return C.LoadImageColors(image) +end + +---Load colors palette from image as a Color array (RGBA - 32bit) +---@param image raylib.Image +---@param maxPaletteSize integer +---@param colorCount ffi.cdata* +---@return ffi.cdata* +function M.LoadImagePalette(image, maxPaletteSize, colorCount) + return C.LoadImagePalette(image, maxPaletteSize, colorCount) +end + +---Unload color data loaded with LoadImageColors() +---@param colors ffi.cdata* +---@return nil +function M.UnloadImageColors(colors) + C.UnloadImageColors(colors) +end + +---Unload colors palette loaded with LoadImagePalette() +---@param colors ffi.cdata* +---@return nil +function M.UnloadImagePalette(colors) + C.UnloadImagePalette(colors) +end + +---Get image alpha border rectangle +---@param image raylib.Image +---@param threshold number +---@return raylib.Rectangle +function M.GetImageAlphaBorder(image, threshold) + return C.GetImageAlphaBorder(image, threshold) +end + +---Get image pixel color at (x, y) position +---@param image raylib.Image +---@param x integer +---@param y integer +---@return raylib.Color +function M.GetImageColor(image, x, y) + return C.GetImageColor(image, x, y) +end + +---Clear image background with provided color +---@param dst raylib.Image +---@param color raylib.Color +---@return raylib.Image +function M.ImageClearBackground(dst, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageClearBackground(_o1, color) + return _o1[0] +end + +---Draw pixel within an image +---@param dst raylib.Image +---@param posX integer +---@param posY integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawPixel(dst, posX, posY, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawPixel(_o1, posX, posY, color) + return _o1[0] +end + +---Draw pixel within an image (Vector version) +---@param dst raylib.Image +---@param position raylib.Vector2 +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawPixelV(dst, position, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawPixelV(_o1, position, color) + return _o1[0] +end + +---Draw line within an image +---@param dst raylib.Image +---@param startPosX integer +---@param startPosY integer +---@param endPosX integer +---@param endPosY integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawLine(dst, startPosX, startPosY, endPosX, endPosY, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawLine(_o1, startPosX, startPosY, endPosX, endPosY, color) + return _o1[0] +end + +---Draw line within an image (Vector version) +---@param dst raylib.Image +---@param start raylib.Vector2 +---@param end_ raylib.Vector2 +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawLineV(dst, start, end_, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawLineV(_o1, start, end_, color) + return _o1[0] +end + +---Draw a line defining thickness within an image +---@param dst raylib.Image +---@param start raylib.Vector2 +---@param end_ raylib.Vector2 +---@param thick integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawLineEx(dst, start, end_, thick, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawLineEx(_o1, start, end_, thick, color) + return _o1[0] +end + +---Draw a lines sequence within an image +---@param dst raylib.Image +---@param points raylib.Vector2[] +---@param pointCount integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawLineStrip(dst, points, pointCount, color) + local _o1 = ffi.new("Image[1]", dst) + local _a2 + if type(points) == "table" then _a2 = to_array("Vector2", points) + else _a2 = points end + C.ImageDrawLineStrip(_o1, _a2, pointCount, color) + return _o1[0] +end + +---Draw triangle within an image +---@param dst raylib.Image +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@param v3 raylib.Vector2 +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawTriangle(dst, v1, v2, v3, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawTriangle(_o1, v1, v2, v3, color) + return _o1[0] +end + +---Draw triangle with interpolated colors within an image +---@param dst raylib.Image +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@param v3 raylib.Vector2 +---@param c1 raylib.Color +---@param c2 raylib.Color +---@param c3 raylib.Color +---@return raylib.Image +function M.ImageDrawTriangleGradient(dst, v1, v2, v3, c1, c2, c3) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawTriangleGradient(_o1, v1, v2, v3, c1, c2, c3) + return _o1[0] +end + +---Draw triangle outline within an image +---@param dst raylib.Image +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@param v3 raylib.Vector2 +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawTriangleLines(dst, v1, v2, v3, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawTriangleLines(_o1, v1, v2, v3, color) + return _o1[0] +end + +---Draw a triangle fan defined by points within an image (first vertex is the center) +---@param dst raylib.Image +---@param points raylib.Vector2[] +---@param pointCount integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawTriangleFan(dst, points, pointCount, color) + local _o1 = ffi.new("Image[1]", dst) + local _a2 + if type(points) == "table" then _a2 = to_array("Vector2", points) + else _a2 = points end + C.ImageDrawTriangleFan(_o1, _a2, pointCount, color) + return _o1[0] +end + +---Draw a triangle strip defined by points within an image +---@param dst raylib.Image +---@param points raylib.Vector2[] +---@param pointCount integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawTriangleStrip(dst, points, pointCount, color) + local _o1 = ffi.new("Image[1]", dst) + local _a2 + if type(points) == "table" then _a2 = to_array("Vector2", points) + else _a2 = points end + C.ImageDrawTriangleStrip(_o1, _a2, pointCount, color) + return _o1[0] +end + +---Draw rectangle within an image +---@param dst raylib.Image +---@param posX integer +---@param posY integer +---@param width integer +---@param height integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawRectangle(dst, posX, posY, width, height, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawRectangle(_o1, posX, posY, width, height, color) + return _o1[0] +end + +---Draw rectangle within an image (Vector version) +---@param dst raylib.Image +---@param position raylib.Vector2 +---@param size raylib.Vector2 +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawRectangleV(dst, position, size, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawRectangleV(_o1, position, size, color) + return _o1[0] +end + +---Draw rectangle within an image +---@param dst raylib.Image +---@param rec raylib.Rectangle +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawRectangleRec(dst, rec, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawRectangleRec(_o1, rec, color) + return _o1[0] +end + +---Draw a color-filled rectangle with pro parameters within and image +---@param dst raylib.Image +---@param rec raylib.Rectangle +---@param origin raylib.Vector2 +---@param rotation number +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawRectanglePro(dst, rec, origin, rotation, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawRectanglePro(_o1, rec, origin, rotation, color) + return _o1[0] +end + +---Draw rectangle lines within an image +---@param dst raylib.Image +---@param posX integer +---@param posY integer +---@param width integer +---@param height integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawRectangleLines(dst, posX, posY, width, height, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawRectangleLines(_o1, posX, posY, width, height, color) + return _o1[0] +end + +---Draw rectangle lines within an image with line thickness +---@param dst raylib.Image +---@param rec raylib.Rectangle +---@param thick integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawRectangleLinesEx(dst, rec, thick, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawRectangleLinesEx(_o1, rec, thick, color) + return _o1[0] +end + +---Draw rectangle with gradient colors within an image, counter-clockwise color order +---@param dst raylib.Image +---@param rec raylib.Rectangle +---@param col1 raylib.Color +---@param col2 raylib.Color +---@param col3 raylib.Color +---@param col4 raylib.Color +---@return raylib.Image +function M.ImageDrawRectangleGradientEx(dst, rec, col1, col2, col3, col4) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawRectangleGradientEx(_o1, rec, col1, col2, col3, col4) + return _o1[0] +end + +---Draw a filled circle within an image +---@param dst raylib.Image +---@param centerX integer +---@param centerY integer +---@param radius integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawCircle(dst, centerX, centerY, radius, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawCircle(_o1, centerX, centerY, radius, color) + return _o1[0] +end + +---Draw a filled circle within an image (Vector version) +---@param dst raylib.Image +---@param center raylib.Vector2 +---@param radius integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawCircleV(dst, center, radius, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawCircleV(_o1, center, radius, color) + return _o1[0] +end + +---Draw circle outline within an image +---@param dst raylib.Image +---@param centerX integer +---@param centerY integer +---@param radius integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawCircleLines(dst, centerX, centerY, radius, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawCircleLines(_o1, centerX, centerY, radius, color) + return _o1[0] +end + +---Draw circle outline within an image (Vector version) +---@param dst raylib.Image +---@param center raylib.Vector2 +---@param radius integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawCircleLinesV(dst, center, radius, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawCircleLinesV(_o1, center, radius, color) + return _o1[0] +end + +---Draw a gradient-filled circle within an image +---@param dst raylib.Image +---@param center raylib.Vector2 +---@param radius number +---@param inner raylib.Color +---@param outer raylib.Color +---@return raylib.Image +function M.ImageDrawCircleGradient(dst, center, radius, inner, outer) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawCircleGradient(_o1, center, radius, inner, outer) + return _o1[0] +end + +---Draw an image within an image +---@param dst raylib.Image +---@param src raylib.Image +---@param posX integer +---@param posY integer +---@param tint raylib.Color +---@return raylib.Image +function M.ImageDrawImage(dst, src, posX, posY, tint) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawImage(_o1, src, posX, posY, tint) + return _o1[0] +end + +---Draw an image with scaling and rotation within an image +---@param dst raylib.Image +---@param src raylib.Image +---@param position raylib.Vector2 +---@param rotation number +---@param scale number +---@param tint raylib.Color +---@return raylib.Image +function M.ImageDrawImageEx(dst, src, position, rotation, scale, tint) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawImageEx(_o1, src, position, rotation, scale, tint) + return _o1[0] +end + +---Draw a part of an image defined by a rectangle within an image +---@param dst raylib.Image +---@param src raylib.Image +---@param srcRec raylib.Rectangle +---@param position raylib.Vector2 +---@param tint raylib.Color +---@return raylib.Image +function M.ImageDrawImageRec(dst, src, srcRec, position, tint) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawImageRec(_o1, src, srcRec, position, tint) + return _o1[0] +end + +---Draw a part of an image defined by a rectangle into destination rectangle, with scaling and rotation, within an image +---@param dst raylib.Image +---@param src raylib.Image +---@param srcRec raylib.Rectangle +---@param dstRec raylib.Rectangle +---@param origin raylib.Vector2 +---@param rotation number +---@param tint raylib.Color +---@return raylib.Image +function M.ImageDrawImagePro(dst, src, srcRec, dstRec, origin, rotation, tint) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawImagePro(_o1, src, srcRec, dstRec, origin, rotation, tint) + return _o1[0] +end + +---Draw text (using default font) within an image (destination) +---@param dst raylib.Image +---@param text string +---@param posX integer +---@param posY integer +---@param fontSize integer +---@param color raylib.Color +---@return raylib.Image +function M.ImageDrawText(dst, text, posX, posY, fontSize, color) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawText(_o1, text, posX, posY, fontSize, color) + return _o1[0] +end + +---Draw text (custom sprite font) within an image (destination) +---@param dst raylib.Image +---@param font raylib.Font +---@param text string +---@param position raylib.Vector2 +---@param fontSize number +---@param spacing number +---@param tint raylib.Color +---@return raylib.Image +function M.ImageDrawTextEx(dst, font, text, position, fontSize, spacing, tint) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawTextEx(_o1, font, text, position, fontSize, spacing, tint) + return _o1[0] +end + +---Draw text using Font and pro parameters (rotation) +---@param dst raylib.Image +---@param font raylib.Font +---@param text string +---@param position raylib.Vector2 +---@param origin raylib.Vector2 +---@param rotation number +---@param fontSize number +---@param spacing number +---@param tint raylib.Color +---@return raylib.Image +function M.ImageDrawTextPro(dst, font, text, position, origin, rotation, fontSize, spacing, tint) + local _o1 = ffi.new("Image[1]", dst) + C.ImageDrawTextPro(_o1, font, text, position, origin, rotation, fontSize, spacing, tint) + return _o1[0] +end + +---Load texture from file into GPU memory (VRAM) +---@param fileName string +---@return raylib.Texture2D +function M.LoadTexture(fileName) + return C.LoadTexture(fileName) +end + +---Load texture from image data +---@param image raylib.Image +---@return raylib.Texture2D +function M.LoadTextureFromImage(image) + return C.LoadTextureFromImage(image) +end + +---Load cubemap from image, multiple image cubemap layouts supported +---@param image raylib.Image +---@param layout integer +---@return raylib.TextureCubemap +function M.LoadTextureCubemap(image, layout) + return C.LoadTextureCubemap(image, layout) +end + +---Load texture for rendering (framebuffer) +---@param width integer +---@param height integer +---@return raylib.RenderTexture2D +function M.LoadRenderTexture(width, height) + return C.LoadRenderTexture(width, height) +end + +---Load texture for rendering (framebuffer), with specific format +---@param width integer +---@param height integer +---@param format integer +---@return raylib.RenderTexture2D +function M.LoadRenderTextureEx(width, height, format) + return C.LoadRenderTextureEx(width, height, format) +end + +---Check if texture is valid (loaded in GPU) +---@param texture raylib.Texture2D +---@return boolean +function M.IsTextureValid(texture) + return C.IsTextureValid(texture) +end + +---Unload texture from GPU memory (VRAM) +---@param texture raylib.Texture2D +---@return nil +function M.UnloadTexture(texture) + C.UnloadTexture(texture) +end + +---Check if render texture is valid (loaded in GPU) +---@param target raylib.RenderTexture2D +---@return boolean +function M.IsRenderTextureValid(target) + return C.IsRenderTextureValid(target) +end + +---Unload render texture from GPU memory (VRAM) +---@param target raylib.RenderTexture2D +---@return nil +function M.UnloadRenderTexture(target) + C.UnloadRenderTexture(target) +end + +---Update GPU texture with new data (pixels should be able to fill texture) +---@param texture raylib.Texture2D +---@param pixels ffi.cdata*|string +---@return nil +function M.UpdateTexture(texture, pixels) + local _a2 + if type(pixels) == "string" then _a2 = ffi.cast("const void *", pixels) + else _a2 = pixels end + C.UpdateTexture(texture, _a2) +end + +---Update GPU texture rectangle with new data (pixels and rec should fit in texture) +---@param texture raylib.Texture2D +---@param rec raylib.Rectangle +---@param pixels ffi.cdata*|string +---@return nil +function M.UpdateTextureRec(texture, rec, pixels) + local _a3 + if type(pixels) == "string" then _a3 = ffi.cast("const void *", pixels) + else _a3 = pixels end + C.UpdateTextureRec(texture, rec, _a3) +end + +---Generate GPU mipmaps for a texture +---@param texture raylib.Texture2D +---@return raylib.Texture2D +function M.GenTextureMipmaps(texture) + local _o1 = ffi.new("Texture2D[1]", texture) + C.GenTextureMipmaps(_o1) + return _o1[0] +end + +---Set texture scaling filter mode +---@param texture raylib.Texture2D +---@param filter integer +---@return nil +function M.SetTextureFilter(texture, filter) + C.SetTextureFilter(texture, filter) +end + +---Set texture wrapping mode +---@param texture raylib.Texture2D +---@param wrap integer +---@return nil +function M.SetTextureWrap(texture, wrap) + C.SetTextureWrap(texture, wrap) +end + +---Draw a Texture2D +---@param texture raylib.Texture2D +---@param posX integer +---@param posY integer +---@param tint raylib.Color +---@return nil +function M.DrawTexture(texture, posX, posY, tint) + C.DrawTexture(texture, posX, posY, tint) +end + +---Draw a Texture2D with position defined as Vector2 +---@param texture raylib.Texture2D +---@param position raylib.Vector2 +---@param tint raylib.Color +---@return nil +function M.DrawTextureV(texture, position, tint) + C.DrawTextureV(texture, position, tint) +end + +---Draw a Texture2D with rotation and scale +---@param texture raylib.Texture2D +---@param position raylib.Vector2 +---@param rotation number +---@param scale number +---@param tint raylib.Color +---@return nil +function M.DrawTextureEx(texture, position, rotation, scale, tint) + C.DrawTextureEx(texture, position, rotation, scale, tint) +end + +---Draw a part of a texture defined by a rectangle +---@param texture raylib.Texture2D +---@param rec raylib.Rectangle +---@param position raylib.Vector2 +---@param tint raylib.Color +---@return nil +function M.DrawTextureRec(texture, rec, position, tint) + C.DrawTextureRec(texture, rec, position, tint) +end + +---Draw a part of a texture defined by a source rectangle to destination rectangle, with scaling and rotation +---@param texture raylib.Texture2D +---@param srcrec raylib.Rectangle +---@param dstrec raylib.Rectangle +---@param origin raylib.Vector2 +---@param rotation number +---@param tint raylib.Color +---@return nil +function M.DrawTexturePro(texture, srcrec, dstrec, origin, rotation, tint) + C.DrawTexturePro(texture, srcrec, dstrec, origin, rotation, tint) +end + +---Draw a texture (or part of it) that stretches or shrinks nicely +---@param texture raylib.Texture2D +---@param nPatchInfo raylib.NPatchInfo +---@param dstrec raylib.Rectangle +---@param origin raylib.Vector2 +---@param rotation number +---@param tint raylib.Color +---@return nil +function M.DrawTextureNPatch(texture, nPatchInfo, dstrec, origin, rotation, tint) + C.DrawTextureNPatch(texture, nPatchInfo, dstrec, origin, rotation, tint) +end + +---Check if two colors are equal +---@param col1 raylib.Color +---@param col2 raylib.Color +---@return boolean +function M.ColorIsEqual(col1, col2) + return C.ColorIsEqual(col1, col2) +end + +---Get color with alpha applied, alpha goes from 0.0f to 1.0f +---@param color raylib.Color +---@param alpha number +---@return raylib.Color +function M.Fade(color, alpha) + return C.Fade(color, alpha) +end + +---Get hexadecimal value for a Color (0xRRGGBBAA) +---@param color raylib.Color +---@return integer +function M.ColorToInt(color) + return C.ColorToInt(color) +end + +---Get Color normalized as float [0..1] +---@param color raylib.Color +---@return raylib.Vector4 +function M.ColorNormalize(color) + return C.ColorNormalize(color) +end + +---Get Color from normalized values [0..1] +---@param normalized raylib.Vector4 +---@return raylib.Color +function M.ColorFromNormalized(normalized) + return C.ColorFromNormalized(normalized) +end + +---Get HSV values for a Color, hue [0..360], saturation/value [0..1] +---@param color raylib.Color +---@return raylib.Vector3 +function M.ColorToHSV(color) + return C.ColorToHSV(color) +end + +---Get a Color from HSV values, hue [0..360], saturation/value [0..1] +---@param hue number +---@param saturation number +---@param value number +---@return raylib.Color +function M.ColorFromHSV(hue, saturation, value) + return C.ColorFromHSV(hue, saturation, value) +end + +---Get color multiplied with another color +---@param color raylib.Color +---@param tint raylib.Color +---@return raylib.Color +function M.ColorTint(color, tint) + return C.ColorTint(color, tint) +end + +---Get color with brightness correction, brightness factor goes from -1.0f to 1.0f +---@param color raylib.Color +---@param factor number +---@return raylib.Color +function M.ColorBrightness(color, factor) + return C.ColorBrightness(color, factor) +end + +---Get color with contrast correction, contrast values between -1.0f and 1.0f +---@param color raylib.Color +---@param contrast number +---@return raylib.Color +function M.ColorContrast(color, contrast) + return C.ColorContrast(color, contrast) +end + +---Get color with alpha applied, alpha goes from 0.0f to 1.0f +---@param color raylib.Color +---@param alpha number +---@return raylib.Color +function M.ColorAlpha(color, alpha) + return C.ColorAlpha(color, alpha) +end + +---Get src alpha-blended into dst color with tint +---@param dst raylib.Color +---@param src raylib.Color +---@param tint raylib.Color +---@return raylib.Color +function M.ColorAlphaBlend(dst, src, tint) + return C.ColorAlphaBlend(dst, src, tint) +end + +---Get color lerp interpolation between two colors, factor [0.0f..1.0f] +---@param color1 raylib.Color +---@param color2 raylib.Color +---@param factor number +---@return raylib.Color +function M.ColorLerp(color1, color2, factor) + return C.ColorLerp(color1, color2, factor) +end + +---Get Color structure from hexadecimal value +---@param hexValue integer +---@return raylib.Color +function M.GetColor(hexValue) + return C.GetColor(hexValue) +end + +---Get Color from a source pixel pointer of certain format +---@param srcPtr ffi.cdata*|string +---@param format integer +---@return raylib.Color +function M.GetPixelColor(srcPtr, format) + local _a1 + if type(srcPtr) == "string" then _a1 = ffi.cast("const void *", srcPtr) + else _a1 = srcPtr end + return C.GetPixelColor(_a1, format) +end + +---Set color formatted into destination pixel pointer +---@param dstPtr ffi.cdata*|string +---@param color raylib.Color +---@param format integer +---@return nil +function M.SetPixelColor(dstPtr, color, format) + local _a1 + if type(dstPtr) == "string" then _a1 = ffi.cast("const void *", dstPtr) + else _a1 = dstPtr end + C.SetPixelColor(_a1, color, format) +end + +---Get pixel data size in bytes for certain format +---@param width integer +---@param height integer +---@param format integer +---@return integer +function M.GetPixelDataSize(width, height, format) + return C.GetPixelDataSize(width, height, format) +end + +---Get the default Font +---@return raylib.Font +function M.GetFontDefault() + return C.GetFontDefault() +end + +---Load font from file into GPU memory (VRAM) +---@param fileName string +---@return raylib.Font +function M.LoadFont(fileName) + return C.LoadFont(fileName) +end + +---Load font from file with defined codepoints and generation size, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height +---@param fileName string +---@param fontSize integer +---@param codepoints integer[] +---@param codepointCount integer +---@return raylib.Font +function M.LoadFontEx(fileName, fontSize, codepoints, codepointCount) + local _a3 + if type(codepoints) == "table" then _a3 = to_array("int", codepoints) + else _a3 = codepoints end + return C.LoadFontEx(fileName, fontSize, _a3, codepointCount) +end + +---Load font from Image (XNA style) +---@param image raylib.Image +---@param key raylib.Color +---@param firstChar integer +---@return raylib.Font +function M.LoadFontFromImage(image, key, firstChar) + return C.LoadFontFromImage(image, key, firstChar) +end + +---Load font from memory buffer, fileType refers to extension: i.e. '.ttf' +---@param fileType string +---@param fileData string|integer[] +---@param dataSize integer +---@param fontSize integer +---@param codepoints integer[] +---@param codepointCount integer +---@return raylib.Font +function M.LoadFontFromMemory(fileType, fileData, dataSize, fontSize, codepoints, codepointCount) + local _a2 + if type(fileData) == "string" then _a2 = ffi.cast("const unsigned char *", fileData) + elseif type(fileData) == "table" then _a2 = to_array("unsigned char", fileData) + else _a2 = fileData end + local _a5 + if type(codepoints) == "table" then _a5 = to_array("int", codepoints) + else _a5 = codepoints end + return C.LoadFontFromMemory(fileType, _a2, dataSize, fontSize, _a5, codepointCount) +end + +---Check if font is valid (font data loaded, WARNING: GPU texture not checked) +---@param font raylib.Font +---@return boolean +function M.IsFontValid(font) + return C.IsFontValid(font) +end + +---Load font data for further use +---@param fileData string|integer[] +---@param dataSize integer +---@param fontSize integer +---@param codepoints integer[] +---@param codepointCount integer +---@param type integer +---@param glyphCount ffi.cdata* +---@return ffi.cdata* +function M.LoadFontData(fileData, dataSize, fontSize, codepoints, codepointCount, type, glyphCount) + local _a1 + if type(fileData) == "string" then _a1 = ffi.cast("const unsigned char *", fileData) + elseif type(fileData) == "table" then _a1 = to_array("unsigned char", fileData) + else _a1 = fileData end + local _a4 + if type(codepoints) == "table" then _a4 = to_array("int", codepoints) + else _a4 = codepoints end + return C.LoadFontData(_a1, dataSize, fontSize, _a4, codepointCount, type, glyphCount) +end + +---Generate image font atlas using chars info +---@param glyphs raylib.GlyphInfo[] +---@param glyphRecs ffi.cdata* +---@param glyphCount integer +---@param fontSize integer +---@param padding integer +---@param packMethod integer +---@return raylib.Image +function M.GenImageFontAtlas(glyphs, glyphRecs, glyphCount, fontSize, padding, packMethod) + local _a1 + if type(glyphs) == "table" then _a1 = to_array("GlyphInfo", glyphs) + else _a1 = glyphs end + return C.GenImageFontAtlas(_a1, glyphRecs, glyphCount, fontSize, padding, packMethod) +end + +---Unload font chars info data (RAM) +---@param glyphs ffi.cdata* +---@param glyphCount integer +---@return nil +function M.UnloadFontData(glyphs, glyphCount) + C.UnloadFontData(glyphs, glyphCount) +end + +---Unload font from GPU memory (VRAM) +---@param font raylib.Font +---@return nil +function M.UnloadFont(font) + C.UnloadFont(font) +end + +---Export font as code file, returns true on success +---@param font raylib.Font +---@param fileName string +---@return boolean +function M.ExportFontAsCode(font, fileName) + return C.ExportFontAsCode(font, fileName) +end + +---Draw current FPS +---@param posX integer +---@param posY integer +---@return nil +function M.DrawFPS(posX, posY) + C.DrawFPS(posX, posY) +end + +---Draw text (using default font) +---@param text string +---@param posX integer +---@param posY integer +---@param fontSize integer +---@param color raylib.Color +---@return nil +function M.DrawText(text, posX, posY, fontSize, color) + C.DrawText(text, posX, posY, fontSize, color) +end + +---Draw text using font and additional parameters +---@param font raylib.Font +---@param text string +---@param position raylib.Vector2 +---@param fontSize number +---@param spacing number +---@param tint raylib.Color +---@return nil +function M.DrawTextEx(font, text, position, fontSize, spacing, tint) + C.DrawTextEx(font, text, position, fontSize, spacing, tint) +end + +---Draw text using Font and pro parameters (rotation) +---@param font raylib.Font +---@param text string +---@param position raylib.Vector2 +---@param origin raylib.Vector2 +---@param rotation number +---@param fontSize number +---@param spacing number +---@param tint raylib.Color +---@return nil +function M.DrawTextPro(font, text, position, origin, rotation, fontSize, spacing, tint) + C.DrawTextPro(font, text, position, origin, rotation, fontSize, spacing, tint) +end + +---Draw one character (codepoint) +---@param font raylib.Font +---@param codepoint integer +---@param position raylib.Vector2 +---@param fontSize number +---@param tint raylib.Color +---@return nil +function M.DrawTextCodepoint(font, codepoint, position, fontSize, tint) + C.DrawTextCodepoint(font, codepoint, position, fontSize, tint) +end + +---Draw multiple characters (codepoint) +---@param font raylib.Font +---@param codepoints integer[] +---@param codepointCount integer +---@param position raylib.Vector2 +---@param fontSize number +---@param spacing number +---@param tint raylib.Color +---@return nil +function M.DrawTextCodepoints(font, codepoints, codepointCount, position, fontSize, spacing, tint) + local _a2 + if type(codepoints) == "table" then _a2 = to_array("int", codepoints) + else _a2 = codepoints end + C.DrawTextCodepoints(font, _a2, codepointCount, position, fontSize, spacing, tint) +end + +---Set vertical line spacing when drawing with line-breaks +---@param spacing integer +---@return nil +function M.SetTextLineSpacing(spacing) + C.SetTextLineSpacing(spacing) +end + +---Measure string width for default font +---@param text string +---@param fontSize integer +---@return integer +function M.MeasureText(text, fontSize) + return C.MeasureText(text, fontSize) +end + +---Measure string size for Font +---@param font raylib.Font +---@param text string +---@param fontSize number +---@param spacing number +---@return raylib.Vector2 +function M.MeasureTextEx(font, text, fontSize, spacing) + return C.MeasureTextEx(font, text, fontSize, spacing) +end + +---Measure string size for an existing array of codepoints for Font +---@param font raylib.Font +---@param codepoints integer[] +---@param length integer +---@param fontSize number +---@param spacing number +---@return raylib.Vector2 +function M.MeasureTextCodepoints(font, codepoints, length, fontSize, spacing) + local _a2 + if type(codepoints) == "table" then _a2 = to_array("int", codepoints) + else _a2 = codepoints end + return C.MeasureTextCodepoints(font, _a2, length, fontSize, spacing) +end + +---Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found +---@param font raylib.Font +---@param codepoint integer +---@return integer +function M.GetGlyphIndex(font, codepoint) + return C.GetGlyphIndex(font, codepoint) +end + +---Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found +---@param font raylib.Font +---@param codepoint integer +---@return raylib.GlyphInfo +function M.GetGlyphInfo(font, codepoint) + return C.GetGlyphInfo(font, codepoint) +end + +---Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found +---@param font raylib.Font +---@param codepoint integer +---@return raylib.Rectangle +function M.GetGlyphAtlasRec(font, codepoint) + return C.GetGlyphAtlasRec(font, codepoint) +end + +---Load UTF-8 text encoded from codepoints array +---@param codepoints integer[] +---@param length integer +---@return string|nil +function M.LoadUTF8(codepoints, length) + local _a1 + if type(codepoints) == "table" then _a1 = to_array("int", codepoints) + else _a1 = codepoints end + local _p = C.LoadUTF8(_a1, length) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + C.UnloadUTF8(_p) + return _s +end + +---Unload UTF-8 text encoded from codepoints array +---@param text raylib.char_buffer|string +---@return nil +function M.UnloadUTF8(text) + C.UnloadUTF8(text) +end + +---Load all codepoints from a UTF-8 text string, codepoints count returned by parameter +---@param text string +---@param count ffi.cdata* +---@return ffi.cdata* +function M.LoadCodepoints(text, count) + return C.LoadCodepoints(text, count) +end + +---Unload codepoints data from memory +---@param codepoints ffi.cdata* +---@return nil +function M.UnloadCodepoints(codepoints) + C.UnloadCodepoints(codepoints) +end + +---Get total number of codepoints in a UTF-8 encoded string +---@param text string +---@return integer +function M.GetCodepointCount(text) + return C.GetCodepointCount(text) +end + +---Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure +---@param text string +---@param codepointSize ffi.cdata* +---@return integer +function M.GetCodepoint(text, codepointSize) + return C.GetCodepoint(text, codepointSize) +end + +---Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure +---@param text string +---@param codepointSize ffi.cdata* +---@return integer +function M.GetCodepointNext(text, codepointSize) + return C.GetCodepointNext(text, codepointSize) +end + +---Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure +---@param text string +---@param codepointSize ffi.cdata* +---@return integer +function M.GetCodepointPrevious(text, codepointSize) + return C.GetCodepointPrevious(text, codepointSize) +end + +---Encode one codepoint into UTF-8 byte array (array length returned as parameter) +---@param codepoint integer +---@return string|nil +function M.CodepointToUTF8(codepoint) + local size = ffi.new("int[1]") + local p = C.CodepointToUTF8(codepoint, size) + if p == nil then return nil end + return ffi_string(p, size[0]) +end + +---Load text as separate lines ('\n') +---@param text string +---@param count ffi.cdata* +---@return ffi.cdata* +function M.LoadTextLines(text, count) + return C.LoadTextLines(text, count) +end + +---Unload text lines +---@param text string[]|raylib.cstring_array +---@param lineCount integer +---@return nil +function M.UnloadTextLines(text, lineCount) + local _a1 + if type(text) == "table" then _a1 = ffi.cast("char **", to_array("const char *", text)) + else _a1 = text end + C.UnloadTextLines(_a1, lineCount) +end + +---Copy one string to another, returns bytes copied +---@param dst raylib.char_buffer|string +---@param src string +---@return integer +function M.TextCopy(dst, src) + return C.TextCopy(dst, src) +end + +---Check if two text strings are equal +---@param text1 string +---@param text2 string +---@return boolean +function M.TextIsEqual(text1, text2) + return C.TextIsEqual(text1, text2) +end + +---Get text length, checks for '\0' ending +---@param text string +---@return integer +function M.TextLength(text) + return C.TextLength(text) +end + +---Text formatting with variables (sprintf() style) +---@param fmt string +---@param ... any +---@return string +function M.TextFormat(fmt, ...) + if select("#", ...) == 0 then + return fmt + end + return string_format(fmt, ...) +end + +---Get a piece of a text string +---@param text string +---@param position integer +---@param length integer +---@return string|nil +function M.TextSubtext(text, position, length) + local _p = C.TextSubtext(text, position, length) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Remove text spaces, concat words +---@param text string +---@return string|nil +function M.TextRemoveSpaces(text) + local _p = C.TextRemoveSpaces(text) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get text between two strings +---@param text string +---@param begin string +---@param end_ string +---@return string|nil +function M.GetTextBetween(text, begin, end_) + local _p = C.GetTextBetween(text, begin, end_) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Replace text string with new string +---@param text string +---@param search string +---@param replacement string +---@return string|nil +function M.TextReplace(text, search, replacement) + local _p = C.TextReplace(text, search, replacement) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Replace text string with new string, memory must be MemFree() +---@param text string +---@param search string +---@param replacement string +---@return string|nil +function M.TextReplaceAlloc(text, search, replacement) + local _p = C.TextReplaceAlloc(text, search, replacement) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + C.MemFree(_p) + return _s +end + +---Replace text between two specific strings +---@param text string +---@param begin string +---@param end_ string +---@param replacement string +---@return string|nil +function M.TextReplaceBetween(text, begin, end_, replacement) + local _p = C.TextReplaceBetween(text, begin, end_, replacement) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Replace text between two specific strings, memory must be MemFree() +---@param text string +---@param begin string +---@param end_ string +---@param replacement string +---@return string|nil +function M.TextReplaceBetweenAlloc(text, begin, end_, replacement) + local _p = C.TextReplaceBetweenAlloc(text, begin, end_, replacement) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + C.MemFree(_p) + return _s +end + +---Insert text in a defined byte position +---@param text string +---@param insert string +---@param position integer +---@return string|nil +function M.TextInsert(text, insert, position) + local _p = C.TextInsert(text, insert, position) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Insert text in a defined byte position, memory must be MemFree() +---@param text string +---@param insert string +---@param position integer +---@return string|nil +function M.TextInsertAlloc(text, insert, position) + local _p = C.TextInsertAlloc(text, insert, position) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + C.MemFree(_p) + return _s +end + +---Join text strings with delimiter +---@param textList string[]|raylib.cstring_array +---@param count integer +---@param delimiter string +---@return string|nil +function M.TextJoin(textList, count, delimiter) + local _a1 + if type(textList) == "table" then _a1 = ffi.cast("char **", to_array("const char *", textList)) + else _a1 = textList end + local _p = C.TextJoin(_a1, count, delimiter) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Split text into multiple strings, using MAX_TEXTSPLIT_COUNT static strings +---@param text string +---@param delimiter integer +---@param count ffi.cdata* +---@return ffi.cdata* +function M.TextSplit(text, delimiter, count) + return C.TextSplit(text, delimiter, count) +end + +---Append text at specific position and move cursor +---@param text raylib.char_buffer|string +---@param append string +---@param position ffi.cdata* +---@return nil +function M.TextAppend(text, append, position) + C.TextAppend(text, append, position) +end + +---Find first text occurrence within a string, -1 if not found +---@param text string +---@param search string +---@return integer +function M.TextFindIndex(text, search) + return C.TextFindIndex(text, search) +end + +---Get upper case version of provided string +---@param text string +---@return string|nil +function M.TextToUpper(text) + local _p = C.TextToUpper(text) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get lower case version of provided string +---@param text string +---@return string|nil +function M.TextToLower(text) + local _p = C.TextToLower(text) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get Pascal case notation version of provided string +---@param text string +---@return string|nil +function M.TextToPascal(text) + local _p = C.TextToPascal(text) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get Snake case notation version of provided string +---@param text string +---@return string|nil +function M.TextToSnake(text) + local _p = C.TextToSnake(text) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get Camel case notation version of provided string +---@param text string +---@return string|nil +function M.TextToCamel(text) + local _p = C.TextToCamel(text) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Get integer value from text +---@param text string +---@return integer +function M.TextToInteger(text) + return C.TextToInteger(text) +end + +---Get float value from text +---@param text string +---@return number +function M.TextToFloat(text) + return C.TextToFloat(text) +end + +---Draw a line in 3D world space +---@param startPos raylib.Vector3 +---@param endPos raylib.Vector3 +---@param color raylib.Color +---@return nil +function M.DrawLine3D(startPos, endPos, color) + C.DrawLine3D(startPos, endPos, color) +end + +---Draw a point in 3D space, actually a small line +---@param position raylib.Vector3 +---@param color raylib.Color +---@return nil +function M.DrawPoint3D(position, color) + C.DrawPoint3D(position, color) +end + +---Draw a circle in 3D world space +---@param center raylib.Vector3 +---@param radius number +---@param rotationAxis raylib.Vector3 +---@param rotationAngle number +---@param color raylib.Color +---@return nil +function M.DrawCircle3D(center, radius, rotationAxis, rotationAngle, color) + C.DrawCircle3D(center, radius, rotationAxis, rotationAngle, color) +end + +---Draw a color-filled triangle, counter-clockwise vertex order +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@param v3 raylib.Vector3 +---@param color raylib.Color +---@return nil +function M.DrawTriangle3D(v1, v2, v3, color) + C.DrawTriangle3D(v1, v2, v3, color) +end + +---Draw a triangle strip defined by points +---@param points raylib.Vector3[] +---@param pointCount integer +---@param color raylib.Color +---@return nil +function M.DrawTriangleStrip3D(points, pointCount, color) + local _a1 + if type(points) == "table" then _a1 = to_array("Vector3", points) + else _a1 = points end + C.DrawTriangleStrip3D(_a1, pointCount, color) +end + +---Draw cube +---@param position raylib.Vector3 +---@param width number +---@param height number +---@param length number +---@param color raylib.Color +---@return nil +function M.DrawCube(position, width, height, length, color) + C.DrawCube(position, width, height, length, color) +end + +---Draw cube (Vector version) +---@param position raylib.Vector3 +---@param size raylib.Vector3 +---@param color raylib.Color +---@return nil +function M.DrawCubeV(position, size, color) + C.DrawCubeV(position, size, color) +end + +---Draw cube wires +---@param position raylib.Vector3 +---@param width number +---@param height number +---@param length number +---@param color raylib.Color +---@return nil +function M.DrawCubeWires(position, width, height, length, color) + C.DrawCubeWires(position, width, height, length, color) +end + +---Draw cube wires (Vector version) +---@param position raylib.Vector3 +---@param size raylib.Vector3 +---@param color raylib.Color +---@return nil +function M.DrawCubeWiresV(position, size, color) + C.DrawCubeWiresV(position, size, color) +end + +---Draw sphere +---@param centerPos raylib.Vector3 +---@param radius number +---@param color raylib.Color +---@return nil +function M.DrawSphere(centerPos, radius, color) + C.DrawSphere(centerPos, radius, color) +end + +---Draw sphere with defined rings and slices +---@param centerPos raylib.Vector3 +---@param radius number +---@param rings integer +---@param slices integer +---@param color raylib.Color +---@return nil +function M.DrawSphereEx(centerPos, radius, rings, slices, color) + C.DrawSphereEx(centerPos, radius, rings, slices, color) +end + +---Draw sphere wires +---@param centerPos raylib.Vector3 +---@param radius number +---@param rings integer +---@param slices integer +---@param color raylib.Color +---@return nil +function M.DrawSphereWires(centerPos, radius, rings, slices, color) + C.DrawSphereWires(centerPos, radius, rings, slices, color) +end + +---Draw a cylinder/cone +---@param position raylib.Vector3 +---@param radiusTop number +---@param radiusBottom number +---@param height number +---@param sides integer +---@param color raylib.Color +---@return nil +function M.DrawCylinder(position, radiusTop, radiusBottom, height, sides, color) + C.DrawCylinder(position, radiusTop, radiusBottom, height, sides, color) +end + +---Draw a cylinder with base at startPos and top at endPos +---@param startPos raylib.Vector3 +---@param endPos raylib.Vector3 +---@param startRadius number +---@param endRadius number +---@param sides integer +---@param color raylib.Color +---@return nil +function M.DrawCylinderEx(startPos, endPos, startRadius, endRadius, sides, color) + C.DrawCylinderEx(startPos, endPos, startRadius, endRadius, sides, color) +end + +---Draw a cylinder/cone wires +---@param position raylib.Vector3 +---@param radiusTop number +---@param radiusBottom number +---@param height number +---@param sides integer +---@param color raylib.Color +---@return nil +function M.DrawCylinderWires(position, radiusTop, radiusBottom, height, sides, color) + C.DrawCylinderWires(position, radiusTop, radiusBottom, height, sides, color) +end + +---Draw a cylinder wires with base at startPos and top at endPos +---@param startPos raylib.Vector3 +---@param endPos raylib.Vector3 +---@param startRadius number +---@param endRadius number +---@param sides integer +---@param color raylib.Color +---@return nil +function M.DrawCylinderWiresEx(startPos, endPos, startRadius, endRadius, sides, color) + C.DrawCylinderWiresEx(startPos, endPos, startRadius, endRadius, sides, color) +end + +---Draw a capsule with the center of its sphere caps at startPos and endPos +---@param startPos raylib.Vector3 +---@param endPos raylib.Vector3 +---@param radius number +---@param rings integer +---@param slices integer +---@param color raylib.Color +---@return nil +function M.DrawCapsule(startPos, endPos, radius, rings, slices, color) + C.DrawCapsule(startPos, endPos, radius, rings, slices, color) +end + +---Draw capsule wireframe with the center of its sphere caps at startPos and endPos +---@param startPos raylib.Vector3 +---@param endPos raylib.Vector3 +---@param radius number +---@param rings integer +---@param slices integer +---@param color raylib.Color +---@return nil +function M.DrawCapsuleWires(startPos, endPos, radius, rings, slices, color) + C.DrawCapsuleWires(startPos, endPos, radius, rings, slices, color) +end + +---Draw a plane XZ +---@param centerPos raylib.Vector3 +---@param size raylib.Vector2 +---@param color raylib.Color +---@return nil +function M.DrawPlane(centerPos, size, color) + C.DrawPlane(centerPos, size, color) +end + +---Draw a ray line +---@param ray raylib.Ray +---@param color raylib.Color +---@return nil +function M.DrawRay(ray, color) + C.DrawRay(ray, color) +end + +---Draw a grid (centered at (0, 0, 0)) +---@param slices integer +---@param spacing number +---@return nil +function M.DrawGrid(slices, spacing) + C.DrawGrid(slices, spacing) +end + +---Load model from files (meshes and materials) +---@param fileName string +---@return raylib.Model +function M.LoadModel(fileName) + return C.LoadModel(fileName) +end + +---Load model from generated mesh (default material) +---@param mesh raylib.Mesh +---@return raylib.Model +function M.LoadModelFromMesh(mesh) + return C.LoadModelFromMesh(mesh) +end + +---Check if model is valid (loaded in GPU, VAO/VBOs) +---@param model raylib.Model +---@return boolean +function M.IsModelValid(model) + return C.IsModelValid(model) +end + +---Unload model (including meshes) from memory (RAM and/or VRAM) +---@param model raylib.Model +---@return nil +function M.UnloadModel(model) + C.UnloadModel(model) +end + +---Compute model bounding box limits (considers all meshes) +---@param model raylib.Model +---@return raylib.BoundingBox +function M.GetModelBoundingBox(model) + return C.GetModelBoundingBox(model) +end + +---Draw a model (with texture if set) +---@param model raylib.Model +---@param position raylib.Vector3 +---@param scale number +---@param tint raylib.Color +---@return nil +function M.DrawModel(model, position, scale, tint) + C.DrawModel(model, position, scale, tint) +end + +---Draw a model with custom transform +---@param model raylib.Model +---@param position raylib.Vector3 +---@param rotationAxis raylib.Vector3 +---@param rotationAngle number +---@param scale raylib.Vector3 +---@param tint raylib.Color +---@return nil +function M.DrawModelEx(model, position, rotationAxis, rotationAngle, scale, tint) + C.DrawModelEx(model, position, rotationAxis, rotationAngle, scale, tint) +end + +---Draw a model wires (with texture if set) +---@param model raylib.Model +---@param position raylib.Vector3 +---@param scale number +---@param tint raylib.Color +---@return nil +function M.DrawModelWires(model, position, scale, tint) + C.DrawModelWires(model, position, scale, tint) +end + +---Draw a model wires with custom transform +---@param model raylib.Model +---@param position raylib.Vector3 +---@param rotationAxis raylib.Vector3 +---@param rotationAngle number +---@param scale raylib.Vector3 +---@param tint raylib.Color +---@return nil +function M.DrawModelWiresEx(model, position, rotationAxis, rotationAngle, scale, tint) + C.DrawModelWiresEx(model, position, rotationAxis, rotationAngle, scale, tint) +end + +---Draw bounding box (wires) +---@param box raylib.BoundingBox +---@param color raylib.Color +---@return nil +function M.DrawBoundingBox(box, color) + C.DrawBoundingBox(box, color) +end + +---Draw a billboard texture +---@param camera raylib.Camera +---@param texture raylib.Texture2D +---@param position raylib.Vector3 +---@param scale number +---@param tint raylib.Color +---@return nil +function M.DrawBillboard(camera, texture, position, scale, tint) + C.DrawBillboard(camera, texture, position, scale, tint) +end + +---Draw a billboard texture defined by rectangle +---@param camera raylib.Camera +---@param texture raylib.Texture2D +---@param rec raylib.Rectangle +---@param position raylib.Vector3 +---@param size raylib.Vector2 +---@param tint raylib.Color +---@return nil +function M.DrawBillboardRec(camera, texture, rec, position, size, tint) + C.DrawBillboardRec(camera, texture, rec, position, size, tint) +end + +---Draw a billboard texture defined by source rectangle with scaling and rotation +---@param camera raylib.Camera +---@param texture raylib.Texture2D +---@param rec raylib.Rectangle +---@param position raylib.Vector3 +---@param up raylib.Vector3 +---@param size raylib.Vector2 +---@param origin raylib.Vector2 +---@param rotation number +---@param tint raylib.Color +---@return nil +function M.DrawBillboardPro(camera, texture, rec, position, up, size, origin, rotation, tint) + C.DrawBillboardPro(camera, texture, rec, position, up, size, origin, rotation, tint) +end + +---Upload mesh vertex data in GPU and provide VAO/VBO ids +---@param mesh raylib.Mesh +---@param dynamic boolean +---@return raylib.Mesh +function M.UploadMesh(mesh, dynamic) + local _o1 = ffi.new("Mesh[1]", mesh) + C.UploadMesh(_o1, dynamic) + return _o1[0] +end + +---Update mesh vertex data in GPU for a specific buffer index +---@param mesh raylib.Mesh +---@param index integer +---@param data ffi.cdata*|string +---@param dataSize integer +---@param offset integer +---@return nil +function M.UpdateMeshBuffer(mesh, index, data, dataSize, offset) + local _a3 + if type(data) == "string" then _a3 = ffi.cast("const void *", data) + else _a3 = data end + C.UpdateMeshBuffer(mesh, index, _a3, dataSize, offset) +end + +---Unload mesh data from CPU and GPU +---@param mesh raylib.Mesh +---@return nil +function M.UnloadMesh(mesh) + C.UnloadMesh(mesh) +end + +---Draw a 3d mesh with material and transform +---@param mesh raylib.Mesh +---@param material raylib.Material +---@param transform raylib.Matrix +---@return nil +function M.DrawMesh(mesh, material, transform) + C.DrawMesh(mesh, material, transform) +end + +---Draw multiple mesh instances with material and different transforms +---@param mesh raylib.Mesh +---@param material raylib.Material +---@param transforms raylib.Matrix[] +---@param instances integer +---@return nil +function M.DrawMeshInstanced(mesh, material, transforms, instances) + local _a3 + if type(transforms) == "table" then _a3 = to_array("Matrix", transforms) + else _a3 = transforms end + C.DrawMeshInstanced(mesh, material, _a3, instances) +end + +---Compute mesh bounding box limits +---@param mesh raylib.Mesh +---@return raylib.BoundingBox +function M.GetMeshBoundingBox(mesh) + return C.GetMeshBoundingBox(mesh) +end + +---Compute mesh tangents +---@param mesh raylib.Mesh +---@return raylib.Mesh +function M.GenMeshTangents(mesh) + local _o1 = ffi.new("Mesh[1]", mesh) + C.GenMeshTangents(_o1) + return _o1[0] +end + +---Export mesh data to file, returns true on success +---@param mesh raylib.Mesh +---@param fileName string +---@return boolean +function M.ExportMesh(mesh, fileName) + return C.ExportMesh(mesh, fileName) +end + +---Export mesh as code file (.h) defining multiple arrays of vertex attributes +---@param mesh raylib.Mesh +---@param fileName string +---@return boolean +function M.ExportMeshAsCode(mesh, fileName) + return C.ExportMeshAsCode(mesh, fileName) +end + +---Generate polygonal mesh +---@param sides integer +---@param radius number +---@return raylib.Mesh +function M.GenMeshPoly(sides, radius) + return C.GenMeshPoly(sides, radius) +end + +---Generate plane mesh (with subdivisions) +---@param width number +---@param length number +---@param resX integer +---@param resZ integer +---@return raylib.Mesh +function M.GenMeshPlane(width, length, resX, resZ) + return C.GenMeshPlane(width, length, resX, resZ) +end + +---Generate cuboid mesh +---@param width number +---@param height number +---@param length number +---@return raylib.Mesh +function M.GenMeshCube(width, height, length) + return C.GenMeshCube(width, height, length) +end + +---Generate sphere mesh (standard sphere) +---@param radius number +---@param rings integer +---@param slices integer +---@return raylib.Mesh +function M.GenMeshSphere(radius, rings, slices) + return C.GenMeshSphere(radius, rings, slices) +end + +---Generate half-sphere mesh (no bottom cap) +---@param radius number +---@param rings integer +---@param slices integer +---@return raylib.Mesh +function M.GenMeshHemiSphere(radius, rings, slices) + return C.GenMeshHemiSphere(radius, rings, slices) +end + +---Generate cylinder mesh +---@param radius number +---@param height number +---@param slices integer +---@return raylib.Mesh +function M.GenMeshCylinder(radius, height, slices) + return C.GenMeshCylinder(radius, height, slices) +end + +---Generate cone/pyramid mesh +---@param radius number +---@param height number +---@param slices integer +---@return raylib.Mesh +function M.GenMeshCone(radius, height, slices) + return C.GenMeshCone(radius, height, slices) +end + +---Generate torus mesh +---@param radius number +---@param size number +---@param radSeg integer +---@param sides integer +---@return raylib.Mesh +function M.GenMeshTorus(radius, size, radSeg, sides) + return C.GenMeshTorus(radius, size, radSeg, sides) +end + +---Generate trefoil knot mesh +---@param radius number +---@param size number +---@param radSeg integer +---@param sides integer +---@return raylib.Mesh +function M.GenMeshKnot(radius, size, radSeg, sides) + return C.GenMeshKnot(radius, size, radSeg, sides) +end + +---Generate heightmap mesh from image data +---@param heightmap raylib.Image +---@param size raylib.Vector3 +---@return raylib.Mesh +function M.GenMeshHeightmap(heightmap, size) + return C.GenMeshHeightmap(heightmap, size) +end + +---Generate cubes-based map mesh from image data +---@param cubicmap raylib.Image +---@param cubeSize raylib.Vector3 +---@return raylib.Mesh +function M.GenMeshCubicmap(cubicmap, cubeSize) + return C.GenMeshCubicmap(cubicmap, cubeSize) +end + +---Load materials from model file +---@param fileName string +---@param materialCount ffi.cdata* +---@return ffi.cdata* +function M.LoadMaterials(fileName, materialCount) + return C.LoadMaterials(fileName, materialCount) +end + +---Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) +---@return raylib.Material +function M.LoadMaterialDefault() + return C.LoadMaterialDefault() +end + +---Check if material is valid (shader assigned, map textures loaded in GPU) +---@param material raylib.Material +---@return boolean +function M.IsMaterialValid(material) + return C.IsMaterialValid(material) +end + +---Unload material from GPU memory (VRAM) +---@param material raylib.Material +---@return nil +function M.UnloadMaterial(material) + C.UnloadMaterial(material) +end + +---Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...) +---@param material raylib.Material +---@param mapType integer +---@param texture raylib.Texture2D +---@return raylib.Material +function M.SetMaterialTexture(material, mapType, texture) + local _o1 = ffi.new("Material[1]", material) + C.SetMaterialTexture(_o1, mapType, texture) + return _o1[0] +end + +---Set material for a mesh +---@param model raylib.Model +---@param meshId integer +---@param materialId integer +---@return raylib.Model +function M.SetModelMeshMaterial(model, meshId, materialId) + local _o1 = ffi.new("Model[1]", model) + C.SetModelMeshMaterial(_o1, meshId, materialId) + return _o1[0] +end + +---Load model animations from file +---@param fileName string +---@param animCount ffi.cdata* +---@return ffi.cdata* +function M.LoadModelAnimations(fileName, animCount) + return C.LoadModelAnimations(fileName, animCount) +end + +---Update model animation pose (vertex buffers and bone matrices) +---@param model raylib.Model +---@param anim raylib.ModelAnimation +---@param frame number +---@return nil +function M.UpdateModelAnimation(model, anim, frame) + C.UpdateModelAnimation(model, anim, frame) +end + +---Update model animation pose, blending two animations +---@param model raylib.Model +---@param animA raylib.ModelAnimation +---@param frameA number +---@param animB raylib.ModelAnimation +---@param frameB number +---@param blend number +---@return nil +function M.UpdateModelAnimationEx(model, animA, frameA, animB, frameB, blend) + C.UpdateModelAnimationEx(model, animA, frameA, animB, frameB, blend) +end + +---Unload animation array data +---@param animations ffi.cdata* +---@param animCount integer +---@return nil +function M.UnloadModelAnimations(animations, animCount) + C.UnloadModelAnimations(animations, animCount) +end + +---Check model animation skeleton match +---@param model raylib.Model +---@param anim raylib.ModelAnimation +---@return boolean +function M.IsModelAnimationValid(model, anim) + return C.IsModelAnimationValid(model, anim) +end + +---Check collision between two spheres +---@param center1 raylib.Vector3 +---@param radius1 number +---@param center2 raylib.Vector3 +---@param radius2 number +---@return boolean +function M.CheckCollisionSpheres(center1, radius1, center2, radius2) + return C.CheckCollisionSpheres(center1, radius1, center2, radius2) +end + +---Check collision between two bounding boxes +---@param box1 raylib.BoundingBox +---@param box2 raylib.BoundingBox +---@return boolean +function M.CheckCollisionBoxes(box1, box2) + return C.CheckCollisionBoxes(box1, box2) +end + +---Check collision between box and sphere +---@param box raylib.BoundingBox +---@param center raylib.Vector3 +---@param radius number +---@return boolean +function M.CheckCollisionBoxSphere(box, center, radius) + return C.CheckCollisionBoxSphere(box, center, radius) +end + +---Get collision info between ray and sphere +---@param ray raylib.Ray +---@param center raylib.Vector3 +---@param radius number +---@return raylib.RayCollision +function M.GetRayCollisionSphere(ray, center, radius) + return C.GetRayCollisionSphere(ray, center, radius) +end + +---Get collision info between ray and box +---@param ray raylib.Ray +---@param box raylib.BoundingBox +---@return raylib.RayCollision +function M.GetRayCollisionBox(ray, box) + return C.GetRayCollisionBox(ray, box) +end + +---Get collision info between ray and mesh +---@param ray raylib.Ray +---@param mesh raylib.Mesh +---@param transform raylib.Matrix +---@return raylib.RayCollision +function M.GetRayCollisionMesh(ray, mesh, transform) + return C.GetRayCollisionMesh(ray, mesh, transform) +end + +---Get collision info between ray and triangle +---@param ray raylib.Ray +---@param p1 raylib.Vector3 +---@param p2 raylib.Vector3 +---@param p3 raylib.Vector3 +---@return raylib.RayCollision +function M.GetRayCollisionTriangle(ray, p1, p2, p3) + return C.GetRayCollisionTriangle(ray, p1, p2, p3) +end + +---Get collision info between ray and quad +---@param ray raylib.Ray +---@param p1 raylib.Vector3 +---@param p2 raylib.Vector3 +---@param p3 raylib.Vector3 +---@param p4 raylib.Vector3 +---@return raylib.RayCollision +function M.GetRayCollisionQuad(ray, p1, p2, p3, p4) + return C.GetRayCollisionQuad(ray, p1, p2, p3, p4) +end + +---Initialize audio device and context +---@return nil +function M.InitAudioDevice() + C.InitAudioDevice() +end + +---Close the audio device and context +---@return nil +function M.CloseAudioDevice() + C.CloseAudioDevice() +end + +---Check if audio device has been initialized successfully +---@return boolean +function M.IsAudioDeviceReady() + return C.IsAudioDeviceReady() +end + +---Set master volume (listener) +---@param volume number +---@return nil +function M.SetMasterVolume(volume) + C.SetMasterVolume(volume) +end + +---Get master volume (listener) +---@return number +function M.GetMasterVolume() + return C.GetMasterVolume() +end + +---Load wave data from file +---@param fileName string +---@return raylib.Wave +function M.LoadWave(fileName) + return C.LoadWave(fileName) +end + +---Load wave from memory buffer, fileType refers to extension: i.e. '.wav' +---@param fileType string +---@param fileData string|integer[] +---@param dataSize integer +---@return raylib.Wave +function M.LoadWaveFromMemory(fileType, fileData, dataSize) + local _a2 + if type(fileData) == "string" then _a2 = ffi.cast("const unsigned char *", fileData) + elseif type(fileData) == "table" then _a2 = to_array("unsigned char", fileData) + else _a2 = fileData end + return C.LoadWaveFromMemory(fileType, _a2, dataSize) +end + +---Check if wave data is valid (data loaded and parameters) +---@param wave raylib.Wave +---@return boolean +function M.IsWaveValid(wave) + return C.IsWaveValid(wave) +end + +---Load sound from file +---@param fileName string +---@return raylib.Sound +function M.LoadSound(fileName) + return C.LoadSound(fileName) +end + +---Load sound from wave data +---@param wave raylib.Wave +---@return raylib.Sound +function M.LoadSoundFromWave(wave) + return C.LoadSoundFromWave(wave) +end + +---Load sound alias, new sound that shares the same sample data as the source sound, does not own the sound data +---@param source raylib.Sound +---@return raylib.Sound +function M.LoadSoundAlias(source) + return C.LoadSoundAlias(source) +end + +---Check if sound is valid (data loaded and buffers initialized) +---@param sound raylib.Sound +---@return boolean +function M.IsSoundValid(sound) + return C.IsSoundValid(sound) +end + +---Update sound buffer with new data (default data format: 32 bit float, stereo) +---@param sound raylib.Sound +---@param data ffi.cdata*|string +---@param frameCount integer +---@return nil +function M.UpdateSound(sound, data, frameCount) + local _a2 + if type(data) == "string" then _a2 = ffi.cast("const void *", data) + else _a2 = data end + C.UpdateSound(sound, _a2, frameCount) +end + +---Unload wave data +---@param wave raylib.Wave +---@return nil +function M.UnloadWave(wave) + C.UnloadWave(wave) +end + +---Unload sound +---@param sound raylib.Sound +---@return nil +function M.UnloadSound(sound) + C.UnloadSound(sound) +end + +---Unload sound alias (does not deallocate sample data) +---@param alias raylib.Sound +---@return nil +function M.UnloadSoundAlias(alias) + C.UnloadSoundAlias(alias) +end + +---Export wave data to file, returns true on success +---@param wave raylib.Wave +---@param fileName string +---@return boolean +function M.ExportWave(wave, fileName) + return C.ExportWave(wave, fileName) +end + +---Export wave sample data to code (.h), returns true on success +---@param wave raylib.Wave +---@param fileName string +---@return boolean +function M.ExportWaveAsCode(wave, fileName) + return C.ExportWaveAsCode(wave, fileName) +end + +---Play a sound +---@param sound raylib.Sound +---@return nil +function M.PlaySound(sound) + C.PlaySound(sound) +end + +---Stop playing a sound +---@param sound raylib.Sound +---@return nil +function M.StopSound(sound) + C.StopSound(sound) +end + +---Pause a sound +---@param sound raylib.Sound +---@return nil +function M.PauseSound(sound) + C.PauseSound(sound) +end + +---Resume a paused sound +---@param sound raylib.Sound +---@return nil +function M.ResumeSound(sound) + C.ResumeSound(sound) +end + +---Check if sound is currently playing +---@param sound raylib.Sound +---@return boolean +function M.IsSoundPlaying(sound) + return C.IsSoundPlaying(sound) +end + +---Set volume for a sound (1.0 is max level) +---@param sound raylib.Sound +---@param volume number +---@return nil +function M.SetSoundVolume(sound, volume) + C.SetSoundVolume(sound, volume) +end + +---Set pitch for a sound (1.0 is base level) +---@param sound raylib.Sound +---@param pitch number +---@return nil +function M.SetSoundPitch(sound, pitch) + C.SetSoundPitch(sound, pitch) +end + +---Set pan for a sound (-1.0 left, 0.0 center, 1.0 right) +---@param sound raylib.Sound +---@param pan number +---@return nil +function M.SetSoundPan(sound, pan) + C.SetSoundPan(sound, pan) +end + +---Copy a wave to a new wave +---@param wave raylib.Wave +---@return raylib.Wave +function M.WaveCopy(wave) + return C.WaveCopy(wave) +end + +---Crop a wave to defined frames range +---@param wave raylib.Wave +---@param initFrame integer +---@param finalFrame integer +---@return raylib.Wave +function M.WaveCrop(wave, initFrame, finalFrame) + local _o1 = ffi.new("Wave[1]", wave) + C.WaveCrop(_o1, initFrame, finalFrame) + return _o1[0] +end + +---Convert wave data to desired format +---@param wave raylib.Wave +---@param sampleRate integer +---@param sampleSize integer +---@param channels integer +---@return raylib.Wave +function M.WaveFormat(wave, sampleRate, sampleSize, channels) + local _o1 = ffi.new("Wave[1]", wave) + C.WaveFormat(_o1, sampleRate, sampleSize, channels) + return _o1[0] +end + +---Load samples data from wave as a 32bit float data array +---@param wave raylib.Wave +---@return ffi.cdata* +function M.LoadWaveSamples(wave) + return C.LoadWaveSamples(wave) +end + +---Unload samples data loaded with LoadWaveSamples() +---@param samples ffi.cdata* +---@return nil +function M.UnloadWaveSamples(samples) + C.UnloadWaveSamples(samples) +end + +---Load music stream from file +---@param fileName string +---@return raylib.Music +function M.LoadMusicStream(fileName) + return C.LoadMusicStream(fileName) +end + +---Load music stream from data +---@param fileType string +---@param data string|integer[] +---@param dataSize integer +---@return raylib.Music +function M.LoadMusicStreamFromMemory(fileType, data, dataSize) + local _a2 + if type(data) == "string" then _a2 = ffi.cast("const unsigned char *", data) + elseif type(data) == "table" then _a2 = to_array("unsigned char", data) + else _a2 = data end + return C.LoadMusicStreamFromMemory(fileType, _a2, dataSize) +end + +---Check if music stream is valid (context and buffers initialized) +---@param music raylib.Music +---@return boolean +function M.IsMusicValid(music) + return C.IsMusicValid(music) +end + +---Unload music stream +---@param music raylib.Music +---@return nil +function M.UnloadMusicStream(music) + C.UnloadMusicStream(music) +end + +---Start music playing +---@param music raylib.Music +---@return nil +function M.PlayMusicStream(music) + C.PlayMusicStream(music) +end + +---Check if music is playing +---@param music raylib.Music +---@return boolean +function M.IsMusicStreamPlaying(music) + return C.IsMusicStreamPlaying(music) +end + +---Update buffers for music streaming +---@param music raylib.Music +---@return nil +function M.UpdateMusicStream(music) + C.UpdateMusicStream(music) +end + +---Stop music playing +---@param music raylib.Music +---@return nil +function M.StopMusicStream(music) + C.StopMusicStream(music) +end + +---Pause music playing +---@param music raylib.Music +---@return nil +function M.PauseMusicStream(music) + C.PauseMusicStream(music) +end + +---Resume playing paused music +---@param music raylib.Music +---@return nil +function M.ResumeMusicStream(music) + C.ResumeMusicStream(music) +end + +---Seek music to a position (in seconds) +---@param music raylib.Music +---@param position number +---@return nil +function M.SeekMusicStream(music, position) + C.SeekMusicStream(music, position) +end + +---Set volume for music (1.0 is max level) +---@param music raylib.Music +---@param volume number +---@return nil +function M.SetMusicVolume(music, volume) + C.SetMusicVolume(music, volume) +end + +---Set pitch for music (1.0 is base level) +---@param music raylib.Music +---@param pitch number +---@return nil +function M.SetMusicPitch(music, pitch) + C.SetMusicPitch(music, pitch) +end + +---Set pan for music (-1.0 left, 0.0 center, 1.0 right) +---@param music raylib.Music +---@param pan number +---@return nil +function M.SetMusicPan(music, pan) + C.SetMusicPan(music, pan) +end + +---Get music time length (in seconds) +---@param music raylib.Music +---@return number +function M.GetMusicTimeLength(music) + return C.GetMusicTimeLength(music) +end + +---Get current music time played (in seconds) +---@param music raylib.Music +---@return number +function M.GetMusicTimePlayed(music) + return C.GetMusicTimePlayed(music) +end + +---Load audio stream (to stream raw audio pcm data) +---@param sampleRate integer +---@param sampleSize integer +---@param channels integer +---@return raylib.AudioStream +function M.LoadAudioStream(sampleRate, sampleSize, channels) + return C.LoadAudioStream(sampleRate, sampleSize, channels) +end + +---Check if an audio stream is valid (buffers initialized) +---@param stream raylib.AudioStream +---@return boolean +function M.IsAudioStreamValid(stream) + return C.IsAudioStreamValid(stream) +end + +---Unload audio stream and free memory +---@param stream raylib.AudioStream +---@return nil +function M.UnloadAudioStream(stream) + C.UnloadAudioStream(stream) +end + +---Update audio stream buffers with data +---@param stream raylib.AudioStream +---@param data ffi.cdata*|string +---@param frameCount integer +---@return nil +function M.UpdateAudioStream(stream, data, frameCount) + local _a2 + if type(data) == "string" then _a2 = ffi.cast("const void *", data) + else _a2 = data end + C.UpdateAudioStream(stream, _a2, frameCount) +end + +---Check if any audio stream buffers requires refill +---@param stream raylib.AudioStream +---@return boolean +function M.IsAudioStreamProcessed(stream) + return C.IsAudioStreamProcessed(stream) +end + +---Play audio stream +---@param stream raylib.AudioStream +---@return nil +function M.PlayAudioStream(stream) + C.PlayAudioStream(stream) +end + +---Pause audio stream +---@param stream raylib.AudioStream +---@return nil +function M.PauseAudioStream(stream) + C.PauseAudioStream(stream) +end + +---Resume audio stream +---@param stream raylib.AudioStream +---@return nil +function M.ResumeAudioStream(stream) + C.ResumeAudioStream(stream) +end + +---Check if audio stream is playing +---@param stream raylib.AudioStream +---@return boolean +function M.IsAudioStreamPlaying(stream) + return C.IsAudioStreamPlaying(stream) +end + +---Stop audio stream +---@param stream raylib.AudioStream +---@return nil +function M.StopAudioStream(stream) + C.StopAudioStream(stream) +end + +---Set volume for audio stream (1.0 is max level) +---@param stream raylib.AudioStream +---@param volume number +---@return nil +function M.SetAudioStreamVolume(stream, volume) + C.SetAudioStreamVolume(stream, volume) +end + +---Set pitch for audio stream (1.0 is base level) +---@param stream raylib.AudioStream +---@param pitch number +---@return nil +function M.SetAudioStreamPitch(stream, pitch) + C.SetAudioStreamPitch(stream, pitch) +end + +---Set pan for audio stream (-1.0 left, 0.0 center, 1.0 right) +---@param stream raylib.AudioStream +---@param pan number +---@return nil +function M.SetAudioStreamPan(stream, pan) + C.SetAudioStreamPan(stream, pan) +end + +---Default size for new audio streams +---@param size integer +---@return nil +function M.SetAudioStreamBufferSizeDefault(size) + C.SetAudioStreamBufferSizeDefault(size) +end + +---Audio thread callback to request new data +---@param stream raylib.AudioStream +---@param callback raylib.AudioCallback +---@return nil +function M.SetAudioStreamCallback(stream, callback) + local _cb2 = pin("AudioCallback", callback) + C.SetAudioStreamCallback(stream, _cb2) +end + +---Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo) +---@param stream raylib.AudioStream +---@param processor raylib.AudioCallback +---@return nil +function M.AttachAudioStreamProcessor(stream, processor) + local _cb2 = pin("AudioCallback", processor) + C.AttachAudioStreamProcessor(stream, _cb2) +end + +---Detach audio stream processor from stream +---@param stream raylib.AudioStream +---@param processor raylib.AudioCallback +---@return nil +function M.DetachAudioStreamProcessor(stream, processor) + local _cb2 = pin("AudioCallback", processor) + C.DetachAudioStreamProcessor(stream, _cb2) +end + +---Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo) +---@param processor raylib.AudioCallback +---@return nil +function M.AttachAudioMixedProcessor(processor) + local _cb1 = pin("AudioCallback", processor) + C.AttachAudioMixedProcessor(_cb1) +end + +---Detach audio stream processor from the entire audio pipeline +---@param processor raylib.AudioCallback +---@return nil +function M.DetachAudioMixedProcessor(processor) + local _cb1 = pin("AudioCallback", processor) + C.DetachAudioMixedProcessor(_cb1) +end + +---Choose the current matrix to be transformed +---@param mode integer +---@return nil +function M.rlMatrixMode(mode) + C.rlMatrixMode(mode) +end + +---Push the current matrix to stack +---@return nil +function M.rlPushMatrix() + C.rlPushMatrix() +end + +---Pop latest inserted matrix from stack +---@return nil +function M.rlPopMatrix() + C.rlPopMatrix() +end + +---Reset current matrix to identity matrix +---@return nil +function M.rlLoadIdentity() + C.rlLoadIdentity() +end + +---Multiply the current matrix by a translation matrix +---@param x number +---@param y number +---@param z number +---@return nil +function M.rlTranslatef(x, y, z) + C.rlTranslatef(x, y, z) +end + +---Multiply the current matrix by a rotation matrix +---@param angle number +---@param x number +---@param y number +---@param z number +---@return nil +function M.rlRotatef(angle, x, y, z) + C.rlRotatef(angle, x, y, z) +end + +---Multiply the current matrix by a scaling matrix +---@param x number +---@param y number +---@param z number +---@return nil +function M.rlScalef(x, y, z) + C.rlScalef(x, y, z) +end + +---Multiply the current matrix by another matrix +---@param matf number[] +---@return nil +function M.rlMultMatrixf(matf) + local _a1 + if type(matf) == "table" then _a1 = to_array("float", matf) + else _a1 = matf end + C.rlMultMatrixf(_a1) +end + +---@param left number +---@param right number +---@param bottom number +---@param top number +---@param znear number +---@param zfar number +---@return nil +function M.rlFrustum(left, right, bottom, top, znear, zfar) + C.rlFrustum(left, right, bottom, top, znear, zfar) +end + +---@param left number +---@param right number +---@param bottom number +---@param top number +---@param znear number +---@param zfar number +---@return nil +function M.rlOrtho(left, right, bottom, top, znear, zfar) + C.rlOrtho(left, right, bottom, top, znear, zfar) +end + +---Set the viewport area +---@param x integer +---@param y integer +---@param width integer +---@param height integer +---@return nil +function M.rlViewport(x, y, width, height) + C.rlViewport(x, y, width, height) +end + +---Set clip planes distances +---@param nearPlane number +---@param farPlane number +---@return nil +function M.rlSetClipPlanes(nearPlane, farPlane) + C.rlSetClipPlanes(nearPlane, farPlane) +end + +---Get cull plane distance near +---@return number +function M.rlGetCullDistanceNear() + return C.rlGetCullDistanceNear() +end + +---Get cull plane distance far +---@return number +function M.rlGetCullDistanceFar() + return C.rlGetCullDistanceFar() +end + +---Initialize drawing mode (how to organize vertex) +---@param mode integer +---@return nil +function M.rlBegin(mode) + C.rlBegin(mode) +end + +---Finish vertex providing +---@return nil +function M.rlEnd() + C.rlEnd() +end + +---Define one vertex (position) - 2 int +---@param x integer +---@param y integer +---@return nil +function M.rlVertex2i(x, y) + C.rlVertex2i(x, y) +end + +---Define one vertex (position) - 2 float +---@param x number +---@param y number +---@return nil +function M.rlVertex2f(x, y) + C.rlVertex2f(x, y) +end + +---Define one vertex (position) - 3 float +---@param x number +---@param y number +---@param z number +---@return nil +function M.rlVertex3f(x, y, z) + C.rlVertex3f(x, y, z) +end + +---Define one vertex (texture coordinate) - 2 float +---@param x number +---@param y number +---@return nil +function M.rlTexCoord2f(x, y) + C.rlTexCoord2f(x, y) +end + +---Define one vertex (normal) - 3 float +---@param x number +---@param y number +---@param z number +---@return nil +function M.rlNormal3f(x, y, z) + C.rlNormal3f(x, y, z) +end + +---Define one vertex (color) - 4 byte +---@param r integer +---@param g integer +---@param b integer +---@param a integer +---@return nil +function M.rlColor4ub(r, g, b, a) + C.rlColor4ub(r, g, b, a) +end + +---Define one vertex (color) - 3 float +---@param x number +---@param y number +---@param z number +---@return nil +function M.rlColor3f(x, y, z) + C.rlColor3f(x, y, z) +end + +---Define one vertex (color) - 4 float +---@param x number +---@param y number +---@param z number +---@param w number +---@return nil +function M.rlColor4f(x, y, z, w) + C.rlColor4f(x, y, z, w) +end + +---Enable vertex array (VAO, if supported) +---@param vaoId integer +---@return boolean +function M.rlEnableVertexArray(vaoId) + return C.rlEnableVertexArray(vaoId) +end + +---Disable vertex array (VAO, if supported) +---@return nil +function M.rlDisableVertexArray() + C.rlDisableVertexArray() +end + +---Enable vertex buffer (VBO) +---@param id integer +---@return nil +function M.rlEnableVertexBuffer(id) + C.rlEnableVertexBuffer(id) +end + +---Disable vertex buffer (VBO) +---@return nil +function M.rlDisableVertexBuffer() + C.rlDisableVertexBuffer() +end + +---Enable vertex buffer element (VBO element) +---@param id integer +---@return nil +function M.rlEnableVertexBufferElement(id) + C.rlEnableVertexBufferElement(id) +end + +---Disable vertex buffer element (VBO element) +---@return nil +function M.rlDisableVertexBufferElement() + C.rlDisableVertexBufferElement() +end + +---Enable vertex attribute index +---@param index integer +---@return nil +function M.rlEnableVertexAttribute(index) + C.rlEnableVertexAttribute(index) +end + +---Disable vertex attribute index +---@param index integer +---@return nil +function M.rlDisableVertexAttribute(index) + C.rlDisableVertexAttribute(index) +end + +---Enable attribute state pointer +---@param vertexAttribType integer +---@param buffer ffi.cdata*|string +---@return nil +function M.rlEnableStatePointer(vertexAttribType, buffer) + local _a2 + if type(buffer) == "string" then _a2 = ffi.cast("const void *", buffer) + else _a2 = buffer end + C.rlEnableStatePointer(vertexAttribType, _a2) +end + +---Disable attribute state pointer +---@param vertexAttribType integer +---@return nil +function M.rlDisableStatePointer(vertexAttribType) + C.rlDisableStatePointer(vertexAttribType) +end + +---Select and active a texture slot +---@param slot integer +---@return nil +function M.rlActiveTextureSlot(slot) + C.rlActiveTextureSlot(slot) +end + +---Enable texture +---@param id integer +---@return nil +function M.rlEnableTexture(id) + C.rlEnableTexture(id) +end + +---Disable texture +---@return nil +function M.rlDisableTexture() + C.rlDisableTexture() +end + +---Enable texture cubemap +---@param id integer +---@return nil +function M.rlEnableTextureCubemap(id) + C.rlEnableTextureCubemap(id) +end + +---Disable texture cubemap +---@return nil +function M.rlDisableTextureCubemap() + C.rlDisableTextureCubemap() +end + +---Set texture parameters (filter, wrap) +---@param id integer +---@param param integer +---@param value integer +---@return nil +function M.rlTextureParameters(id, param, value) + C.rlTextureParameters(id, param, value) +end + +---Set cubemap parameters (filter, wrap) +---@param id integer +---@param param integer +---@param value integer +---@return nil +function M.rlCubemapParameters(id, param, value) + C.rlCubemapParameters(id, param, value) +end + +---Enable shader program +---@param id integer +---@return nil +function M.rlEnableShader(id) + C.rlEnableShader(id) +end + +---Disable shader program +---@return nil +function M.rlDisableShader() + C.rlDisableShader() +end + +---Enable render texture (fbo) +---@param id integer +---@return nil +function M.rlEnableFramebuffer(id) + C.rlEnableFramebuffer(id) +end + +---Disable render texture (fbo), return to default framebuffer +---@return nil +function M.rlDisableFramebuffer() + C.rlDisableFramebuffer() +end + +---Get the currently active render texture (fbo), 0 for default framebuffer +---@return integer +function M.rlGetActiveFramebuffer() + return C.rlGetActiveFramebuffer() +end + +---Activate multiple draw color buffers +---@param count integer +---@return nil +function M.rlActiveDrawBuffers(count) + C.rlActiveDrawBuffers(count) +end + +---Blit active framebuffer to main framebuffer +---@param srcX integer +---@param srcY integer +---@param srcWidth integer +---@param srcHeight integer +---@param dstX integer +---@param dstY integer +---@param dstWidth integer +---@param dstHeight integer +---@param bufferMask integer +---@return nil +function M.rlBlitFramebuffer(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask) + C.rlBlitFramebuffer(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask) +end + +---Bind framebuffer (FBO) +---@param target integer +---@param framebuffer integer +---@return nil +function M.rlBindFramebuffer(target, framebuffer) + C.rlBindFramebuffer(target, framebuffer) +end + +---Enable color blending +---@return nil +function M.rlEnableColorBlend() + C.rlEnableColorBlend() +end + +---Disable color blending +---@return nil +function M.rlDisableColorBlend() + C.rlDisableColorBlend() +end + +---Enable depth test +---@return nil +function M.rlEnableDepthTest() + C.rlEnableDepthTest() +end + +---Disable depth test +---@return nil +function M.rlDisableDepthTest() + C.rlDisableDepthTest() +end + +---Enable depth write +---@return nil +function M.rlEnableDepthMask() + C.rlEnableDepthMask() +end + +---Disable depth write +---@return nil +function M.rlDisableDepthMask() + C.rlDisableDepthMask() +end + +---Enable backface culling +---@return nil +function M.rlEnableBackfaceCulling() + C.rlEnableBackfaceCulling() +end + +---Disable backface culling +---@return nil +function M.rlDisableBackfaceCulling() + C.rlDisableBackfaceCulling() +end + +---Color mask control +---@param r boolean +---@param g boolean +---@param b boolean +---@param a boolean +---@return nil +function M.rlColorMask(r, g, b, a) + C.rlColorMask(r, g, b, a) +end + +---Set face culling mode +---@param mode integer +---@return nil +function M.rlSetCullFace(mode) + C.rlSetCullFace(mode) +end + +---Enable scissor test +---@return nil +function M.rlEnableScissorTest() + C.rlEnableScissorTest() +end + +---Disable scissor test +---@return nil +function M.rlDisableScissorTest() + C.rlDisableScissorTest() +end + +---Scissor test +---@param x integer +---@param y integer +---@param width integer +---@param height integer +---@return nil +function M.rlScissor(x, y, width, height) + C.rlScissor(x, y, width, height) +end + +---Enable point mode +---@return nil +function M.rlEnablePointMode() + C.rlEnablePointMode() +end + +---Disable point mode +---@return nil +function M.rlDisablePointMode() + C.rlDisablePointMode() +end + +---Set the point drawing size +---@param size number +---@return nil +function M.rlSetPointSize(size) + C.rlSetPointSize(size) +end + +---Get the point drawing size +---@return number +function M.rlGetPointSize() + return C.rlGetPointSize() +end + +---Enable wire mode +---@return nil +function M.rlEnableWireMode() + C.rlEnableWireMode() +end + +---Disable wire mode +---@return nil +function M.rlDisableWireMode() + C.rlDisableWireMode() +end + +---Set the line drawing width +---@param width number +---@return nil +function M.rlSetLineWidth(width) + C.rlSetLineWidth(width) +end + +---Get the line drawing width +---@return number +function M.rlGetLineWidth() + return C.rlGetLineWidth() +end + +---Enable line aliasing +---@return nil +function M.rlEnableSmoothLines() + C.rlEnableSmoothLines() +end + +---Disable line aliasing +---@return nil +function M.rlDisableSmoothLines() + C.rlDisableSmoothLines() +end + +---Enable stereo rendering +---@return nil +function M.rlEnableStereoRender() + C.rlEnableStereoRender() +end + +---Disable stereo rendering +---@return nil +function M.rlDisableStereoRender() + C.rlDisableStereoRender() +end + +---Check if stereo render is enabled +---@return boolean +function M.rlIsStereoRenderEnabled() + return C.rlIsStereoRenderEnabled() +end + +---Clear color buffer with color +---@param r integer +---@param g integer +---@param b integer +---@param a integer +---@return nil +function M.rlClearColor(r, g, b, a) + C.rlClearColor(r, g, b, a) +end + +---Clear used screen buffers (color and depth) +---@return nil +function M.rlClearScreenBuffers() + C.rlClearScreenBuffers() +end + +---Check and log OpenGL error codes +---@return nil +function M.rlCheckErrors() + C.rlCheckErrors() +end + +---Set blending mode +---@param mode integer +---@return nil +function M.rlSetBlendMode(mode) + C.rlSetBlendMode(mode) +end + +---Set blending mode factor and equation (using OpenGL factors) +---@param glSrcFactor integer +---@param glDstFactor integer +---@param glEquation integer +---@return nil +function M.rlSetBlendFactors(glSrcFactor, glDstFactor, glEquation) + C.rlSetBlendFactors(glSrcFactor, glDstFactor, glEquation) +end + +---Set blending mode factors and equations separately (using OpenGL factors) +---@param glSrcRGB integer +---@param glDstRGB integer +---@param glSrcAlpha integer +---@param glDstAlpha integer +---@param glEqRGB integer +---@param glEqAlpha integer +---@return nil +function M.rlSetBlendFactorsSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha) + C.rlSetBlendFactorsSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha) +end + +---Initialize rlgl (buffers, shaders, textures, states) +---@param width integer +---@param height integer +---@return nil +function M.rlglInit(width, height) + C.rlglInit(width, height) +end + +---De-initialize rlgl (buffers, shaders, textures) +---@return nil +function M.rlglClose() + C.rlglClose() +end + +---Load OpenGL extensions (loader function required) +---@param loader ffi.cdata*|string +---@return nil +function M.rlLoadExtensions(loader) + local _a1 + if type(loader) == "string" then _a1 = ffi.cast("const void *", loader) + else _a1 = loader end + C.rlLoadExtensions(_a1) +end + +---Get OpenGL procedure address +---@param procName string +---@return ffi.cdata* +function M.rlGetProcAddress(procName) + return C.rlGetProcAddress(procName) +end + +---Get current OpenGL version +---@return integer +function M.rlGetVersion() + return C.rlGetVersion() +end + +---Set current framebuffer width +---@param width integer +---@return nil +function M.rlSetFramebufferWidth(width) + C.rlSetFramebufferWidth(width) +end + +---Get default framebuffer width +---@return integer +function M.rlGetFramebufferWidth() + return C.rlGetFramebufferWidth() +end + +---Set current framebuffer height +---@param height integer +---@return nil +function M.rlSetFramebufferHeight(height) + C.rlSetFramebufferHeight(height) +end + +---Get default framebuffer height +---@return integer +function M.rlGetFramebufferHeight() + return C.rlGetFramebufferHeight() +end + +---Get default texture id +---@return integer +function M.rlGetTextureIdDefault() + return C.rlGetTextureIdDefault() +end + +---Get default shader id +---@return integer +function M.rlGetShaderIdDefault() + return C.rlGetShaderIdDefault() +end + +---Get default shader locations +---@return ffi.cdata* +function M.rlGetShaderLocsDefault() + return C.rlGetShaderLocsDefault() +end + +---Load a render batch system +---@param numBuffers integer +---@param bufferElements integer +---@return raylib.rlRenderBatch +function M.rlLoadRenderBatch(numBuffers, bufferElements) + return C.rlLoadRenderBatch(numBuffers, bufferElements) +end + +---Unload render batch system +---@param batch raylib.rlRenderBatch +---@return nil +function M.rlUnloadRenderBatch(batch) + C.rlUnloadRenderBatch(batch) +end + +---Draw render batch data (Update->Draw->Reset) +---@param batch ffi.cdata* +---@return nil +function M.rlDrawRenderBatch(batch) + C.rlDrawRenderBatch(batch) +end + +---Set the active render batch for rlgl (NULL for default internal) +---@param batch ffi.cdata* +---@return nil +function M.rlSetRenderBatchActive(batch) + C.rlSetRenderBatchActive(batch) +end + +---Update and draw internal render batch +---@return nil +function M.rlDrawRenderBatchActive() + C.rlDrawRenderBatchActive() +end + +---Check internal buffer overflow for a given number of vertex +---@param vCount integer +---@return boolean +function M.rlCheckRenderBatchLimit(vCount) + return C.rlCheckRenderBatchLimit(vCount) +end + +---Set current texture for render batch and check buffers limits +---@param id integer +---@return nil +function M.rlSetTexture(id) + C.rlSetTexture(id) +end + +---Load vertex array (vao) if supported +---@return integer +function M.rlLoadVertexArray() + return C.rlLoadVertexArray() +end + +---Load a vertex buffer object +---@param buffer ffi.cdata*|string +---@param size integer +---@param dynamic boolean +---@return integer +function M.rlLoadVertexBuffer(buffer, size, dynamic) + local _a1 + if type(buffer) == "string" then _a1 = ffi.cast("const void *", buffer) + else _a1 = buffer end + return C.rlLoadVertexBuffer(_a1, size, dynamic) +end + +---Load vertex buffer elements object +---@param buffer ffi.cdata*|string +---@param size integer +---@param dynamic boolean +---@return integer +function M.rlLoadVertexBufferElement(buffer, size, dynamic) + local _a1 + if type(buffer) == "string" then _a1 = ffi.cast("const void *", buffer) + else _a1 = buffer end + return C.rlLoadVertexBufferElement(_a1, size, dynamic) +end + +---Update vertex buffer object data on GPU buffer +---@param bufferId integer +---@param data ffi.cdata*|string +---@param dataSize integer +---@param offset integer +---@return nil +function M.rlUpdateVertexBuffer(bufferId, data, dataSize, offset) + local _a2 + if type(data) == "string" then _a2 = ffi.cast("const void *", data) + else _a2 = data end + C.rlUpdateVertexBuffer(bufferId, _a2, dataSize, offset) +end + +---Update vertex buffer elements data on GPU buffer +---@param id integer +---@param data ffi.cdata*|string +---@param dataSize integer +---@param offset integer +---@return nil +function M.rlUpdateVertexBufferElements(id, data, dataSize, offset) + local _a2 + if type(data) == "string" then _a2 = ffi.cast("const void *", data) + else _a2 = data end + C.rlUpdateVertexBufferElements(id, _a2, dataSize, offset) +end + +---Unload vertex array (vao) +---@param vaoId integer +---@return nil +function M.rlUnloadVertexArray(vaoId) + C.rlUnloadVertexArray(vaoId) +end + +---Unload vertex buffer object +---@param vboId integer +---@return nil +function M.rlUnloadVertexBuffer(vboId) + C.rlUnloadVertexBuffer(vboId) +end + +---Set vertex attribute data configuration +---@param index integer +---@param compSize integer +---@param type integer +---@param normalized boolean +---@param stride integer +---@param offset integer +---@return nil +function M.rlSetVertexAttribute(index, compSize, type, normalized, stride, offset) + C.rlSetVertexAttribute(index, compSize, type, normalized, stride, offset) +end + +---Set vertex attribute data divisor +---@param index integer +---@param divisor integer +---@return nil +function M.rlSetVertexAttributeDivisor(index, divisor) + C.rlSetVertexAttributeDivisor(index, divisor) +end + +---Set vertex attribute default value, when attribute to provided +---@param locIndex integer +---@param value ffi.cdata*|string +---@param attribType integer +---@param count integer +---@return nil +function M.rlSetVertexAttributeDefault(locIndex, value, attribType, count) + local _a2 + if type(value) == "string" then _a2 = ffi.cast("const void *", value) + else _a2 = value end + C.rlSetVertexAttributeDefault(locIndex, _a2, attribType, count) +end + +---Draw vertex array (currently active vao) +---@param offset integer +---@param count integer +---@return nil +function M.rlDrawVertexArray(offset, count) + C.rlDrawVertexArray(offset, count) +end + +---Draw vertex array elements +---@param offset integer +---@param count integer +---@param buffer ffi.cdata*|string +---@return nil +function M.rlDrawVertexArrayElements(offset, count, buffer) + local _a3 + if type(buffer) == "string" then _a3 = ffi.cast("const void *", buffer) + else _a3 = buffer end + C.rlDrawVertexArrayElements(offset, count, _a3) +end + +---Draw vertex array (currently active vao) with instancing +---@param offset integer +---@param count integer +---@param instances integer +---@return nil +function M.rlDrawVertexArrayInstanced(offset, count, instances) + C.rlDrawVertexArrayInstanced(offset, count, instances) +end + +---Draw vertex array elements with instancing +---@param offset integer +---@param count integer +---@param buffer ffi.cdata*|string +---@param instances integer +---@return nil +function M.rlDrawVertexArrayElementsInstanced(offset, count, buffer, instances) + local _a3 + if type(buffer) == "string" then _a3 = ffi.cast("const void *", buffer) + else _a3 = buffer end + C.rlDrawVertexArrayElementsInstanced(offset, count, _a3, instances) +end + +---Load texture data +---@param data ffi.cdata*|string +---@param width integer +---@param height integer +---@param format integer +---@param mipmapCount integer +---@return integer +function M.rlLoadTexture(data, width, height, format, mipmapCount) + local _a1 + if type(data) == "string" then _a1 = ffi.cast("const void *", data) + else _a1 = data end + return C.rlLoadTexture(_a1, width, height, format, mipmapCount) +end + +---Load depth texture/renderbuffer (to be attached to fbo) +---@param width integer +---@param height integer +---@param useRenderBuffer boolean +---@return integer +function M.rlLoadTextureDepth(width, height, useRenderBuffer) + return C.rlLoadTextureDepth(width, height, useRenderBuffer) +end + +---Load texture cubemap data +---@param data ffi.cdata*|string +---@param size integer +---@param format integer +---@param mipmapCount integer +---@return integer +function M.rlLoadTextureCubemap(data, size, format, mipmapCount) + local _a1 + if type(data) == "string" then _a1 = ffi.cast("const void *", data) + else _a1 = data end + return C.rlLoadTextureCubemap(_a1, size, format, mipmapCount) +end + +---Update texture with new data on GPU +---@param id integer +---@param offsetX integer +---@param offsetY integer +---@param width integer +---@param height integer +---@param format integer +---@param data ffi.cdata*|string +---@return nil +function M.rlUpdateTexture(id, offsetX, offsetY, width, height, format, data) + local _a7 + if type(data) == "string" then _a7 = ffi.cast("const void *", data) + else _a7 = data end + C.rlUpdateTexture(id, offsetX, offsetY, width, height, format, _a7) +end + +---Get OpenGL internal formats +---@param format integer +---@param glInternalFormat ffi.cdata* +---@param glFormat ffi.cdata* +---@param glType ffi.cdata* +---@return nil +function M.rlGetGlTextureFormats(format, glInternalFormat, glFormat, glType) + C.rlGetGlTextureFormats(format, glInternalFormat, glFormat, glType) +end + +---Get name string for pixel format +---@param format integer +---@return string|nil +function M.rlGetPixelFormatName(format) + local _p = C.rlGetPixelFormatName(format) + if _p == nil then + return nil + end + local _s = ffi_string(_p) + return _s +end + +---Unload texture from GPU memory +---@param id integer +---@return nil +function M.rlUnloadTexture(id) + C.rlUnloadTexture(id) +end + +---Generate mipmap data for selected texture +---@param id integer +---@param width integer +---@param height integer +---@param format integer +---@param mipmaps ffi.cdata* +---@return nil +function M.rlGenTextureMipmaps(id, width, height, format, mipmaps) + C.rlGenTextureMipmaps(id, width, height, format, mipmaps) +end + +---Read texture pixel data +---@param id integer +---@param width integer +---@param height integer +---@param format integer +---@return ffi.cdata* +function M.rlReadTexturePixels(id, width, height, format) + return C.rlReadTexturePixels(id, width, height, format) +end + +---Read screen pixel data (color buffer) +---@param width integer +---@param height integer +---@return ffi.cdata* +function M.rlReadScreenPixels(width, height) + return C.rlReadScreenPixels(width, height) +end + +---Load an empty framebuffer +---@return integer +function M.rlLoadFramebuffer() + return C.rlLoadFramebuffer() +end + +---Attach texture/renderbuffer to a framebuffer +---@param id integer +---@param texId integer +---@param attachType integer +---@param texType integer +---@param mipLevel integer +---@return nil +function M.rlFramebufferAttach(id, texId, attachType, texType, mipLevel) + C.rlFramebufferAttach(id, texId, attachType, texType, mipLevel) +end + +---Verify framebuffer is complete +---@param id integer +---@return boolean +function M.rlFramebufferComplete(id) + return C.rlFramebufferComplete(id) +end + +---Delete framebuffer from GPU +---@param id integer +---@return nil +function M.rlUnloadFramebuffer(id) + C.rlUnloadFramebuffer(id) +end + +---Copy framebuffer pixel data to internal buffer +---@param x integer +---@param y integer +---@param width integer +---@param height integer +---@param format integer +---@param pixels ffi.cdata*|string +---@return nil +function M.rlCopyFramebuffer(x, y, width, height, format, pixels) + local _a6 + if type(pixels) == "string" then _a6 = ffi.cast("const void *", pixels) + else _a6 = pixels end + C.rlCopyFramebuffer(x, y, width, height, format, _a6) +end + +---Resize internal framebuffer +---@param width integer +---@param height integer +---@return nil +function M.rlResizeFramebuffer(width, height) + C.rlResizeFramebuffer(width, height) +end + +---Load (compile) shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER) +---@param code string +---@param type integer +---@return integer +function M.rlLoadShader(code, type) + return C.rlLoadShader(code, type) +end + +---Load shader from code strings +---@param vsCode string +---@param fsCode string +---@return integer +function M.rlLoadShaderProgram(vsCode, fsCode) + return C.rlLoadShaderProgram(vsCode, fsCode) +end + +---Load shader program, using already loaded shader ids +---@param vsId integer +---@param fsId integer +---@return integer +function M.rlLoadShaderProgramEx(vsId, fsId) + return C.rlLoadShaderProgramEx(vsId, fsId) +end + +---Load compute shader program +---@param csId integer +---@return integer +function M.rlLoadShaderProgramCompute(csId) + return C.rlLoadShaderProgramCompute(csId) +end + +---Unload shader, loaded with rlLoadShader() +---@param id integer +---@return nil +function M.rlUnloadShader(id) + C.rlUnloadShader(id) +end + +---Unload shader program +---@param id integer +---@return nil +function M.rlUnloadShaderProgram(id) + C.rlUnloadShaderProgram(id) +end + +---Get shader location uniform, requires shader program id +---@param id integer +---@param uniformName string +---@return integer +function M.rlGetLocationUniform(id, uniformName) + return C.rlGetLocationUniform(id, uniformName) +end + +---Get shader location attribute, requires shader program id +---@param id integer +---@param attribName string +---@return integer +function M.rlGetLocationAttrib(id, attribName) + return C.rlGetLocationAttrib(id, attribName) +end + +---Set shader value uniform +---@param locIndex integer +---@param value ffi.cdata*|string +---@param uniformType integer +---@param count integer +---@return nil +function M.rlSetUniform(locIndex, value, uniformType, count) + local _a2 + if type(value) == "string" then _a2 = ffi.cast("const void *", value) + else _a2 = value end + C.rlSetUniform(locIndex, _a2, uniformType, count) +end + +---Set shader value matrix +---@param locIndex integer +---@param mat raylib.Matrix +---@return nil +function M.rlSetUniformMatrix(locIndex, mat) + C.rlSetUniformMatrix(locIndex, mat) +end + +---Set shader value matrices +---@param locIndex integer +---@param mat raylib.Matrix[] +---@param count integer +---@return nil +function M.rlSetUniformMatrices(locIndex, mat, count) + local _a2 + if type(mat) == "table" then _a2 = to_array("Matrix", mat) + else _a2 = mat end + C.rlSetUniformMatrices(locIndex, _a2, count) +end + +---Set shader value sampler +---@param locIndex integer +---@param textureId integer +---@return nil +function M.rlSetUniformSampler(locIndex, textureId) + C.rlSetUniformSampler(locIndex, textureId) +end + +---Set shader currently active (id and locations) +---@param id integer +---@param locs ffi.cdata* +---@return nil +function M.rlSetShader(id, locs) + C.rlSetShader(id, locs) +end + +---Dispatch compute shader (equivalent to *draw* for graphics pipeline) +---@param groupX integer +---@param groupY integer +---@param groupZ integer +---@return nil +function M.rlComputeShaderDispatch(groupX, groupY, groupZ) + C.rlComputeShaderDispatch(groupX, groupY, groupZ) +end + +---Load shader storage buffer object (SSBO) +---@param size integer +---@param data ffi.cdata*|string +---@param usageHint integer +---@return integer +function M.rlLoadShaderBuffer(size, data, usageHint) + local _a2 + if type(data) == "string" then _a2 = ffi.cast("const void *", data) + else _a2 = data end + return C.rlLoadShaderBuffer(size, _a2, usageHint) +end + +---Unload shader storage buffer object (SSBO) +---@param ssboId integer +---@return nil +function M.rlUnloadShaderBuffer(ssboId) + C.rlUnloadShaderBuffer(ssboId) +end + +---Update SSBO buffer data +---@param id integer +---@param data ffi.cdata*|string +---@param dataSize integer +---@param offset integer +---@return nil +function M.rlUpdateShaderBuffer(id, data, dataSize, offset) + local _a2 + if type(data) == "string" then _a2 = ffi.cast("const void *", data) + else _a2 = data end + C.rlUpdateShaderBuffer(id, _a2, dataSize, offset) +end + +---Bind SSBO buffer +---@param id integer +---@param index integer +---@return nil +function M.rlBindShaderBuffer(id, index) + C.rlBindShaderBuffer(id, index) +end + +---Read SSBO buffer data (GPU->CPU) +---@param id integer +---@param dest ffi.cdata*|string +---@param count integer +---@param offset integer +---@return nil +function M.rlReadShaderBuffer(id, dest, count, offset) + local _a2 + if type(dest) == "string" then _a2 = ffi.cast("const void *", dest) + else _a2 = dest end + C.rlReadShaderBuffer(id, _a2, count, offset) +end + +---Copy SSBO data between buffers +---@param destId integer +---@param srcId integer +---@param destOffset integer +---@param srcOffset integer +---@param count integer +---@return nil +function M.rlCopyShaderBuffer(destId, srcId, destOffset, srcOffset, count) + C.rlCopyShaderBuffer(destId, srcId, destOffset, srcOffset, count) +end + +---Get SSBO buffer size +---@param id integer +---@return integer +function M.rlGetShaderBufferSize(id) + return C.rlGetShaderBufferSize(id) +end + +---Bind image texture +---@param id integer +---@param index integer +---@param format integer +---@param readonly boolean +---@return nil +function M.rlBindImageTexture(id, index, format, readonly) + C.rlBindImageTexture(id, index, format, readonly) +end + +---Get internal modelview matrix +---@return raylib.Matrix +function M.rlGetMatrixModelview() + return C.rlGetMatrixModelview() +end + +---Get internal projection matrix +---@return raylib.Matrix +function M.rlGetMatrixProjection() + return C.rlGetMatrixProjection() +end + +---Get internal accumulated transform matrix +---@return raylib.Matrix +function M.rlGetMatrixTransform() + return C.rlGetMatrixTransform() +end + +---Get internal projection matrix for stereo render (selected eye) +---@param eye integer +---@return raylib.Matrix +function M.rlGetMatrixProjectionStereo(eye) + return C.rlGetMatrixProjectionStereo(eye) +end + +---Get internal view offset matrix for stereo render (selected eye) +---@param eye integer +---@return raylib.Matrix +function M.rlGetMatrixViewOffsetStereo(eye) + return C.rlGetMatrixViewOffsetStereo(eye) +end + +---Set a custom projection matrix (replaces internal projection matrix) +---@param proj raylib.Matrix +---@return nil +function M.rlSetMatrixProjection(proj) + C.rlSetMatrixProjection(proj) +end + +---Set a custom modelview matrix (replaces internal modelview matrix) +---@param view raylib.Matrix +---@return nil +function M.rlSetMatrixModelview(view) + C.rlSetMatrixModelview(view) +end + +---Set eyes projection matrices for stereo rendering +---@param right raylib.Matrix +---@param left raylib.Matrix +---@return nil +function M.rlSetMatrixProjectionStereo(right, left) + C.rlSetMatrixProjectionStereo(right, left) +end + +---Set eyes view offsets matrices for stereo rendering +---@param right raylib.Matrix +---@param left raylib.Matrix +---@return nil +function M.rlSetMatrixViewOffsetStereo(right, left) + C.rlSetMatrixViewOffsetStereo(right, left) +end + +---Load and draw a cube +---@return nil +function M.rlLoadDrawCube() + C.rlLoadDrawCube() +end + +---Load and draw a quad +---@return nil +function M.rlLoadDrawQuad() + C.rlLoadDrawQuad() +end + +---@param value number +---@param min number +---@param max number +---@return number +function M.Clamp(value, min, max) + return C.Clamp(value, min, max) +end + +---@param start number +---@param end_ number +---@param amount number +---@return number +function M.Lerp(start, end_, amount) + return C.Lerp(start, end_, amount) +end + +---@param value number +---@param start number +---@param end_ number +---@return number +function M.Normalize(value, start, end_) + return C.Normalize(value, start, end_) +end + +---@param value number +---@param inputStart number +---@param inputEnd number +---@param outputStart number +---@param outputEnd number +---@return number +function M.Remap(value, inputStart, inputEnd, outputStart, outputEnd) + return C.Remap(value, inputStart, inputEnd, outputStart, outputEnd) +end + +---@param value number +---@param min number +---@param max number +---@return number +function M.Wrap(value, min, max) + return C.Wrap(value, min, max) +end + +---@param x number +---@param y number +---@return integer +function M.FloatEquals(x, y) + return C.FloatEquals(x, y) +end + +---@return raylib.Vector2 +function M.Vector2Zero() + return C.Vector2Zero() +end + +---@return raylib.Vector2 +function M.Vector2One() + return C.Vector2One() +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Add(v1, v2) + return C.Vector2Add(v1, v2) +end + +---@param v raylib.Vector2 +---@param add number +---@return raylib.Vector2 +function M.Vector2AddValue(v, add) + return C.Vector2AddValue(v, add) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Subtract(v1, v2) + return C.Vector2Subtract(v1, v2) +end + +---@param v raylib.Vector2 +---@param sub number +---@return raylib.Vector2 +function M.Vector2SubtractValue(v, sub) + return C.Vector2SubtractValue(v, sub) +end + +---@param v raylib.Vector2 +---@return number +function M.Vector2Length(v) + return C.Vector2Length(v) +end + +---@param v raylib.Vector2 +---@return number +function M.Vector2LengthSqr(v) + return C.Vector2LengthSqr(v) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return number +function M.Vector2DotProduct(v1, v2) + return C.Vector2DotProduct(v1, v2) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return number +function M.Vector2CrossProduct(v1, v2) + return C.Vector2CrossProduct(v1, v2) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return number +function M.Vector2Distance(v1, v2) + return C.Vector2Distance(v1, v2) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return number +function M.Vector2DistanceSqr(v1, v2) + return C.Vector2DistanceSqr(v1, v2) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return number +function M.Vector2Angle(v1, v2) + return C.Vector2Angle(v1, v2) +end + +---@param start raylib.Vector2 +---@param end_ raylib.Vector2 +---@return number +function M.Vector2LineAngle(start, end_) + return C.Vector2LineAngle(start, end_) +end + +---@param v raylib.Vector2 +---@param scale number +---@return raylib.Vector2 +function M.Vector2Scale(v, scale) + return C.Vector2Scale(v, scale) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Multiply(v1, v2) + return C.Vector2Multiply(v1, v2) +end + +---@param v raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Negate(v) + return C.Vector2Negate(v) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Divide(v1, v2) + return C.Vector2Divide(v1, v2) +end + +---@param v raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Normalize(v) + return C.Vector2Normalize(v) +end + +---@param v raylib.Vector2 +---@param mat raylib.Matrix +---@return raylib.Vector2 +function M.Vector2Transform(v, mat) + return C.Vector2Transform(v, mat) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@param amount number +---@return raylib.Vector2 +function M.Vector2Lerp(v1, v2, amount) + return C.Vector2Lerp(v1, v2, amount) +end + +---@param v raylib.Vector2 +---@param normal raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Reflect(v, normal) + return C.Vector2Reflect(v, normal) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Min(v1, v2) + return C.Vector2Min(v1, v2) +end + +---@param v1 raylib.Vector2 +---@param v2 raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Max(v1, v2) + return C.Vector2Max(v1, v2) +end + +---@param v raylib.Vector2 +---@param angle number +---@return raylib.Vector2 +function M.Vector2Rotate(v, angle) + return C.Vector2Rotate(v, angle) +end + +---@param v raylib.Vector2 +---@param target raylib.Vector2 +---@param maxDistance number +---@return raylib.Vector2 +function M.Vector2MoveTowards(v, target, maxDistance) + return C.Vector2MoveTowards(v, target, maxDistance) +end + +---@param v raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Invert(v) + return C.Vector2Invert(v) +end + +---@param v raylib.Vector2 +---@param min raylib.Vector2 +---@param max raylib.Vector2 +---@return raylib.Vector2 +function M.Vector2Clamp(v, min, max) + return C.Vector2Clamp(v, min, max) +end + +---@param v raylib.Vector2 +---@param min number +---@param max number +---@return raylib.Vector2 +function M.Vector2ClampValue(v, min, max) + return C.Vector2ClampValue(v, min, max) +end + +---@param p raylib.Vector2 +---@param q raylib.Vector2 +---@return integer +function M.Vector2Equals(p, q) + return C.Vector2Equals(p, q) +end + +---@param v raylib.Vector2 +---@param n raylib.Vector2 +---@param r number +---@return raylib.Vector2 +function M.Vector2Refract(v, n, r) + return C.Vector2Refract(v, n, r) +end + +---@return raylib.Vector3 +function M.Vector3Zero() + return C.Vector3Zero() +end + +---@return raylib.Vector3 +function M.Vector3One() + return C.Vector3One() +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Add(v1, v2) + return C.Vector3Add(v1, v2) +end + +---@param v raylib.Vector3 +---@param add number +---@return raylib.Vector3 +function M.Vector3AddValue(v, add) + return C.Vector3AddValue(v, add) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Subtract(v1, v2) + return C.Vector3Subtract(v1, v2) +end + +---@param v raylib.Vector3 +---@param sub number +---@return raylib.Vector3 +function M.Vector3SubtractValue(v, sub) + return C.Vector3SubtractValue(v, sub) +end + +---@param v raylib.Vector3 +---@param scalar number +---@return raylib.Vector3 +function M.Vector3Scale(v, scalar) + return C.Vector3Scale(v, scalar) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Multiply(v1, v2) + return C.Vector3Multiply(v1, v2) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3CrossProduct(v1, v2) + return C.Vector3CrossProduct(v1, v2) +end + +---@param v raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Perpendicular(v) + return C.Vector3Perpendicular(v) +end + +---@param v raylib.Vector3 +---@return number +function M.Vector3Length(v) + return C.Vector3Length(v) +end + +---@param v raylib.Vector3 +---@return number +function M.Vector3LengthSqr(v) + return C.Vector3LengthSqr(v) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return number +function M.Vector3DotProduct(v1, v2) + return C.Vector3DotProduct(v1, v2) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return number +function M.Vector3Distance(v1, v2) + return C.Vector3Distance(v1, v2) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return number +function M.Vector3DistanceSqr(v1, v2) + return C.Vector3DistanceSqr(v1, v2) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return number +function M.Vector3Angle(v1, v2) + return C.Vector3Angle(v1, v2) +end + +---@param v raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Negate(v) + return C.Vector3Negate(v) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Divide(v1, v2) + return C.Vector3Divide(v1, v2) +end + +---@param v raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Normalize(v) + return C.Vector3Normalize(v) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Project(v1, v2) + return C.Vector3Project(v1, v2) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Reject(v1, v2) + return C.Vector3Reject(v1, v2) +end + +---@param v1 ffi.cdata* +---@param v2 ffi.cdata* +---@return nil +function M.Vector3OrthoNormalize(v1, v2) + C.Vector3OrthoNormalize(v1, v2) +end + +---@param v raylib.Vector3 +---@param mat raylib.Matrix +---@return raylib.Vector3 +function M.Vector3Transform(v, mat) + return C.Vector3Transform(v, mat) +end + +---@param v raylib.Vector3 +---@param q raylib.Quaternion +---@return raylib.Vector3 +function M.Vector3RotateByQuaternion(v, q) + return C.Vector3RotateByQuaternion(v, q) +end + +---@param v raylib.Vector3 +---@param axis raylib.Vector3 +---@param angle number +---@return raylib.Vector3 +function M.Vector3RotateByAxisAngle(v, axis, angle) + return C.Vector3RotateByAxisAngle(v, axis, angle) +end + +---@param v raylib.Vector3 +---@param target raylib.Vector3 +---@param maxDistance number +---@return raylib.Vector3 +function M.Vector3MoveTowards(v, target, maxDistance) + return C.Vector3MoveTowards(v, target, maxDistance) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@param amount number +---@return raylib.Vector3 +function M.Vector3Lerp(v1, v2, amount) + return C.Vector3Lerp(v1, v2, amount) +end + +---@param v1 raylib.Vector3 +---@param tangent1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@param tangent2 raylib.Vector3 +---@param amount number +---@return raylib.Vector3 +function M.Vector3CubicHermite(v1, tangent1, v2, tangent2, amount) + return C.Vector3CubicHermite(v1, tangent1, v2, tangent2, amount) +end + +---@param v raylib.Vector3 +---@param normal raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Reflect(v, normal) + return C.Vector3Reflect(v, normal) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Min(v1, v2) + return C.Vector3Min(v1, v2) +end + +---@param v1 raylib.Vector3 +---@param v2 raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Max(v1, v2) + return C.Vector3Max(v1, v2) +end + +---@param p raylib.Vector3 +---@param a raylib.Vector3 +---@param b raylib.Vector3 +---@param c raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Barycenter(p, a, b, c) + return C.Vector3Barycenter(p, a, b, c) +end + +---@param source raylib.Vector3 +---@param projection raylib.Matrix +---@param view raylib.Matrix +---@return raylib.Vector3 +function M.Vector3Unproject(source, projection, view) + return C.Vector3Unproject(source, projection, view) +end + +---@param v raylib.Vector3 +---@return raylib.float3 +function M.Vector3ToFloatV(v) + return C.Vector3ToFloatV(v) +end + +---@param v raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Invert(v) + return C.Vector3Invert(v) +end + +---@param v raylib.Vector3 +---@param min raylib.Vector3 +---@param max raylib.Vector3 +---@return raylib.Vector3 +function M.Vector3Clamp(v, min, max) + return C.Vector3Clamp(v, min, max) +end + +---@param v raylib.Vector3 +---@param min number +---@param max number +---@return raylib.Vector3 +function M.Vector3ClampValue(v, min, max) + return C.Vector3ClampValue(v, min, max) +end + +---@param p raylib.Vector3 +---@param q raylib.Vector3 +---@return integer +function M.Vector3Equals(p, q) + return C.Vector3Equals(p, q) +end + +---@param v raylib.Vector3 +---@param n raylib.Vector3 +---@param r number +---@return raylib.Vector3 +function M.Vector3Refract(v, n, r) + return C.Vector3Refract(v, n, r) +end + +---@return raylib.Vector4 +function M.Vector4Zero() + return C.Vector4Zero() +end + +---@return raylib.Vector4 +function M.Vector4One() + return C.Vector4One() +end + +---@param v1 raylib.Vector4 +---@param v2 raylib.Vector4 +---@return raylib.Vector4 +function M.Vector4Add(v1, v2) + return C.Vector4Add(v1, v2) +end + +---@param v raylib.Vector4 +---@param add number +---@return raylib.Vector4 +function M.Vector4AddValue(v, add) + return C.Vector4AddValue(v, add) +end + +---@param v1 raylib.Vector4 +---@param v2 raylib.Vector4 +---@return raylib.Vector4 +function M.Vector4Subtract(v1, v2) + return C.Vector4Subtract(v1, v2) +end + +---@param v raylib.Vector4 +---@param add number +---@return raylib.Vector4 +function M.Vector4SubtractValue(v, add) + return C.Vector4SubtractValue(v, add) +end + +---@param v raylib.Vector4 +---@return number +function M.Vector4Length(v) + return C.Vector4Length(v) +end + +---@param v raylib.Vector4 +---@return number +function M.Vector4LengthSqr(v) + return C.Vector4LengthSqr(v) +end + +---@param v1 raylib.Vector4 +---@param v2 raylib.Vector4 +---@return number +function M.Vector4DotProduct(v1, v2) + return C.Vector4DotProduct(v1, v2) +end + +---@param v1 raylib.Vector4 +---@param v2 raylib.Vector4 +---@return number +function M.Vector4Distance(v1, v2) + return C.Vector4Distance(v1, v2) +end + +---@param v1 raylib.Vector4 +---@param v2 raylib.Vector4 +---@return number +function M.Vector4DistanceSqr(v1, v2) + return C.Vector4DistanceSqr(v1, v2) +end + +---@param v raylib.Vector4 +---@param scale number +---@return raylib.Vector4 +function M.Vector4Scale(v, scale) + return C.Vector4Scale(v, scale) +end + +---@param v1 raylib.Vector4 +---@param v2 raylib.Vector4 +---@return raylib.Vector4 +function M.Vector4Multiply(v1, v2) + return C.Vector4Multiply(v1, v2) +end + +---@param v raylib.Vector4 +---@return raylib.Vector4 +function M.Vector4Negate(v) + return C.Vector4Negate(v) +end + +---@param v1 raylib.Vector4 +---@param v2 raylib.Vector4 +---@return raylib.Vector4 +function M.Vector4Divide(v1, v2) + return C.Vector4Divide(v1, v2) +end + +---@param v raylib.Vector4 +---@return raylib.Vector4 +function M.Vector4Normalize(v) + return C.Vector4Normalize(v) +end + +---@param v1 raylib.Vector4 +---@param v2 raylib.Vector4 +---@return raylib.Vector4 +function M.Vector4Min(v1, v2) + return C.Vector4Min(v1, v2) +end + +---@param v1 raylib.Vector4 +---@param v2 raylib.Vector4 +---@return raylib.Vector4 +function M.Vector4Max(v1, v2) + return C.Vector4Max(v1, v2) +end + +---@param v1 raylib.Vector4 +---@param v2 raylib.Vector4 +---@param amount number +---@return raylib.Vector4 +function M.Vector4Lerp(v1, v2, amount) + return C.Vector4Lerp(v1, v2, amount) +end + +---@param v raylib.Vector4 +---@param target raylib.Vector4 +---@param maxDistance number +---@return raylib.Vector4 +function M.Vector4MoveTowards(v, target, maxDistance) + return C.Vector4MoveTowards(v, target, maxDistance) +end + +---@param v raylib.Vector4 +---@return raylib.Vector4 +function M.Vector4Invert(v) + return C.Vector4Invert(v) +end + +---@param p raylib.Vector4 +---@param q raylib.Vector4 +---@return integer +function M.Vector4Equals(p, q) + return C.Vector4Equals(p, q) +end + +---@param mat raylib.Matrix +---@return number +function M.MatrixDeterminant(mat) + return C.MatrixDeterminant(mat) +end + +---@param mat raylib.Matrix +---@return number +function M.MatrixTrace(mat) + return C.MatrixTrace(mat) +end + +---@param mat raylib.Matrix +---@return raylib.Matrix +function M.MatrixTranspose(mat) + return C.MatrixTranspose(mat) +end + +---@param mat raylib.Matrix +---@return raylib.Matrix +function M.MatrixInvert(mat) + return C.MatrixInvert(mat) +end + +---@return raylib.Matrix +function M.MatrixIdentity() + return C.MatrixIdentity() +end + +---@param left raylib.Matrix +---@param right raylib.Matrix +---@return raylib.Matrix +function M.MatrixAdd(left, right) + return C.MatrixAdd(left, right) +end + +---@param left raylib.Matrix +---@param right raylib.Matrix +---@return raylib.Matrix +function M.MatrixSubtract(left, right) + return C.MatrixSubtract(left, right) +end + +---@param left raylib.Matrix +---@param right raylib.Matrix +---@return raylib.Matrix +function M.MatrixMultiply(left, right) + return C.MatrixMultiply(left, right) +end + +---@param left raylib.Matrix +---@param value number +---@return raylib.Matrix +function M.MatrixMultiplyValue(left, value) + return C.MatrixMultiplyValue(left, value) +end + +---@param x number +---@param y number +---@param z number +---@return raylib.Matrix +function M.MatrixTranslate(x, y, z) + return C.MatrixTranslate(x, y, z) +end + +---@param axis raylib.Vector3 +---@param angle number +---@return raylib.Matrix +function M.MatrixRotate(axis, angle) + return C.MatrixRotate(axis, angle) +end + +---@param angle number +---@return raylib.Matrix +function M.MatrixRotateX(angle) + return C.MatrixRotateX(angle) +end + +---@param angle number +---@return raylib.Matrix +function M.MatrixRotateY(angle) + return C.MatrixRotateY(angle) +end + +---@param angle number +---@return raylib.Matrix +function M.MatrixRotateZ(angle) + return C.MatrixRotateZ(angle) +end + +---@param angle raylib.Vector3 +---@return raylib.Matrix +function M.MatrixRotateXYZ(angle) + return C.MatrixRotateXYZ(angle) +end + +---@param angle raylib.Vector3 +---@return raylib.Matrix +function M.MatrixRotateZYX(angle) + return C.MatrixRotateZYX(angle) +end + +---@param x number +---@param y number +---@param z number +---@return raylib.Matrix +function M.MatrixScale(x, y, z) + return C.MatrixScale(x, y, z) +end + +---@param left number +---@param right number +---@param bottom number +---@param top number +---@param nearPlane number +---@param farPlane number +---@return raylib.Matrix +function M.MatrixFrustum(left, right, bottom, top, nearPlane, farPlane) + return C.MatrixFrustum(left, right, bottom, top, nearPlane, farPlane) +end + +---@param fovY number +---@param aspect number +---@param nearPlane number +---@param farPlane number +---@return raylib.Matrix +function M.MatrixPerspective(fovY, aspect, nearPlane, farPlane) + return C.MatrixPerspective(fovY, aspect, nearPlane, farPlane) +end + +---@param left number +---@param right number +---@param bottom number +---@param top number +---@param nearPlane number +---@param farPlane number +---@return raylib.Matrix +function M.MatrixOrtho(left, right, bottom, top, nearPlane, farPlane) + return C.MatrixOrtho(left, right, bottom, top, nearPlane, farPlane) +end + +---@param eye raylib.Vector3 +---@param target raylib.Vector3 +---@param up raylib.Vector3 +---@return raylib.Matrix +function M.MatrixLookAt(eye, target, up) + return C.MatrixLookAt(eye, target, up) +end + +---@param mat raylib.Matrix +---@return raylib.float16 +function M.MatrixToFloatV(mat) + return C.MatrixToFloatV(mat) +end + +---@param q1 raylib.Quaternion +---@param q2 raylib.Quaternion +---@return raylib.Quaternion +function M.QuaternionAdd(q1, q2) + return C.QuaternionAdd(q1, q2) +end + +---@param q raylib.Quaternion +---@param add number +---@return raylib.Quaternion +function M.QuaternionAddValue(q, add) + return C.QuaternionAddValue(q, add) +end + +---@param q1 raylib.Quaternion +---@param q2 raylib.Quaternion +---@return raylib.Quaternion +function M.QuaternionSubtract(q1, q2) + return C.QuaternionSubtract(q1, q2) +end + +---@param q raylib.Quaternion +---@param sub number +---@return raylib.Quaternion +function M.QuaternionSubtractValue(q, sub) + return C.QuaternionSubtractValue(q, sub) +end + +---@return raylib.Quaternion +function M.QuaternionIdentity() + return C.QuaternionIdentity() +end + +---@param q raylib.Quaternion +---@return number +function M.QuaternionLength(q) + return C.QuaternionLength(q) +end + +---@param q raylib.Quaternion +---@return raylib.Quaternion +function M.QuaternionNormalize(q) + return C.QuaternionNormalize(q) +end + +---@param q raylib.Quaternion +---@return raylib.Quaternion +function M.QuaternionInvert(q) + return C.QuaternionInvert(q) +end + +---@param q1 raylib.Quaternion +---@param q2 raylib.Quaternion +---@return raylib.Quaternion +function M.QuaternionMultiply(q1, q2) + return C.QuaternionMultiply(q1, q2) +end + +---@param q raylib.Quaternion +---@param mul number +---@return raylib.Quaternion +function M.QuaternionScale(q, mul) + return C.QuaternionScale(q, mul) +end + +---@param q1 raylib.Quaternion +---@param q2 raylib.Quaternion +---@return raylib.Quaternion +function M.QuaternionDivide(q1, q2) + return C.QuaternionDivide(q1, q2) +end + +---@param q1 raylib.Quaternion +---@param q2 raylib.Quaternion +---@param amount number +---@return raylib.Quaternion +function M.QuaternionLerp(q1, q2, amount) + return C.QuaternionLerp(q1, q2, amount) +end + +---@param q1 raylib.Quaternion +---@param q2 raylib.Quaternion +---@param amount number +---@return raylib.Quaternion +function M.QuaternionNlerp(q1, q2, amount) + return C.QuaternionNlerp(q1, q2, amount) +end + +---@param q1 raylib.Quaternion +---@param q2 raylib.Quaternion +---@param amount number +---@return raylib.Quaternion +function M.QuaternionSlerp(q1, q2, amount) + return C.QuaternionSlerp(q1, q2, amount) +end + +---@param q1 raylib.Quaternion +---@param outTangent1 raylib.Quaternion +---@param q2 raylib.Quaternion +---@param inTangent2 raylib.Quaternion +---@param t number +---@return raylib.Quaternion +function M.QuaternionCubicHermiteSpline(q1, outTangent1, q2, inTangent2, t) + return C.QuaternionCubicHermiteSpline(q1, outTangent1, q2, inTangent2, t) +end + +---@param from raylib.Vector3 +---@param to raylib.Vector3 +---@return raylib.Quaternion +function M.QuaternionFromVector3ToVector3(from, to) + return C.QuaternionFromVector3ToVector3(from, to) +end + +---@param mat raylib.Matrix +---@return raylib.Quaternion +function M.QuaternionFromMatrix(mat) + return C.QuaternionFromMatrix(mat) +end + +---@param q raylib.Quaternion +---@return raylib.Matrix +function M.QuaternionToMatrix(q) + return C.QuaternionToMatrix(q) +end + +---@param axis raylib.Vector3 +---@param angle number +---@return raylib.Quaternion +function M.QuaternionFromAxisAngle(axis, angle) + return C.QuaternionFromAxisAngle(axis, angle) +end + +---@param q raylib.Quaternion +---@param outAxis ffi.cdata* +---@param outAngle ffi.cdata* +---@return nil +function M.QuaternionToAxisAngle(q, outAxis, outAngle) + C.QuaternionToAxisAngle(q, outAxis, outAngle) +end + +---@param pitch number +---@param yaw number +---@param roll number +---@return raylib.Quaternion +function M.QuaternionFromEuler(pitch, yaw, roll) + return C.QuaternionFromEuler(pitch, yaw, roll) +end + +---@param q raylib.Quaternion +---@return raylib.Vector3 +function M.QuaternionToEuler(q) + return C.QuaternionToEuler(q) +end + +---@param q raylib.Quaternion +---@param mat raylib.Matrix +---@return raylib.Quaternion +function M.QuaternionTransform(q, mat) + return C.QuaternionTransform(q, mat) +end + +---@param p raylib.Quaternion +---@param q raylib.Quaternion +---@return integer +function M.QuaternionEquals(p, q) + return C.QuaternionEquals(p, q) +end + +---@param translation raylib.Vector3 +---@param rotation raylib.Quaternion +---@param scale raylib.Vector3 +---@return raylib.Matrix +function M.MatrixCompose(translation, rotation, scale) + return C.MatrixCompose(translation, rotation, scale) +end + +---@param mat raylib.Matrix +---@param translation? raylib.Vector3 +---@param rotation? raylib.Quaternion +---@param scale? raylib.Vector3 +---@return raylib.Vector3 +---@return raylib.Quaternion +---@return raylib.Vector3 +function M.MatrixDecompose(mat, translation, rotation, scale) + local _o2 = ffi.new("Vector3[1]") + if translation ~= nil then _o2[0] = translation end + local _o3 = ffi.new("Quaternion[1]") + if rotation ~= nil then _o3[0] = rotation end + local _o4 = ffi.new("Vector3[1]") + if scale ~= nil then _o4[0] = scale end + C.MatrixDecompose(mat, _o2, _o3, _o4) + return _o2[0], _o3[0], _o4[0] +end + +return M diff --git a/submodules/raylib b/submodules/raylib new file mode 160000 index 0000000..ad124dd --- /dev/null +++ b/submodules/raylib @@ -0,0 +1 @@ +Subproject commit ad124dd7f5864fcdd9cc8868d5baae61041a7d3c