Add even more files

This commit is contained in:
TSnake41 2020-02-27 18:01:34 +01:00
parent dae35f0d74
commit bfcdb200b5
19 changed files with 1707 additions and 2215 deletions

10
.gitignore vendored
View File

@ -2,3 +2,13 @@
wray_standalone\.exe
src/wray_api\.c
libwray\.a
raylua_e.exe
raylua_s.exe
src/autogen/bind.c
src/autogen/boot.c
src/autogen/builder.c

View File

@ -0,0 +1,15 @@
rl.SetConfigFlags(rl.FLAG_VSYNC_HINT)
rl.SetTargetFPS(60)
rl.InitWindow(800, 450, "raylib [core] example - basic window")
while not rl.WindowShouldClose() do
rl.BeginDrawing()
rl.ClearBackground(rl.RAYWHITE)
rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY)
rl.EndDrawing()
end
rl.CloseWindow()

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

View File

@ -0,0 +1,26 @@
local ffi = require "ffi"
local lua_color = ffi.new("Color", 3, 3, 128, 255)
rl.SetConfigFlags(rl.FLAG_VSYNC_HINT)
rl.SetTargetFPS(60)
local width, height = 800, 450
rl.InitWindow(800, 450, "raylib [shapes] example - basic shapes drawing")
while not rl.WindowShouldClose() do
rl.BeginDrawing()
rl.ClearBackground(rl.RAYWHITE)
rl.DrawRectangle(width / 2 - 128, height / 2 - 128, 256, 256, lua_color)
rl.DrawRectangle(width / 2 - 112, height / 2 - 112, 224, 224, rl.RAYWHITE)
rl.DrawText("raylib", width / 2 - 44, height / 2 + 24, 50, lua_color)
rl.DrawText("Lua", width / 2 - 44, height / 2 + 65, 50, lua_color)
rl.DrawText("this is NOT a texture!", 350, 370, 10, rl.GRAY)
rl.EndDrawing()
end
rl.CloseWindow()

View File

