Compare commits
No commits in common. "master" and "compute-shaders" have entirely different histories.
master
...
compute-sh
14
.gitignore
vendored
14
.gitignore
vendored
@ -1,12 +1,14 @@
|
||||
*.o
|
||||
*.res
|
||||
*.a
|
||||
wray_standalone\.exe
|
||||
src/wray_api\.c
|
||||
libwray\.a
|
||||
|
||||
raylua_e.exe
|
||||
raylua_r.exe
|
||||
raylua_s.exe
|
||||
raylua_s
|
||||
raylua_e
|
||||
|
||||
src/autogen/bind.c
|
||||
src/autogen/boot.c
|
||||
src/autogen/builder.c
|
||||
libraylua.a
|
||||
|
||||
libraylua.a
|
||||
src/res/icon.res
|
||||
|
5
.gitmodules
vendored
5
.gitmodules
vendored
@ -1,11 +1,10 @@
|
||||
[submodule "LuaJIT"]
|
||||
path = luajit
|
||||
url = https://github.com/LuaJIT/LuaJIT
|
||||
branch = v2.0
|
||||
url = https://github.com/moonjit/moonjit
|
||||
|
||||
[submodule "raylib"]
|
||||
path = raylib
|
||||
url = https://github.com/raysan5/raylib
|
||||
url = https://github.com/TSnake41/raylib
|
||||
|
||||
[submodule "raygui"]
|
||||
path = raygui
|
||||
|
@ -1,5 +1,3 @@
|
||||
**NOTE:** This is a clone of [raylib-lua from TSnake41](https://github.com/TSnake41/raylib-lua), but using LuaJIT 2.0 instead of 2.1+, to support CPUs without SSE2.
|
||||
|
||||
![raylib-lua logo](assets/logo.png)
|
||||
|
||||
[![release](https://img.shields.io/github/v/release/TSnake41/raylib-lua?style=flat-square)](https://github.com/TSnake41/raylib-lua/releases/latest)
|
||||
@ -65,8 +63,8 @@ If you need to update raylib binding, there are few tasks to do :
|
||||
|
||||
### Loading embedded ressources
|
||||
|
||||
Currently, raylib-lua support loading ressources from payload using
|
||||
raylib API. You can also arbitrarily load files from payload using
|
||||
Currently, raylib-lua doesn't support loading ressources from payload using
|
||||
raylib API. However, you can still arbitrarily load files from payload using
|
||||
`raylua.loadfile` which returns a boolean indicating success and file content.
|
||||
|
||||
### Making structs
|
||||
|
168
Saphirefile.lua
168
Saphirefile.lua
@ -1,168 +0,0 @@
|
||||
--[[
|
||||
Saphire-based build system for raylib-lua
|
||||
Copyright (C) 2021 Astie Teddy
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
]]
|
||||
|
||||
local saphire = require "saphire"
|
||||
local c = require "saphire-c"
|
||||
local Future = require "saphire-future"
|
||||
local los = require "los"
|
||||
|
||||
local cc = os.getenv "CC" or "cc"
|
||||
local ar = os.getenv "AR" or "ar"
|
||||
local windres = os.getenv "WINDRES" or "windres"
|
||||
|
||||
-- TODO: Use current lua interpreter
|
||||
local lua = os.getenv "LUA"
|
||||
local needs_luajit_built = not (os.getenv "LUA")
|
||||
|
||||
local cflags = os.getenv "CFLAGS" or "-O2 -s"
|
||||
local ldflags = os.getenv "LDFLAGS" or "-O2 -s -lm"
|
||||
local ldflags_r = os.getenv "LDFLAGS_R" or ""
|
||||
|
||||
local modules = "raymath rlgl easings gestures physac raygui"
|
||||
local graphics = os.getenv "GRAPHICS" or "GRAPHICS_API_OPENGL_43"
|
||||
|
||||
cflags = cflags .. " -Iluajit/src -Iraygui/src -Iraylib/src".. " -D" .. graphics
|
||||
|
||||
local raylua_so_path = "raylua.so" -- assume unix-like by default
|
||||
local so_ldflags = ldflags
|
||||
|
||||
if los.type() == "linux" then
|
||||
ldflags = ldflags .. " -ldl -pthread"
|
||||
cflags = cflags .. " -fPIC"
|
||||
so_ldflags = ldflags .. " -llua5.1"
|
||||
lua = lua or "luajit/src/luajit"
|
||||
elseif los.type() == "win32" then
|
||||
ldflags = ldflags .. " -lopengl32 -lgdi32 -lwinmm -static "
|
||||
so_ldflags = ldflags .. " -llua5.1.dll"
|
||||
raylua_so_path = "raylua.dll"
|
||||
ldflags_r = ldflags_r .. "-mwindows"
|
||||
lua = lua or "luajit\\src\\luajit"
|
||||
end
|
||||
|
||||
local libluajit
|
||||
if saphire.targets.clean then
|
||||
libluajit = {
|
||||
command = "make -C luajit clean",
|
||||
name = "LuaJIT"
|
||||
}
|
||||
else
|
||||
libluajit = {
|
||||
command = string.format("make -C luajit amalg CC=%s BUILDMODE=static MACOSX_DEPLOYMENT_TARGET=10.13", cc),
|
||||
name = "LuaJIT"
|
||||
}
|
||||
end
|
||||
saphire.do_single(libluajit)
|
||||
libluajit[1] = "luajit/src/libluajit.a"
|
||||
|
||||
local libraylib = Future "raylib/src/libraylib.a"
|
||||
saphire.do_subdir("raylib/src", false, "build/buildRaylib.lua", libraylib)
|
||||
|
||||
local function lua2c(files, output, name)
|
||||
if saphire.targets.clean then
|
||||
return string.format("rm -f %s", output)
|
||||
else
|
||||
return string.format("%s tools/lua2str.lua %s %s %s", lua, output, name, table.concat(files, " "))
|
||||
end
|
||||
end
|
||||
|
||||
local function genbind(output, modules)
|
||||
if saphire.targets.clean then
|
||||
return string.format("rm -f %s", output)
|
||||
else
|
||||
return string.format("%s tools/genbind.lua src/autogen/bind.c %s", lua, modules)
|
||||
end
|
||||
end
|
||||
|
||||
local raylua_src = {
|
||||
c.src("src/raylua.c", function ()
|
||||
-- Generate bind.c and boot.c
|
||||
if needs_luajit_built then
|
||||
-- LuaJIT needs to be built
|
||||
libluajit:wait()
|
||||
end
|
||||
|
||||
saphire.do_multi({
|
||||
{
|
||||
command = lua2c(
|
||||
{ "src/raylib.lua", "src/compat.lua", "src/raylua.lua" },
|
||||
"src/autogen/boot.c",
|
||||
"raylua_boot_lua"
|
||||
),
|
||||
name = "boot.c"
|
||||
},
|
||||
{
|
||||
command = genbind("src/autogen/bind.c", modules),
|
||||
name = "bind.c"
|
||||
}
|
||||
}, true)
|
||||
end)
|
||||
}
|
||||
local raylua_obj = c.compile(raylua_src, cflags .. " -D" .. graphics, "raylua", cc)
|
||||
|
||||
local libraylua = c.lib("libraylua.a", raylua_obj, "raylua", ar)
|
||||
|
||||
local raylua_s_src = {
|
||||
"src/raylua_s.c"
|
||||
}
|
||||
local raylua_s_objs = c.compile(raylua_s_src, cflags, "raylua_s", cc)
|
||||
|
||||
local raylua_e_src = {
|
||||
c.src("src/raylua_builder.c", function ()
|
||||
saphire.do_single(lua2c({ "src/raylua_builder.lua" }, "src/autogen/builder.c", "raylua_builder_lua"), true)
|
||||
end),
|
||||
"src/raylua_e.c",
|
||||
"src/lib/miniz.c",
|
||||
"src/raylua_self.c",
|
||||
}
|
||||
local raylua_e_objs = c.compile(raylua_e_src, cflags, "raylua_e", cc)
|
||||
|
||||
local icon
|
||||
if los.type() == "win32" then
|
||||
icon = c.res("src/res/icon.rc", { "src/res/icon.ico" }, "icon", windres)
|
||||
end
|
||||
|
||||
local raylua_s = c.link("raylua_s",
|
||||
saphire.merge(raylua_s_objs, { libraylua, libraylib, libluajit, icon }),
|
||||
ldflags,
|
||||
false,
|
||||
"raylua_s",
|
||||
cc
|
||||
)
|
||||
|
||||
local raylua_e = c.link("raylua_e",
|
||||
saphire.merge(raylua_e_objs, { libraylua, libraylib, libluajit, icon }),
|
||||
ldflags,
|
||||
false,
|
||||
"raylua_e",
|
||||
cc
|
||||
)
|
||||
|
||||
local raylua_r = c.link("raylua_r",
|
||||
saphire.merge(raylua_e_objs, { libraylua, libraylib, libluajit, icon }),
|
||||
ldflags .. " " .. ldflags_r,
|
||||
false,
|
||||
"raylua_r",
|
||||
cc
|
||||
)
|
||||
|
||||
local raylua_so = c.link(raylua_so_path,
|
||||
saphire.merge(raylua_obj, { libraylib }),
|
||||
so_ldflags,
|
||||
true,
|
||||
raylua_so_path,
|
||||
cc
|
||||
)
|
@ -1,101 +0,0 @@
|
||||
local saphire = require "saphire"
|
||||
|
||||
local cc = os.getenv "CC" or "cc"
|
||||
local ar = os.getenv "AR" or "ar"
|
||||
|
||||
local cflags = os.getenv "CFLAGS" or "-O2 -s"
|
||||
local ldflags = os.getenv "LDFLAGS" or "-O2 -s -lm"
|
||||
|
||||
local include_paths = "-I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw"
|
||||
|
||||
local los = require "los"
|
||||
|
||||
local consts = {
|
||||
RAYLIB_VERSION = "3.7.0",
|
||||
RAYLIB_API_VERSION = "370",
|
||||
}
|
||||
|
||||
local vars = saphire.map({
|
||||
{ "RAYLIB_LIBTYPE", "STATIC" },
|
||||
{ "RAYLIB_BUILD_MODE", "RELEASE" },
|
||||
{ "RAYLIB_LIB_NAME", "raylib" },
|
||||
{ "RAYLIB_RES_FILE", "./raylib.dll.rc.data" },
|
||||
{ "PLATFORM", "PLATFORM_DESKTOP" },
|
||||
{ "GRAPHICS", "GRAPHICS_API_OPENGL_33" },
|
||||
{ "USE_EXTERNAL_GLFW", "FALSE" },
|
||||
{ "USE_WAYLAND_DISPLAY", "FALSE" }
|
||||
}, function (v)
|
||||
return { v[1], os.getenv(v[1]) or v[2] }
|
||||
end)
|
||||
|
||||
for i,v in ipairs(vars) do
|
||||
vars[v[1]] = v[2]
|
||||
end
|
||||
|
||||
local function build_c(src, obj, flags)
|
||||
return {
|
||||
command = string.format("%s -fdiagnostics-color=always -c -o %s %s %s %s %s", cc, obj, src, flags or "", cflags, ldflags),
|
||||
name = "raylib",
|
||||
display = obj
|
||||
}
|
||||
end
|
||||
|
||||
local function build_a(objs, lib)
|
||||
return {
|
||||
command = string.format("%s rcs %s %s", ar, lib, table.concat(objs, " ")),
|
||||
name = "raylib",
|
||||
lib = lib
|
||||
}
|
||||
end
|
||||
|
||||
local function build_e(files, output, flags)
|
||||
return {
|
||||
command = string.format("%s -fdiagnostics-color=always -o %s %s %s %s", cc, output, table.concat(files, " "), flags or "", ldflags),
|
||||
name = "raylib",
|
||||
display = output
|
||||
}
|
||||
end
|
||||
|
||||
local function build_res(src, output)
|
||||
return {
|
||||
command = string.format("%s %s -O coff %s", windres, src, output),
|
||||
name = "raylib"
|
||||
}
|
||||
end
|
||||
|
||||
local objects = {
|
||||
-- ["obj.o"] = { src... }
|
||||
{ "rcore.o", { "rcore.c", "raylib.h", "rlgl.h", "utils.h", "raymath.h", "camera.h", "rgestures.h" } },
|
||||
{ "rglfw.o", { "rglfw.c", flags = os.getenv "GLFW_OSX" or "" } },
|
||||
{ "rshapes.o", { "rshapes.c", "raylib.h", "rlgl.h" } },
|
||||
{ "rtextures.o", { "rtextures.c", "raylib.h", "rlgl.h", "utils.h" } },
|
||||
{ "rtext.o", { "rtext.c", "raylib.h", "utils.h" } },
|
||||
{ "utils.o", { "utils.c", "utils.h" } },
|
||||
{ "rmodels.o", { "rmodels.c", "raylib.h", "rlgl.h", "raymath.h" } },
|
||||
{ "raudio.o", { "raudio.c", "raylib.h" } }
|
||||
}
|
||||
|
||||
if saphire.targets.clean then
|
||||
saphire.do_multi(
|
||||
saphire.map(objects, function (obj_info)
|
||||
return {
|
||||
command = string.format("rm -f %s", obj_info[1])
|
||||
}
|
||||
end), true)
|
||||
else
|
||||
saphire.do_multi(
|
||||
saphire.map(objects, function (obj_info)
|
||||
return function()
|
||||
local obj, src = unpack(obj_info)
|
||||
saphire.do_recipe(src, obj, build_c(src[1], obj,
|
||||
table.concat({ "-D" .. vars.PLATFORM, "-D" .. vars.GRAPHICS, include_paths, src.flags }, " ")),
|
||||
true)
|
||||
end
|
||||
end), true)
|
||||
|
||||
saphire.do_single(
|
||||
build_a(
|
||||
saphire.map(objects, function (obj) return obj[1] end),
|
||||
"libraylib.a"),
|
||||
true)
|
||||
end
|
@ -1,61 +0,0 @@
|
||||
local future = arg[1]
|
||||
|
||||
local saphire = require "saphire"
|
||||
local c = require "saphire-c"
|
||||
|
||||
local cc = os.getenv "CC" or "cc"
|
||||
local ar = os.getenv "AR" or "ar"
|
||||
|
||||
local cflags = os.getenv "CFLAGS" or "-O2 -s"
|
||||
|
||||
local include_paths = "-I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw"
|
||||
|
||||
local los = require "los"
|
||||
|
||||
if los.type() == "linux" then
|
||||
cflags = cflags .. " -fPIC"
|
||||
end
|
||||
|
||||
local consts = {
|
||||
RAYLIB_VERSION = "4.0.0",
|
||||
RAYLIB_API_VERSION = "400",
|
||||
}
|
||||
|
||||
local vars = saphire.map({
|
||||
{ "RAYLIB_LIBTYPE", "STATIC" },
|
||||
{ "RAYLIB_BUILD_MODE", "RELEASE" },
|
||||
{ "RAYLIB_LIB_NAME", "raylib" },
|
||||
{ "RAYLIB_RES_FILE", "./raylib.dll.rc.data" },
|
||||
{ "PLATFORM", "PLATFORM_DESKTOP" },
|
||||
{ "GRAPHICS", "GRAPHICS_API_OPENGL_43" },
|
||||
{ "USE_EXTERNAL_GLFW", "FALSE" },
|
||||
{ "USE_WAYLAND_DISPLAY", "FALSE" }
|
||||
}, function (v)
|
||||
return { v[1], os.getenv(v[1]) or v[2] }
|
||||
end)
|
||||
|
||||
for i,v in ipairs(vars) do
|
||||
vars[v[1]] = v[2]
|
||||
end
|
||||
|
||||
local flags = string.format("%s -D%s -D%s %s", cflags, vars.PLATFORM, vars.GRAPHICS, include_paths)
|
||||
|
||||
local src = {
|
||||
-- ["obj.o"] = { src... }
|
||||
{ "rcore.o", { "rcore.c", "raylib.h", "rlgl.h", "utils.h", "raymath.h", "rcamera.h", "rgestures.h" } },
|
||||
{ "rglfw.o", { "rglfw.c", flags = os.getenv "GLFW_OSX" or "" } },
|
||||
{ "rshapes.o", { "rshapes.c", "raylib.h", "rlgl.h" } },
|
||||
{ "rtextures.o", { "rtextures.c", "raylib.h", "rlgl.h", "utils.h" } },
|
||||
{ "rtext.o", { "rtext.c", "raylib.h", "utils.h" } },
|
||||
{ "utils.o", { "utils.c", "utils.h" } },
|
||||
{ "rmodels.o", { "rmodels.c", "raylib.h", "rlgl.h", "raymath.h" } },
|
||||
{ "raudio.o", { "raudio.c", "raylib.h" } }
|
||||
}
|
||||
|
||||
local objs = c.compile(src, flags, "raylib", cc)
|
||||
local libraylib = c.lib("libraylib.a", objs, "raylib")
|
||||
|
||||
libraylib:wait()
|
||||
if future then
|
||||
future:resolve()
|
||||
end
|
@ -1,41 +0,0 @@
|
||||
#version 430
|
||||
|
||||
// Game of Life logic shader
|
||||
|
||||
#define GOL_WIDTH 768
|
||||
|
||||
layout (local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
|
||||
|
||||
layout(std430, binding = 1) readonly restrict buffer golLayout {
|
||||
uint golBuffer[]; // golBuffer[x, y] = golBuffer[x + gl_NumWorkGroups.x * y]
|
||||
};
|
||||
|
||||
layout(std430, binding = 2) writeonly restrict buffer golLayout2 {
|
||||
uint golBufferDest[]; // golBufferDest[x, y] = golBufferDest[x + gl_NumWorkGroups.x * y]
|
||||
};
|
||||
|
||||
#define fetchGol(x, y) ((((x) < 0) || ((y) < 0) || ((x) > GOL_WIDTH) || ((y) > GOL_WIDTH)) \
|
||||
? (0) \
|
||||
: golBuffer[(x) + GOL_WIDTH * (y)])
|
||||
|
||||
#define setGol(x, y, value) golBufferDest[(x) + GOL_WIDTH*(y)] = value
|
||||
|
||||
void main()
|
||||
{
|
||||
uint neighbourCount = 0;
|
||||
uint x = gl_GlobalInvocationID.x;
|
||||
uint y = gl_GlobalInvocationID.y;
|
||||
|
||||
neighbourCount += fetchGol(x - 1, y - 1); // Top left
|
||||
neighbourCount += fetchGol(x, y - 1); // Top middle
|
||||
neighbourCount += fetchGol(x + 1, y - 1); // Top right
|
||||
neighbourCount += fetchGol(x - 1, y); // Left
|
||||
neighbourCount += fetchGol(x + 1, y); // Right
|
||||
neighbourCount += fetchGol(x - 1, y + 1); // Bottom left
|
||||
neighbourCount += fetchGol(x, y + 1); // Bottom middle
|
||||
neighbourCount += fetchGol(x + 1, y + 1); // Bottom right
|
||||
|
||||
if (neighbourCount == 3) setGol(x, y, 1);
|
||||
else if (neighbourCount == 2) setGol(x, y, fetchGol(x, y));
|
||||
else setGol(x, y, 0);
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
#version 430
|
||||
|
||||
// Game of Life rendering shader
|
||||
// Just renders the content of the ssbo at binding 1 to screen
|
||||
|
||||
#define GOL_WIDTH 768
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
// Input game of life grid.
|
||||
layout(std430, binding = 1) readonly buffer golLayout
|
||||
{
|
||||
uint golBuffer[];
|
||||
};
|
||||
|
||||
// Output resolution
|
||||
uniform vec2 resolution;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 coords = ivec2(fragTexCoord*resolution);
|
||||
|
||||
if ((golBuffer[coords.x + coords.y*uvec2(resolution).x]) == 1) finalColor = vec4(1.0);
|
||||
else finalColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
#version 430
|
||||
|
||||
// Game of life transfert shader
|
||||
|
||||
#define GOL_WIDTH 768
|
||||
|
||||
// Game Of Life Update Command
|
||||
// NOTE: matches the structure defined on main program
|
||||
struct GolUpdateCmd {
|
||||
uint x; // x coordinate of the gol command
|
||||
uint y; // y coordinate of the gol command
|
||||
uint w; // width of the filled zone
|
||||
uint enabled; // whether to enable or disable zone
|
||||
};
|
||||
|
||||
// Local compute unit size
|
||||
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
// Output game of life grid buffer
|
||||
layout(std430, binding = 1) buffer golBufferLayout
|
||||
{
|
||||
uint golBuffer[]; // golBuffer[x, y] = golBuffer[x + GOL_WIDTH * y]
|
||||
};
|
||||
|
||||
// Command buffer
|
||||
layout(std430, binding = 3) readonly restrict buffer golUpdateLayout
|
||||
{
|
||||
uint count;
|
||||
GolUpdateCmd commands[];
|
||||
};
|
||||
|
||||
#define isInside(x, y) (((x) >= 0) && ((y) >= 0) && ((x) < GOL_WIDTH) && ((y) < GOL_WIDTH))
|
||||
#define getBufferIndex(x, y) ((x) + GOL_WIDTH * (y))
|
||||
|
||||
void main()
|
||||
{
|
||||
uint cmdIndex = gl_GlobalInvocationID.x;
|
||||
GolUpdateCmd cmd = commands[cmdIndex];
|
||||
|
||||
for (uint x = cmd.x; x < (cmd.x + cmd.w); x++)
|
||||
{
|
||||
for (uint y = cmd.y; y < (cmd.y + cmd.w); y++)
|
||||
{
|
||||
if (isInside(x, y))
|
||||
{
|
||||
if (cmd.enabled != 0) atomicOr(golBuffer[getBufferIndex(x, y)], 1);
|
||||
else atomicAnd(golBuffer[getBufferIndex(x, y)], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
57
examples/resources/gol.glsl
Normal file
57
examples/resources/gol.glsl
Normal file
@ -0,0 +1,57 @@
|
||||
#version 430
|
||||
|
||||
#define GOL_WIDTH 1024
|
||||
|
||||
layout (local_size_x = 16, local_size_y = 16, local_size_x = 1) in;
|
||||
|
||||
layout(std430, binding = 1) readonly restrict buffer golLayout {
|
||||
int golBuffer[]; // golBuffer[x, y] = golBuffer[x + gl_NumWorkGroups.x * y]
|
||||
};
|
||||
|
||||
layout(std430, set = 1, binding = 2) writeonly restrict buffer golLayout2 {
|
||||
int golBufferDest[]; // golBufferDest[x, y] = golBufferDest[x + gl_NumWorkGroups.x * y]
|
||||
};
|
||||
|
||||
#define fetchGol(x, y) ((((x) < 0) || ((y) < 0) || ((x) > GOL_WIDTH) || ((y) > GOL_WIDTH)) \
|
||||
? (0) \
|
||||
: golBuffer[(x) + GOL_WIDTH * (y)])
|
||||
|
||||
#define setGol(x, y, value) golBufferDest[(x) + GOL_WIDTH * (y)] = value
|
||||
|
||||
void main()
|
||||
{
|
||||
uint neighbour_count = 0;
|
||||
uint x = gl_GlobalInvocationID.x;
|
||||
uint y = gl_GlobalInvocationID.y;
|
||||
|
||||
// Top left
|
||||
neighbour_count += fetchGol(x - 1, y - 1);
|
||||
|
||||
// Top middle
|
||||
neighbour_count += fetchGol(x, y - 1);
|
||||
|
||||
// Top right
|
||||
neighbour_count += fetchGol(x + 1, y - 1);
|
||||
|
||||
// Left
|
||||
neighbour_count += fetchGol(x - 1, y);
|
||||
|
||||
// Right
|
||||
neighbour_count += fetchGol(x + 1, y);
|
||||
|
||||
// Bottom left
|
||||
neighbour_count += fetchGol(x - 1, y + 1);
|
||||
|
||||
// Bottom middle
|
||||
neighbour_count += fetchGol(x, y + 1);
|
||||
|
||||
// Bottom right
|
||||
neighbour_count += fetchGol(x + 1, y + 1);
|
||||
|
||||
if (neighbour_count == 3)
|
||||
setGol(x, y, 1);
|
||||
else if (neighbour_count == 2)
|
||||
setGol(x, y, fetchGol(x, y));
|
||||
else
|
||||
setGol(x, y, 0);
|
||||
}
|
@ -1,134 +1,105 @@
|
||||
local ffi = require "ffi"
|
||||
|
||||
-- IMPORTANT: This must match gol*.glsl GOL_WIDTH constant.
|
||||
-- This must be a multiple of 16 (check golLogic compute dispatch).
|
||||
local GOL_WIDTH = 768
|
||||
|
||||
-- Maximum amount of queued draw commands (squares draw from mouse down events).
|
||||
local MAX_BUFFERED_TRANSFERTS = 48
|
||||
|
||||
ffi.cdef [[
|
||||
typedef struct GolUpdateCmd {
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
unsigned int w;
|
||||
unsigned int enabled;
|
||||
} GolUpdateCmd;
|
||||
]]
|
||||
|
||||
ffi.cdef(string.format([[
|
||||
typedef struct GolUpdateSSBO {
|
||||
unsigned int count;
|
||||
GolUpdateCmd commands[%d];
|
||||
} GolUpdateSSBO;
|
||||
]], MAX_BUFFERED_TRANSFERTS))
|
||||
|
||||
rl.InitWindow(GOL_WIDTH, GOL_WIDTH, "raylib [rlgl] example - compute shader - game of life")
|
||||
|
||||
local resolution = rl.new("Vector2", GOL_WIDTH, GOL_WIDTH)
|
||||
local brushSize = 8
|
||||
|
||||
-- Game of Life logic compute shader
|
||||
local golLogicCode = rl.LoadFileText("resources/glsl430/gol.glsl")
|
||||
local golLogicShader = rl.rlCompileShader(golLogicCode, rl.RL_COMPUTE_SHADER);
|
||||
local golLogicProgram = rl.rlLoadComputeShaderProgram(golLogicShader);
|
||||
rl.UnloadFileText(golLogicCode);
|
||||
|
||||
-- Game of Life rendering compute shader
|
||||
local golRenderShader = rl.LoadShader(nil, "resources/glsl430/gol_render.glsl")
|
||||
local resUniformLoc = rl.GetShaderLocation(golRenderShader, "resolution")
|
||||
|
||||
local golTransfertCode = rl.LoadFileText("resources/glsl430/gol_transfert.glsl");
|
||||
local golTransfertShader = rl.rlCompileShader(golTransfertCode, rl.RL_COMPUTE_SHADER);
|
||||
local golTransfertProgram = rl.rlLoadComputeShaderProgram(golTransfertShader);
|
||||
rl.UnloadFileText(golTransfertCode);
|
||||
|
||||
local ssboSize = ffi.sizeof("int[?]", GOL_WIDTH * GOL_WIDTH)
|
||||
local ssboA = rl.rlLoadShaderBuffer(ssboSize, nil, rl.RL_DYNAMIC_COPY);
|
||||
local ssboB = rl.rlLoadShaderBuffer(ssboSize, nil, rl.RL_DYNAMIC_COPY);
|
||||
|
||||
local transfertBuffer = ffi.new("struct GolUpdateSSBO")
|
||||
transfertBuffer.count = 0
|
||||
|
||||
local transfertBufferSize = ffi.sizeof "struct GolUpdateSSBO"
|
||||
|
||||
local transfertSSBO = rl.rlLoadShaderBuffer(transfertBufferSize, nil, rl.RL_DYNAMIC_COPY);
|
||||
|
||||
-- Create a white texture of the size of the window to update
|
||||
-- each pixel of the window using the fragment shader
|
||||
local whiteImage = rl.GenImageColor(GOL_WIDTH, GOL_WIDTH, rl.WHITE);
|
||||
local whiteTex = rl.LoadTextureFromImage(whiteImage);
|
||||
rl.UnloadImage(whiteImage)
|
||||
|
||||
while not rl.WindowShouldClose() do
|
||||
|
||||
brushSize = math.floor(brushSize + rl.GetMouseWheelMove())
|
||||
|
||||
if ((rl.IsMouseButtonDown(rl.MOUSE_BUTTON_LEFT) or rl.IsMouseButtonDown(rl.MOUSE_BUTTON_RIGHT))
|
||||
and (transfertBuffer.count < MAX_BUFFERED_TRANSFERTS)) then
|
||||
-- Buffer a new command
|
||||
transfertBuffer.commands[transfertBuffer.count].x = rl.GetMouseX() - brushSize/2
|
||||
transfertBuffer.commands[transfertBuffer.count].y = rl.GetMouseY() - brushSize/2
|
||||
transfertBuffer.commands[transfertBuffer.count].w = brushSize
|
||||
transfertBuffer.commands[transfertBuffer.count].enabled = rl.IsMouseButtonDown(rl.MOUSE_BUTTON_LEFT)
|
||||
transfertBuffer.count = transfertBuffer.count + 1
|
||||
elseif transfertBuffer.count > 0 then
|
||||
-- Process transfert buffer
|
||||
|
||||
-- Send SSBO buffer to GPU
|
||||
rl.rlUpdateShaderBufferElements(transfertSSBO, transfertBuffer, transfertBufferSize, 0);
|
||||
|
||||
-- Process ssbo command
|
||||
rl.rlEnableShader(golTransfertProgram);
|
||||
rl.rlBindShaderBuffer(ssboA, 1);
|
||||
rl.rlBindShaderBuffer(transfertSSBO, 3);
|
||||
rl.rlComputeShaderDispatch(transfertBuffer.count, 1, 1) -- each GPU unit will process a command
|
||||
rl.rlDisableShader();
|
||||
|
||||
transfertBuffer.count = 0;
|
||||
else
|
||||
-- Process game of life logic
|
||||
rl.rlEnableShader(golLogicProgram)
|
||||
rl.rlBindShaderBuffer(ssboA, 1)
|
||||
rl.rlBindShaderBuffer(ssboB, 2)
|
||||
rl.rlComputeShaderDispatch(GOL_WIDTH / 16, GOL_WIDTH / 16, 1)
|
||||
rl.rlDisableShader()
|
||||
|
||||
ssboA, ssboB = ssboB, ssboA
|
||||
end
|
||||
|
||||
rl.rlBindShaderBuffer(ssboA, 1)
|
||||
rl.SetShaderValue(golRenderShader, resUniformLoc, resolution, rl.SHADER_UNIFORM_VEC2);
|
||||
|
||||
rl.BeginDrawing()
|
||||
|
||||
rl.ClearBackground(rl.BLANK)
|
||||
|
||||
rl.BeginShaderMode(golRenderShader)
|
||||
rl.DrawTexture(whiteTex, 0, 0, rl.WHITE)
|
||||
rl.EndShaderMode()
|
||||
|
||||
rl.DrawRectangleLines(
|
||||
rl.GetMouseX() - brushSize/2,
|
||||
rl.GetMouseY() - brushSize/2,
|
||||
brushSize, brushSize,
|
||||
rl.RED)
|
||||
|
||||
rl.DrawText("Use Mouse wheel to increase/decrease brush size", 10, 10, 20, rl.WHITE);
|
||||
rl.DrawFPS(rl.GetScreenWidth() - 100, 10);
|
||||
|
||||
rl.EndDrawing()
|
||||
local width, height = 1024, 1024
|
||||
rl.InitWindow(width, height, "raylib-lua [core] example - compute shader")
|
||||
local computeShaderCode
|
||||
do
|
||||
local f = io.open("resources/gol.glsl", "rb")
|
||||
assert(f, "Can't read resources/gol.glsl file")
|
||||
computeShaderCode = f:read "*a"
|
||||
f:close()
|
||||
end
|
||||
|
||||
rl.rlUnloadShaderBuffer(ssboA);
|
||||
rl.rlUnloadShaderBuffer(ssboB);
|
||||
rl.rlUnloadShaderBuffer(transfertSSBO);
|
||||
local computeShader = rl.rlCompileShader(computeShaderCode, rl.RL_COMPUTE_SHADER)
|
||||
local csProgram = rl.rlLoadComputeShaderProgram(computeShader)
|
||||
print(csProgram)
|
||||
|
||||
-- Unload compute shader programs
|
||||
rl.rlUnloadShaderProgram(golTransfertProgram)
|
||||
rl.rlUnloadShaderProgram(golLogicProgram)
|
||||
local ssbo_size = ffi.sizeof("int32_t[?]", width * height)
|
||||
local ssbo_baseBuffer = ffi.new("int32_t[?]", width * height)
|
||||
for i=0,width * height - 1 do
|
||||
ssbo_baseBuffer[i] = 0
|
||||
end
|
||||
|
||||
rl.UnloadTexture(whiteTex) -- Unload white texture
|
||||
rl.UnloadShader(golRenderShader) -- Unload rendering fragment shader
|
||||
local shader_framebuffer = rl.new("Color[?]", width * height)
|
||||
local ssbo_image = rl.new "Image" ---@type Image
|
||||
|
||||
rl.CloseWindow() -- Close window and OpenGL context
|
||||
ssbo_image.data = shader_framebuffer
|
||||
ssbo_image.width = width
|
||||
ssbo_image.height = height
|
||||
ssbo_image.format = rl.PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
||||
ssbo_image.mipmaps = 1
|
||||
|
||||
local ssboA = rl.rlLoadShaderBuffer(ssbo_size, ssbo_baseBuffer, rl.RL_STREAM_COPY)
|
||||
local ssboB = rl.rlLoadShaderBuffer(ssbo_size, ssbo_baseBuffer, rl.RL_STREAM_COPY)
|
||||
|
||||
-- Create a texture to apply shader
|
||||
local renderTexture = rl.LoadRenderTexture(width, height)
|
||||
|
||||
local renderShader = rl.LoadShaderFromMemory(nil, [[
|
||||
#version 430
|
||||
out vec4 finalColor;
|
||||
in vec2 fragTexCoord;
|
||||
|
||||
layout(std430, binding = 1) readonly buffer golLayout {
|
||||
int golBuffer[];
|
||||
};
|
||||
|
||||
uniform vec2 res;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 coords = ivec2(fragTexCoord * res);
|
||||
|
||||
if (golBuffer[coords.x + coords.y * uint(res.x)] == 1)
|
||||
finalColor = vec4(1.0);
|
||||
else
|
||||
finalColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
]])
|
||||
|
||||
local resolution = ffi.new("float[2]", width, height)
|
||||
local res_uniform = rl.GetShaderLocation(renderShader, "res")
|
||||
|
||||
while not rl.WindowShouldClose() do
|
||||
rl.BeginDrawing()
|
||||
|
||||
if rl.IsMouseButtonDown(rl.MOUSE_BUTTON_LEFT) then
|
||||
rl.rlReadShaderBufferElements(ssboB, ssbo_baseBuffer, ssbo_size, 0)
|
||||
|
||||
-- Correct colors
|
||||
for i=0,(width * height)-1 do
|
||||
local toggled = ssbo_baseBuffer[i]
|
||||
|
||||
shader_framebuffer[i].r = toggled * 255
|
||||
shader_framebuffer[i].g = toggled * 255
|
||||
shader_framebuffer[i].b = toggled * 255
|
||||
shader_framebuffer[i].a = toggled * 255
|
||||
end
|
||||
|
||||
rl.ImageDrawRectangleV(ssbo_image, rl.GetMousePosition(), rl.new("Vector2", 25, 25), rl.WHITE)
|
||||
|
||||
for x=0,ssbo_image.width-1 do
|
||||
for y=0,ssbo_image.height-1 do
|
||||
ssbo_baseBuffer[x + y * width] = (shader_framebuffer[x + y * width].r > 0)
|
||||
end
|
||||
end
|
||||
rl.rlUpdateShaderBufferElements(ssboB, ssbo_baseBuffer, ssbo_size, 0)
|
||||
else
|
||||
rl.rlEnableShader(csProgram)
|
||||
rl.rlBindShaderBuffer(ssboA, 1)
|
||||
rl.rlBindShaderBuffer(ssboB, 2)
|
||||
rl.rlComputeShaderDispatch(width / 16, height / 16, 1)
|
||||
rl.rlDisableShader()
|
||||
end
|
||||
|
||||
rl.ClearBackground(rl.BLANK)
|
||||
rl.SetShaderValue(renderShader, res_uniform, resolution, rl.SHADER_UNIFORM_VEC2)
|
||||
rl.BeginShaderMode(renderShader)
|
||||
rl.DrawTexture(renderTexture.texture, 0, 0, rl.WHITE)
|
||||
rl.EndShaderMode()
|
||||
rl.DrawFPS(0, 0)
|
||||
rl.EndDrawing()
|
||||
|
||||
ssboA, ssboB = ssboB, ssboA
|
||||
end
|
||||
|
||||
rl.CloseWindow()
|
||||
|
2
luajit
2
luajit
@ -1 +1 @@
|
||||
Subproject commit 5e3c45c43bb0e0f1f2917d432e9d2dba12c42a6e
|
||||
Subproject commit e4b4d9451402be704d5b47a359f640a29db4977f
|
11
makefile
11
makefile
@ -6,7 +6,7 @@ LUA ?= luajit/src/luajit
|
||||
|
||||
WINDRES ?= windres
|
||||
|
||||
CFLAGS += -Iluajit/src -Iraylib/src -Iraygui/src
|
||||
CFLAGS += -Iluajit/src -Iraylib/src -Iraygui/src -DSUPPORT_COMPUTE_SHADERS
|
||||
LDFLAGS += luajit/src/libluajit.a raylib/src/libraylib.a
|
||||
|
||||
MODULES := raymath rlgl easings gestures physac raygui
|
||||
@ -15,14 +15,11 @@ MODULES := raymath rlgl easings gestures physac raygui
|
||||
PLATFORM ?= PLATFORM_DESKTOP
|
||||
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||
|
||||
CFLAGS += -D$(GRAPHICS) -D$(PLATFORM)
|
||||
|
||||
USE_WAYLAND_DISPLAY ?= FALSE
|
||||
USE_EXTERNAL_GLFW ?= FALSE
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
LDFLAGS += -lopengl32 -lgdi32 -lwinmm -static
|
||||
LDFLAGS_R += -mwindows
|
||||
EXTERNAL_FILES := src/res/icon.res
|
||||
else ifeq ($(shell uname),Darwin)
|
||||
LDFLAGS += -framework CoreVideo -framework IOKit -framework Cocoa \
|
||||
@ -39,7 +36,7 @@ else
|
||||
EXTERNAL_FILES :=
|
||||
endif
|
||||
|
||||
all: raylua_s raylua_e raylua_r luajit raylib
|
||||
all: raylua_s raylua_e luajit raylib
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
@ -64,10 +61,6 @@ raylua_e: src/raylua_e.o src/raylua_self.o src/raylua_builder.o src/lib/miniz.o
|
||||
$(EXTERNAL_FILES) libraylua.a
|
||||
$(CC) -o $@ $^ $(LDFLAGS) luajit/src/libluajit.a
|
||||
|
||||
raylua_r: src/raylua_e.o src/raylua_self.o src/raylua_builder.o src/lib/miniz.o \
|
||||
$(EXTERNAL_FILES) libraylua.a
|
||||
$(CC) -o $@ $^ $(LDFLAGS) $(LDFLAGS_R) luajit/src/libluajit.a
|
||||
|
||||
src/res/icon.res: src/res/icon.rc
|
||||
$(WINDRES) $^ -O coff $@
|
||||
|
||||
|
2
raygui
2
raygui
@ -1 +1 @@
|
||||
Subproject commit 865bb293764073c01e74314ef647464f1f10fd96
|
||||
Subproject commit e81fd89b6dcc97bf1cee7878e8c6cfcbca2583a7
|
2
raylib
2
raylib
@ -1 +1 @@
|
||||
Subproject commit 559ffc633164c30824065a63324ba08efa651ee6
|
||||
Subproject commit 9b3d74db6bd9e38bc1447f636897990bbd698b4b
|
558
src/raylib.lua
558
src/raylib.lua
@ -231,11 +231,8 @@ ffi.cdef [[
|
||||
} Wave;
|
||||
|
||||
typedef struct rAudioBuffer rAudioBuffer;
|
||||
typedef struct rAudioProcessor rAudioProcessor;
|
||||
|
||||
typedef struct AudioStream {
|
||||
rAudioBuffer *buffer;
|
||||
rAudioProcessor *processor;
|
||||
|
||||
unsigned int sampleRate;
|
||||
unsigned int sampleSize;
|
||||
@ -600,7 +597,6 @@ ffi.cdef [[
|
||||
BLEND_MULTIPLIED,
|
||||
BLEND_ADD_COLORS,
|
||||
BLEND_SUBTRACT_COLORS,
|
||||
BLEND_ALPHA_PREMUL,
|
||||
BLEND_CUSTOM
|
||||
} BlendMode;
|
||||
|
||||
@ -638,7 +634,6 @@ ffi.cdef [[
|
||||
} NPatchLayout;
|
||||
|
||||
typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args);
|
||||
typedef void (*AudioCallback)(void *bufferData, unsigned int frames);
|
||||
]]
|
||||
|
||||
-- raymath cdef
|
||||
@ -649,14 +644,6 @@ ffi.cdef [[
|
||||
|
||||
-- rlgl cdef
|
||||
ffi.cdef [[
|
||||
typedef enum {
|
||||
OPENGL_11 = 1,
|
||||
OPENGL_21,
|
||||
OPENGL_33,
|
||||
OPENGL_43,
|
||||
OPENGL_ES_20
|
||||
} rlGlVersion;
|
||||
|
||||
typedef enum {
|
||||
RL_LOG_ALL = 0,
|
||||
RL_LOG_TRACE,
|
||||
@ -707,7 +694,6 @@ ffi.cdef [[
|
||||
RL_BLEND_MULTIPLIED,
|
||||
RL_BLEND_ADD_COLORS,
|
||||
RL_BLEND_SUBTRACT_COLORS,
|
||||
RL_BLEND_ALPHA_PREMUL,
|
||||
RL_BLEND_CUSTOM
|
||||
} rlBlendMode;
|
||||
|
||||
@ -787,6 +773,10 @@ ffi.cdef [[
|
||||
typedef struct rlVertexBuffer {
|
||||
int elementCount;
|
||||
|
||||
int vCounter;
|
||||
int tcCounter;
|
||||
int cCounter;
|
||||
|
||||
float *vertices;
|
||||
float *texcoords;
|
||||
unsigned char *colors;
|
||||
@ -1018,15 +1008,6 @@ ffi.cdef [[
|
||||
PROGRESS_PADDING = 16,
|
||||
} GuiProgressBarProperty;
|
||||
|
||||
typedef enum {
|
||||
ARROWS_SIZE = 16,
|
||||
ARROWS_VISIBLE,
|
||||
SCROLL_SLIDER_PADDING,
|
||||
SCROLL_SLIDER_SIZE,
|
||||
SCROLL_PADDING,
|
||||
SCROLL_SPEED,
|
||||
} GuiScrollBarProperty;
|
||||
|
||||
typedef enum {
|
||||
CHECK_PADDING = 16
|
||||
} GuiCheckBoxProperty;
|
||||
@ -1038,19 +1019,30 @@ ffi.cdef [[
|
||||
|
||||
typedef enum {
|
||||
ARROW_PADDING = 16,
|
||||
DROPDOWN_ITEMS_SPACING
|
||||
DROPDOWN_ITEMS_PADDING
|
||||
} GuiDropdownBoxProperty;
|
||||
|
||||
typedef enum {
|
||||
TEXT_INNER_PADDING = 16,
|
||||
TEXT_LINES_SPACING
|
||||
TEXT_LINES_PADDING,
|
||||
COLOR_SELECTED_FG,
|
||||
COLOR_SELECTED_BG
|
||||
} GuiTextBoxProperty;
|
||||
|
||||
typedef enum {
|
||||
SPIN_BUTTON_WIDTH = 16,
|
||||
SPIN_BUTTON_SPACING,
|
||||
SPIN_BUTTON_PADDING,
|
||||
} GuiSpinnerProperty;
|
||||
|
||||
typedef enum {
|
||||
ARROWS_SIZE = 16,
|
||||
ARROWS_VISIBLE,
|
||||
SCROLL_SLIDER_PADDING,
|
||||
SCROLL_SLIDER_SIZE,
|
||||
SCROLL_PADDING,
|
||||
SCROLL_SPEED,
|
||||
} GuiScrollBarProperty;
|
||||
|
||||
typedef enum {
|
||||
SCROLLBAR_LEFT_SIDE = 0,
|
||||
SCROLLBAR_RIGHT_SIDE
|
||||
@ -1058,7 +1050,7 @@ ffi.cdef [[
|
||||
|
||||
typedef enum {
|
||||
LIST_ITEMS_HEIGHT = 16,
|
||||
LIST_ITEMS_SPACING,
|
||||
LIST_ITEMS_PADDING,
|
||||
SCROLLBAR_WIDTH,
|
||||
SCROLLBAR_SIDE,
|
||||
} GuiListViewProperty;
|
||||
@ -1079,262 +1071,262 @@ ffi.cdef [[
|
||||
} GuiTextBoxState;
|
||||
|
||||
typedef enum {
|
||||
RAYGUI_ICON_NONE = 0,
|
||||
RAYGUI_ICON_FOLDER_FILE_OPEN = 1,
|
||||
RAYGUI_ICON_FILE_SAVE_CLASSIC = 2,
|
||||
RAYGUI_ICON_FOLDER_OPEN = 3,
|
||||
RAYGUI_ICON_FOLDER_SAVE = 4,
|
||||
RAYGUI_ICON_FILE_OPEN = 5,
|
||||
RAYGUI_ICON_FILE_SAVE = 6,
|
||||
RAYGUI_ICON_FILE_EXPORT = 7,
|
||||
RAYGUI_ICON_FILE_ADD = 8,
|
||||
RAYGUI_ICON_FILE_DELETE = 9,
|
||||
RAYGUI_ICON_FILETYPE_TEXT = 10,
|
||||
RAYGUI_ICON_FILETYPE_AUDIO = 11,
|
||||
RAYGUI_ICON_FILETYPE_IMAGE = 12,
|
||||
RAYGUI_ICON_FILETYPE_PLAY = 13,
|
||||
RAYGUI_ICON_FILETYPE_VIDEO = 14,
|
||||
RAYGUI_ICON_FILETYPE_INFO = 15,
|
||||
RAYGUI_ICON_FILE_COPY = 16,
|
||||
RAYGUI_ICON_FILE_CUT = 17,
|
||||
RAYGUI_ICON_FILE_PASTE = 18,
|
||||
RAYGUI_ICON_CURSOR_HAND = 19,
|
||||
RAYGUI_ICON_CURSOR_POINTER = 20,
|
||||
RAYGUI_ICON_CURSOR_CLASSIC = 21,
|
||||
RAYGUI_ICON_PENCIL = 22,
|
||||
RAYGUI_ICON_PENCIL_BIG = 23,
|
||||
RAYGUI_ICON_BRUSH_CLASSIC = 24,
|
||||
RAYGUI_ICON_BRUSH_PAINTER = 25,
|
||||
RAYGUI_ICON_WATER_DROP = 26,
|
||||
RAYGUI_ICON_COLOR_PICKER = 27,
|
||||
RAYGUI_ICON_RUBBER = 28,
|
||||
RAYGUI_ICON_COLOR_BUCKET = 29,
|
||||
RAYGUI_ICON_TEXT_T = 30,
|
||||
RAYGUI_ICON_TEXT_A = 31,
|
||||
RAYGUI_ICON_SCALE = 32,
|
||||
RAYGUI_ICON_RESIZE = 33,
|
||||
RAYGUI_ICON_FILTER_POINT = 34,
|
||||
RAYGUI_ICON_FILTER_BILINEAR = 35,
|
||||
RAYGUI_ICON_CROP = 36,
|
||||
RAYGUI_ICON_CROP_ALPHA = 37,
|
||||
RAYGUI_ICON_SQUARE_TOGGLE = 38,
|
||||
RAYGUI_ICON_SYMMETRY = 39,
|
||||
RAYGUI_ICON_SYMMETRY_HORIZONTAL = 40,
|
||||
RAYGUI_ICON_SYMMETRY_VERTICAL = 41,
|
||||
RAYGUI_ICON_LENS = 42,
|
||||
RAYGUI_ICON_LENS_BIG = 43,
|
||||
RAYGUI_ICON_EYE_ON = 44,
|
||||
RAYGUI_ICON_EYE_OFF = 45,
|
||||
RAYGUI_ICON_FILTER_TOP = 46,
|
||||
RAYGUI_ICON_FILTER = 47,
|
||||
RAYGUI_ICON_TARGET_POINT = 48,
|
||||
RAYGUI_ICON_TARGET_SMALL = 49,
|
||||
RAYGUI_ICON_TARGET_BIG = 50,
|
||||
RAYGUI_ICON_TARGET_MOVE = 51,
|
||||
RAYGUI_ICON_CURSOR_MOVE = 52,
|
||||
RAYGUI_ICON_CURSOR_SCALE = 53,
|
||||
RAYGUI_ICON_CURSOR_SCALE_RIGHT = 54,
|
||||
RAYGUI_ICON_CURSOR_SCALE_LEFT = 55,
|
||||
RAYGUI_ICON_UNDO = 56,
|
||||
RAYGUI_ICON_REDO = 57,
|
||||
RAYGUI_ICON_REREDO = 58,
|
||||
RAYGUI_ICON_MUTATE = 59,
|
||||
RAYGUI_ICON_ROTATE = 60,
|
||||
RAYGUI_ICON_REPEAT = 61,
|
||||
RAYGUI_ICON_SHUFFLE = 62,
|
||||
RAYGUI_ICON_EMPTYBOX = 63,
|
||||
RAYGUI_ICON_TARGET = 64,
|
||||
RAYGUI_ICON_TARGET_SMALL_FILL = 65,
|
||||
RAYGUI_ICON_TARGET_BIG_FILL = 66,
|
||||
RAYGUI_ICON_TARGET_MOVE_FILL = 67,
|
||||
RAYGUI_ICON_CURSOR_MOVE_FILL = 68,
|
||||
RAYGUI_ICON_CURSOR_SCALE_FILL = 69,
|
||||
RAYGUI_ICON_CURSOR_SCALE_RIGHT_FILL = 70,
|
||||
RAYGUI_ICON_CURSOR_SCALE_LEFT_FILL = 71,
|
||||
RAYGUI_ICON_UNDO_FILL = 72,
|
||||
RAYGUI_ICON_REDO_FILL = 73,
|
||||
RAYGUI_ICON_REREDO_FILL = 74,
|
||||
RAYGUI_ICON_MUTATE_FILL = 75,
|
||||
RAYGUI_ICON_ROTATE_FILL = 76,
|
||||
RAYGUI_ICON_REPEAT_FILL = 77,
|
||||
RAYGUI_ICON_SHUFFLE_FILL = 78,
|
||||
RAYGUI_ICON_EMPTYBOX_SMALL = 79,
|
||||
RAYGUI_ICON_BOX = 80,
|
||||
RAYGUI_ICON_BOX_TOP = 81,
|
||||
RAYGUI_ICON_BOX_TOP_RIGHT = 82,
|
||||
RAYGUI_ICON_BOX_RIGHT = 83,
|
||||
RAYGUI_ICON_BOX_BOTTOM_RIGHT = 84,
|
||||
RAYGUI_ICON_BOX_BOTTOM = 85,
|
||||
RAYGUI_ICON_BOX_BOTTOM_LEFT = 86,
|
||||
RAYGUI_ICON_BOX_LEFT = 87,
|
||||
RAYGUI_ICON_BOX_TOP_LEFT = 88,
|
||||
RAYGUI_ICON_BOX_CENTER = 89,
|
||||
RAYGUI_ICON_BOX_CIRCLE_MASK = 90,
|
||||
RAYGUI_ICON_POT = 91,
|
||||
RAYGUI_ICON_ALPHA_MULTIPLY = 92,
|
||||
RAYGUI_ICON_ALPHA_CLEAR = 93,
|
||||
RAYGUI_ICON_DITHERING = 94,
|
||||
RAYGUI_ICON_MIPMAPS = 95,
|
||||
RAYGUI_ICON_BOX_GRID = 96,
|
||||
RAYGUI_ICON_GRID = 97,
|
||||
RAYGUI_ICON_BOX_CORNERS_SMALL = 98,
|
||||
RAYGUI_ICON_BOX_CORNERS_BIG = 99,
|
||||
RAYGUI_ICON_FOUR_BOXES = 100,
|
||||
RAYGUI_ICON_GRID_FILL = 101,
|
||||
RAYGUI_ICON_BOX_MULTISIZE = 102,
|
||||
RAYGUI_ICON_ZOOM_SMALL = 103,
|
||||
RAYGUI_ICON_ZOOM_MEDIUM = 104,
|
||||
RAYGUI_ICON_ZOOM_BIG = 105,
|
||||
RAYGUI_ICON_ZOOM_ALL = 106,
|
||||
RAYGUI_ICON_ZOOM_CENTER = 107,
|
||||
RAYGUI_ICON_BOX_DOTS_SMALL = 108,
|
||||
RAYGUI_ICON_BOX_DOTS_BIG = 109,
|
||||
RAYGUI_ICON_BOX_CONCENTRIC = 110,
|
||||
RAYGUI_ICON_BOX_GRID_BIG = 111,
|
||||
RAYGUI_ICON_OK_TICK = 112,
|
||||
RAYGUI_ICON_CROSS = 113,
|
||||
RAYGUI_ICON_ARROW_LEFT = 114,
|
||||
RAYGUI_ICON_ARROW_RIGHT = 115,
|
||||
RAYGUI_ICON_ARROW_DOWN = 116,
|
||||
RAYGUI_ICON_ARROW_UP = 117,
|
||||
RAYGUI_ICON_ARROW_LEFT_FILL = 118,
|
||||
RAYGUI_ICON_ARROW_RIGHT_FILL = 119,
|
||||
RAYGUI_ICON_ARROW_DOWN_FILL = 120,
|
||||
RAYGUI_ICON_ARROW_UP_FILL = 121,
|
||||
RAYGUI_ICON_AUDIO = 122,
|
||||
RAYGUI_ICON_FX = 123,
|
||||
RAYGUI_ICON_WAVE = 124,
|
||||
RAYGUI_ICON_WAVE_SINUS = 125,
|
||||
RAYGUI_ICON_WAVE_SQUARE = 126,
|
||||
RAYGUI_ICON_WAVE_TRIANGULAR = 127,
|
||||
RAYGUI_ICON_CROSS_SMALL = 128,
|
||||
RAYGUI_ICON_PLAYER_PREVIOUS = 129,
|
||||
RAYGUI_ICON_PLAYER_PLAY_BACK = 130,
|
||||
RAYGUI_ICON_PLAYER_PLAY = 131,
|
||||
RAYGUI_ICON_PLAYER_PAUSE = 132,
|
||||
RAYGUI_ICON_PLAYER_STOP = 133,
|
||||
RAYGUI_ICON_PLAYER_NEXT = 134,
|
||||
RAYGUI_ICON_PLAYER_RECORD = 135,
|
||||
RAYGUI_ICON_MAGNET = 136,
|
||||
RAYGUI_ICON_LOCK_CLOSE = 137,
|
||||
RAYGUI_ICON_LOCK_OPEN = 138,
|
||||
RAYGUI_ICON_CLOCK = 139,
|
||||
RAYGUI_ICON_TOOLS = 140,
|
||||
RAYGUI_ICON_GEAR = 141,
|
||||
RAYGUI_ICON_GEAR_BIG = 142,
|
||||
RAYGUI_ICON_BIN = 143,
|
||||
RAYGUI_ICON_HAND_POINTER = 144,
|
||||
RAYGUI_ICON_LASER = 145,
|
||||
RAYGUI_ICON_COIN = 146,
|
||||
RAYGUI_ICON_EXPLOSION = 147,
|
||||
RAYGUI_ICON_1UP = 148,
|
||||
RAYGUI_ICON_PLAYER = 149,
|
||||
RAYGUI_ICON_PLAYER_JUMP = 150,
|
||||
RAYGUI_ICON_KEY = 151,
|
||||
RAYGUI_ICON_DEMON = 152,
|
||||
RAYGUI_ICON_TEXT_POPUP = 153,
|
||||
RAYGUI_ICON_GEAR_EX = 154,
|
||||
RAYGUI_ICON_CRACK = 155,
|
||||
RAYGUI_ICON_CRACK_POINTS = 156,
|
||||
RAYGUI_ICON_STAR = 157,
|
||||
RAYGUI_ICON_DOOR = 158,
|
||||
RAYGUI_ICON_EXIT = 159,
|
||||
RAYGUI_ICON_MODE_2D = 160,
|
||||
RAYGUI_ICON_MODE_3D = 161,
|
||||
RAYGUI_ICON_CUBE = 162,
|
||||
RAYGUI_ICON_CUBE_FACE_TOP = 163,
|
||||
RAYGUI_ICON_CUBE_FACE_LEFT = 164,
|
||||
RAYGUI_ICON_CUBE_FACE_FRONT = 165,
|
||||
RAYGUI_ICON_CUBE_FACE_BOTTOM = 166,
|
||||
RAYGUI_ICON_CUBE_FACE_RIGHT = 167,
|
||||
RAYGUI_ICON_CUBE_FACE_BACK = 168,
|
||||
RAYGUI_ICON_CAMERA = 169,
|
||||
RAYGUI_ICON_SPECIAL = 170,
|
||||
RAYGUI_ICON_LINK_NET = 171,
|
||||
RAYGUI_ICON_LINK_BOXES = 172,
|
||||
RAYGUI_ICON_LINK_MULTI = 173,
|
||||
RAYGUI_ICON_LINK = 174,
|
||||
RAYGUI_ICON_LINK_BROKE = 175,
|
||||
RAYGUI_ICON_TEXT_NOTES = 176,
|
||||
RAYGUI_ICON_NOTEBOOK = 177,
|
||||
RAYGUI_ICON_SUITCASE = 178,
|
||||
RAYGUI_ICON_SUITCASE_ZIP = 179,
|
||||
RAYGUI_ICON_MAILBOX = 180,
|
||||
RAYGUI_ICON_MONITOR = 181,
|
||||
RAYGUI_ICON_PRINTER = 182,
|
||||
RAYGUI_ICON_PHOTO_CAMERA = 183,
|
||||
RAYGUI_ICON_PHOTO_CAMERA_FLASH = 184,
|
||||
RAYGUI_ICON_HOUSE = 185,
|
||||
RAYGUI_ICON_HEART = 186,
|
||||
RAYGUI_ICON_CORNER = 187,
|
||||
RAYGUI_ICON_VERTICAL_BARS = 188,
|
||||
RAYGUI_ICON_VERTICAL_BARS_FILL = 189,
|
||||
RAYGUI_ICON_LIFE_BARS = 190,
|
||||
RAYGUI_ICON_INFO = 191,
|
||||
RAYGUI_ICON_CROSSLINE = 192,
|
||||
RAYGUI_ICON_HELP = 193,
|
||||
RAYGUI_ICON_FILETYPE_ALPHA = 194,
|
||||
RAYGUI_ICON_FILETYPE_HOME = 195,
|
||||
RAYGUI_ICON_LAYERS_VISIBLE = 196,
|
||||
RAYGUI_ICON_LAYERS = 197,
|
||||
RAYGUI_ICON_WINDOW = 198,
|
||||
RAYGUI_ICON_HIDPI = 199,
|
||||
RAYGUI_ICON_FILETYPE_BINARY = 200,
|
||||
RAYGUI_ICON_HEX = 201,
|
||||
RAYGUI_ICON_SHIELD = 202,
|
||||
RAYGUI_ICON_FILE_NEW = 203,
|
||||
RAYGUI_ICON_FOLDER_ADD = 204,
|
||||
RAYGUI_ICON_205 = 205,
|
||||
RAYGUI_ICON_206 = 206,
|
||||
RAYGUI_ICON_207 = 207,
|
||||
RAYGUI_ICON_208 = 208,
|
||||
RAYGUI_ICON_209 = 209,
|
||||
RAYGUI_ICON_210 = 210,
|
||||
RAYGUI_ICON_211 = 211,
|
||||
RAYGUI_ICON_212 = 212,
|
||||
RAYGUI_ICON_213 = 213,
|
||||
RAYGUI_ICON_214 = 214,
|
||||
RAYGUI_ICON_215 = 215,
|
||||
RAYGUI_ICON_216 = 216,
|
||||
RAYGUI_ICON_217 = 217,
|
||||
RAYGUI_ICON_218 = 218,
|
||||
RAYGUI_ICON_219 = 219,
|
||||
RAYGUI_ICON_220 = 220,
|
||||
RAYGUI_ICON_221 = 221,
|
||||
RAYGUI_ICON_222 = 222,
|
||||
RAYGUI_ICON_223 = 223,
|
||||
RAYGUI_ICON_224 = 224,
|
||||
RAYGUI_ICON_225 = 225,
|
||||
RAYGUI_ICON_226 = 226,
|
||||
RAYGUI_ICON_227 = 227,
|
||||
RAYGUI_ICON_228 = 228,
|
||||
RAYGUI_ICON_229 = 229,
|
||||
RAYGUI_ICON_230 = 230,
|
||||
RAYGUI_ICON_231 = 231,
|
||||
RAYGUI_ICON_232 = 232,
|
||||
RAYGUI_ICON_233 = 233,
|
||||
RAYGUI_ICON_234 = 234,
|
||||
RAYGUI_ICON_235 = 235,
|
||||
RAYGUI_ICON_236 = 236,
|
||||
RAYGUI_ICON_237 = 237,
|
||||
RAYGUI_ICON_238 = 238,
|
||||
RAYGUI_ICON_239 = 239,
|
||||
RAYGUI_ICON_240 = 240,
|
||||
RAYGUI_ICON_241 = 241,
|
||||
RAYGUI_ICON_242 = 242,
|
||||
RAYGUI_ICON_243 = 243,
|
||||
RAYGUI_ICON_244 = 244,
|
||||
RAYGUI_ICON_245 = 245,
|
||||
RAYGUI_ICON_246 = 246,
|
||||
RAYGUI_ICON_247 = 247,
|
||||
RAYGUI_ICON_248 = 248,
|
||||
RAYGUI_ICON_249 = 249,
|
||||
RAYGUI_ICON_250 = 250,
|
||||
RAYGUI_ICON_251 = 251,
|
||||
RAYGUI_ICON_252 = 252,
|
||||
RAYGUI_ICON_253 = 253,
|
||||
RAYGUI_ICON_254 = 254,
|
||||
RAYGUI_ICON_255 = 255,
|
||||
RICON_NONE = 0,
|
||||
RICON_FOLDER_FILE_OPEN = 1,
|
||||
RICON_FILE_SAVE_CLASSIC = 2,
|
||||
RICON_FOLDER_OPEN = 3,
|
||||
RICON_FOLDER_SAVE = 4,
|
||||
RICON_FILE_OPEN = 5,
|
||||
RICON_FILE_SAVE = 6,
|
||||
RICON_FILE_EXPORT = 7,
|
||||
RICON_FILE_NEW = 8,
|
||||
RICON_FILE_DELETE = 9,
|
||||
RICON_FILETYPE_TEXT = 10,
|
||||
RICON_FILETYPE_AUDIO = 11,
|
||||
RICON_FILETYPE_IMAGE = 12,
|
||||
RICON_FILETYPE_PLAY = 13,
|
||||
RICON_FILETYPE_VIDEO = 14,
|
||||
RICON_FILETYPE_INFO = 15,
|
||||
RICON_FILE_COPY = 16,
|
||||
RICON_FILE_CUT = 17,
|
||||
RICON_FILE_PASTE = 18,
|
||||
RICON_CURSOR_HAND = 19,
|
||||
RICON_CURSOR_POINTER = 20,
|
||||
RICON_CURSOR_CLASSIC = 21,
|
||||
RICON_PENCIL = 22,
|
||||
RICON_PENCIL_BIG = 23,
|
||||
RICON_BRUSH_CLASSIC = 24,
|
||||
RICON_BRUSH_PAINTER = 25,
|
||||
RICON_WATER_DROP = 26,
|
||||
RICON_COLOR_PICKER = 27,
|
||||
RICON_RUBBER = 28,
|
||||
RICON_COLOR_BUCKET = 29,
|
||||
RICON_TEXT_T = 30,
|
||||
RICON_TEXT_A = 31,
|
||||
RICON_SCALE = 32,
|
||||
RICON_RESIZE = 33,
|
||||
RICON_FILTER_POINT = 34,
|
||||
RICON_FILTER_BILINEAR = 35,
|
||||
RICON_CROP = 36,
|
||||
RICON_CROP_ALPHA = 37,
|
||||
RICON_SQUARE_TOGGLE = 38,
|
||||
RICON_SYMMETRY = 39,
|
||||
RICON_SYMMETRY_HORIZONTAL = 40,
|
||||
RICON_SYMMETRY_VERTICAL = 41,
|
||||
RICON_LENS = 42,
|
||||
RICON_LENS_BIG = 43,
|
||||
RICON_EYE_ON = 44,
|
||||
RICON_EYE_OFF = 45,
|
||||
RICON_FILTER_TOP = 46,
|
||||
RICON_FILTER = 47,
|
||||
RICON_TARGET_POINT = 48,
|
||||
RICON_TARGET_SMALL = 49,
|
||||
RICON_TARGET_BIG = 50,
|
||||
RICON_TARGET_MOVE = 51,
|
||||
RICON_CURSOR_MOVE = 52,
|
||||
RICON_CURSOR_SCALE = 53,
|
||||
RICON_CURSOR_SCALE_RIGHT = 54,
|
||||
RICON_CURSOR_SCALE_LEFT = 55,
|
||||
RICON_UNDO = 56,
|
||||
RICON_REDO = 57,
|
||||
RICON_REREDO = 58,
|
||||
RICON_MUTATE = 59,
|
||||
RICON_ROTATE = 60,
|
||||
RICON_REPEAT = 61,
|
||||
RICON_SHUFFLE = 62,
|
||||
RICON_EMPTYBOX = 63,
|
||||
RICON_TARGET = 64,
|
||||
RICON_TARGET_SMALL_FILL = 65,
|
||||
RICON_TARGET_BIG_FILL = 66,
|
||||
RICON_TARGET_MOVE_FILL = 67,
|
||||
RICON_CURSOR_MOVE_FILL = 68,
|
||||
RICON_CURSOR_SCALE_FILL = 69,
|
||||
RICON_CURSOR_SCALE_RIGHT_FILL = 70,
|
||||
RICON_CURSOR_SCALE_LEFT_FILL = 71,
|
||||
RICON_UNDO_FILL = 72,
|
||||
RICON_REDO_FILL = 73,
|
||||
RICON_REREDO_FILL = 74,
|
||||
RICON_MUTATE_FILL = 75,
|
||||
RICON_ROTATE_FILL = 76,
|
||||
RICON_REPEAT_FILL = 77,
|
||||
RICON_SHUFFLE_FILL = 78,
|
||||
RICON_EMPTYBOX_SMALL = 79,
|
||||
RICON_BOX = 80,
|
||||
RICON_BOX_TOP = 81,
|
||||
RICON_BOX_TOP_RIGHT = 82,
|
||||
RICON_BOX_RIGHT = 83,
|
||||
RICON_BOX_BOTTOM_RIGHT = 84,
|
||||
RICON_BOX_BOTTOM = 85,
|
||||
RICON_BOX_BOTTOM_LEFT = 86,
|
||||
RICON_BOX_LEFT = 87,
|
||||
RICON_BOX_TOP_LEFT = 88,
|
||||
RICON_BOX_CENTER = 89,
|
||||
RICON_BOX_CIRCLE_MASK = 90,
|
||||
RICON_POT = 91,
|
||||
RICON_ALPHA_MULTIPLY = 92,
|
||||
RICON_ALPHA_CLEAR = 93,
|
||||
RICON_DITHERING = 94,
|
||||
RICON_MIPMAPS = 95,
|
||||
RICON_BOX_GRID = 96,
|
||||
RICON_GRID = 97,
|
||||
RICON_BOX_CORNERS_SMALL = 98,
|
||||
RICON_BOX_CORNERS_BIG = 99,
|
||||
RICON_FOUR_BOXES = 100,
|
||||
RICON_GRID_FILL = 101,
|
||||
RICON_BOX_MULTISIZE = 102,
|
||||
RICON_ZOOM_SMALL = 103,
|
||||
RICON_ZOOM_MEDIUM = 104,
|
||||
RICON_ZOOM_BIG = 105,
|
||||
RICON_ZOOM_ALL = 106,
|
||||
RICON_ZOOM_CENTER = 107,
|
||||
RICON_BOX_DOTS_SMALL = 108,
|
||||
RICON_BOX_DOTS_BIG = 109,
|
||||
RICON_BOX_CONCENTRIC = 110,
|
||||
RICON_BOX_GRID_BIG = 111,
|
||||
RICON_OK_TICK = 112,
|
||||
RICON_CROSS = 113,
|
||||
RICON_ARROW_LEFT = 114,
|
||||
RICON_ARROW_RIGHT = 115,
|
||||
RICON_ARROW_BOTTOM = 116,
|
||||
RICON_ARROW_TOP = 117,
|
||||
RICON_ARROW_LEFT_FILL = 118,
|
||||
RICON_ARROW_RIGHT_FILL = 119,
|
||||
RICON_ARROW_BOTTOM_FILL = 120,
|
||||
RICON_ARROW_TOP_FILL = 121,
|
||||
RICON_AUDIO = 122,
|
||||
RICON_FX = 123,
|
||||
RICON_WAVE = 124,
|
||||
RICON_WAVE_SINUS = 125,
|
||||
RICON_WAVE_SQUARE = 126,
|
||||
RICON_WAVE_TRIANGULAR = 127,
|
||||
RICON_CROSS_SMALL = 128,
|
||||
RICON_PLAYER_PREVIOUS = 129,
|
||||
RICON_PLAYER_PLAY_BACK = 130,
|
||||
RICON_PLAYER_PLAY = 131,
|
||||
RICON_PLAYER_PAUSE = 132,
|
||||
RICON_PLAYER_STOP = 133,
|
||||
RICON_PLAYER_NEXT = 134,
|
||||
RICON_PLAYER_RECORD = 135,
|
||||
RICON_MAGNET = 136,
|
||||
RICON_LOCK_CLOSE = 137,
|
||||
RICON_LOCK_OPEN = 138,
|
||||
RICON_CLOCK = 139,
|
||||
RICON_TOOLS = 140,
|
||||
RICON_GEAR = 141,
|
||||
RICON_GEAR_BIG = 142,
|
||||
RICON_BIN = 143,
|
||||
RICON_HAND_POINTER = 144,
|
||||
RICON_LASER = 145,
|
||||
RICON_COIN = 146,
|
||||
RICON_EXPLOSION = 147,
|
||||
RICON_1UP = 148,
|
||||
RICON_PLAYER = 149,
|
||||
RICON_PLAYER_JUMP = 150,
|
||||
RICON_KEY = 151,
|
||||
RICON_DEMON = 152,
|
||||
RICON_TEXT_POPUP = 153,
|
||||
RICON_GEAR_EX = 154,
|
||||
RICON_CRACK = 155,
|
||||
RICON_CRACK_POINTS = 156,
|
||||
RICON_STAR = 157,
|
||||
RICON_DOOR = 158,
|
||||
RICON_EXIT = 159,
|
||||
RICON_MODE_2D = 160,
|
||||
RICON_MODE_3D = 161,
|
||||
RICON_CUBE = 162,
|
||||
RICON_CUBE_FACE_TOP = 163,
|
||||
RICON_CUBE_FACE_LEFT = 164,
|
||||
RICON_CUBE_FACE_FRONT = 165,
|
||||
RICON_CUBE_FACE_BOTTOM = 166,
|
||||
RICON_CUBE_FACE_RIGHT = 167,
|
||||
RICON_CUBE_FACE_BACK = 168,
|
||||
RICON_CAMERA = 169,
|
||||
RICON_SPECIAL = 170,
|
||||
RICON_LINK_NET = 171,
|
||||
RICON_LINK_BOXES = 172,
|
||||
RICON_LINK_MULTI = 173,
|
||||
RICON_LINK = 174,
|
||||
RICON_LINK_BROKE = 175,
|
||||
RICON_TEXT_NOTES = 176,
|
||||
RICON_NOTEBOOK = 177,
|
||||
RICON_SUITCASE = 178,
|
||||
RICON_SUITCASE_ZIP = 179,
|
||||
RICON_MAILBOX = 180,
|
||||
RICON_MONITOR = 181,
|
||||
RICON_PRINTER = 182,
|
||||
RICON_PHOTO_CAMERA = 183,
|
||||
RICON_PHOTO_CAMERA_FLASH = 184,
|
||||
RICON_HOUSE = 185,
|
||||
RICON_HEART = 186,
|
||||
RICON_CORNER = 187,
|
||||
RICON_VERTICAL_BARS = 188,
|
||||
RICON_VERTICAL_BARS_FILL = 189,
|
||||
RICON_LIFE_BARS = 190,
|
||||
RICON_INFO = 191,
|
||||
RICON_CROSSLINE = 192,
|
||||
RICON_HELP = 193,
|
||||
RICON_FILETYPE_ALPHA = 194,
|
||||
RICON_FILETYPE_HOME = 195,
|
||||
RICON_LAYERS_VISIBLE = 196,
|
||||
RICON_LAYERS = 197,
|
||||
RICON_WINDOW = 198,
|
||||
RICON_HIDPI = 199,
|
||||
RICON_200 = 200,
|
||||
RICON_201 = 201,
|
||||
RICON_202 = 202,
|
||||
RICON_203 = 203,
|
||||
RICON_204 = 204,
|
||||
RICON_205 = 205,
|
||||
RICON_206 = 206,
|
||||
RICON_207 = 207,
|
||||
RICON_208 = 208,
|
||||
RICON_209 = 209,
|
||||
RICON_210 = 210,
|
||||
RICON_211 = 211,
|
||||
RICON_212 = 212,
|
||||
RICON_213 = 213,
|
||||
RICON_214 = 214,
|
||||
RICON_215 = 215,
|
||||
RICON_216 = 216,
|
||||
RICON_217 = 217,
|
||||
RICON_218 = 218,
|
||||
RICON_219 = 219,
|
||||
RICON_220 = 220,
|
||||
RICON_221 = 221,
|
||||
RICON_222 = 222,
|
||||
RICON_223 = 223,
|
||||
RICON_224 = 224,
|
||||
RICON_225 = 225,
|
||||
RICON_226 = 226,
|
||||
RICON_227 = 227,
|
||||
RICON_228 = 228,
|
||||
RICON_229 = 229,
|
||||
RICON_230 = 230,
|
||||
RICON_231 = 231,
|
||||
RICON_232 = 232,
|
||||
RICON_233 = 233,
|
||||
RICON_234 = 234,
|
||||
RICON_235 = 235,
|
||||
RICON_236 = 236,
|
||||
RICON_237 = 237,
|
||||
RICON_238 = 238,
|
||||
RICON_239 = 239,
|
||||
RICON_240 = 240,
|
||||
RICON_241 = 241,
|
||||
RICON_242 = 242,
|
||||
RICON_243 = 243,
|
||||
RICON_244 = 244,
|
||||
RICON_245 = 245,
|
||||
RICON_246 = 246,
|
||||
RICON_247 = 247,
|
||||
RICON_248 = 248,
|
||||
RICON_249 = 249,
|
||||
RICON_250 = 250,
|
||||
RICON_251 = 251,
|
||||
RICON_252 = 252,
|
||||
RICON_253 = 253,
|
||||
RICON_254 = 254,
|
||||
RICON_255 = 255,
|
||||
} guiIconName;
|
||||
]]
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <extras/easings.h>
|
||||
#include <rgestures.h>
|
||||
|
||||
#define RAYGUI_SUPPORT_RICONS
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#define RAYGUI_STATIC
|
||||
#include <raygui.h>
|
||||
@ -39,9 +40,6 @@
|
||||
|
||||
extern const char *raylua_boot_str;
|
||||
|
||||
#ifdef WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
void raylua_boot(lua_State *L, lua_CFunction loadfile, lua_CFunction listfiles,
|
||||
bool repl)
|
||||
{
|
||||
@ -79,9 +77,6 @@ void raylua_boot(lua_State *L, lua_CFunction loadfile, lua_CFunction listfiles,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
int luaopen_raylua(lua_State *L)
|
||||
{
|
||||
raylua_boot(L, NULL, NULL, false);
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
local load = loadstring
|
||||
|
||||
raylua.version = "v4.0b"
|
||||
raylua.version = "v4.0-dev"
|
||||
|
||||
function raylua.repl()
|
||||
print("> raylua " .. raylua.version .. " <")
|
||||
@ -45,10 +45,6 @@ end
|
||||
|
||||
package.path = "?.lua;?/init.lua"
|
||||
|
||||
if os.getenv "LUA_PATH" then
|
||||
package.path = package.path .. ";" .. os.getenv "LUA_PATH"
|
||||
end
|
||||
|
||||
if raylua.loadfile then
|
||||
-- Change the second loader to load files using raylua.loadfile
|
||||
package.loaders[2] = function (name)
|
||||
|
37
tools/api.h
37
tools/api.h
@ -21,12 +21,9 @@ void SetWindowPosition(int x, int y)
|
||||
void SetWindowMonitor(int monitor)
|
||||
void SetWindowMinSize(int width, int height)
|
||||
void SetWindowSize(int width, int height)
|
||||
void SetWindowOpacity(float opacity)
|
||||
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)
|
||||
@ -107,14 +104,12 @@ bool SaveFileText(const char *fileName, char *text)
|
||||
bool FileExists(const char *fileName)
|
||||
bool DirectoryExists(const char *dirPath)
|
||||
bool IsFileExtension(const char *fileName, const char *ext)
|
||||
int GetFileLength(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)
|
||||
char **GetDirectoryFiles(const char *dirPath, int *count)
|
||||
void ClearDirectoryFiles(void)
|
||||
bool ChangeDirectory(const char *dir)
|
||||
@ -122,10 +117,8 @@ bool IsFileDropped(void)
|
||||
char **GetDroppedFiles(int *count)
|
||||
void ClearDroppedFiles(void)
|
||||
long GetFileModTime(const char *fileName)
|
||||
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 unsigned char *data, int *outputSize)
|
||||
unsigned char *CompressData(unsigned char *data, int dataLength, int *compDataLength)
|
||||
unsigned char *DecompressData(unsigned char *compData, int compDataLength, int *dataLength)
|
||||
bool SaveStorageValue(unsigned int position, int value)
|
||||
int LoadStorageValue(unsigned int position)
|
||||
void OpenURL(const char *url)
|
||||
@ -137,6 +130,7 @@ void SetExitKey(int key)
|
||||
int GetKeyPressed(void)
|
||||
int GetCharPressed(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)
|
||||
@ -223,7 +217,6 @@ 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 CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint)
|
||||
bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold)
|
||||
Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
|
||||
Image LoadImage(const char *fileName)
|
||||
Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize)
|
||||
@ -240,6 +233,7 @@ 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)
|
||||
Image ImageCopy(Image image)
|
||||
Image ImageFromImage(Image image, Rectangle rec)
|
||||
@ -328,13 +322,11 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
|
||||
Image GenImageFontAtlas(const GlyphInfo *chars, Rectangle **recs, int glyphCount, int fontSize, int padding, int packMethod)
|
||||
void UnloadFontData(GlyphInfo *chars, 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 count, Vector2 position, float fontSize, float spacing, 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)
|
||||
@ -345,7 +337,7 @@ void UnloadCodepoints(int *codepoints)
|
||||
int GetCodepointCount(const char *text)
|
||||
int GetCodepoint(const char *text, int *bytesProcessed)
|
||||
const char *CodepointToUTF8(int codepoint, int *byteSize)
|
||||
char *TextCodepointsToUTF8(const int *codepoints, int length)
|
||||
char *TextCodepointsToUTF8(int *codepoints, int length)
|
||||
int TextCopy(char *dst, const char *src)
|
||||
bool TextIsEqual(const char *text1, const char *text2)
|
||||
unsigned int TextLength(const char *text)
|
||||
@ -376,9 +368,7 @@ 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 DrawCylinderEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color)
|
||||
void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color)
|
||||
void DrawCylinderWiresEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color)
|
||||
void DrawPlane(Vector3 centerPos, Vector2 size, Color color)
|
||||
void DrawRay(Ray ray, Color color)
|
||||
void DrawGrid(int slices, float spacing)
|
||||
@ -396,10 +386,10 @@ void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float siz
|
||||
void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint)
|
||||
void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, 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 UpdateMeshBuffer(Mesh mesh, int index, 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)
|
||||
void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int instances)
|
||||
bool ExportMesh(Mesh mesh, const char *fileName)
|
||||
BoundingBox GetMeshBoundingBox(Mesh mesh)
|
||||
void GenMeshTangents(Mesh *mesh)
|
||||
@ -430,6 +420,7 @@ 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 GetRayCollisionModel(Ray ray, Model model)
|
||||
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)
|
||||
@ -456,14 +447,13 @@ int GetSoundsPlaying(void)
|
||||
bool IsSoundPlaying(Sound sound)
|
||||
void SetSoundVolume(Sound sound, float volume)
|
||||
void SetSoundPitch(Sound sound, float pitch)
|
||||
void SetSoundPan(Sound sound, float pan)
|
||||
void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels)
|
||||
Wave WaveCopy(Wave wave)
|
||||
void WaveCrop(Wave *wave, int initSample, int finalSample)
|
||||
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)
|
||||
Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int dataSize)
|
||||
void UnloadMusicStream(Music music)
|
||||
void PlayMusicStream(Music music)
|
||||
bool IsMusicStreamPlaying(Music music)
|
||||
@ -473,7 +463,6 @@ void PauseMusicStream(Music music)
|
||||
void ResumeMusicStream(Music music)
|
||||
void SeekMusicStream(Music music, float position)
|
||||
void SetMusicVolume(Music music, float volume)
|
||||
void SetMusicPan(Music music, float pan)
|
||||
void SetMusicPitch(Music music, float pitch)
|
||||
float GetMusicTimeLength(Music music)
|
||||
float GetMusicTimePlayed(Music music)
|
||||
@ -488,8 +477,4 @@ 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 SetAudioStreamBufferSizeDefault(int size)
|
@ -1,139 +0,0 @@
|
||||
local json = require "json"
|
||||
|
||||
local content = io.open(arg[1], "r"):read "*a"
|
||||
local t = json.decode(content)
|
||||
|
||||
print "---@diagnostic disable"
|
||||
|
||||
print "---raylib-lua binding"
|
||||
print "rl = {}"
|
||||
|
||||
local ffi_type_list = {}
|
||||
|
||||
local function luaify(t)
|
||||
-- strings
|
||||
for _,v in ipairs { "void %*", "char %*" } do
|
||||
if string.find(t, v) then
|
||||
return 'string|lightuserdata'
|
||||
end
|
||||
end
|
||||
|
||||
for _,v in ipairs { "char" } do
|
||||
if string.find(t, v) then
|
||||
return "number|string[]"
|
||||
end
|
||||
end
|
||||
|
||||
for _,v in ipairs { "int", "long", "float", "double" } do
|
||||
if string.find(t, v) then
|
||||
return "number"
|
||||
end
|
||||
end
|
||||
|
||||
local t = t:gsub(" ", "_"):gsub("*", "_ptr"):gsub("__", "_")
|
||||
if t:find "_ptr" then
|
||||
t = t .. "|lightuserdata"
|
||||
end
|
||||
|
||||
return t
|
||||
end
|
||||
|
||||
for _,enum in ipairs(t.enums) do
|
||||
print("---@alias " .. enum.name)
|
||||
for _,v in pairs(enum.values) do
|
||||
print(string.format("---| '%s'", v.name))
|
||||
end
|
||||
|
||||
if enum.description ~= "" then
|
||||
print("---" .. enum.description)
|
||||
end
|
||||
|
||||
print ""
|
||||
|
||||
for _,v in pairs(enum.values) do
|
||||
if v.description ~= "" then
|
||||
print("---" .. v.description)
|
||||
end
|
||||
print(string.format("rl.%s = %u", v.name, v.value))
|
||||
end
|
||||
end
|
||||
|
||||
for _,struct in ipairs(t.structs) do
|
||||
print(string.format("---@class %s%s", struct.name,
|
||||
(struct.description ~= "") and string.format(" @ %s", struct.description) or ""))
|
||||
|
||||
print(string.format("---@alias %s_ptr %s", struct.name, struct.name))
|
||||
print(string.format("---@alias %s_ptr_ptr %s", struct.name, struct.name))
|
||||
|
||||
if struct.name == "Texture" then
|
||||
print "---@alias Texture2D Texture"
|
||||
end
|
||||
if struct.name == "RenderTexture" then
|
||||
print "---@alias RenderTexture2D RenderTexture"
|
||||
end
|
||||
|
||||
ffi_type_list[#ffi_type_list+1] = struct.name
|
||||
|
||||
for _,field in pairs(struct.fields) do
|
||||
for n in field.name:gmatch "([^, ]+),?" do
|
||||
local arraySize = n:match "%[(.-)%]"
|
||||
if arraySize then
|
||||
n = n:match("(%S-)%[.-%]")
|
||||
field.type = string.format("%s[]", luaify(field.type), arraySize)
|
||||
end
|
||||
|
||||
print(string.format('---@field %s %s%s', n, luaify(field.type),
|
||||
(field.description ~= "") and string.format(" # %s", field.description) or ""))
|
||||
end
|
||||
end
|
||||
print(string.format('---Constructed using `rl.new("%s", ...)`', struct.name))
|
||||
print(string.format("local %s = {}", struct.name))
|
||||
end
|
||||
|
||||
for _,func in ipairs(t.functions) do
|
||||
local arraySize
|
||||
|
||||
local args = {}
|
||||
local vla = false
|
||||
|
||||
for i,param in ipairs(func.params or {}) do
|
||||
if param.name ~= "" then
|
||||
arraySize = param.name:match "%[(.-)%]"
|
||||
if arraySize then
|
||||
param.name = param.name:match("(%S-)%[.-%]")
|
||||
param.type = string.format("%s[%d]", param.type, arraySize)
|
||||
end
|
||||
|
||||
arraySize = param.name:match "%[(.-)%]"
|
||||
if arraySize then
|
||||
param.name = param.name:match("(%S-)%[.-%]")
|
||||
param.type = string.format("%s[%d]", luaify(param.type), arraySize)
|
||||
end
|
||||
|
||||
print(string.format('---@param %s %s', param.name, luaify(param.type)))
|
||||
|
||||
args[#args + 1] = param.name
|
||||
else
|
||||
vla = true
|
||||
end
|
||||
end
|
||||
|
||||
if func.returnType and func.returnType ~= "void" then
|
||||
print(string.format('---@return %s', luaify(func.returnType)))
|
||||
end
|
||||
|
||||
if vla then
|
||||
print "---@vararg any"
|
||||
end
|
||||
|
||||
if func.description ~= "" then
|
||||
print("---" .. func.description)
|
||||
end
|
||||
print(string.format("function rl.%s(%s%s) end", func.name, table.concat(args, ","), vla and ", ..." or ""))
|
||||
end
|
||||
|
||||
print "---Create a new variable of ffi type `t`"
|
||||
for i,t in ipairs(ffi_type_list) do
|
||||
print(string.format([[---@overload fun(t: '"%s"', ...): %s]], t, t))
|
||||
end
|
||||
print("function rl.new(...) end")
|
@ -1,388 +0,0 @@
|
||||
--
|
||||
-- json.lua
|
||||
--
|
||||
-- Copyright (c) 2020 rxi
|
||||
--
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
-- this software and associated documentation files (the "Software"), to deal in
|
||||
-- the Software without restriction, including without limitation the rights to
|
||||
-- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
-- of the Software, and to permit persons to whom the Software is furnished to do
|
||||
-- so, subject to the following conditions:
|
||||
--
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
--
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
--
|
||||
|
||||
local json = { _version = "0.1.2" }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Encode
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
local encode
|
||||
|
||||
local escape_char_map = {
|
||||
[ "\\" ] = "\\",
|
||||
[ "\"" ] = "\"",
|
||||
[ "\b" ] = "b",
|
||||
[ "\f" ] = "f",
|
||||
[ "\n" ] = "n",
|
||||
[ "\r" ] = "r",
|
||||
[ "\t" ] = "t",
|
||||
}
|
||||
|
||||
local escape_char_map_inv = { [ "/" ] = "/" }
|
||||
for k, v in pairs(escape_char_map) do
|
||||
escape_char_map_inv[v] = k
|
||||
end
|
||||
|
||||
|
||||
local function escape_char(c)
|
||||
return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte()))
|
||||
end
|
||||
|
||||
|
||||
local function encode_nil(val)
|
||||
return "null"
|
||||
end
|
||||
|
||||
|
||||
local function encode_table(val, stack)
|
||||
local res = {}
|
||||
stack = stack or {}
|
||||
|
||||
-- Circular reference?
|
||||
if stack[val] then error("circular reference") end
|
||||
|
||||
stack[val] = true
|
||||
|
||||
if rawget(val, 1) ~= nil or next(val) == nil then
|
||||
-- Treat as array -- check keys are valid and it is not sparse
|
||||
local n = 0
|
||||
for k in pairs(val) do
|
||||
if type(k) ~= "number" then
|
||||
error("invalid table: mixed or invalid key types")
|
||||
end
|
||||
n = n + 1
|
||||
end
|
||||
if n ~= #val then
|
||||
error("invalid table: sparse array")
|
||||
end
|
||||
-- Encode
|
||||
for i, v in ipairs(val) do
|
||||
table.insert(res, encode(v, stack))
|
||||
end
|
||||
stack[val] = nil
|
||||
return "[" .. table.concat(res, ",") .. "]"
|
||||
|
||||
else
|
||||
-- Treat as an object
|
||||
for k, v in pairs(val) do
|
||||
if type(k) ~= "string" then
|
||||
error("invalid table: mixed or invalid key types")
|
||||
end
|
||||
table.insert(res, encode(k, stack) .. ":" .. encode(v, stack))
|
||||
end
|
||||
stack[val] = nil
|
||||
return "{" .. table.concat(res, ",") .. "}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function encode_string(val)
|
||||
return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
|
||||
end
|
||||
|
||||
|
||||
local function encode_number(val)
|
||||
-- Check for NaN, -inf and inf
|
||||
if val ~= val or val <= -math.huge or val >= math.huge then
|
||||
error("unexpected number value '" .. tostring(val) .. "'")
|
||||
end
|
||||
return string.format("%.14g", val)
|
||||
end
|
||||
|
||||
|
||||
local type_func_map = {
|
||||
[ "nil" ] = encode_nil,
|
||||
[ "table" ] = encode_table,
|
||||
[ "string" ] = encode_string,
|
||||
[ "number" ] = encode_number,
|
||||
[ "boolean" ] = tostring,
|
||||
}
|
||||
|
||||
|
||||
encode = function(val, stack)
|
||||
local t = type(val)
|
||||
local f = type_func_map[t]
|
||||
if f then
|
||||
return f(val, stack)
|
||||
end
|
||||
error("unexpected type '" .. t .. "'")
|
||||
end
|
||||
|
||||
|
||||
function json.encode(val)
|
||||
return ( encode(val) )
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Decode
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
local parse
|
||||
|
||||
local function create_set(...)
|
||||
local res = {}
|
||||
for i = 1, select("#", ...) do
|
||||
res[ select(i, ...) ] = true
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
local space_chars = create_set(" ", "\t", "\r", "\n")
|
||||
local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",")
|
||||
local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u")
|
||||
local literals = create_set("true", "false", "null")
|
||||
|
||||
local literal_map = {
|
||||
[ "true" ] = true,
|
||||
[ "false" ] = false,
|
||||
[ "null" ] = nil,
|
||||
}
|
||||
|
||||
|
||||
local function next_char(str, idx, set, negate)
|
||||
for i = idx, #str do
|
||||
if set[str:sub(i, i)] ~= negate then
|
||||
return i
|
||||
end
|
||||
end
|
||||
return #str + 1
|
||||
end
|
||||
|
||||
|
||||
local function decode_error(str, idx, msg)
|
||||
local line_count = 1
|
||||
local col_count = 1
|
||||
for i = 1, idx - 1 do
|
||||
col_count = col_count + 1
|
||||
if str:sub(i, i) == "\n" then
|
||||
line_count = line_count + 1
|
||||
col_count = 1
|
||||
end
|
||||
end
|
||||
error( string.format("%s at line %d col %d", msg, line_count, col_count) )
|
||||
end
|
||||
|
||||
|
||||
local function codepoint_to_utf8(n)
|
||||
-- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa
|
||||
local f = math.floor
|
||||
if n <= 0x7f then
|
||||
return string.char(n)
|
||||
elseif n <= 0x7ff then
|
||||
return string.char(f(n / 64) + 192, n % 64 + 128)
|
||||
elseif n <= 0xffff then
|
||||
return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128)
|
||||
elseif n <= 0x10ffff then
|
||||
return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128,
|
||||
f(n % 4096 / 64) + 128, n % 64 + 128)
|
||||
end
|
||||
error( string.format("invalid unicode codepoint '%x'", n) )
|
||||
end
|
||||
|
||||
|
||||
local function parse_unicode_escape(s)
|
||||
local n1 = tonumber( s:sub(1, 4), 16 )
|
||||
local n2 = tonumber( s:sub(7, 10), 16 )
|
||||
-- Surrogate pair?
|
||||
if n2 then
|
||||
return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
|
||||
else
|
||||
return codepoint_to_utf8(n1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function parse_string(str, i)
|
||||
local res = ""
|
||||
local j = i + 1
|
||||
local k = j
|
||||
|
||||
while j <= #str do
|
||||
local x = str:byte(j)
|
||||
|
||||
if x < 32 then
|
||||
decode_error(str, j, "control character in string")
|
||||
|
||||
elseif x == 92 then -- `\`: Escape
|
||||
res = res .. str:sub(k, j - 1)
|
||||
j = j + 1
|
||||
local c = str:sub(j, j)
|
||||
if c == "u" then
|
||||
local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1)
|
||||
or str:match("^%x%x%x%x", j + 1)
|
||||
or decode_error(str, j - 1, "invalid unicode escape in string")
|
||||
res = res .. parse_unicode_escape(hex)
|
||||
j = j + #hex
|
||||
else
|
||||
if not escape_chars[c] then
|
||||
decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string")
|
||||
end
|
||||
res = res .. escape_char_map_inv[c]
|
||||
end
|
||||
k = j + 1
|
||||
|
||||
elseif x == 34 then -- `"`: End of string
|
||||
res = res .. str:sub(k, j - 1)
|
||||
return res, j + 1
|
||||
end
|
||||
|
||||
j = j + 1
|
||||
end
|
||||
|
||||
decode_error(str, i, "expected closing quote for string")
|
||||
end
|
||||
|
||||
|
||||
local function parse_number(str, i)
|
||||
local x = next_char(str, i, delim_chars)
|
||||
local s = str:sub(i, x - 1)
|
||||
local n = tonumber(s)
|
||||
if not n then
|
||||
decode_error(str, i, "invalid number '" .. s .. "'")
|
||||
end
|
||||
return n, x
|
||||
end
|
||||
|
||||
|
||||
local function parse_literal(str, i)
|
||||
local x = next_char(str, i, delim_chars)
|
||||
local word = str:sub(i, x - 1)
|
||||
if not literals[word] then
|
||||
decode_error(str, i, "invalid literal '" .. word .. "'")
|
||||
end
|
||||
return literal_map[word], x
|
||||
end
|
||||
|
||||
|
||||
local function parse_array(str, i)
|
||||
local res = {}
|
||||
local n = 1
|
||||
i = i + 1
|
||||
while 1 do
|
||||
local x
|
||||
i = next_char(str, i, space_chars, true)
|
||||
-- Empty / end of array?
|
||||
if str:sub(i, i) == "]" then
|
||||
i = i + 1
|
||||
break
|
||||
end
|
||||
-- Read token
|
||||
x, i = parse(str, i)
|
||||
res[n] = x
|
||||
n = n + 1
|
||||
-- Next token
|
||||
i = next_char(str, i, space_chars, true)
|
||||
local chr = str:sub(i, i)
|
||||
i = i + 1
|
||||
if chr == "]" then break end
|
||||
if chr ~= "," then decode_error(str, i, "expected ']' or ','") end
|
||||
end
|
||||
return res, i
|
||||
end
|
||||
|
||||
|
||||
local function parse_object(str, i)
|
||||
local res = {}
|
||||
i = i + 1
|
||||
while 1 do
|
||||
local key, val
|
||||
i = next_char(str, i, space_chars, true)
|
||||
-- Empty / end of object?
|
||||
if str:sub(i, i) == "}" then
|
||||
i = i + 1
|
||||
break
|
||||
end
|
||||
-- Read key
|
||||
if str:sub(i, i) ~= '"' then
|
||||
decode_error(str, i, "expected string for key")
|
||||
end
|
||||
key, i = parse(str, i)
|
||||
-- Read ':' delimiter
|
||||
i = next_char(str, i, space_chars, true)
|
||||
if str:sub(i, i) ~= ":" then
|
||||
decode_error(str, i, "expected ':' after key")
|
||||
end
|
||||
i = next_char(str, i + 1, space_chars, true)
|
||||
-- Read value
|
||||
val, i = parse(str, i)
|
||||
-- Set
|
||||
res[key] = val
|
||||
-- Next token
|
||||
i = next_char(str, i, space_chars, true)
|
||||
local chr = str:sub(i, i)
|
||||
i = i + 1
|
||||
if chr == "}" then break end
|
||||
if chr ~= "," then decode_error(str, i, "expected '}' or ','") end
|
||||
end
|
||||
return res, i
|
||||
end
|
||||
|
||||
|
||||
local char_func_map = {
|
||||
[ '"' ] = parse_string,
|
||||
[ "0" ] = parse_number,
|
||||
[ "1" ] = parse_number,
|
||||
[ "2" ] = parse_number,
|
||||
[ "3" ] = parse_number,
|
||||
[ "4" ] = parse_number,
|
||||
[ "5" ] = parse_number,
|
||||
[ "6" ] = parse_number,
|
||||
[ "7" ] = parse_number,
|
||||
[ "8" ] = parse_number,
|
||||
[ "9" ] = parse_number,
|
||||
[ "-" ] = parse_number,
|
||||
[ "t" ] = parse_literal,
|
||||
[ "f" ] = parse_literal,
|
||||
[ "n" ] = parse_literal,
|
||||
[ "[" ] = parse_array,
|
||||
[ "{" ] = parse_object,
|
||||
}
|
||||
|
||||
|
||||
parse = function(str, idx)
|
||||
local chr = str:sub(idx, idx)
|
||||
local f = char_func_map[chr]
|
||||
if f then
|
||||
return f(str, idx)
|
||||
end
|
||||
decode_error(str, idx, "unexpected character '" .. chr .. "'")
|
||||
end
|
||||
|
||||
|
||||
function json.decode(str)
|
||||
if type(str) ~= "string" then
|
||||
error("expected argument of type string, got " .. type(str))
|
||||
end
|
||||
local res, idx = parse(str, next_char(str, 1, space_chars, true))
|
||||
idx = next_char(str, idx, space_chars, true)
|
||||
if idx <= #str then
|
||||
decode_error(str, idx, "trailing garbage")
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
|
||||
return json
|
File diff suppressed because it is too large
Load Diff
@ -16,8 +16,7 @@ local structs = {
|
||||
"TextureCubemap", "TraceLogCallback", "PhysicsBody",
|
||||
"GestureEvent", "GuiStyle", "GuiTextBoxState",
|
||||
"TraceLogCallback", "VertexBuffer", "DrawCall", "RenderBatch",
|
||||
"ShaderAttributeDataType", "MaterialMapIndex", "VrStereoConfig",
|
||||
"AudioCallback"
|
||||
"ShaderAttributeDataType", "MaterialMapIndex", "VrStereoConfig"
|
||||
}
|
||||
|
||||
local rl_structs = {
|
||||
@ -32,15 +31,11 @@ local functions = {}
|
||||
local proto = {}
|
||||
|
||||
local counter = 0
|
||||
local file = io.open(arg[1], "wb")
|
||||
local modules = { "api" }
|
||||
local funcname
|
||||
|
||||
local custom_support = {
|
||||
["rlgl"] = function (line)
|
||||
return line:gsub("([%s*]+)(rl%w+)", function (pre, part)
|
||||
functions[#functions + 1] = part
|
||||
funcname = part
|
||||
counter = counter + 1
|
||||
|
||||
if counter == 2 then
|
||||
@ -52,10 +47,66 @@ local custom_support = {
|
||||
end
|
||||
}
|
||||
|
||||
local file = io.open(arg[1], "wb")
|
||||
local modules = { "api" }
|
||||
|
||||
for i=2,#arg do
|
||||
modules[i] = arg[i]
|
||||
end
|
||||
|
||||
for _,modname in ipairs(modules) do
|
||||
for line in io.lines("tools/" .. modname .. ".h") do
|
||||
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
|
||||
|
||||
for i,s in ipairs(rl_structs) do
|
||||
if part == s then
|
||||
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
|
||||
end
|
||||
|
||||
assert(#proto == #functions, "Mismatching proto and function count : " ..
|
||||
#proto .. " ~= " .. #functions)
|
||||
|
||||
file:write [[
|
||||
struct raylua_bind_entry {
|
||||
const char *name;
|
||||
@ -66,76 +117,12 @@ struct raylua_bind_entry {
|
||||
struct raylua_bind_entry raylua_entries[] = {
|
||||
]]
|
||||
|
||||
for _,modname in ipairs(modules) do
|
||||
for line in io.lines("tools/" .. modname .. ".h") do
|
||||
if line:sub(1, 2) ~= "//" then
|
||||
if line:sub(1, 1) == "#" then
|
||||
file:write(" " .. line .. "\n")
|
||||
else
|
||||
counter = 0
|
||||
funcname = nil
|
||||
|
||||
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
|
||||
|
||||
for i,s in ipairs(rl_structs) do
|
||||
if part == s then
|
||||
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
|
||||
funcname = part
|
||||
counter = counter + 1
|
||||
|
||||
if counter == 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
|
||||
|
||||
if funcname and line then
|
||||
file:write(string.format(' { "%s", "%s", &%s },\n', funcname, line, funcname))
|
||||
elseif counter == 0 then
|
||||
print("WARN: Invalid entry", funcname, line)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for i=1,#proto do
|
||||
local name, proto = functions[i], proto[i]
|
||||
file:write(string.format('{ "%s", "%s", &%s },\n', name, proto, name))
|
||||
end
|
||||
|
||||
assert(#proto == #functions, "Mismatching proto and function count : " ..
|
||||
#proto .. " ~= " .. #functions)
|
||||
|
||||
print(string.format("Bound %d functions.", #proto))
|
||||
|
||||
file:write ' { NULL, NULL, NULL },\n'
|
||||
file:write '{ NULL, NULL, NULL },\n'
|
||||
file:write "};\n"
|
||||
|
||||
file:close()
|
||||
|
@ -13,11 +13,13 @@ int GuiGetStyle(int control, int property)
|
||||
bool GuiWindowBox(Rectangle bounds, const char *title)
|
||||
void GuiGroupBox(Rectangle bounds, const char *text)
|
||||
void GuiLine(Rectangle bounds, const char *text)
|
||||
void GuiPanel(Rectangle bounds, const char *text)
|
||||
Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll)
|
||||
void GuiPanel(Rectangle bounds)
|
||||
Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 *scroll)
|
||||
void GuiLabel(Rectangle bounds, const char *text)
|
||||
bool GuiButton(Rectangle bounds, const char *text)
|
||||
bool GuiLabelButton(Rectangle bounds, const char *text)
|
||||
bool GuiImageButton(Rectangle bounds, const char *text, Texture2D texture)
|
||||
bool GuiImageButtonEx(Rectangle bounds, const char *text, Texture2D texture, Rectangle texSource)
|
||||
bool GuiToggle(Rectangle bounds, const char *text, bool active)
|
||||
int GuiToggleGroup(Rectangle bounds, const char *text, int active)
|
||||
bool GuiCheckBox(Rectangle bounds, const char *text, bool checked)
|
||||
@ -32,23 +34,23 @@ float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight
|
||||
float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue)
|
||||
void GuiStatusBar(Rectangle bounds, const char *text)
|
||||
void GuiDummyRec(Rectangle bounds, const char *text)
|
||||
Vector2 GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs)
|
||||
int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue)
|
||||
Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs)
|
||||
int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active)
|
||||
int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active)
|
||||
int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons)
|
||||
int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, int *secretViewActive)
|
||||
Color GuiColorPicker(Rectangle bounds, const char *text, Color color)
|
||||
Color GuiColorPanel(Rectangle bounds, const char *text, Color color)
|
||||
float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha)
|
||||
float GuiColorBarHue(Rectangle bounds, const char *text, float value)
|
||||
int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text)
|
||||
Color GuiColorPicker(Rectangle bounds, Color color)
|
||||
Color GuiColorPanel(Rectangle bounds, Color color)
|
||||
float GuiColorBarAlpha(Rectangle bounds, float alpha)
|
||||
float GuiColorBarHue(Rectangle bounds, float value)
|
||||
void GuiLoadStyle(const char *fileName)
|
||||
void GuiLoadStyleDefault(void)
|
||||
const char *GuiIconText(int iconId, const char *text)
|
||||
void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color)
|
||||
void GuiDrawIcon(int iconId, Vector2 position, int pixelSize, Color color)
|
||||
unsigned int *GuiGetIcons(void)
|
||||
unsigned int *GuiGetIconData(int iconId)
|
||||
void GuiSetIconData(int iconId, unsigned int *data)
|
||||
void GuiSetIconScale(unsigned int scale)
|
||||
void GuiSetIconPixel(int iconId, int x, int y)
|
||||
void GuiClearIconPixel(int iconId, int x, int y)
|
||||
bool GuiCheckIconPixel(int iconId, int x, int y)
|
@ -12,14 +12,12 @@ float Vector2Length(Vector2 v)
|
||||
float Vector2LengthSqr(Vector2 v)
|
||||
float Vector2DotProduct(Vector2 v1, Vector2 v2)
|
||||
float Vector2Distance(Vector2 v1, Vector2 v2)
|
||||
float Vector2DistanceSqr(Vector2 v1, Vector2 v2)
|
||||
float Vector2Angle(Vector2 v1, Vector2 v2)
|
||||
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 Vector2Rotate(Vector2 v, float degs)
|
||||
@ -38,7 +36,6 @@ 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)
|
||||
Vector2 Vector3Angle(Vector3 v1, Vector3 v2)
|
||||
Vector3 Vector3Negate(Vector3 v)
|
||||
Vector3 Vector3Divide(Vector3 v1, Vector3 v2)
|
||||
@ -56,6 +53,7 @@ float MatrixDeterminant(Matrix mat)
|
||||
float MatrixTrace(Matrix mat)
|
||||
Matrix MatrixTranspose(Matrix mat)
|
||||
Matrix MatrixInvert(Matrix mat)
|
||||
Matrix MatrixNormalize(Matrix mat)
|
||||
Matrix MatrixIdentity(void)
|
||||
Matrix MatrixAdd(Matrix left, Matrix right)
|
||||
Matrix MatrixSubtract(Matrix left, Matrix right)
|
||||
|
25
tools/rlgl.h
25
tools/rlgl.h
@ -27,10 +27,6 @@ void rlEnableVertexBufferElement(unsigned int id)
|
||||
void rlDisableVertexBufferElement(void)
|
||||
void rlEnableVertexAttribute(unsigned int index)
|
||||
void rlDisableVertexAttribute(unsigned int index)
|
||||
#if defined(GRAPHICS_API_OPENGL_11)
|
||||
void rlEnableStatePointer(int vertexAttribType, void *buffer)
|
||||
void rlDisableStatePointer(int vertexAttribType)
|
||||
#endif
|
||||
void rlActiveTextureSlot(int slot)
|
||||
void rlEnableTexture(unsigned int id)
|
||||
void rlDisableTexture(void)
|
||||
@ -84,24 +80,23 @@ 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)
|
||||
unsigned int rlLoadVertexBuffer(void *buffer, int size, bool dynamic)
|
||||
unsigned int rlLoadVertexBufferElement(void *buffer, int size, bool dynamic)
|
||||
void rlUpdateVertexBuffer(unsigned int bufferId, 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, const void *pointer)
|
||||
void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, void *pointer)
|
||||
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 rlDrawVertexArrayElements(int offset, int count, 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)
|
||||
void rlDrawVertexArrayElementsInstanced(int offset, int count, void *buffer, int instances)
|
||||
unsigned int rlLoadTexture(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)
|
||||
unsigned int rlLoadTextureCubemap(void *data, int size, int format)
|
||||
void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data)
|
||||
void rlGetGlTextureFormats(int format, int *glInternalFormat, int *glFormat, int *glType)
|
||||
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)
|
||||
@ -121,7 +116,6 @@ void rlSetUniform(int locIndex, const void *value, int uniformType, int count)
|
||||
void rlSetUniformMatrix(int locIndex, Matrix mat)
|
||||
void rlSetUniformSampler(int locIndex, unsigned int textureId)
|
||||
void rlSetShader(unsigned int id, int *locs)
|
||||
#if defined(GRAPHICS_API_OPENGL_43)
|
||||
unsigned int rlLoadComputeShaderProgram(int shaderId)
|
||||
void rlComputeShaderDispatch(unsigned int groupX, unsigned int groupY, unsigned int groupZ)
|
||||
unsigned int rlLoadShaderBuffer(unsigned long long size, const void *data, int usageHint)
|
||||
@ -132,7 +126,6 @@ void rlReadShaderBufferElements(unsigned int id, void *dest, unsigned long long
|
||||
void rlBindShaderBuffer(unsigned int id, unsigned int index)
|
||||
void rlCopyBuffersElements(unsigned int destId, unsigned int srcId, unsigned long long destOffset, unsigned long long srcOffset, unsigned long long count)
|
||||
void rlBindImageTexture(unsigned int id, unsigned int index, unsigned int format, int readonly)
|
||||
#endif
|
||||
Matrix rlGetMatrixModelview(void)
|
||||
Matrix rlGetMatrixProjection(void)
|
||||
Matrix rlGetMatrixTransform(void)
|
||||
|
Loading…
Reference in New Issue
Block a user