From 89e0058bb41794618159835ee57b37d93199503a Mon Sep 17 00:00:00 2001 From: TSnake41 Date: Tue, 16 Feb 2021 22:25:45 +0100 Subject: [PATCH] Update binding, update LuaJIT to Tarantool's fork. --- luajit | 2 +- raygui | 2 +- raylib | 2 +- src/raylib.lua | 5 +++ src/raylua.lua | 2 +- tools/api.h | 15 +++++---- tools/genbind.lua | 78 +++++++++++++++++++++++++---------------------- 7 files changed, 59 insertions(+), 47 deletions(-) diff --git a/luajit b/luajit index a2a39ea..c0c2e62 160000 --- a/luajit +++ b/luajit @@ -1 +1 @@ -Subproject commit a2a39ea7184f3c8cab9474c6e41f6541265fb362 +Subproject commit c0c2e62a5404b51ba740ed28762e65b2ef56bcf9 diff --git a/raygui b/raygui index 28d7584..3627bb9 160000 --- a/raygui +++ b/raygui @@ -1 +1 @@ -Subproject commit 28d7584fc1ad11aff3bb59de130ffca45b4dd7b3 +Subproject commit 3627bb960a4df7e13dbf82fc8ace0e27ed2b072c diff --git a/raylib b/raylib index 005bc4c..0f5aab3 160000 --- a/raylib +++ b/raylib @@ -1 +1 @@ -Subproject commit 005bc4c4143f2b79ffc18fa98be144c905d2ce7f +Subproject commit 0f5aab3a1ca2ffaae6c6e784d485007d7d6e7182 diff --git a/src/raylib.lua b/src/raylib.lua index 1c12e42..f290376 100644 --- a/src/raylib.lua +++ b/src/raylib.lua @@ -623,6 +623,11 @@ ffi.cdef [[ } NPatchType; typedef void (*TraceLogCallback)(int logType, const char *text, va_list args); + typedef void *(*MemAllocCallback)(int size); + typedef void *(*MemReallocCallback)(int size); + typedef void (*MemFreeCallback)(void *ptr); + typedef unsigned char* (*LoadFileDataCallback)(const char* fileName, unsigned int* bytesRead); + typedef char* (*LoadFileTextCallback)(const char* fileName); ]] -- raymath cdef diff --git a/src/raylua.lua b/src/raylua.lua index 883cd85..be93884 100644 --- a/src/raylua.lua +++ b/src/raylua.lua @@ -16,7 +16,7 @@ local load = loadstring -raylua.version = "v3.5a" +raylua.version = "v3.5b" function raylua.repl() print("> raylua " .. raylua.version .. " <") diff --git a/tools/api.h b/tools/api.h index 5b565da..f80c2d5 100644 --- a/tools/api.h +++ b/tools/api.h @@ -65,15 +65,19 @@ void SetTargetFPS(int fps) int GetFPS(void) float GetFrameTime(void) double GetTime(void) +int GetRandomValue(int min, int max) +void TakeScreenshot(const char *fileName) void SetConfigFlags(unsigned int flags) -void SetTraceLogLevel(int logType) -void SetTraceLogExit(int logType) -void SetTraceLogCallback(TraceLogCallback callback) void TraceLog(int logType, const char *text, ...) +void SetTraceLogLevel(int logType) void *MemAlloc(int size) void MemFree(void *ptr) -void TakeScreenshot(const char *fileName) -int GetRandomValue(int min, int max) +void SetTraceLogCallback(TraceLogCallback callback) +//void SetMemAllocCallback(MemAllocCallback callback) +//void SetMemReallocCallback(MemReallocCallback callback) +//void SetMemFreeCallback(MemFreeCallback callback) +//void SetLoadFileDataCallback(LoadFileDataCallback callback) +//void SetLoadFileTextCallback(LoadFileDataCallback callback) uint8_t *LoadFileData(const char *fileName, unsigned int *bytesRead) void UnloadFileData(unsigned char *data) bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite) @@ -373,7 +377,6 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize) BoundingBox MeshBoundingBox(Mesh mesh) void MeshTangents(Mesh *mesh) void MeshBinormals(Mesh *mesh) -void MeshNormalsSmooth(Mesh *mesh) 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) diff --git a/tools/genbind.lua b/tools/genbind.lua index 782f26d..8a7961b 100644 --- a/tools/genbind.lua +++ b/tools/genbind.lua @@ -14,7 +14,9 @@ local structs = { "Ray", "RayHitInfo", "BoundingBox", "Wave", "Sound", "Music", "AudioStream", "VrDeviceInfo", "Camera3D", "RenderTexture2D", "TextureCubemap", "TraceLogCallback", "PhysicsBody", - "GestureEvent", "GuiStyle", "GuiTextBoxState" + "GestureEvent", "GuiStyle", "GuiTextBoxState", + "TraceLogCallback", "MemAllocCallback", "MemReallocCallback", + "MemFreeCallback", "LoadFileDataCallback" } local functions = {} @@ -46,43 +48,45 @@ end for _,modname in ipairs(modules) do for line in io.lines("tools/" .. modname .. ".h") do - if custom_support[modname] then - line = custom_support[modname](line) + if line:sub(0, 2) ~= "//" then + if custom_support[modname] then + line = custom_support[modname](line) + end + + line = line:gsub("(%W)([%l%d][%w_]*)", function (before, part) + for i,keyword in ipairs(keywords) do + if part == keyword + or part == "t" then -- uintX_t workaround + return before .. part + end + end + + return before + end) + + line = line:gsub("%u%w+", function (part) + for i,struct in ipairs(structs) do + if part == struct then + return part + end + end + + functions[#functions + 1] = part + counter = counter + 1 + + if count == 2 then + print("WARN: Multiple matches for: " .. line) + end + + return "(*)" + end) + + -- Strip spaces + line = line:gsub("([(),*.])%s+(%w)", function (a, b) return a .. b end) + line = line:gsub("(%w)%s+([(),*.])", function (a, b) return a .. b end) + + proto[#proto + 1] = line end - - line = line:gsub("(%W)([%l%d][%w_]*)", function (before, part) - for i,keyword in ipairs(keywords) do - if part == keyword - or part == "t" then -- uintX_t workaround - return before .. part - end - end - - return before - end) - - line = line:gsub("%u%w+", function (part) - for i,struct in ipairs(structs) do - if part == struct then - return part - end - end - - functions[#functions + 1] = part - counter = counter + 1 - - if count == 2 then - print("WARN: Multiple matches for: " .. line) - end - - return "(*)" - end) - - -- Strip spaces - line = line:gsub("([(),*.])%s+(%w)", function (a, b) return a .. b end) - line = line:gsub("(%w)%s+([(),*.])", function (a, b) return a .. b end) - - proto[#proto + 1] = line end end