@ -0,0 +1,112 @@
--------------------------------------------------------------------------------------------
--
-- raylib [textures] example - Bunnymark
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2019 Ramon Santamaria (@raysan5)
--
--------------------------------------------------------------------------------------------
local ffi = require "ffi"
local MAX_BUNNIES = 100000 -- 100K bunnies limit
-- This is the maximum amount of elements (quads) per batch
-- NOTE: This value is defined in [rlgl] module and can be changed there
local MAX_BATCH_ELEMENTS = 8192
-- Create the Bunny class.
Bunny = {}
Bunny.__index = Bunny
function Bunny:new(pos, spd, col)
local bunny = {}
setmetatable(bunny,Bunny)
bunny.position = pos
bunny.speed = spd
bunny.color = col
return bunny
end
function Bunny:update(texture)
self.position.x = self.position.x + self.speed.x
self.position.y = self.position.y + self.speed.y
if ((self.position.x + texture.width/2) > rl.GetScreenWidth()) or ((self.position.x + texture.width/2) < 0) then
self.speed.x = self.speed.x * -1
end
if ((self.position.y + texture.height/2) > rl.GetScreenHeight()) or ((self.position.y + texture.height/2 - 40) < 0) then
self.speed.y = self.speed.y * -1
end
end
-- Initialization
----------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
rl.InitWindow(screenWidth, screenHeight, "raylib [textures] example - bunnymark")
-- Load bunny texture
local texBunny = rl.LoadTexture("resources/wabbit_alpha.png")
local bunnies = {}
rl.SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
----------------------------------------------------------------------------------------
-- Main game loop
while not rl.WindowShouldClose() do -- Detect window close button or ESC key
-- Update
------------------------------------------------------------------------------------
if rl.IsMouseButtonDown(rl.MOUSE_LEFT_BUTTON) then
-- Create more bunnies
for i = 1, 100 do
if #bunnies < MAX_BUNNIES then
local speed = ffi.new("Vector2", rl.GetRandomValue(-250, 250) / 60, rl.GetRandomValue(-250, 250) / 60)
local color = ffi.new("Color", rl.GetRandomValue(50, 240), rl.GetRandomValue(80, 240), rl.GetRandomValue(100, 240), 255)
--bunnies[#bunnies] = Bunny:new(nil, GetMousePosition(), speed, color)
table.insert(bunnies, Bunny:new(rl.GetMousePosition(), speed, color))
end
end
end
-- Update bunnies
for i = 1, #bunnies do
bunnies[i]:update(texBunny)
end
------------------------------------------------------------------------------------
-- Draw
------------------------------------------------------------------------------------
rl.BeginDrawing();
rl.ClearBackground(rl.RAYWHITE);
for i = 1, #bunnies do
-- NOTE: When internal batch buffer limit is reached (MAX_BATCH_ELEMENTS),
-- a draw call is launched and buffer starts being filled again;
-- before issuing a draw call, updated vertex data from internal CPU buffer is send to GPU...
-- Process of sending data is costly and it could happen that GPU data has not been completely
-- processed for drawing while new data is tried to be sent (updating current in-use buffers)
-- it could generates a stall and consequently a frame drop, limiting the number of drawn bunnies
rl.DrawTexture(texBunny, bunnies[i].position.x, bunnies[i].position.y, bunnies[i].color);
end
rl.DrawRectangle(0, 0, screenWidth, 40, rl.BLACK)
rl.DrawText("bunnies: " .. #bunnies, 120, 10, 20, rl.GREEN)
rl.DrawText("batched draw calls: " .. math.ceil(1 + #bunnies / MAX_BATCH_ELEMENTS), 320, 10, 20, rl.MAROON)
-- DrawText(FormatText("bunnies: %i", #bunnies), 120, 10, 20, GREEN)
-- DrawText(FormatText("batched draw calls: %i", 1 + #bunnies/MAX_BATCH_ELEMENTS), 320, 10, 20, MAROON)
rl.DrawFPS(10, 10)
rl.EndDrawing()
------------------------------------------------------------------------------------
end
-- De-Initialization
----------------------------------------------------------------------------------------
rl.UnloadTexture(texBunny) -- Unload bunny texture
rl.CloseWindow() -- Close window and OpenGL context
----------------------------------------------------------------------------------------

View File

@ -1,9 +1,16 @@
CFLAGS := -O2 -s
LDFLAGS := -O2 -s -lm -lluajit
LDFLAGS := -O2 -s -lm
AR ?= ar
LUA ?= luajit
CFLAGS += -Iluajit/src -Iraylib/src
LDFLAGS += -Lluajit/src -lluajit -Lraylib/src -lraylib
ifeq ($(OS),Windows_NT)
LDFLAGS += -lopengl32 -lgdi32 -lwinmm
endif
BOOT_FILES := src/raylib.lua src/raylua.lua
all: raylua_s raylua_e
@ -11,16 +18,36 @@ all: raylua_s raylua_e
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
src/raylua_boot.c: src/raylib.lua src/raylua.lua
$(LUA) tools/lua2str.lua $@ raylua_boot $^
all: luajit raylib raylua_s raylua_e
raylua_s: src/raylua_boot.o src/raylua_s.o
luajit:
$(MAKE) -C luajit amalg BUILDMODE=static
raylib:
$(MAKE) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" -C raylib/src
raylua_s: src/raylua.o src/raylua_s.o
$(CC) -o $@ $^ $(LDFLAGS)
raylua_e: src/lib/miniz.o src/raylua_boot.o src/raylua_builder.o src/raylua_e.o
$(CC) -o $@ $^ -lwray $(LDFLAGS)
raylua_e: src/raylua.o src/raylua_e.o src/raylua_builder.o src/lib/miniz.o
$(CC) -o $@ $^ $(LDFLAGS)
src/raylua.o: src/autogen/boot.c src/autogen/bind.c
src/raylua_builder.o: src/autogen/builder.c
src/autogen/boot.c: src/raylib.lua src/raylua.lua
$(LUA) tools/lua2str.lua $@ raylua_boot_lua $^
src/autogen/bind.c:
$(LUA) tools/genbind.lua $@
src/autogen/builder.c: src/raylua_builder.lua
$(LUA) tools/lua2str.lua $@ raylua_builder_lua $^
clean:
rm -rf raylua_s raylua_e src/raylua_boot.c src/*.o src/lib/miniz.o
rm -rf raylua_s raylua_e src/raylua_e.o src/raylua_s.o src/raylua.o src/autogen/*.c
$(MAKE) -C luajit clean
$(MAKE) -C raylib clean
.PHONY: raylua_s raylua_e
.PHONY: all src/autogen/bind.c src/autogen/boot.c raylua_s raylua_e luajit raylib clean

1
raylib Submodule

@ -0,0 +1 @@
Subproject commit acfa967e891997e862d1c77dac21ae9a484017c5

File diff suppressed because it is too large Load Diff

31
src/raylua.c Normal file
View File

@ -0,0 +1,31 @@
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include <raylib.h>
#include "autogen/bind.c"
#include "autogen/boot.c"
extern const char *raylua_boot_str;
void raylua_boot(lua_State *L, lua_CFunction loadfile)
{
lua_newtable(L);
if (loadfile) {
lua_pushstring(L, "loadfile");
lua_pushcfunction(L, loadfile);
lua_settable(L, -3);
}
lua_pushstring(L, "bind_entries");
lua_pushlightuserdata(L, raylua_entries);
lua_settable(L, -3);
lua_setglobal(L, "raylua");
if (luaL_dostring(L, raylua_boot_lua))
fputs(luaL_checkstring(L, -1), stderr);
}

8
src/raylua.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef H_RAYLUA
#define H_RAYLUA
#include <lua.h>
void raylua_boot(lua_State *L, lua_CFunction loadfile);
#endif /* H_RAYLUA */

View File

@ -1,22 +1,50 @@
local load = loadstring
if raylua then
-- Change the second loader to load files using raylua.loadfiles
package.loaders[2] = function (name)
for path in package.path:gmatch "([^;]+);?" do
path = path:gsub("?", name)
local status, content = raylua.loadfiles(path)
if status then
local f, err = load(content)
assert(f, err)
return f
end
end
return nil
end
end
require "main"
local load = loadstring
if raylua.loadfile then
package.path = "?.lua"
-- Change the second loader to load files using raylua.loadfile
package.loaders[2] = function (name)
for path in package.path:gmatch "([^;]+);?" do
path = path:gsub("?", name)
local status, content = raylua.loadfile(path)
if status then
local f, err = load(content)
assert(f, err)
return f
end
end
return nil
end
print "[RAYLUA] Load main.lua from payload."
require "main"
return
end
if arg[1] then
dofile(arg[1])
else
-- Run small REPL
print ">> raylua WIP repl <<"
print ""
while true do
io.write "> "
local line = io.read "l"
local f, err = loadstring(line)
if f then
local status, err = pcall(f)
if not status then
print(err)
end
else
print(err)
end
end
end

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
#ifndef H_RAYLUA_BOOT
#define H_RAYLUA_BOOT
extern const char *raylua_boot;
#endif /* H_RAYLUA_BOOT */

View File

@ -25,17 +25,19 @@
#ifdef WIN32
#include "lib/dirent.h"
#define stat _stat
#ifndef strcasecmp
#define strcasecmp strcmpi
#endif
#else
#include <dirent.h>
#endif
#include "lib/miniz.h"
#ifndef WRAY_NO_BUILDER
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#ifndef RAYLUA_NO_BUILDER
#include "autogen/builder.c"
static void append_file(FILE *dst, FILE *src)
{
size_t count;
@ -46,125 +48,151 @@ static void append_file(FILE *dst, FILE *src)
} while(count == 4096);
}
int wray_build_executable(const char *self_path, const char *input_path)
static void append_file_offset(FILE *output, FILE *source, FILE *input)
{
printf("Create new executable from %s.\n", input_path);
append_file(output, source);
fpos_t pos;
fgetpos(output, &pos);
append_file(output, input);
fwrite(&pos, sizeof(fpos_t), 1, output);
}
struct stat st;
int result = stat(input_path, &st);
if (result) {
printf("%s: Can't get file information.\n", input_path);
return 1;
typedef struct raylua_builder {
mz_zip_archive zip;
FILE *file;
fpos_t offset;
} raylua_builder;
raylua_builder *raylua_builder_new(const char *self_path, const char *path)
{
raylua_builder *builder = malloc(sizeof(raylua_builder));
mz_zip_zero_struct(&builder->zip);
FILE *f = fopen(path, "wb");
if (!f) {
free(builder);
return NULL;
}
size_t arg_len = strlen(input_path);
size_t len = arg_len + 5; // + ".exe\0"
char output_path[len];
strcpy(output_path, input_path);
if (output_path[arg_len - 1] == '/') {
/* Remove trailing '/'. */
output_path[arg_len - 1] = '\0';
arg_len--;
}
strncpy(output_path + arg_len, ".exe", 5);
FILE *output = fopen(output_path, "wb");
if (output == NULL) {
printf("Can't open %s for writing.\n", output_path);
return 1;
}
builder->file = f;
FILE *self = fopen(self_path, "rb");
if (self == NULL) {
puts("Can't open itself");
if (!self) {
free(builder);
fclose(f);
return NULL;
}
append_file(f, self);
fgetpos(f, &builder->offset); /* get eof offset */
fclose(self);
if (!mz_zip_writer_init_cfile(&builder->zip, f, 0)) {
free(builder);
fclose(f);
fclose(self);
return NULL;
}
return builder;
}
void raylua_builder_close(raylua_builder *builder)
{
mz_zip_writer_finalize_archive(&builder->zip);
/* Write offset */
fwrite(&builder->offset, sizeof(fpos_t), 1, builder->file);
fclose(builder->file);
free(builder);
}
void raylua_builder_add(raylua_builder *builder, const char *path, const char *dest)
{
if (!dest)
dest = path;
if (!mz_zip_writer_add_file(&builder->zip, dest, path, NULL, 0,
MZ_BEST_COMPRESSION))
printf("Unable to write %s (%s)\n", dest, path);
}
static int get_type(lua_State *L)
{
const char *path = luaL_checkstring(L, -1);
struct stat st;
if (stat(path, &st)) {
lua_pushboolean(L, 0);
return 1;
}
/* Copy self into output. */
append_file(output, self);
fclose(self);
if (S_ISREG(st.st_mode))
lua_pushstring(L, "file");
else if (S_ISDIR(st.st_mode))
lua_pushstring(L, "directory");
else
lua_pushstring(L, "other");
/* Get the offset to put it at the end of the file. */
fpos_t offset;
fgetpos(output, &offset);
return 1;
}
if (S_ISREG(st.st_mode)) {
/* Consider input as a bare bundle, just append file to get output. */
FILE *input = fopen(input_path, "rb");
static int list_dir(lua_State *L)
{
const char *path = luaL_checkstring(L, -1);
DIR *d = opendir(path);
append_file(output, input);
fclose(input);
} else if (S_ISDIR(st.st_mode)) {
/* We need to explore the directory and write each file to a zip file. */
mz_zip_archive zip;
mz_zip_zero_struct(&zip);
if (!d)
return 0;
if (!mz_zip_writer_init_cfile(&zip, output, 0)) {
puts("Can't initialize zip writter inside output.");
return 0;
}
struct dirent *entry;
size_t count = 0;
DIR *d = opendir(input_path);
chdir(input_path);
lua_newtable(L);
struct dirent *entry;
/* NOTE: Hardcoded 512 path limit. */
char dest_path[512];
while ((entry = readdir(d))) {
char *original_path = entry->d_name;
memset(dest_path, 0, 512);
struct stat st;
if (stat(original_path, &st)) {
printf("Skip %s (stat() failed)\n", original_path);
continue;
}
if (!S_ISREG(st.st_mode)) {
printf("Skip %s (not a file)\n", original_path);
continue;
}
size_t len = strlen(original_path);
if (len > 512) {
printf("Skipping %s: path too long\n", original_path);
continue;
}
if (len > 5 && strcmp(original_path + len - 5, ".wren") == 0) {
len -= 5; /* Exclude .wren extension. */
}
strncpy(dest_path, original_path, len);
printf("Add %s (original: %s)...\n", dest_path, original_path);
if (!mz_zip_writer_add_file(&zip, dest_path, original_path, NULL, 0,
MZ_BEST_COMPRESSION)) {
printf("miniz error: %x\n", mz_zip_get_last_error(&zip));
}
}
closedir(d);
puts("Finalizing zip archive...");
if (!mz_zip_writer_finalize_archive(&zip))
puts("Can't finalize archive.");
mz_zip_end(&zip);
// Write offset
fwrite(&offset, sizeof(fpos_t), 1, output);
fclose(output);
while ((entry = readdir(d))) {
lua_pushstring(L, entry->d_name);
lua_rawseti(L, -2, count++);
}
free(output_path);
closedir(d);
return 1;
}
int raylua_build_executable(const char *self, const char *input)
{
lua_State *L = luaL_newstate();
luaL_openlibs(L);
lua_pushcfunction(L, get_type);
lua_setglobal(L, "get_type");
lua_pushcfunction(L, list_dir);
lua_setglobal(L, "list_dir");
lua_pushlightuserdata(L, append_file_offset);
lua_setglobal(L, "append_file_offset");
lua_pushlightuserdata(L, &raylua_builder_new);
lua_setglobal(L, "builder_new");
lua_pushlightuserdata(L, &raylua_builder_close);
lua_setglobal(L, "builder_close");
lua_pushlightuserdata(L, &raylua_builder_add);
lua_setglobal(L, "builder_add");
lua_pushstring(L, self);
lua_setglobal(L, "self_path");
lua_pushstring(L, input);
lua_setglobal(L, "input_path");
if (luaL_dostring(L, raylua_builder_lua))
fputs(luaL_checkstring(L, -1), stderr);
return 0;
}
#endif

112
src/raylua_builder.lua Normal file
View File

@ -0,0 +1,112 @@
local t = get_type(input_path)
local ffi = require "ffi"
print ">> Raylua builder <<"
ffi.cdef "typedef struct raylua_builder raylua_builder;"
local builder_new = ffi.cast("raylua_builder *(*)(const char *, const char *)", builder_new)
local builder_close = ffi.cast("void (*)(raylua_builder *)", builder_close)
local builder_add = ffi.cast("void (*)(raylua_builder *, const char *, const char *)", builder_add)
local function path_concat(...)
return table.concat({ ... }, "/")
end
if ffi.os == "Windows" and self_path:sub("-4") ~= ".exe" then
self_path = self_path .. ".exe"
end
print("Self is " .. self_path)
if t == "directory" then
local path = input_path
if ffi.os == "Windows" then
path = path .. ".exe"
else
path = path .. ".elf"
end
print("Building " .. path)
local builder = builder_new(self_path, path)
assert(builder ~= ffi.new("void *", nil), "Can't initialize builder")
local have_main = false
local function add_dir(root, dir)
for i,file in ipairs(list_dir(path_concat(root, dir))) do
if file ~= ".." then
local partial_file_path, full_file_path
if dir then
partial_file_path = path_concat(dir, file)
full_file_path = path_concat(root, dir, file)
else
partial_file_path = file
full_file_path = path_concat(root, file)
end
if partial_file_path == "main.lua" then
have_main = true
end
local t = get_type(full_file_path)
if t == "file" then
print("Adding file " .. partial_file_path)
builder_add(builder, full_file_path, partial_file_path)
elseif t == "directory" then
print("Adding directory " .. partial_file_path .. "/")
add_dir(root, partial_file_path)
else
print("Unknown file type " .. partial_file_path)
end
end
end
end
add_dir(input_path, nil)
if not have_main then
print("WARN: main.lua is missing, your executable may not run")
end
builder_close(builder)
elseif t == "file" then
local ext = input_path:sub(-4)
-- Remove extension
local path = input_path:sub(0, #input_path - 4)
if ffi.os == "Windows" then
path = path .. ".exe"
else
path = path .. ".elf"
end
print("Building " .. path)
if ext == ".zip" then
print "Build from zip file."
local dest = assert(io.open(path, "wb"), "Can't open destination file.")
local source = assert(io.open(self_path, "rb"), "Can't open self file.")
local input = assert(io.open(input_path, "rb"), "Can't open zip file.")
append_file_offset(output, source, input)
dest:close()
source:close()
input:close()
elseif ext == ".lua" then
print "Build from lua file."
local builder = builder_new(self_path, path)
builder_add(builder, input_path, "main.lua")
builder_close(builder)
end
end
print "Done"

View File

@ -14,7 +14,7 @@
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* Wray embedded executable */
/* Raylua embedded executable */
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
@ -23,11 +23,11 @@
#include <lualib.h>
#include <lauxlib.h>
#include "raylua_boot.h"
#include "raylua.h"
#include "lib/miniz.h"
#ifndef WRAY_NO_BUILDER
#ifndef RAYLUA_NO_BUILDER
int raylua_build_executable(const char *self_path, const char *input_path);
#endif
@ -97,10 +97,12 @@ int main(int argc, const char **argv)
}
lua_State *L = luaL_newstate();
luaL_openlibs(L);
if (L == NULL)
puts("[RAYLUA] Unable to initialize Lua.");
/* Populate arg. */
lua_newtable(L);
int i = 0;
@ -113,10 +115,7 @@ int main(int argc, const char **argv)
lua_setglobal(L, "arg");
lua_pushcfunction(L, raylua_loadfile);
lua_setglobal(L, "raylua_loadfile");
luaL_dostring(L, raylua_boot);
raylua_boot(L, raylua_loadfile);
lua_close(L);
return 0;
}

View File

@ -18,7 +18,7 @@
#include <stdlib.h>
#include <string.h>
#include "raylua_boot.h"
#include "raylua.h"
#include <lua.h>
#include <lualib.h>
@ -27,6 +27,7 @@
int main(int argc, const char **argv)
{
lua_State *L = luaL_newstate();
luaL_openlibs(L);
if (L == NULL)
puts("[RAYLUA] Unable to initialize Lua.");
@ -43,7 +44,7 @@ int main(int argc, const char **argv)
lua_setglobal(L, "arg");
luaL_dostring(L, raylua_boot);
raylua_boot(L, NULL);
lua_close(L);
return 0;
}

430
tools/api.h Normal file
View File

@ -0,0 +1,430 @@
void InitWindow(int width, int height, const char *title);
bool WindowShouldClose(void);
void CloseWindow(void);
bool IsWindowReady(void);
bool IsWindowMinimized(void);
bool IsWindowResized(void);
bool IsWindowHidden(void);
void ToggleFullscreen(void);
void UnhideWindow(void);
void HideWindow(void);
void SetWindowIcon(Image image);
void SetWindowTitle(const char *title);
void SetWindowPosition(int x, int y);
void SetWindowMonitor(int monitor);
void SetWindowMinSize(int width, int height);
void SetWindowSize(int width, int height);
void *GetWindowHandle(void);
int GetScreenWidth(void);
int GetScreenHeight(void);
int GetMonitorCount(void);
int GetMonitorWidth(int monitor);
int GetMonitorHeight(int monitor);
int GetMonitorPhysicalWidth(int monitor);
int GetMonitorPhysicalHeight(int monitor);
Vector2 GetWindowPosition(void);
const char *GetMonitorName(int monitor);
const char *GetClipboardText(void);
void SetClipboardText(const char *text);
void ShowCursor(void);
void HideCursor(void);
bool IsCursorHidden(void);
void EnableCursor(void);
void DisableCursor(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 BeginScissorMode(int x, int y, int width, int height);
void EndScissorMode(void);
Ray GetMouseRay(Vector2 mousePosition, Camera camera);
Matrix GetCameraMatrix(Camera camera);
Matrix GetCameraMatrix2D(Camera2D camera);
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);
void SetTargetFPS(int fps);
int GetFPS(void);
float GetFrameTime(void);
double GetTime(void);
int ColorToInt(Color color);
Vector4 ColorNormalize(Color color);
Color ColorFromNormalized(Vector4 normalized);
Vector3 ColorToHSV(Color color);
Color ColorFromHSV(Vector3 hsv);
Color GetColor(int hexValue);
Color Fade(Color color, float alpha);
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 TakeScreenshot(const char *fileName);
int GetRandomValue(int min, int max);
unsigned char *LoadFileData(const char *fileName, int *bytesRead);
void SaveFileData(const char *fileName, void *data, int bytesToWrite);
bool FileExists(const char *fileName);
bool IsFileExtension(const char *fileName, const char *ext);
bool DirectoryExists(const char *dirPath);
const char *GetExtension(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);
char **GetDirectoryFiles(const char *dirPath, int *count);
void ClearDirectoryFiles(void);
bool ChangeDirectory(const char *dir);
bool IsFileDropped(void);
char **GetDroppedFiles(int *count);
void ClearDroppedFiles(void);
long GetFileModTime(const char *fileName);
unsigned char *CompressData(unsigned char *data, int dataLength, int *compDataLength);
unsigned char *DecompressData(unsigned char *compData, int compDataLength, int *dataLength);
void SaveStorageValue(int position, int value);
int LoadStorageValue(int position);
void OpenURL(const char *url);
bool IsKeyPressed(int key);
bool IsKeyDown(int key);
bool IsKeyReleased(int key);
bool IsKeyUp(int key);
void SetExitKey(int key);
int GetKeyPressed(void);
bool IsGamepadAvailable(int gamepad);
bool IsGamepadName(int gamepad, const char *name);
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);
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);
void SetMousePosition(int x, int y);
void SetMouseOffset(int offsetX, int offsetY);
void SetMouseScale(float scaleX, float scaleY);
int GetMouseWheelMove(void);
int GetTouchX(void);
int GetTouchY(void);
Vector2 GetTouchPosition(int index);
void SetGesturesEnabled(unsigned int gestureFlags);
bool IsGestureDetected(int gesture);
int GetGestureDetected(void);
int GetTouchPointsCount(void);
float GetGestureHoldDuration(void);
Vector2 GetGestureDragVector(void);
float GetGestureDragAngle(void);
Vector2 GetGesturePinchVector(void);
float GetGesturePinchAngle(void);
void SetCameraMode(Camera camera, int mode);
void UpdateCamera(Camera *camera);
void SetCameraPanControl(int panKey);
void SetCameraAltControl(int altKey);
void SetCameraSmoothZoomControl(int szKey);
void SetCameraMoveControls(int frontKey, int backKey, int rightKey, int leftKey, int upKey, int downKey);
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 DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color);
void DrawLineStrip(Vector2 *points, int numPoints, Color color);
void DrawCircle(int centerX, int centerY, float radius, Color color);
void DrawCircleSector(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color);
void DrawCircleSectorLines(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color);
void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2);
void DrawCircleV(Vector2 center, float radius, Color color);
void DrawCircleLines(int centerX, int centerY, float radius, Color color);
void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color);
void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color);
void DrawRing(Vector2 center, float innerRadius, float outerRadius, int startAngle, int endAngle, int segments, Color color);
void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, int startAngle, int endAngle, int segments, 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 color1, Color color2);
void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);
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, int lineThick, Color color);
void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color);
void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int lineThick, Color color);
void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color);
void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color);
void DrawTriangleFan(Vector2 *points, int numPoints, Color color);
void DrawTriangleStrip(Vector2 *points, int pointsCount, 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);
bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2);
bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2);
bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);
Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2);
bool CheckCollisionPointRec(Vector2 point, Rectangle rec);
bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius);
bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3);
Image LoadImage(const char *fileName);
Image LoadImageEx(Color *pixels, int width, int height);
Image LoadImagePro(void *data, int width, int height, int format);
Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize);
void ExportImage(Image image, const char *fileName);
void ExportImageAsCode(Image image, const char *fileName);
Texture2D LoadTexture(const char *fileName);
Texture2D LoadTextureFromImage(Image image);
TextureCubemap LoadTextureCubemap(Image image, int layoutType);
RenderTexture2D LoadRenderTexture(int width, int height);
void UnloadImage(Image image);
void UnloadTexture(Texture2D texture);
void UnloadRenderTexture(RenderTexture2D target);
Color *GetImageData(Image image);
Vector4 *GetImageDataNormalized(Image image);
Rectangle GetImageAlphaBorder(Image image, float threshold);
int GetPixelDataSize(int width, int height, int format);
Image GetTextureData(Texture2D texture);
Image GetScreenData(void);
void UpdateTexture(Texture2D texture, const void *pixels);
Image ImageCopy(Image image);
Image ImageFromImage(Image image, Rectangle rec);
void ImageToPOT(Image *image, Color fillColor);
void ImageFormat(Image *image, int newFormat);
void ImageAlphaMask(Image *image, Image alphaMask);
void ImageAlphaClear(Image *image, Color color, float threshold);
void ImageAlphaCrop(Image *image, float threshold);
void ImageAlphaPremultiply(Image *image);
void ImageCrop(Image *image, Rectangle crop);
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 color);
void ImageMipmaps(Image *image);
void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp);
Color *ImageExtractPalette(Image image, int maxPaletteSize, int *extractCount);
Image ImageText(const char *text, int fontSize, Color color);
Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint);
void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint);
void ImageDrawRectangle(Image *dst, Rectangle rec, Color color);
void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color);
void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color);
void ImageDrawTextEx(Image *dst, Vector2 position, Font font, const char *text, float fontSize, float spacing, Color color);
void ImageFlipVertical(Image *image);
void ImageFlipHorizontal(Image *image);
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, float contrast);
void ImageColorBrightness(Image *image, int brightness);
void ImageColorReplace(Image *image, Color color, Color replace);
Image GenImageColor(int width, int height, Color color);
Image GenImageGradientV(int width, int height, Color top, Color bottom);
Image GenImageGradientH(int width, int height, Color left, Color right);
Image GenImageGradientRadial(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);
void GenTextureMipmaps(Texture2D *texture);
void SetTextureFilter(Texture2D texture, int filterMode);
void SetTextureWrap(Texture2D texture, int wrapMode);
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 sourceRec, Vector2 position, Color tint);
void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint);
void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint);
void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle destRec, Vector2 origin, float rotation, Color tint);
Font GetFontDefault(void);
Font LoadFont(const char *fileName);
Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount);
Font LoadFontFromImage(Image image, Color key, int firstChar);
CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type);
Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int charsCount, int fontSize, int padding, int packMethod);
void UnloadFont(Font font);
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 DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint);
void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint);
void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float scale, Color tint);
int MeasureText(const char *text, int fontSize);
Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing);
int GetGlyphIndex(Font font, int codepoint);
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);
char *TextReplace(char *text, const char *replace, const char *by);
char *TextInsert(const char *text, const char *insert, int position);
const char *TextJoin(const char **textList, int count, const char *delimiter);
const 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 *find);
const char *TextToUpper(const char *text);
const char *TextToLower(const char *text);
const char *TextToPascal(const char *text);
int TextToInteger(const char *text);
char *TextToUtf8(int *codepoints, int length);
int *GetCodepoints(const char *text, int *count);
int GetCodepointsCount(const char *text);
int GetNextCodepoint(const char *text, int *bytesProcessed);
const char *CodepointToUtf8(int codepoint, int *byteLength);
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 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 DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float length, 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 slices, Color color);
void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color);
void DrawPlane(Vector3 centerPos, Vector2 size, Color color);
void DrawRay(Ray ray, Color color);
void DrawGrid(int slices, float spacing);
void DrawGizmo(Vector3 position);
Model LoadModel(const char *fileName);
Model LoadModelFromMesh(Mesh mesh);
void UnloadModel(Model model);
Mesh *LoadMeshes(const char *fileName, int *meshCount);
void ExportMesh(Mesh mesh, const char *fileName);
void UnloadMesh(Mesh mesh);
Material *LoadMaterials(const char *fileName, int *materialCount);
Material LoadMaterialDefault(void);
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 *animsCount);
void UpdateModelAnimation(Model model, ModelAnimation anim, int frame);
void UnloadModelAnimation(ModelAnimation anim);
bool IsModelAnimationValid(Model model, ModelAnimation anim);
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 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);
BoundingBox MeshBoundingBox(Mesh mesh);
void MeshTangents(Mesh *mesh);
void MeshBinormals(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);
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 center, float size, Color tint);
void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint);
bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB);
bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2);
bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius);
bool CheckCollisionRaySphere(Ray ray, Vector3 center, float radius);
bool CheckCollisionRaySphereEx(Ray ray, Vector3 center, float radius, Vector3 *collisionPoint);
bool CheckCollisionRayBox(Ray ray, BoundingBox box);
RayHitInfo GetCollisionRayModel(Ray ray, Model model);
RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3);
RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight);
char *LoadText(const char *fileName);
Shader LoadShader(const char *vsFileName, const char *fsFileName);
Shader LoadShaderCode(const char *vsCode, const char *fsCode);
void UnloadShader(Shader shader);
Shader GetShaderDefault(void);
Texture2D GetTextureDefault(void);
Texture2D GetShapesTexture(void);
Rectangle GetShapesTextureRec(void);
void SetShapesTexture(Texture2D texture, Rectangle source);
int GetShaderLocation(Shader shader, const char *uniformName);
void SetShaderValue(Shader shader, int uniformLoc, const void *value, int uniformType);
void SetShaderValueV(Shader shader, int uniformLoc, const void *value, int uniformType, int count);
void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat);
void SetShaderValueTexture(Shader shader, int uniformLoc, Texture2D texture);
void SetMatrixProjection(Matrix proj);
void SetMatrixModelview(Matrix view);
Matrix GetMatrixModelview(void);
Matrix GetMatrixProjection(void);
Texture2D GenTextureCubemap(Shader shader, Texture2D map, int size);
Texture2D GenTextureIrradiance(Shader shader, Texture2D cubemap, int size);
Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size);
Texture2D GenTextureBRDF(Shader shader, int size);
void BeginShaderMode(Shader shader);
void EndShaderMode(void);
void BeginBlendMode(int mode);
void EndBlendMode(void);
void InitVrSimulator(void);
void CloseVrSimulator(void);
void UpdateVrTracking(Camera *camera);
void SetVrConfiguration(VrDeviceInfo info, Shader distortion);
bool IsVrSimulatorReady(void);
void ToggleVrMode(void);
void BeginVrDrawing(void);
void EndVrDrawing(void);
void InitAudioDevice(void);
void CloseAudioDevice(void);
bool IsAudioDeviceReady(void);
void SetMasterVolume(float volume);
Wave LoadWave(const char *fileName);
Sound LoadSound(const char *fileName);
Sound LoadSoundFromWave(Wave wave);
void UpdateSound(Sound sound, const void *data, int samplesCount);
void UnloadWave(Wave wave);
void UnloadSound(Sound sound);
void ExportWave(Wave wave, const char *fileName);
void ExportWaveAsCode(Wave wave, const char *fileName);
void PlaySound(Sound sound);
void StopSound(Sound sound);
void PauseSound(Sound sound);
void ResumeSound(Sound sound);
void PlaySoundMulti(Sound sound);
void StopSoundMulti(void);
int GetSoundsPlaying(void);
bool IsSoundPlaying(Sound sound);
void SetSoundVolume(Sound sound, float volume);
void SetSoundPitch(Sound sound, float pitch);
void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels);
Wave WaveCopy(Wave wave);
void WaveCrop(Wave *wave, int initSample, int finalSample);
float *GetWaveData(Wave wave);
Music LoadMusicStream(const char *fileName);
void UnloadMusicStream(Music music);
void PlayMusicStream(Music music);
void UpdateMusicStream(Music music);
void StopMusicStream(Music music);
void PauseMusicStream(Music music);
void ResumeMusicStream(Music music);
bool IsMusicPlaying(Music music);
void SetMusicVolume(Music music, float volume);
void SetMusicPitch(Music music, float pitch);
void SetMusicLoopCount(Music music, int count);
float GetMusicTimeLength(Music music);
float GetMusicTimePlayed(Music music);
AudioStream InitAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels);
void UpdateAudioStream(AudioStream stream, const void *data, int samplesCount);
void CloseAudioStream(AudioStream stream);
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 SetAudioStreamBufferSizeDefault(int size);

