updated readme and fixed folder selection

This commit is contained in:
David Lannan 2024-11-18 22:42:17 +10:30
parent 94f674e9e3
commit 4af9000c40
10 changed files with 22 additions and 4 deletions

View File

@ -15,6 +15,9 @@ Discord - https://discord.gg/KMDeFebk
The repo is based entirely on the brilliant framework here: The repo is based entirely on the brilliant framework here:
https://github.com/floooh/sokol https://github.com/floooh/sokol
The sokol api has been built into dll's (this may change in the future) and it is executed in the best (imho) runtime system there is using its amazing ffi module:
https://luajit.org/
sdf exmample sdf exmample
![alt text](https://github.com/dlannan/sokol-luajit/blob/main/media/2024-10-30_11-48.png "sdf Example") ![alt text](https://github.com/dlannan/sokol-luajit/blob/main/media/2024-10-30_11-48.png "sdf Example")

BIN
bin/linux/libluajit.so Normal file

Binary file not shown.

Binary file not shown.

BIN
bin/macos/libluajit.so Normal file

Binary file not shown.

BIN
bin/macos/luajit Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/win64/luajit.lib Normal file

Binary file not shown.

View File

@ -95,8 +95,7 @@ local folder_select = {
if(bhit) then if(bhit) then
udata.hit = bhit udata.hit = bhit
if(bhit[2] == "..") then if(bhit[2] == "..") then
udata.folder_path = udata.folder_path:match("(.-)[^\\]-$") udata.folder_path = dirtools.get_folder(udata.folder_path)
print(udata.folder_path)
if(udata.folder_path == nil or udata.folder_path == "") then udata.folder_path = "." end if(udata.folder_path == nil or udata.folder_path == "") then udata.folder_path = "." end
else else
udata.folder_path = udata.folder_path.."\\"..udata.hit[2] udata.folder_path = udata.folder_path.."\\"..udata.hit[2]

View File

@ -1,6 +1,9 @@
local ffi = require("ffi") local ffi = require("ffi")
local dirtools = {} local dirtools = {}
local tinsert = table.insert
local tconcat = table.concat
--------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------
@ -22,6 +25,19 @@ dirtools.add_default_paths = function(path)
package.path = package.path..";"..path.."/?.lua" package.path = package.path..";"..path.."/?.lua"
end end
---------------------------------------------------------------------------------------
-- Much safer way to build folder than pattern match (very unstable)
dirtools.get_folder = function(path)
local parts = {}
local sep = "\\"
local patt = "(.-)[\\]"
if(ffi.os ~= "Windows") then patt = "(.-)[/]"; sep = "/" end
for pseg in string.gmatch(path, patt) do
tinsert(parts, pseg)
end
return tconcat(parts, sep)
end
--------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------
dirtools.get_app_path = function( expected_root_folder ) dirtools.get_app_path = function( expected_root_folder )