Compare commits
1 Commits
master
...
builder-ui
Author | SHA1 | Date | |
---|---|---|---|
|
68cff02f60 |
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
|
@ -4,8 +4,10 @@ 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
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
rl.SetTraceLogLevel(rl.LOG_WARNING)
|
||||
rl.SetConfigFlags(rl.FLAG_VSYNC_HINT)
|
||||
rl.InitWindow(800, 450, "raylib [core] example - mouse input");
|
||||
|
||||
local ball_position = rl.new("Vector2", -100, -100)
|
||||
local ball_color = rl.DARKBLUE
|
||||
|
||||
while not rl.WindowShouldClose() do
|
||||
ball_position.x = rl.GetMouseX()
|
||||
ball_position.y = rl.GetMouseY()
|
||||
|
||||
if rl.IsMouseButtonPressed(rl.MOUSE_BUTTON_LEFT) then
|
||||
ball_color = rl.MAROON
|
||||
elseif rl.IsMouseButtonPressed(rl.MOUSE_BUTTON_MIDDLE) then
|
||||
ball_color = rl.LIME
|
||||
elseif rl.IsMouseButtonPressed(rl.MOUSE_BUTTON_RIGHT) then
|
||||
ball_color = rl.DARKBLUE
|
||||
end
|
||||
|
||||
rl.BeginDrawing()
|
||||
|
||||
rl.ClearBackground(rl.RAYWHITE)
|
||||
rl.DrawCircleV(ball_position, 40, ball_color)
|
||||
rl.DrawText("move ball with mouse and click mouse button to change color",
|
||||
10, 10, 20, rl.DARKGRAY)
|
||||
|
||||
rl.EndDrawing()
|
||||
end
|
||||
|
||||
rl.CloseWindow()
|
@ -5,13 +5,11 @@ rl.InitWindow(800, 450, "raylib [shapes] example - basic shapes drawing")
|
||||
rl.InitAudioDevice()
|
||||
|
||||
local logo = rl.LoadTexture "ressources/logo.png"
|
||||
local music = rl.LoadMusicStream "ressources/mini1111.xm"
|
||||
local music = rl.LoadSound "ressources/mini1111.ogg"
|
||||
|
||||
rl.PlayMusicStream(music)
|
||||
rl.PlaySound(music)
|
||||
|
||||
while not rl.WindowShouldClose() do
|
||||
rl.UpdateMusicStream(music)
|
||||
|
||||
rl.BeginDrawing()
|
||||
rl.ClearBackground(rl.RAYWHITE)
|
||||
|
||||
@ -21,7 +19,5 @@ while not rl.WindowShouldClose() do
|
||||
rl.EndDrawing()
|
||||
end
|
||||
|
||||
rl.UnloadMusicStream(music)
|
||||
|
||||
rl.CloseAudioDevice()
|
||||
rl.CloseWindow()
|
||||
|
BIN
examples/embedding/ressources/mini1111.ogg
Normal file
BIN
examples/embedding/ressources/mini1111.ogg
Normal file
Binary file not shown.
@ -1,44 +0,0 @@
|
||||
local width, height = 1280, 720
|
||||
|
||||
rl.SetConfigFlags(rl.FLAG_WINDOW_UNDECORATED)
|
||||
rl.InitWindow(width, height, "raygui - portable window")
|
||||
rl.SetTargetFPS(75)
|
||||
|
||||
local mouse_pos = rl.new("Vector2", 0, 0)
|
||||
local window_pos = rl.GetWindowPosition()
|
||||
local pan_offset = rl.new("Vector2", mouse_pos)
|
||||
|
||||
local drag_window = false
|
||||
local exit_window = false
|
||||
|
||||
while not exit_window and not rl.WindowShouldClose() do
|
||||
mouse_pos = rl.GetMousePosition()
|
||||
|
||||
if rl.IsMouseButtonPressed(rl.MOUSE_BUTTON_LEFT) then
|
||||
if rl.CheckCollisionPointRec(mouse_pos, rl.new("Rectangle", 0, 0, width, 20)) then
|
||||
drag_window = true
|
||||
pan_offset = rl.new("Vector2", mouse_pos)
|
||||
end
|
||||
end
|
||||
|
||||
if drag_window then
|
||||
window_pos = window_pos + mouse_pos - pan_offset
|
||||
|
||||
if rl.IsMouseButtonReleased(rl.MOUSE_BUTTON_RIGHT) then
|
||||
drag_window = false
|
||||
end
|
||||
|
||||
rl.SetWindowPosition(window_pos.x, window_pos.y)
|
||||
end
|
||||
|
||||
rl.BeginDrawing()
|
||||
|
||||
rl.ClearBackground(rl.RAYWHITE)
|
||||
exit_window = rl.GuiWindowBox(rl.new("Rectangle", 0, 0, width, height), "PORTABLE WINDOW")
|
||||
rl.DrawText(string.format("Mouse Position: [ %.0f, %.0f ]", mouse_pos.x, mouse_pos.y),
|
||||
10, 40, 10, rl.DARKGRAY)
|
||||
|
||||
rl.EndDrawing()
|
||||
end
|
||||
|
||||
rl.CloseWindow()
|
@ -20,10 +20,13 @@ local menu = lynx.menu ({
|
||||
})
|
||||
|
||||
rl.SetConfigFlags(rl.FLAG_VSYNC_HINT)
|
||||
--rl.SetTargetFPS(60)
|
||||
|
||||
rl.InitWindow(800, 450, "raylib [lua] example - lynx menu")
|
||||
|
||||
while not rl.WindowShouldClose() do
|
||||
rl.BeginDrawing()
|
||||
|
||||
rl.ClearBackground(rl.BLACK)
|
||||
local pos = rl.GetMousePosition()
|
||||
menu:input_mouse(pos.x, pos.y, 0)
|
||||
|
@ -46,7 +46,7 @@ rl.SetConfigFlags(rl.FLAG_VSYNC_HINT)
|
||||
rl.InitWindow(windowWidth, windowHeight, "my 32x32 game/demo")
|
||||
|
||||
local target = rl.LoadRenderTexture(gameScreenWidth, gameScreenHeight)
|
||||
rl.SetTextureFilter(target.texture, rl.TEXTURE_FILTER_POINT)
|
||||
rl.SetTextureFilter(target.texture, rl.FILTER_POINT)
|
||||
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
|
@ -22,10 +22,10 @@ local camera = rl.new("Camera3D", {
|
||||
local num_blocks = 15
|
||||
|
||||
while not rl.WindowShouldClose() do
|
||||
local t = rl.GetTime()
|
||||
local time = rl.GetTime()
|
||||
|
||||
local scale = (2.0 + math.sin(t)) * 0.7
|
||||
local camera_time = t * 0.3
|
||||
local scale = (2.0 + math.sin(time)) * 0.7
|
||||
local camera_time = time * 0.3
|
||||
|
||||
camera.position.x = math.cos(camera_time) * 40.0
|
||||
camera.position.z = math.sin(camera_time) * 40.0
|
||||
@ -40,7 +40,7 @@ while not rl.WindowShouldClose() do
|
||||
for y=0,num_blocks-1 do
|
||||
for z=0,num_blocks-1 do
|
||||
local block_scale = (x + y + z) / 30
|
||||
local scatter = math.sin(block_scale * 20.0 + t * 4.0)
|
||||
local scatter = math.sin(block_scale * 20.0 + time * 4.0)
|
||||
|
||||
local cube_pos = rl.new("Vector3",
|
||||
(x - num_blocks / 2) * (scale * 3.0) + scatter,
|
||||
|
@ -20,7 +20,7 @@ circle.enabled = false
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
while not rl.WindowShouldClose() do
|
||||
rl.UpdatePhysics()
|
||||
rl.RunPhysicsStep()
|
||||
|
||||
if needsReset then
|
||||
floor = rl.CreatePhysicsBodyRectangle({ screenWidth/2, screenHeight }, 500, 100, 10)
|
||||
@ -37,9 +37,9 @@ while not rl.WindowShouldClose() do
|
||||
needsReset = true
|
||||
end
|
||||
|
||||
if rl.IsMouseButtonPressed(rl.MOUSE_BUTTON_LEFT) then
|
||||
if rl.IsMouseButtonPressed(rl.MOUSE_LEFT_BUTTON) then
|
||||
rl.CreatePhysicsBodyPolygon(rl.GetMousePosition(), rl.GetRandomValue(20, 80), rl.GetRandomValue(3, 8), 10);
|
||||
elseif rl.IsMouseButtonPressed(rl.MOUSE_BUTTON_RIGHT) then
|
||||
elseif rl.IsMouseButtonPressed(rl.MOUSE_RIGHT_BUTTON) then
|
||||
rl.CreatePhysicsBodyCircle(rl.GetMousePosition(), rl.GetRandomValue(10, 45), 10)
|
||||
end
|
||||
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,134 +0,0 @@
|
||||
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()
|
||||
end
|
||||
|
||||
rl.rlUnloadShaderBuffer(ssboA);
|
||||
rl.rlUnloadShaderBuffer(ssboB);
|
||||
rl.rlUnloadShaderBuffer(transfertSSBO);
|
||||
|
||||
-- Unload compute shader programs
|
||||
rl.rlUnloadShaderProgram(golTransfertProgram)
|
||||
rl.rlUnloadShaderProgram(golLogicProgram)
|
||||
|
||||
rl.UnloadTexture(whiteTex) -- Unload white texture
|
||||
rl.UnloadShader(golRenderShader) -- Unload rendering fragment shader
|
||||
|
||||
rl.CloseWindow() -- Close window and OpenGL context
|
@ -1,232 +0,0 @@
|
||||
local screenWidth = 1920
|
||||
local screenHeight = 1080
|
||||
|
||||
local preset = 3
|
||||
local default_sharpness = 1.0
|
||||
|
||||
local presets = {
|
||||
{ 2.0, "Performance" },
|
||||
{ 1.7, "Balanced" },
|
||||
{ 1.5, "Quality" },
|
||||
{ 1.3, "Ultra Quality" },
|
||||
{ 1.0, "Custom (Native)" }
|
||||
}
|
||||
|
||||
local use_fsr = true
|
||||
|
||||
local ratio = presets[preset][1]
|
||||
|
||||
local num_blocks = 15
|
||||
|
||||
local screenSize = rl.new("Vector2", screenWidth, screenHeight)
|
||||
|
||||
local fbWidth = screenWidth / ratio
|
||||
local fbHeight = screenHeight / ratio
|
||||
|
||||
local fbSize = rl.new("Vector2", fbWidth, fbHeight)
|
||||
|
||||
rl.SetConfigFlags(rl.FLAG_FULLSCREEN_MODE)
|
||||
rl.InitWindow(screenWidth, screenHeight, "raylua [shaders] example - AMD FSR")
|
||||
|
||||
local render_texture = rl.LoadRenderTexture(fbWidth, fbHeight)
|
||||
|
||||
local dest_fb = rl.LoadRenderTexture(screenWidth, screenHeight)
|
||||
|
||||
local easu_shader = rl.LoadShader(nil, "resources/fsr/fsrEasu.frag")
|
||||
|
||||
local srcSize_loc = rl.GetShaderLocation(easu_shader, "srcSize")
|
||||
local dstSize_loc = rl.GetShaderLocation(easu_shader, "dstSize")
|
||||
|
||||
rl.SetShaderValue(easu_shader, srcSize_loc, fbSize, rl.SHADER_UNIFORM_VEC2)
|
||||
rl.SetShaderValue(easu_shader, dstSize_loc, screenSize, rl.SHADER_UNIFORM_VEC2)
|
||||
|
||||
local rcas_shader = rl.LoadShader(nil, "resources/fsr/fsrRcas.frag")
|
||||
|
||||
local sharpness_loc = rl.GetShaderLocation(rcas_shader, "sharpness")
|
||||
local size_loc = rl.GetShaderLocation(rcas_shader, "dstSize")
|
||||
|
||||
local sharpness = rl.new("float[1]", default_sharpness)
|
||||
|
||||
rl.SetShaderValue(rcas_shader, sharpness_loc, sharpness, rl.SHADER_UNIFORM_FLOAT)
|
||||
rl.SetShaderValue(rcas_shader, size_loc, screenSize, rl.SHADER_UNIFORM_VEC2)
|
||||
|
||||
local camera = rl.new("Camera3D", {
|
||||
position = { 30, 20, 30 },
|
||||
target = { 0, 0, 0 },
|
||||
up = { 0, 1, 0 },
|
||||
fovy = 70,
|
||||
type = rl.CAMERA_PERSPECTIVE
|
||||
})
|
||||
|
||||
local enable_easu = false
|
||||
local enable_rcas = false
|
||||
|
||||
local stop_animation = false
|
||||
local t = 0.0
|
||||
|
||||
local bilinear = false
|
||||
|
||||
while not rl.WindowShouldClose() do
|
||||
if not stop_animation then
|
||||
t = rl.GetTime()
|
||||
end
|
||||
|
||||
local scale = (2.0 + math.sin(t)) * 0.7
|
||||
local camera_time = t * 0.3
|
||||
|
||||
camera.position.x = math.cos(camera_time) * 40.0
|
||||
camera.position.z = math.sin(camera_time) * 40.0
|
||||
|
||||
if use_fsr then
|
||||
rl.BeginTextureMode(render_texture)
|
||||
else
|
||||
rl.BeginDrawing()
|
||||
end
|
||||
|
||||
rl.BeginMode3D(camera)
|
||||
rl.ClearBackground(rl.RAYWHITE)
|
||||
|
||||
rl.DrawGrid(10, 5.0)
|
||||
|
||||
for x=0,num_blocks-1 do
|
||||
for y=0,num_blocks-1 do
|
||||
for z=0,num_blocks-1 do
|
||||
local block_scale = (x + y + z) / 30
|
||||
local scatter = math.sin(block_scale * 20.0 + t * 4.0)
|
||||
|
||||
local cube_pos = rl.new("Vector3",
|
||||
(x - num_blocks / 2) * (scale * 3.0) + scatter,
|
||||
(y - num_blocks / 2) * (scale * 2.0) + scatter,
|
||||
(z - num_blocks / 2) * (scale * 3.0) + scatter)
|
||||
|
||||
local cube_color = rl.ColorFromHSV(
|
||||
(((x + y + z) * 18) % 360), 0.75, 0.9
|
||||
)
|
||||
|
||||
local cube_size = (2.4 - scale) * block_scale
|
||||
|
||||
rl.DrawCube(cube_pos, cube_size, cube_size, cube_size, cube_color)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
rl.EndMode3D()
|
||||
|
||||
if use_fsr then
|
||||
rl.EndTextureMode()
|
||||
|
||||
rl.BeginTextureMode(dest_fb)
|
||||
rl.ClearBackground(rl.RAYWHITE)
|
||||
|
||||
if enable_easu then
|
||||
rl.BeginShaderMode(easu_shader)
|
||||
end
|
||||
rl.DrawTextureEx(render_texture.texture, screenSize, 180, ratio, rl.WHITE)
|
||||
if enable_easu then
|
||||
rl.EndShaderMode()
|
||||
end
|
||||
|
||||
rl.EndTextureMode()
|
||||
|
||||
rl.BeginDrawing()
|
||||
rl.ClearBackground(rl.WHITE)
|
||||
|
||||
if enable_rcas then
|
||||
rl.BeginShaderMode(rcas_shader)
|
||||
end
|
||||
rl.DrawTextureEx(dest_fb.texture, screenSize, 180, 1.0, rl.WHITE)
|
||||
if enable_rcas then
|
||||
rl.EndShaderMode()
|
||||
end
|
||||
end
|
||||
|
||||
rl.DrawFPS(10, 10)
|
||||
|
||||
if use_fsr then
|
||||
rl.DrawText("EASU", 10, 32, 20, enable_easu and rl.GREEN or rl.RED)
|
||||
rl.DrawText("RCAS", 10, 54, 20, enable_rcas and rl.GREEN or rl.RED)
|
||||
rl.DrawText(string.format("sharpness: %.1f", sharpness[0]), 10, 74, 10, rl.BLACK)
|
||||
rl.DrawText(string.format("Preset: %s (%.1f)", presets[preset][2], ratio), 10, 86, 10, rl.BLACK)
|
||||
rl.DrawText(string.format("Resolution: %dx%d", fbWidth, fbHeight), 10, 98, 10, rl.BLACK)
|
||||
rl.DrawText(string.format("Filter: %s", bilinear and "bilinear" or "point"), 10, 110, 10, rl.BLACK)
|
||||
else
|
||||
rl.DrawText("NATIVE", 10, 32, 20, rl.BLUE)
|
||||
end
|
||||
|
||||
rl.EndDrawing()
|
||||
|
||||
if rl.IsKeyPressed(rl.KEY_E) then
|
||||
enable_easu = not enable_easu
|
||||
end
|
||||
|
||||
if rl.IsKeyPressed(rl.KEY_R) then
|
||||
enable_rcas = not enable_rcas
|
||||
end
|
||||
|
||||
if rl.IsKeyPressed(rl.KEY_N) then
|
||||
use_fsr = not use_fsr
|
||||
end
|
||||
|
||||
if rl.IsKeyPressed(rl.KEY_LEFT) then
|
||||
sharpness[0] = math.max(0.0, sharpness[0] - 0.1)
|
||||
rl.SetShaderValue(rcas_shader, sharpness_loc, sharpness, rl.SHADER_UNIFORM_FLOAT)
|
||||
end
|
||||
|
||||
if rl.IsKeyPressed(rl.KEY_RIGHT) then
|
||||
sharpness[0] = math.min(2.0, sharpness[0] + 0.1)
|
||||
rl.SetShaderValue(rcas_shader, sharpness_loc, sharpness, rl.SHADER_UNIFORM_FLOAT)
|
||||
end
|
||||
|
||||
if rl.IsKeyPressed(rl.KEY_F) then
|
||||
bilinear = not bilinear
|
||||
|
||||
rl.SetTextureFilter(render_texture.texture,
|
||||
bilinear and rl.TEXTURE_FILTER_BILINEAR or rl.TEXTURE_FILTER_POINT)
|
||||
end
|
||||
|
||||
local preset_changed = false
|
||||
if rl.IsKeyPressed(rl.KEY_UP) then
|
||||
preset_changed = true
|
||||
preset = preset + 1
|
||||
if preset == #presets + 1 then
|
||||
preset = 1
|
||||
end
|
||||
end
|
||||
|
||||
if rl.IsKeyPressed(rl.KEY_DOWN) then
|
||||
preset_changed = true
|
||||
preset = preset - 1
|
||||
if preset == 0 then
|
||||
preset = #presets
|
||||
end
|
||||
end
|
||||
|
||||
if rl.IsKeyPressed(rl.KEY_S) then
|
||||
stop_animation = not stop_animation
|
||||
end
|
||||
|
||||
if rl.IsKeyPressed(rl.KEY_F11) then
|
||||
rl.ToggleFullscreen()
|
||||
end
|
||||
|
||||
|
||||
if preset_changed then
|
||||
ratio = presets[preset][1]
|
||||
fbWidth = screenWidth / ratio
|
||||
fbHeight = screenHeight / ratio
|
||||
|
||||
fbSize = rl.new("Vector2", fbWidth, fbHeight)
|
||||
|
||||
rl.UnloadRenderTexture(render_texture)
|
||||
|
||||
render_texture = rl.LoadRenderTexture(fbWidth, fbHeight)
|
||||
|
||||
|
||||
rl.SetTextureFilter(render_texture.texture,
|
||||
bilinear and rl.TEXTURE_FILTER_BILINEAR or rl.TEXTURE_FILTER_POINT)
|
||||
end
|
||||
end
|
||||
|
||||
rl.UnloadRenderTexture(render_texture)
|
||||
rl.UnloadRenderTexture(dest_fb)
|
||||
rl.CloseWindow()
|
@ -1,18 +0,0 @@
|
||||
rl.SetConfigFlags(rl.FLAG_VSYNC_HINT)
|
||||
|
||||
rl.InitWindow(800, 450, "raylib [core] example - basic window")
|
||||
|
||||
local font = rl.LoadFontEx("resources/NotoSans-Medium.ttf", 32, nil, 255)
|
||||
|
||||
while not rl.WindowShouldClose() do
|
||||
rl.BeginDrawing()
|
||||
|
||||
rl.DrawFPS(10, 10)
|
||||
|
||||
rl.ClearBackground(rl.RAYWHITE)
|
||||
rl.DrawTextEx(font, "Congrats! You created your first window!", rl.new("Vector2", 174, 200), 32, 0, rl.BLACK)
|
||||
|
||||
rl.EndDrawing()
|
||||
end
|
||||
|
||||
rl.CloseWindow()
|
@ -11,7 +11,7 @@ local fb_data = rl.new("Color[?]", width * height)
|
||||
|
||||
framebuffer.width = width
|
||||
framebuffer.height = height
|
||||
framebuffer.format = rl.PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
||||
framebuffer.format = rl.UNCOMPRESSED_R8G8B8A8
|
||||
framebuffer.mipmaps = 1
|
||||
framebuffer.data = fb_data
|
||||
|
||||
|
2
luajit
2
luajit
@ -1 +1 @@
|
||||
Subproject commit 5e3c45c43bb0e0f1f2917d432e9d2dba12c42a6e
|
||||
Subproject commit a2a39ea7184f3c8cab9474c6e41f6541265fb362
|
15
makefile
15
makefile
@ -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)
|
||||
@ -60,14 +57,10 @@ raylib:
|
||||
raylua_s: src/raylua_s.o $(EXTERNAL_FILES) libraylua.a
|
||||
$(CC) -o $@ $^ $(LDFLAGS) luajit/src/libluajit.a
|
||||
|
||||
raylua_e: src/raylua_e.o src/raylua_self.o src/raylua_builder.o src/lib/miniz.o \
|
||||
$(EXTERNAL_FILES) libraylua.a
|
||||
raylua_e: src/raylua_e.o src/raylua_self.o src/raylua_builder.o \
|
||||
src/raylua_builder_ui.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 $@
|
||||
|
||||
@ -96,7 +89,7 @@ src/autogen/builder.c: src/raylua_builder.lua
|
||||
clean:
|
||||
rm -rf raylua_s raylua_e libraylua.a src/raylua_e.o src/raylua_s.o \
|
||||
src/raylua.o src/raylua_self.o src/raylua_builder.o src/autogen/*.c \
|
||||
src/lib/miniz.o src/res/icon.res
|
||||
src/raylua_builder_ui.o src/lib/miniz.o src/res/icon.res
|
||||
$(MAKE) -C luajit clean
|
||||
$(MAKE) -C raylib/src clean
|
||||
rm -f raylib/libraylib.a
|
||||
|
2
raygui
2
raygui
@ -1 +1 @@
|
||||
Subproject commit 865bb293764073c01e74314ef647464f1f10fd96
|
||||
Subproject commit f5bd6c08f8d761b625890e4256339ff93c770ac1
|
2
raylib
2
raylib
@ -1 +1 @@
|
||||
Subproject commit 559ffc633164c30824065a63324ba08efa651ee6
|
||||
Subproject commit e25e380e80a117f2404d65b37700fb620dc1f990
|
@ -18,19 +18,60 @@ local new = ffi.new
|
||||
|
||||
-- Load*() wrappers.
|
||||
if raylua.loadfile then
|
||||
local LoadMusicStream = rl.LoadMusicStream
|
||||
function rl.LoadMusicStream(path)
|
||||
local LoadImage = rl.LoadImage
|
||||
function rl.LoadImage(path)
|
||||
local f, err = raylua.loadfile(path)
|
||||
|
||||
if f then
|
||||
local ext = "." .. path:gsub(".+%.", "")
|
||||
local ext = path:gsub(".+%.", "")
|
||||
|
||||
return rl.LoadMusicStreamFromMemory(ext, ffi.cast("void *", f), #f)
|
||||
return rl.LoadImageFromMemory(ext, f, #f)
|
||||
else
|
||||
print(("RAYLUA: %s"):format(err))
|
||||
return LoadMusicStream(path)
|
||||
return LoadImage(path)
|
||||
end
|
||||
end
|
||||
|
||||
function rl.LoadTexture(path)
|
||||
return rl.LoadTextureFromImage(rl.LoadImage(path))
|
||||
end
|
||||
|
||||
local LoadFont, LoadFontEx = rl.LoadFont, rl.LoadFontEx
|
||||
function rl.LoadFontEx(path, sz, chars, count)
|
||||
local f, err = raylua.loadfile(path)
|
||||
|
||||
if f then
|
||||
local ext = path:gsub(".+%.", "")
|
||||
|
||||
return rl.LoadFontFromMemory(ext, f, #f, sz, chars, count)
|
||||
else
|
||||
return LoadFontEx(sz, chars, count)
|
||||
end
|
||||
end
|
||||
|
||||
function rl.LoadFont(path)
|
||||
-- HACK: Hardcoded values (FONT_TTF_DEFAULT_SIZE,
|
||||
-- FONT_TTF_DEFAULT_NUMCHARS)
|
||||
return rl.LoadFontEx(path, 32, nil, 95)
|
||||
end
|
||||
|
||||
local LoadWave = rl.LoadWave
|
||||
function rl.LoadWave(path)
|
||||
local f, err = raylua.loadfile(path)
|
||||
|
||||
if f then
|
||||
local ext = path:gsub(".+%.", "")
|
||||
|
||||
return rl.LoadWaveFromMemory(ext, f, #f)
|
||||
else
|
||||
print(("RAYLUA: %s"):format(err))
|
||||
return LoadWave(path)
|
||||
end
|
||||
end
|
||||
|
||||
function rl.LoadSound(path)
|
||||
return rl.LoadSoundFromWave(rl.LoadWave(path))
|
||||
end
|
||||
end
|
||||
|
||||
-- math metamethods
|
||||
|
1208
src/lib/microui.c
Normal file
1208
src/lib/microui.c
Normal file
File diff suppressed because it is too large
Load Diff
296
src/lib/microui.h
Normal file
296
src/lib/microui.h
Normal file
@ -0,0 +1,296 @@
|
||||
/*
|
||||
** Copyright (c) 2020 rxi
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or modify it
|
||||
** under the terms of the MIT license. See `microui.c` for details.
|
||||
*/
|
||||
|
||||
#ifndef MICROUI_H
|
||||
#define MICROUI_H
|
||||
|
||||
#define MU_VERSION "2.01"
|
||||
|
||||
#define MU_COMMANDLIST_SIZE (256 * 1024)
|
||||
#define MU_ROOTLIST_SIZE 32
|
||||
#define MU_CONTAINERSTACK_SIZE 32
|
||||
#define MU_CLIPSTACK_SIZE 32
|
||||
#define MU_IDSTACK_SIZE 32
|
||||
#define MU_LAYOUTSTACK_SIZE 16
|
||||
#define MU_CONTAINERPOOL_SIZE 48
|
||||
#define MU_TREENODEPOOL_SIZE 48
|
||||
#define MU_MAX_WIDTHS 16
|
||||
#define MU_REAL float
|
||||
#define MU_REAL_FMT "%.3g"
|
||||
#define MU_SLIDER_FMT "%.2f"
|
||||
#define MU_MAX_FMT 127
|
||||
|
||||
#define mu_stack(T, n) struct { int idx; T items[n]; }
|
||||
#define mu_min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define mu_max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define mu_clamp(x, a, b) mu_min(b, mu_max(a, x))
|
||||
|
||||
enum {
|
||||
MU_CLIP_PART = 1,
|
||||
MU_CLIP_ALL
|
||||
};
|
||||
|
||||
enum {
|
||||
MU_COMMAND_JUMP = 1,
|
||||
MU_COMMAND_CLIP,
|
||||
MU_COMMAND_RECT,
|
||||
MU_COMMAND_TEXT,
|
||||
MU_COMMAND_ICON,
|
||||
MU_COMMAND_MAX
|
||||
};
|
||||
|
||||
enum {
|
||||
MU_COLOR_TEXT,
|
||||
MU_COLOR_BORDER,
|
||||
MU_COLOR_WINDOWBG,
|
||||
MU_COLOR_TITLEBG,
|
||||
MU_COLOR_TITLETEXT,
|
||||
MU_COLOR_PANELBG,
|
||||
MU_COLOR_BUTTON,
|
||||
MU_COLOR_BUTTONHOVER,
|
||||
MU_COLOR_BUTTONFOCUS,
|
||||
MU_COLOR_BASE,
|
||||
MU_COLOR_BASEHOVER,
|
||||
MU_COLOR_BASEFOCUS,
|
||||
MU_COLOR_SCROLLBASE,
|
||||
MU_COLOR_SCROLLTHUMB,
|
||||
MU_COLOR_MAX
|
||||
};
|
||||
|
||||
enum {
|
||||
MU_ICON_CLOSE = 1,
|
||||
MU_ICON_CHECK,
|
||||
MU_ICON_COLLAPSED,
|
||||
MU_ICON_EXPANDED,
|
||||
MU_ICON_MAX
|
||||
};
|
||||
|
||||
enum {
|
||||
MU_RES_ACTIVE = (1 << 0),
|
||||
MU_RES_SUBMIT = (1 << 1),
|
||||
MU_RES_CHANGE = (1 << 2)
|
||||
};
|
||||
|
||||
enum {
|
||||
MU_OPT_ALIGNCENTER = (1 << 0),
|
||||
MU_OPT_ALIGNRIGHT = (1 << 1),
|
||||
MU_OPT_NOINTERACT = (1 << 2),
|
||||
MU_OPT_NOFRAME = (1 << 3),
|
||||
MU_OPT_NORESIZE = (1 << 4),
|
||||
MU_OPT_NOSCROLL = (1 << 5),
|
||||
MU_OPT_NOCLOSE = (1 << 6),
|
||||
MU_OPT_NOTITLE = (1 << 7),
|
||||
MU_OPT_HOLDFOCUS = (1 << 8),
|
||||
MU_OPT_AUTOSIZE = (1 << 9),
|
||||
MU_OPT_POPUP = (1 << 10),
|
||||
MU_OPT_CLOSED = (1 << 11),
|
||||
MU_OPT_EXPANDED = (1 << 12)
|
||||
};
|
||||
|
||||
enum {
|
||||
MU_MOUSE_LEFT = (1 << 0),
|
||||
MU_MOUSE_RIGHT = (1 << 1),
|
||||
MU_MOUSE_MIDDLE = (1 << 2)
|
||||
};
|
||||
|
||||
enum {
|
||||
MU_KEY_SHIFT = (1 << 0),
|
||||
MU_KEY_CTRL = (1 << 1),
|
||||
MU_KEY_ALT = (1 << 2),
|
||||
MU_KEY_BACKSPACE = (1 << 3),
|
||||
MU_KEY_RETURN = (1 << 4)
|
||||
};
|
||||
|
||||
|
||||
typedef struct mu_Context mu_Context;
|
||||
typedef unsigned mu_Id;
|
||||
typedef MU_REAL mu_Real;
|
||||
typedef void* mu_Font;
|
||||
|
||||
typedef struct { int x, y; } mu_Vec2;
|
||||
typedef struct { int x, y, w, h; } mu_Rect;
|
||||
typedef struct { unsigned char r, g, b, a; } mu_Color;
|
||||
typedef struct { mu_Id id; int last_update; } mu_PoolItem;
|
||||
|
||||
typedef struct { int type, size; } mu_BaseCommand;
|
||||
typedef struct { mu_BaseCommand base; void *dst; } mu_JumpCommand;
|
||||
typedef struct { mu_BaseCommand base; mu_Rect rect; } mu_ClipCommand;
|
||||
typedef struct { mu_BaseCommand base; mu_Rect rect; mu_Color color; } mu_RectCommand;
|
||||
typedef struct { mu_BaseCommand base; mu_Font font; mu_Vec2 pos; mu_Color color; char str[1]; } mu_TextCommand;
|
||||
typedef struct { mu_BaseCommand base; mu_Rect rect; int id; mu_Color color; } mu_IconCommand;
|
||||
|
||||
typedef union {
|
||||
int type;
|
||||
mu_BaseCommand base;
|
||||
mu_JumpCommand jump;
|
||||
mu_ClipCommand clip;
|
||||
mu_RectCommand rect;
|
||||
mu_TextCommand text;
|
||||
mu_IconCommand icon;
|
||||
} mu_Command;
|
||||
|
||||
typedef struct {
|
||||
mu_Rect body;
|
||||
mu_Rect next;
|
||||
mu_Vec2 position;
|
||||
mu_Vec2 size;
|
||||
mu_Vec2 max;
|
||||
int widths[MU_MAX_WIDTHS];
|
||||
int items;
|
||||
int item_index;
|
||||
int next_row;
|
||||
int next_type;
|
||||
int indent;
|
||||
} mu_Layout;
|
||||
|
||||
typedef struct {
|
||||
mu_Command *head, *tail;
|
||||
mu_Rect rect;
|
||||
mu_Rect body;
|
||||
mu_Vec2 content_size;
|
||||
mu_Vec2 scroll;
|
||||
int zindex;
|
||||
int open;
|
||||
} mu_Container;
|
||||
|
||||
typedef struct {
|
||||
mu_Font font;
|
||||
mu_Vec2 size;
|
||||
int padding;
|
||||
int spacing;
|
||||
int indent;
|
||||
int title_height;
|
||||
int scrollbar_size;
|
||||
int thumb_size;
|
||||
mu_Color colors[MU_COLOR_MAX];
|
||||
} mu_Style;
|
||||
|
||||
struct mu_Context {
|
||||
/* callbacks */
|
||||
int (*text_width)(mu_Font font, const char *str, int len);
|
||||
int (*text_height)(mu_Font font);
|
||||
void (*draw_frame)(mu_Context *ctx, mu_Rect rect, int colorid);
|
||||
/* core state */
|
||||
mu_Style _style;
|
||||
mu_Style *style;
|
||||
mu_Id hover;
|
||||
mu_Id focus;
|
||||
mu_Id last_id;
|
||||
mu_Rect last_rect;
|
||||
int last_zindex;
|
||||
int updated_focus;
|
||||
int frame;
|
||||
mu_Container *hover_root;
|
||||
mu_Container *next_hover_root;
|
||||
mu_Container *scroll_target;
|
||||
char number_edit_buf[MU_MAX_FMT];
|
||||
mu_Id number_edit;
|
||||
/* stacks */
|
||||
mu_stack(char, MU_COMMANDLIST_SIZE) command_list;
|
||||
mu_stack(mu_Container*, MU_ROOTLIST_SIZE) root_list;
|
||||
mu_stack(mu_Container*, MU_CONTAINERSTACK_SIZE) container_stack;
|
||||
mu_stack(mu_Rect, MU_CLIPSTACK_SIZE) clip_stack;
|
||||
mu_stack(mu_Id, MU_IDSTACK_SIZE) id_stack;
|
||||
mu_stack(mu_Layout, MU_LAYOUTSTACK_SIZE) layout_stack;
|
||||
/* retained state pools */
|
||||
mu_PoolItem container_pool[MU_CONTAINERPOOL_SIZE];
|
||||
mu_Container containers[MU_CONTAINERPOOL_SIZE];
|
||||
mu_PoolItem treenode_pool[MU_TREENODEPOOL_SIZE];
|
||||
/* input state */
|
||||
mu_Vec2 mouse_pos;
|
||||
mu_Vec2 last_mouse_pos;
|
||||
mu_Vec2 mouse_delta;
|
||||
mu_Vec2 scroll_delta;
|
||||
int mouse_down;
|
||||
int mouse_pressed;
|
||||
int key_down;
|
||||
int key_pressed;
|
||||
char input_text[32];
|
||||
};
|
||||
|
||||
|
||||
mu_Vec2 mu_vec2(int x, int y);
|
||||
mu_Rect mu_rect(int x, int y, int w, int h);
|
||||
mu_Color mu_color(int r, int g, int b, int a);
|
||||
|
||||
void mu_init(mu_Context *ctx);
|
||||
void mu_begin(mu_Context *ctx);
|
||||
void mu_end(mu_Context *ctx);
|
||||
void mu_set_focus(mu_Context *ctx, mu_Id id);
|
||||
mu_Id mu_get_id(mu_Context *ctx, const void *data, int size);
|
||||
void mu_push_id(mu_Context *ctx, const void *data, int size);
|
||||
void mu_pop_id(mu_Context *ctx);
|
||||
void mu_push_clip_rect(mu_Context *ctx, mu_Rect rect);
|
||||
void mu_pop_clip_rect(mu_Context *ctx);
|
||||
mu_Rect mu_get_clip_rect(mu_Context *ctx);
|
||||
int mu_check_clip(mu_Context *ctx, mu_Rect r);
|
||||
mu_Container* mu_get_current_container(mu_Context *ctx);
|
||||
mu_Container* mu_get_container(mu_Context *ctx, const char *name);
|
||||
void mu_bring_to_front(mu_Context *ctx, mu_Container *cnt);
|
||||
|
||||
int mu_pool_init(mu_Context *ctx, mu_PoolItem *items, int len, mu_Id id);
|
||||
int mu_pool_get(mu_Context *ctx, mu_PoolItem *items, int len, mu_Id id);
|
||||
void mu_pool_update(mu_Context *ctx, mu_PoolItem *items, int idx);
|
||||
|
||||
void mu_input_mousemove(mu_Context *ctx, int x, int y);
|
||||
void mu_input_mousedown(mu_Context *ctx, int x, int y, int btn);
|
||||
void mu_input_mouseup(mu_Context *ctx, int x, int y, int btn);
|
||||
void mu_input_scroll(mu_Context *ctx, int x, int y);
|
||||
void mu_input_keydown(mu_Context *ctx, int key);
|
||||
void mu_input_keyup(mu_Context *ctx, int key);
|
||||
void mu_input_text(mu_Context *ctx, const char *text);
|
||||
|
||||
mu_Command* mu_push_command(mu_Context *ctx, int type, int size);
|
||||
int mu_next_command(mu_Context *ctx, mu_Command **cmd);
|
||||
void mu_set_clip(mu_Context *ctx, mu_Rect rect);
|
||||
void mu_draw_rect(mu_Context *ctx, mu_Rect rect, mu_Color color);
|
||||
void mu_draw_box(mu_Context *ctx, mu_Rect rect, mu_Color color);
|
||||
void mu_draw_text(mu_Context *ctx, mu_Font font, const char *str, int len, mu_Vec2 pos, mu_Color color);
|
||||
void mu_draw_icon(mu_Context *ctx, int id, mu_Rect rect, mu_Color color);
|
||||
|
||||
void mu_layout_row(mu_Context *ctx, int items, const int *widths, int height);
|
||||
void mu_layout_width(mu_Context *ctx, int width);
|
||||
void mu_layout_height(mu_Context *ctx, int height);
|
||||
void mu_layout_begin_column(mu_Context *ctx);
|
||||
void mu_layout_end_column(mu_Context *ctx);
|
||||
void mu_layout_set_next(mu_Context *ctx, mu_Rect r, int relative);
|
||||
mu_Rect mu_layout_next(mu_Context *ctx);
|
||||
|
||||
void mu_draw_control_frame(mu_Context *ctx, mu_Id id, mu_Rect rect, int colorid, int opt);
|
||||
void mu_draw_control_text(mu_Context *ctx, const char *str, mu_Rect rect, int colorid, int opt);
|
||||
int mu_mouse_over(mu_Context *ctx, mu_Rect rect);
|
||||
void mu_update_control(mu_Context *ctx, mu_Id id, mu_Rect rect, int opt);
|
||||
|
||||
#define mu_button(ctx, label) mu_button_ex(ctx, label, 0, MU_OPT_ALIGNCENTER)
|
||||
#define mu_textbox(ctx, buf, bufsz) mu_textbox_ex(ctx, buf, bufsz, 0)
|
||||
#define mu_slider(ctx, value, lo, hi) mu_slider_ex(ctx, value, lo, hi, 0, MU_SLIDER_FMT, MU_OPT_ALIGNCENTER)
|
||||
#define mu_number(ctx, value, step) mu_number_ex(ctx, value, step, MU_SLIDER_FMT, MU_OPT_ALIGNCENTER)
|
||||
#define mu_header(ctx, label) mu_header_ex(ctx, label, 0)
|
||||
#define mu_begin_treenode(ctx, label) mu_begin_treenode_ex(ctx, label, 0)
|
||||
#define mu_begin_window(ctx, title, rect) mu_begin_window_ex(ctx, title, rect, 0)
|
||||
#define mu_begin_panel(ctx, name) mu_begin_panel_ex(ctx, name, 0)
|
||||
|
||||
void mu_text(mu_Context *ctx, const char *text);
|
||||
void mu_label(mu_Context *ctx, const char *text);
|
||||
int mu_button_ex(mu_Context *ctx, const char *label, int icon, int opt);
|
||||
int mu_checkbox(mu_Context *ctx, const char *label, int *state);
|
||||
int mu_textbox_raw(mu_Context *ctx, char *buf, int bufsz, mu_Id id, mu_Rect r, int opt);
|
||||
int mu_textbox_ex(mu_Context *ctx, char *buf, int bufsz, int opt);
|
||||
int mu_slider_ex(mu_Context *ctx, mu_Real *value, mu_Real low, mu_Real high, mu_Real step, const char *fmt, int opt);
|
||||
int mu_number_ex(mu_Context *ctx, mu_Real *value, mu_Real step, const char *fmt, int opt);
|
||||
int mu_header_ex(mu_Context *ctx, const char *label, int opt);
|
||||
int mu_begin_treenode_ex(mu_Context *ctx, const char *label, int opt);
|
||||
void mu_end_treenode(mu_Context *ctx);
|
||||
int mu_begin_window_ex(mu_Context *ctx, const char *title, mu_Rect rect, int opt);
|
||||
void mu_end_window(mu_Context *ctx);
|
||||
void mu_open_popup(mu_Context *ctx, const char *name);
|
||||
int mu_begin_popup(mu_Context *ctx, const char *name);
|
||||
void mu_end_popup(mu_Context *ctx);
|
||||
void mu_begin_panel_ex(mu_Context *ctx, const char *name, int opt);
|
||||
void mu_end_panel(mu_Context *ctx);
|
||||
|
||||
#endif
|
798
src/raylib.lua
798
src/raylib.lua
File diff suppressed because it is too large
Load Diff
18
src/raylua.c
18
src/raylua.c
@ -24,24 +24,23 @@
|
||||
#include <rlgl.h>
|
||||
|
||||
#include <raymath.h>
|
||||
#include <extras/easings.h>
|
||||
#include <rgestures.h>
|
||||
#include <easings.h>
|
||||
#include <gestures.h>
|
||||
|
||||
#define RAYGUI_SUPPORT_ICONS
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#define RAYGUI_STATIC
|
||||
#include <raygui.h>
|
||||
|
||||
#define PHYSAC_IMPLEMENTATION
|
||||
#include <extras/physac.h>
|
||||
#define PHYSAC_NO_THREADS
|
||||
#include <physac.h>
|
||||
|
||||
#include "autogen/bind.c"
|
||||
#include "autogen/boot.c"
|
||||
|
||||
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)
|
||||
{
|
||||
@ -67,10 +66,6 @@ void raylua_boot(lua_State *L, lua_CFunction loadfile, lua_CFunction listfiles,
|
||||
lua_pushboolean(L, repl);
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_pushstring(L, "raylib_version");
|
||||
lua_pushstring(L, RAYLIB_VERSION);
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_setglobal(L, "raylua");
|
||||
|
||||
if (luaL_dostring(L, raylua_boot_lua)) {
|
||||
@ -79,9 +74,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 = "v3.5a"
|
||||
|
||||
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)
|
||||
|
131
src/raylua_builder_ui.c
Normal file
131
src/raylua_builder_ui.c
Normal file
@ -0,0 +1,131 @@
|
||||
/*
|
||||
Copyright (C) 2020 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <raylib.h>
|
||||
#include "lib/microui.c"
|
||||
#include "lib/microui.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "lib/dirent.h"
|
||||
#define stat _stat
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
//#include <windows.h>
|
||||
#endif
|
||||
|
||||
#undef DrawText
|
||||
|
||||
static int get_text_width(mu_Font font, const char *str, int len)
|
||||
{
|
||||
if (font == NULL)
|
||||
return MeasureText(str, 10);
|
||||
}
|
||||
|
||||
static int get_text_height(mu_Font font)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
void builder_menu(mu_Context *ctx)
|
||||
{
|
||||
if (mu_begin_window(ctx, "raylua builder", mu_rect(0, 0, 400, 290))) {
|
||||
|
||||
mu_layout_row(ctx, 1, (int []){ -1 }, -1);
|
||||
|
||||
DIR *dir = opendir(".");
|
||||
struct dirent *ent = NULL;
|
||||
|
||||
while ((ent = readdir(dir)))
|
||||
mu_text(ctx, ent->d_name);
|
||||
|
||||
closedir(dir);
|
||||
|
||||
mu_end_window(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
int raylua_builder_boot_ui(FILE *self)
|
||||
{
|
||||
#ifdef WIN32
|
||||
//FreeConsole();
|
||||
#endif
|
||||
|
||||
//SetTraceLogLevel(LOG_WARNING);
|
||||
SetConfigFlags(FLAG_VSYNC_HINT);
|
||||
InitWindow(400, 300, "raylua builder ui");
|
||||
|
||||
mu_Context *ctx = malloc(sizeof(mu_Context));
|
||||
mu_init(ctx);
|
||||
|
||||
ctx->text_width = get_text_width;
|
||||
ctx->text_height = get_text_height;
|
||||
|
||||
while (!WindowShouldClose()) {
|
||||
|
||||
int mx = GetMouseX(), my = GetMouseY();
|
||||
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
|
||||
mu_input_mousedown(ctx, mx, my, MU_MOUSE_LEFT);
|
||||
if (IsMouseButtonUp(MOUSE_LEFT_BUTTON))
|
||||
mu_input_mouseup(ctx, mx, my, MU_MOUSE_LEFT);
|
||||
|
||||
mu_input_mousemove(&ctx, mx, my);
|
||||
|
||||
mu_begin(ctx);
|
||||
builder_menu(ctx);
|
||||
mu_end(ctx);
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
mu_Command *cmd = NULL;
|
||||
while (mu_next_command(ctx, &cmd)) {
|
||||
if (cmd->type == MU_COMMAND_TEXT) {
|
||||
Color c = {
|
||||
.r = cmd->text.color.r,
|
||||
.g = cmd->text.color.g,
|
||||
.b = cmd->text.color.b,
|
||||
.a = cmd->text.color.a
|
||||
};
|
||||
|
||||
DrawText(cmd->text.str, cmd->text.pos.x, cmd->text.pos.y, 10, c);
|
||||
}
|
||||
if (cmd->type == MU_COMMAND_RECT) {
|
||||
Color c = {
|
||||
.r = cmd->rect.color.r,
|
||||
.g = cmd->rect.color.g,
|
||||
.b = cmd->rect.color.b,
|
||||
.a = cmd->rect.color.a
|
||||
};
|
||||
mu_Rect rect = cmd->rect.rect;
|
||||
|
||||
DrawRectangle(rect.x, rect.y, rect.w, rect.h, c);
|
||||
}
|
||||
if (cmd->type == MU_COMMAND_CLIP) {
|
||||
BeginScissorMode(cmd->clip.rect.x, cmd->clip.rect.y, cmd->clip.rect.w, cmd->clip.rect.h);
|
||||
}
|
||||
}
|
||||
|
||||
EndScissorMode();
|
||||
|
||||
EndDrawing();
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ FILE *raylua_open_self(const char *argv0);
|
||||
|
||||
#ifndef RAYLUA_NO_BUILDER
|
||||
int raylua_builder_boot(lua_State *L, FILE *self);
|
||||
int raylua_builder_boot_ui(FILE *self);
|
||||
#endif
|
||||
|
||||
static mz_zip_archive zip_file;
|
||||
@ -62,12 +63,7 @@ int raylua_loadfile(lua_State *L)
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (!mz_zip_reader_extract_to_mem(&zip_file, index, buffer, size, 0)) {
|
||||
free(buffer);
|
||||
lua_pushnil(L);
|
||||
lua_pushfstring(L, "%s: Can't extract file.", path);
|
||||
return 2;
|
||||
}
|
||||
mz_zip_reader_extract_to_mem(&zip_file, index, buffer, size, 0);
|
||||
|
||||
lua_pushlstring(L, buffer, size);
|
||||
free(buffer);
|
||||
@ -93,69 +89,6 @@ int raylua_listfiles(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned char *raylua_loadFileData(const char *path, unsigned int *out_size)
|
||||
{
|
||||
int index = mz_zip_reader_locate_file(&zip_file, path, NULL, 0);
|
||||
if (index == -1) {
|
||||
printf("RAYLUA: WARN: File not found in payload. '%s'\n", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mz_zip_archive_file_stat stat;
|
||||
if (!mz_zip_reader_file_stat(&zip_file, index, &stat)) {
|
||||
printf("RAYLUA: WARN: Can't get file information in payload. '%s'\n", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t size = stat.m_uncomp_size;
|
||||
unsigned char *buffer = RL_MALLOC(size);
|
||||
if (buffer == NULL) {
|
||||
printf("RAYLUA: WARN: Can't allocate file buffer. '%s'\n", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!mz_zip_reader_extract_to_mem(&zip_file, index, buffer, size, 0)) {
|
||||
free(buffer);
|
||||
printf("RAYLUA: WARN: Can't extract file. '%s'\n", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*out_size = size;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
char *raylua_loadFileText(const char *path)
|
||||
{
|
||||
int index = mz_zip_reader_locate_file(&zip_file, path, NULL, 0);
|
||||
if (index == -1) {
|
||||
printf("RAYLUA: WARN: File not found in payload. '%s'\n", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mz_zip_archive_file_stat stat;
|
||||
if (!mz_zip_reader_file_stat(&zip_file, index, &stat)) {
|
||||
printf("RAYLUA: WARN: Can't get file information in payload. '%s'\n", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t size = stat.m_uncomp_size;
|
||||
char *buffer = RL_MALLOC(size + 1);
|
||||
if (buffer == NULL) {
|
||||
printf("RAYLUA: WARN: Can't allocate file buffer. '%s'\n", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buffer[size] = '\0';
|
||||
|
||||
if (!mz_zip_reader_extract_to_mem(&zip_file, index, buffer, size, 0)) {
|
||||
free(buffer);
|
||||
printf("RAYLUA: WARN: Can't extract file. '%s'\n", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static bool raylua_init_payload(FILE *self)
|
||||
{
|
||||
mz_zip_zero_struct(&zip_file);
|
||||
@ -195,15 +128,13 @@ int main(int argc, const char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
SetLoadFileDataCallback(raylua_loadFileData);
|
||||
SetLoadFileTextCallback(raylua_loadFileText);
|
||||
|
||||
if (!raylua_init_payload(self)) {
|
||||
#ifdef RAYLUA_NO_BUILDER
|
||||
puts("RAYLUA: No payload.");
|
||||
#else
|
||||
puts("RAYLUA: No payload, use internal builder.");
|
||||
raylua_builder_boot(L, self);
|
||||
//raylua_builder_boot(L, self);
|
||||
raylua_builder_boot_ui(self);
|
||||
#endif
|
||||
} else {
|
||||
/* Boot on payload. */
|
||||
|
252
tools/api.h
252
tools/api.h
@ -21,14 +21,10 @@ 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)
|
||||
int GetMonitorWidth(int monitor)
|
||||
int GetMonitorHeight(int monitor)
|
||||
@ -40,9 +36,6 @@ Vector2 GetWindowScaleDPI(void)
|
||||
const char *GetMonitorName(int monitor)
|
||||
void SetClipboardText(const char *text)
|
||||
const char *GetClipboardText(void)
|
||||
void SwapScreenBuffer(void)
|
||||
void PollInputEvents(void)
|
||||
void WaitTime(float ms)
|
||||
void ShowCursor(void)
|
||||
void HideCursor(void)
|
||||
bool IsCursorHidden(void)
|
||||
@ -58,25 +51,8 @@ void BeginMode3D(Camera3D camera)
|
||||
void EndMode3D(void)
|
||||
void BeginTextureMode(RenderTexture2D target)
|
||||
void EndTextureMode(void)
|
||||
void BeginShaderMode(Shader shader)
|
||||
void EndShaderMode(void)
|
||||
void BeginBlendMode(int mode)
|
||||
void EndBlendMode(void)
|
||||
void BeginScissorMode(int x, int y, int width, int height)
|
||||
void EndScissorMode(void)
|
||||
void BeginVrStereoMode(VrStereoConfig config)
|
||||
void EndVrStereoMode(void)
|
||||
VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device)
|
||||
void UnloadVrStereoConfig(VrStereoConfig config)
|
||||
Shader LoadShader(const char *vsFileName, const char *fsFileName)
|
||||
Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
||||
int GetShaderLocation(Shader shader, const char *uniformName)
|
||||
int GetShaderLocationAttrib(Shader shader, const char *attribName)
|
||||
void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType)
|
||||
void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count)
|
||||
void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat)
|
||||
void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture)
|
||||
void UnloadShader(Shader shader)
|
||||
Ray GetMouseRay(Vector2 mousePosition, Camera camera)
|
||||
Matrix GetCameraMatrix(Camera camera)
|
||||
Matrix GetCameraMatrix2D(Camera2D camera)
|
||||
@ -88,33 +64,30 @@ void SetTargetFPS(int fps)
|
||||
int GetFPS(void)
|
||||
float GetFrameTime(void)
|
||||
double GetTime(void)
|
||||
int GetRandomValue(int min, int max)
|
||||
void SetRandomSeed(unsigned int seed)
|
||||
void TakeScreenshot(const char *fileName)
|
||||
void SetConfigFlags(unsigned int flags)
|
||||
void TraceLog(int logLevel, const char *text, ...)
|
||||
void SetTraceLogLevel(int logLevel)
|
||||
void *MemAlloc(int size)
|
||||
void *MemRealloc(void *ptr, int size)
|
||||
void MemFree(void *ptr)
|
||||
void SetTraceLogLevel(int logType)
|
||||
void SetTraceLogExit(int logType)
|
||||
void SetTraceLogCallback(TraceLogCallback callback)
|
||||
unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead)
|
||||
void TraceLog(int logType, const char *text, ...)
|
||||
void *MemAlloc(int size)
|
||||
void MemFree(void *ptr)
|
||||
void TakeScreenshot(const char *fileName)
|
||||
int GetRandomValue(int min, int max)
|
||||
uint8_t *LoadFileData(const char *fileName, unsigned int *bytesRead)
|
||||
void UnloadFileData(unsigned char *data)
|
||||
bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite)
|
||||
char *LoadFileText(const char *fileName)
|
||||
void UnloadFileText(char *text)
|
||||
void UnloadFileText(unsigned char *text)
|
||||
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 +95,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)
|
||||
uint8_t *CompressData(uint8_t *data, int dataLength, int *compDataLength)
|
||||
uint8_t *DecompressData(uint8_t *compData, int compDataLength, int *dataLength)
|
||||
bool SaveStorageValue(unsigned int position, int value)
|
||||
int LoadStorageValue(unsigned int position)
|
||||
void OpenURL(const char *url)
|
||||
@ -137,6 +108,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)
|
||||
@ -145,7 +117,6 @@ bool IsGamepadButtonUp(int gamepad, int button)
|
||||
int GetGamepadButtonPressed(void)
|
||||
int GetGamepadAxisCount(int gamepad)
|
||||
float GetGamepadAxisMovement(int gamepad, int axis)
|
||||
int SetGamepadMappings(const char *mappings)
|
||||
bool IsMouseButtonPressed(int button)
|
||||
bool IsMouseButtonDown(int button)
|
||||
bool IsMouseButtonReleased(int button)
|
||||
@ -153,20 +124,19 @@ bool IsMouseButtonUp(int button)
|
||||
int GetMouseX(void)
|
||||
int GetMouseY(void)
|
||||
Vector2 GetMousePosition(void)
|
||||
Vector2 GetMouseDelta(void)
|
||||
void SetMousePosition(int x, int y)
|
||||
void SetMouseOffset(int offsetX, int offsetY)
|
||||
void SetMouseScale(float scaleX, float scaleY)
|
||||
float GetMouseWheelMove(void)
|
||||
int GetMouseCursor(void)
|
||||
void SetMouseCursor(int cursor)
|
||||
int GetTouchX(void)
|
||||
int GetTouchY(void)
|
||||
Vector2 GetTouchPosition(int index)
|
||||
int GetTouchPointId(int index)
|
||||
int GetTouchPointCount(void)
|
||||
void SetGesturesEnabled(unsigned int flags)
|
||||
void SetGesturesEnabled(unsigned int gestureFlags)
|
||||
bool IsGestureDetected(int gesture)
|
||||
int GetGestureDetected(void)
|
||||
int GetTouchPointsCount(void)
|
||||
float GetGestureHoldDuration(void)
|
||||
Vector2 GetGestureDragVector(void)
|
||||
float GetGestureDragAngle(void)
|
||||
@ -178,26 +148,23 @@ void SetCameraPanControl(int keyPan)
|
||||
void SetCameraAltControl(int keyAlt)
|
||||
void SetCameraSmoothZoomControl(int keySmoothZoom)
|
||||
void SetCameraMoveControls(int keyFront, int keyBack, int keyRight, int keyLeft, int keyUp, int keyDown)
|
||||
void SetShapesTexture(Texture2D texture, Rectangle source)
|
||||
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 DrawLineBezierQuad(Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thick, Color color)
|
||||
void DrawLineBezierCubic(Vector2 startPos, Vector2 endPos, Vector2 startControlPos, Vector2 endControlPos, float thick, Color color)
|
||||
void DrawLineStrip(Vector2 *points, int pointCount, Color color)
|
||||
void DrawLineStrip(Vector2 *points, int pointsCount, Color color)
|
||||
void DrawCircle(int centerX, int centerY, float radius, Color color)
|
||||
void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color)
|
||||
void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color)
|
||||
void 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, float startAngle, float endAngle, int segments, Color color)
|
||||
void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color)
|
||||
void 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)
|
||||
@ -206,16 +173,15 @@ void DrawRectangleGradientV(int posX, int posY, int width, int height, Color col
|
||||
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, float lineThick, 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, float lineThick, 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 pointCount, Color color)
|
||||
void DrawTriangleStrip(Vector2 *points, int pointCount, Color color)
|
||||
void DrawTriangleFan(Vector2 *points, int pointsCount, 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)
|
||||
void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, 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)
|
||||
@ -223,14 +189,11 @@ 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)
|
||||
Image LoadImageAnim(const char *fileName, int *frames)
|
||||
Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize)
|
||||
Image LoadImageFromTexture(Texture2D texture)
|
||||
Image LoadImageFromScreen(void)
|
||||
Image LoadImageFromMemory(const char *fileType, const uint8_t *fileData, int dataSize)
|
||||
void UnloadImage(Image image)
|
||||
bool ExportImage(Image image, const char *fileName)
|
||||
bool ExportImageAsCode(Image image, const char *fileName)
|
||||
@ -240,6 +203,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)
|
||||
@ -268,11 +232,10 @@ void ImageColorContrast(Image *image, float contrast)
|
||||
void ImageColorBrightness(Image *image, int brightness)
|
||||
void ImageColorReplace(Image *image, Color color, Color replace)
|
||||
Color *LoadImageColors(Image image)
|
||||
Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorCount)
|
||||
Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorsCount)
|
||||
void UnloadImageColors(Color *colors)
|
||||
void UnloadImagePalette(Color *colors)
|
||||
Rectangle GetImageAlphaBorder(Image image, float threshold)
|
||||
Color GetImageColor(Image image, int x, int y)
|
||||
void ImageClearBackground(Image *dst, Color color)
|
||||
void ImageDrawPixel(Image *dst, int posX, int posY, Color color)
|
||||
void ImageDrawPixelV(Image *dst, Vector2 position, Color color)
|
||||
@ -289,15 +252,17 @@ void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSiz
|
||||
void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint)
|
||||
Texture2D LoadTexture(const char *fileName)
|
||||
Texture2D LoadTextureFromImage(Image image)
|
||||
TextureCubemap LoadTextureCubemap(Image image, int layout)
|
||||
TextureCubemap LoadTextureCubemap(Image image, int layoutType)
|
||||
RenderTexture2D LoadRenderTexture(int width, int height)
|
||||
void UnloadTexture(Texture2D texture)
|
||||
void UnloadRenderTexture(RenderTexture2D target)
|
||||
void UpdateTexture(Texture2D texture, const void *pixels)
|
||||
void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels)
|
||||
Image GetTextureData(Texture2D texture)
|
||||
Image GetScreenData(void)
|
||||
void GenTextureMipmaps(Texture2D *texture)
|
||||
void SetTextureFilter(Texture2D texture, int filter)
|
||||
void SetTextureWrap(Texture2D texture, int wrap)
|
||||
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)
|
||||
@ -306,7 +271,6 @@ void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangl
|
||||
void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint)
|
||||
void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint)
|
||||
void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint)
|
||||
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint)
|
||||
Color Fade(Color color, float alpha)
|
||||
int ColorToInt(Color color)
|
||||
Vector4 ColorNormalize(Color color)
|
||||
@ -321,31 +285,22 @@ void SetPixelColor(void *dstPtr, Color color, int format)
|
||||
int GetPixelDataSize(int width, int height, int format)
|
||||
Font GetFontDefault(void)
|
||||
Font LoadFont(const char *fileName)
|
||||
Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount)
|
||||
Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount)
|
||||
Font LoadFontFromImage(Image image, Color key, int firstChar)
|
||||
Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int glyphCount)
|
||||
GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int glyphCount, int type)
|
||||
Image GenImageFontAtlas(const GlyphInfo *chars, Rectangle **recs, int glyphCount, int fontSize, int padding, int packMethod)
|
||||
void UnloadFontData(GlyphInfo *chars, int glyphCount)
|
||||
Font LoadFontFromMemory(const char *fileType, const uint8_t *fileData, int dataSize, int fontSize, int *fontChars, int charsCount)
|
||||
CharInfo *LoadFontData(const uint8_t *fileData, int dataSize, int fontSize, int *fontChars, int charsCount, int type)
|
||||
Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int charsCount, int fontSize, int padding, int packMethod)
|
||||
void UnloadFontData(CharInfo *chars, int charsCount)
|
||||
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 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 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)
|
||||
GlyphInfo GetGlyphInfo(Font font, int codepoint)
|
||||
Rectangle GetGlyphAtlasRec(Font font, int codepoint)
|
||||
int *LoadCodepoints(const char *text, int *count)
|
||||
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)
|
||||
int TextCopy(char *dst, const char *src)
|
||||
bool TextIsEqual(const char *text1, const char *text2)
|
||||
unsigned int TextLength(const char *text)
|
||||
@ -361,87 +316,120 @@ 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 DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color)
|
||||
void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color)
|
||||
void DrawTriangleStrip3D(Vector3 *points, int pointsCount, 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 DrawCubeTextureRec(Texture2D texture, Rectangle source, 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 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)
|
||||
void DrawGizmo(Vector3 position)
|
||||
Model LoadModel(const char *fileName)
|
||||
Model LoadModelFromMesh(Mesh mesh)
|
||||
void UnloadModel(Model model)
|
||||
void UnloadModelKeepMeshes(Model model)
|
||||
BoundingBox GetModelBoundingBox(Model model)
|
||||
void DrawModel(Model model, Vector3 position, float scale, Color tint)
|
||||
void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint)
|
||||
void DrawModelWires(Model model, Vector3 position, float scale, Color tint)
|
||||
void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint)
|
||||
void DrawBoundingBox(BoundingBox box, Color color)
|
||||
void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float size, Color tint)
|
||||
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 UnloadMesh(Mesh mesh)
|
||||
void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||
void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, int instances)
|
||||
Mesh *LoadMeshes(const char *fileName, int *meshCount)
|
||||
bool ExportMesh(Mesh mesh, const char *fileName)
|
||||
BoundingBox GetMeshBoundingBox(Mesh mesh)
|
||||
void GenMeshTangents(Mesh *mesh)
|
||||
void GenMeshBinormals(Mesh *mesh)
|
||||
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 GenMeshCone(float radius, float height, int slices)
|
||||
Mesh GenMeshTorus(float radius, float size, int radSeg, int sides)
|
||||
Mesh GenMeshKnot(float radius, float size, int radSeg, int sides)
|
||||
Mesh GenMeshHeightmap(Image heightmap, Vector3 size)
|
||||
Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
|
||||
Material *LoadMaterials(const char *fileName, int *materialCount)
|
||||
Material LoadMaterialDefault(void)
|
||||
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, unsigned int *animCount)
|
||||
void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
|
||||
void UnloadModelAnimation(ModelAnimation anim)
|
||||
void UnloadModelAnimations(ModelAnimation* animations, unsigned int count)
|
||||
bool IsModelAnimationValid(Model model, ModelAnimation anim)
|
||||
BoundingBox MeshBoundingBox(Mesh mesh)
|
||||
void MeshTangents(Mesh *mesh)
|
||||
void MeshBinormals(Mesh *mesh)
|
||||
void MeshNormalsSmooth(Mesh *mesh)
|
||||
void DrawModel(Model model, Vector3 position, float scale, Color tint)
|
||||
void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint)
|
||||
void DrawModelWires(Model model, Vector3 position, float scale, Color tint)
|
||||
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 source, Vector3 center, float size, Color tint)
|
||||
bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2)
|
||||
bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2)
|
||||
bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius)
|
||||
RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius)
|
||||
RayCollision GetRayCollisionBox(Ray ray, BoundingBox box)
|
||||
RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix transform)
|
||||
RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3)
|
||||
RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4)
|
||||
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 GetCollisionRayMesh(Ray ray, Mesh mesh, Matrix transform)
|
||||
RayHitInfo GetCollisionRayModel(Ray ray, Model model)
|
||||
RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3)
|
||||
RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight)
|
||||
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)
|
||||
int GetShaderLocationAttrib(Shader shader, const char *attribName)
|
||||
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)
|
||||
TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format)
|
||||
TextureCubemap GenTextureIrradiance(Shader shader, TextureCubemap cubemap, int size)
|
||||
TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap 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)
|
||||
Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int dataSize)
|
||||
Wave LoadWaveFromMemory(const char *fileType, const uint8_t *fileData, int dataSize)
|
||||
Sound LoadSound(const char *fileName)
|
||||
Sound LoadSoundFromWave(Wave wave)
|
||||
void UpdateSound(Sound sound, const void *data, int sampleCount)
|
||||
void UpdateSound(Sound sound, const void *data, int samplesCount)
|
||||
void UnloadWave(Wave wave)
|
||||
void UnloadSound(Sound sound)
|
||||
bool ExportWave(Wave wave, const char *fileName)
|
||||
@ -456,30 +444,26 @@ 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)
|
||||
void UnloadMusicStream(Music music)
|
||||
void PlayMusicStream(Music music)
|
||||
bool IsMusicStreamPlaying(Music music)
|
||||
void UpdateMusicStream(Music music)
|
||||
void StopMusicStream(Music music)
|
||||
void PauseMusicStream(Music music)
|
||||
void ResumeMusicStream(Music music)
|
||||
void SeekMusicStream(Music music, float position)
|
||||
bool IsMusicPlaying(Music music)
|
||||
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)
|
||||
AudioStream LoadAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels)
|
||||
void UnloadAudioStream(AudioStream stream)
|
||||
void UpdateAudioStream(AudioStream stream, const void *data, int frameCount)
|
||||
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)
|
||||
@ -488,8 +472,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)
|
||||
|
@ -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
@ -8,39 +8,24 @@ local keywords = {
|
||||
local structs = {
|
||||
"Vector2", "Vector3", "Vector4", "Quaternion",
|
||||
"Matrix", "Color", "Rectangle", "Image", "Texture", "Texture2D",
|
||||
"RenderTexture", "NPatchInfo", "GlyphInfo", "Font",
|
||||
"RenderTexture", "NPatchInfo", "CharInfo", "Font",
|
||||
"Camera", "Camera2D", "Mesh", "Shader", "MaterialMap",
|
||||
"Material", "Model", "Transform", "BoneInfo", "ModelAnimation",
|
||||
"Ray", "RayCollision", "BoundingBox", "Wave", "Sound", "Music",
|
||||
"Ray", "RayHitInfo", "BoundingBox", "Wave", "Sound", "Music",
|
||||
"AudioStream", "VrDeviceInfo", "Camera3D", "RenderTexture2D",
|
||||
"TextureCubemap", "TraceLogCallback", "PhysicsBody",
|
||||
"GestureEvent", "GuiStyle", "GuiTextBoxState",
|
||||
"TraceLogCallback", "VertexBuffer", "DrawCall", "RenderBatch",
|
||||
"ShaderAttributeDataType", "MaterialMapIndex", "VrStereoConfig",
|
||||
"AudioCallback"
|
||||
}
|
||||
|
||||
local rl_structs = {
|
||||
"rlTraceLogLevel", "rlPixelFormat", "rlTextureFilter",
|
||||
"rlBlendMode", "rlShaderLocationIndex", "rlShaderUniformDataType",
|
||||
"rlShaderAttributeDataType", "rlFramebufferAttachType",
|
||||
"rlFramebufferAttachTextureType", "rlVertexBuffer", "rlDrawCall",
|
||||
"rlRenderBatch"
|
||||
"GestureEvent", "GuiStyle", "GuiTextBoxState"
|
||||
}
|
||||
|
||||
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)
|
||||
return line:gsub("[%s*]+(rl%w+)", function (part)
|
||||
functions[#functions + 1] = part
|
||||
funcname = part
|
||||
counter = counter + 1
|
||||
|
||||
if counter == 2 then
|
||||
@ -52,10 +37,58 @@ 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 custom_support[modname] then
|
||||
line = custom_support[modname](line)
|
||||
end
|
||||
|
||||
line = line:gsub("(%W)([%l%d][%w_]*)", function (before, part)
|
||||
for i,keyword in ipairs(keywords) do
|
||||
if part == keyword
|
||||
or part == "t" then -- uintX_t workaround
|
||||
return before .. part
|
||||
end
|
||||
end
|
||||
|
||||
return before
|
||||
end)
|
||||
|
||||
line = line:gsub("%u%w+", function (part)
|
||||
for i,struct in ipairs(structs) do
|
||||
if part == struct then
|
||||
return part
|
||||
end
|
||||
end
|
||||
|
||||
functions[#functions + 1] = part
|
||||
counter = counter + 1
|
||||
|
||||
if count == 2 then
|
||||
print("WARN: Multiple matches for: " .. line)
|
||||
end
|
||||
|
||||
return "(*)"
|
||||
end)
|
||||
|
||||
-- Strip spaces
|
||||
line = line:gsub("([(),*.])%s+(%w)", function (a, b) return a .. b end)
|
||||
line = line:gsub("(%w)%s+([(),*.])", function (a, b) return a .. b end)
|
||||
|
||||
proto[#proto + 1] = line
|
||||
end
|
||||
end
|
||||
|
||||
assert(#proto == #functions, "Mismatching proto and function count : " ..
|
||||
#proto .. " ~= " .. #functions)
|
||||
|
||||
file:write [[
|
||||
struct raylua_bind_entry {
|
||||
const char *name;
|
||||
@ -66,76 +99,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()
|
||||
|
@ -1,19 +1,20 @@
|
||||
void InitPhysics(void)
|
||||
void UpdatePhysics(void)
|
||||
void ResetPhysics(void)
|
||||
void ClosePhysics(void)
|
||||
void RunPhysicsStep(void)
|
||||
void SetPhysicsTimeStep(double delta)
|
||||
bool IsPhysicsEnabled(void)
|
||||
void SetPhysicsGravity(float x, float y)
|
||||
PhysicsBody CreatePhysicsBodyCircle(Vector2 pos, float radius, float density)
|
||||
PhysicsBody CreatePhysicsBodyRectangle(Vector2 pos, float width, float height, float density)
|
||||
PhysicsBody CreatePhysicsBodyPolygon(Vector2 pos, float radius, int sides, float density)
|
||||
void DestroyPhysicsBody(PhysicsBody body)
|
||||
void PhysicsAddForce(PhysicsBody body, Vector2 force)
|
||||
void PhysicsAddTorque(PhysicsBody body, float amount)
|
||||
void PhysicsShatter(PhysicsBody body, Vector2 position, float force)
|
||||
void SetPhysicsBodyRotation(PhysicsBody body, float radians)
|
||||
PhysicsBody GetPhysicsBody(int index)
|
||||
int GetPhysicsBodiesCount(void)
|
||||
PhysicsBody GetPhysicsBody(int index)
|
||||
int GetPhysicsShapeType(int index)
|
||||
int GetPhysicsShapeVerticesCount(int index)
|
||||
Vector2 GetPhysicsShapeVertex(PhysicsBody body, int vertex)
|
||||
Vector2 GetPhysicsShapeVertex(PhysicsBody body, int vertex)
|
||||
void SetPhysicsBodyRotation(PhysicsBody body, float radians)
|
||||
void DestroyPhysicsBody(PhysicsBody body)
|
||||
void ResetPhysics(void)
|
||||
void ClosePhysics(void)
|
||||
|
@ -2,7 +2,6 @@ void GuiEnable(void)
|
||||
void GuiDisable(void)
|
||||
void GuiLock(void)
|
||||
void GuiUnlock(void)
|
||||
bool GuiIsLocked(void)
|
||||
void GuiFade(float alpha)
|
||||
void GuiSetState(int state)
|
||||
int GuiGetState(void)
|
||||
@ -10,14 +9,20 @@ void GuiSetFont(Font font)
|
||||
Font GuiGetFont(void)
|
||||
void GuiSetStyle(int control, int property, int value)
|
||||
int GuiGetStyle(int control, int property)
|
||||
void GuiEnableTooltip(void)
|
||||
void GuiDisableTooltip(void)
|
||||
void GuiSetTooltip(const char *tooltip)
|
||||
void GuiClearTooltip(void)
|
||||
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 +37,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)
|
||||
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,8 +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)
|
||||
Vector3 Vector3Normalize(Vector3 v)
|
||||
@ -56,6 +52,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)
|
||||
@ -92,7 +89,7 @@ Quaternion QuaternionFromMatrix(Matrix mat)
|
||||
Matrix QuaternionToMatrix(Quaternion q)
|
||||
Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle)
|
||||
void QuaternionToAxisAngle(Quaternion q, Vector3 *outAxis, float *outAngle)
|
||||
Quaternion QuaternionFromEuler(float pitch, float yaw, float roll)
|
||||
Quaternion QuaternionFromEuler(float roll, float pitch, float yaw)
|
||||
Vector3 QuaternionToEuler(Quaternion q)
|
||||
Quaternion QuaternionTransform(Quaternion q, Matrix mat)
|
||||
Vector3 Vector3Unproject(Vector3 source, Matrix projection, Matrix view)
|
||||
Vector3 Vector3Unproject(Vector3 source, Matrix projection, Matrix view)
|
||||
|
113
tools/rlgl.h
113
tools/rlgl.h
@ -3,7 +3,7 @@ void rlPushMatrix(void)
|
||||
void rlPopMatrix(void)
|
||||
void rlLoadIdentity(void)
|
||||
void rlTranslatef(float x, float y, float z)
|
||||
void rlRotatef(float angle, float x, float y, float z)
|
||||
void rlRotatef(float angleDeg, float x, float y, float z)
|
||||
void rlScalef(float x, float y, float z)
|
||||
void rlMultMatrixf(float *matf)
|
||||
void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar)
|
||||
@ -19,31 +19,13 @@ void rlNormal3f(float x, float y, float z)
|
||||
void rlColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
||||
void rlColor3f(float x, float y, float z)
|
||||
void rlColor4f(float x, float y, float z, float w)
|
||||
bool rlEnableVertexArray(unsigned int vaoId)
|
||||
void rlDisableVertexArray(void)
|
||||
void rlEnableVertexBuffer(unsigned int id)
|
||||
void rlDisableVertexBuffer(void)
|
||||
void rlEnableVertexBufferElement(unsigned int id)
|
||||
void rlDisableVertexBufferElement(void)
|
||||
void rlEnableVertexAttribute(unsigned int index)
|
||||
void rlDisableVertexAttribute(unsigned int index)
|
||||
#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)
|
||||
void rlEnableTextureCubemap(unsigned int id)
|
||||
void rlDisableTextureCubemap(void)
|
||||
void rlTextureParameters(unsigned int id, int param, int value)
|
||||
void rlEnableShader(unsigned int id)
|
||||
void rlDisableShader(void)
|
||||
void rlEnableFramebuffer(unsigned int id)
|
||||
void rlDisableFramebuffer(void)
|
||||
void rlActiveDrawBuffers(int count)
|
||||
void rlEnableColorBlend(void)
|
||||
void rlDisableColorBlend(void)
|
||||
void rlEnableDepthTest(void)
|
||||
void rlDisableDepthTest(void)
|
||||
void rlEnableDepthMask(void)
|
||||
@ -59,88 +41,35 @@ void rlSetLineWidth(float width)
|
||||
float rlGetLineWidth(void)
|
||||
void rlEnableSmoothLines(void)
|
||||
void rlDisableSmoothLines(void)
|
||||
void rlEnableStereoRender(void)
|
||||
void rlDisableStereoRender(void)
|
||||
bool rlIsStereoRenderEnabled(void)
|
||||
void rlClearColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
||||
void rlClearScreenBuffers(void)
|
||||
void rlCheckErrors(void)
|
||||
void rlSetBlendMode(int mode)
|
||||
void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation)
|
||||
void rlUpdateBuffer(int bufferId, void *data, int dataSize)
|
||||
unsigned int rlLoadAttribBuffer(unsigned int vaoId, int shaderLoc, void *buffer, int size, bool dynamic)
|
||||
void rlglInit(int width, int height)
|
||||
void rlglClose(void)
|
||||
void rlLoadExtensions(void *loader)
|
||||
void rlglDraw(void)
|
||||
void rlCheckErrors(void)
|
||||
int rlGetVersion(void)
|
||||
int rlGetFramebufferWidth(void)
|
||||
int rlGetFramebufferHeight(void)
|
||||
unsigned int rlGetTextureIdDefault(void)
|
||||
unsigned int rlGetShaderIdDefault(void)
|
||||
int *rlGetShaderLocsDefault(void)
|
||||
rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements)
|
||||
void rlUnloadRenderBatch(rlRenderBatch batch)
|
||||
void rlDrawRenderBatch(rlRenderBatch *batch)
|
||||
void rlSetRenderBatchActive(rlRenderBatch *batch)
|
||||
void rlDrawRenderBatchActive(void)
|
||||
bool rlCheckRenderBatchLimit(int vCount)
|
||||
void rlSetTexture(unsigned int id)
|
||||
unsigned int rlLoadVertexArray(void)
|
||||
unsigned int rlLoadVertexBuffer(const void *buffer, int size, bool dynamic)
|
||||
unsigned int rlLoadVertexBufferElement(const void *buffer, int size, bool dynamic)
|
||||
void rlUpdateVertexBuffer(unsigned int bufferId, const void *data, int dataSize, int offset)
|
||||
void rlUpdateVertexBufferElements(unsigned int id, const void *data, int dataSize, int offset)
|
||||
void rlUnloadVertexArray(unsigned int vaoId)
|
||||
void rlUnloadVertexBuffer(unsigned int vboId)
|
||||
void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, const 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 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)
|
||||
bool rlCheckBufferLimit(int vCount)
|
||||
void rlSetDebugMarker(const char *text)
|
||||
void rlSetBlendMode(int glSrcFactor, int glDstFactor, int glEquation)
|
||||
void rlLoadExtensions(void *loader)
|
||||
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)
|
||||
const char *rlGetPixelFormatName(unsigned int format)
|
||||
void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType)
|
||||
void rlUnloadTexture(unsigned int id)
|
||||
void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int *mipmaps)
|
||||
void *rlReadTexturePixels(unsigned int id, int width, int height, int format)
|
||||
void rlGenerateMipmaps(Texture2D *texture)
|
||||
void *rlReadTexturePixels(Texture2D texture)
|
||||
unsigned char *rlReadScreenPixels(int width, int height)
|
||||
unsigned int rlLoadFramebuffer(int width, int height)
|
||||
void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType, int texType, int mipLevel)
|
||||
void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType)
|
||||
bool rlFramebufferComplete(unsigned int id)
|
||||
void rlUnloadFramebuffer(unsigned int id)
|
||||
unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode)
|
||||
unsigned int rlCompileShader(const char *shaderCode, int type)
|
||||
unsigned int rlLoadShaderProgram(unsigned int vShaderId, unsigned int fShaderId)
|
||||
void rlUnloadShaderProgram(unsigned int id)
|
||||
int rlGetLocationUniform(unsigned int shaderId, const char *uniformName)
|
||||
int rlGetLocationAttrib(unsigned int shaderId, const char *attribName)
|
||||
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)
|
||||
void rlUnloadShaderBuffer(unsigned int ssboId)
|
||||
void rlUpdateShaderBufferElements(unsigned int id, const void *data, unsigned long long dataSize, unsigned long long offset)
|
||||
unsigned long long rlGetShaderBufferSize(unsigned int id)
|
||||
void rlReadShaderBufferElements(unsigned int id, void *dest, unsigned long long count, unsigned long long offset)
|
||||
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)
|
||||
Matrix rlGetMatrixProjectionStereo(int eye)
|
||||
Matrix rlGetMatrixViewOffsetStereo(int eye)
|
||||
void rlSetMatrixProjection(Matrix proj)
|
||||
void rlSetMatrixModelview(Matrix view)
|
||||
void rlSetMatrixProjectionStereo(Matrix right, Matrix left)
|
||||
void rlSetMatrixViewOffsetStereo(Matrix right, Matrix left)
|
||||
void rlLoadDrawCube(void)
|
||||
void rlLoadDrawQuad(void)
|
||||
void rlLoadMesh(Mesh *mesh, bool dynamic)
|
||||
void rlUpdateMesh(Mesh mesh, int buffer, int num)
|
||||
void rlUpdateMeshAt(Mesh mesh, int buffer, int num, int index)
|
||||
void rlDrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int count)
|
||||
void rlDrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||
void rlUnloadMesh(Mesh mesh)
|
||||
|
Loading…
Reference in New Issue
Block a user