76
tools/genbind.lua Normal file
View File

@ -0,0 +1,76 @@
local keywords = {
"int", "long", "short", "char", "float", "double",
"uint8_t", "uint16_t", "uint32_t", "uint64_t",
"const", "unsigned", "register",
"void", "intptr_t", "bool"
}
local structs = {
"Vector2", "Vector3", "Vector4", "Quaternion",
"Matrix", "Color", "Rectangle", "Image", "Texture", "Texture2D",
"RenderTexture", "NPatchInfo", "CharInfo", "Font",
"Camera", "Camera2D", "Mesh", "Shader", "MaterialMap",
"Material", "Model", "Transform", "BoneInfo", "ModelAnimation",
"Ray", "RayHitInfo", "BoundingBox", "Wave", "Sound", "Music",
"AudioStream", "VrDeviceInfo", "Camera3D", "RenderTexture2D",
"TextureCubemap", "TraceLogCallback"
}
local functions = {}
local proto = {}
for line in io.lines "tools/api.h" do
line = line:gsub("(%W)([%l%d]%w*)", function (before, part)
for i,keyword in ipairs(keywords) do
if part == keyword then
return before .. part
end
end
return before
end)
local count = 0
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
count = count + 1
if count == 2 then
print("WARN: Multiple match for: " .. line)
end
return "(*)"
end)
proto[#proto + 1] = line:gsub(";", "")
end
assert(#proto == #functions, "Mismatching proto and function count.")
local file = io.open(arg[1], "w")
file:write [[
struct raylua_bind_entry {
const char *name;
const char *proto;
void *ptr;
};
struct raylua_bind_entry raylua_entries[] = {
]]
for i=1,#proto do
local name, proto = functions[i], proto[i]
file:write(string.format('{ "%s", "%s", &%s },\n', name, proto, name))
end
file:write '{ NULL, NULL, NULL },\n'
file:write "};\n"
file:close()