diff --git a/lua/json.lua b/lua/json.lua new file mode 100644 index 0000000..eb8038a --- /dev/null +++ b/lua/json.lua @@ -0,0 +1,389 @@ +-- +-- 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, + [ "cdata" ] = encode_nil, +} + + +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 \ No newline at end of file diff --git a/tools/build/rbuilder/config/recent_projects.json b/tools/build/rbuilder/config/recent_projects.json new file mode 100644 index 0000000..e02aef2 --- /dev/null +++ b/tools/build/rbuilder/config/recent_projects.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/tools/build/rbuilder/config/settings.lua b/tools/build/rbuilder/config/settings.lua index 1af40e3..187aef6 100644 --- a/tools/build/rbuilder/config/settings.lua +++ b/tools/build/rbuilder/config/settings.lua @@ -1,7 +1,7 @@ -- rbuild config settings local ffi = require("ffi") - +local json = require("lua.json") -- ------------------------------------------------------------------------------------------------------ @@ -33,9 +33,8 @@ local default = { project = { project_name = { index = 1, value = "default", ptype = "string", slen = 64 }, - project_path = { index = 2, value = ".", ptype = "path", slen = 256 }, -- Always starts empty. Will support a project file. - project_file = { index = 3, value = "default.slp", ptype = "file", pfilter = "*.slp", slen = 64 }, -- Sokol luajit project file - project_start = { index = 4, value = "example1.lua", ptype = "file", pfilter = "*.lua", slen = 128 }, + build_path = { index = 2, value = "", ptype = "path", slen = 256 }, -- Always starts empty. Will support a project file. + project_start = { index = 3, value = "example1.lua", ptype = "file", pfilter = "*.lua", slen = 128 }, }, graphics = { @@ -98,19 +97,22 @@ end settings.load = function( projectpath ) - if( projectpath == nil ) then - projectpath = "./projects/default.slp" - -- Attempt to load it. If it fails, this is the first time run! save a default! - local fh = io.open(projectpath, "r") - if(fh == nil) then - fh = io.open(projectpath, "w") - fh:write(default_settings) - end + -- Grab the recents file list too. + settings.recent = nil + local fh = io.open("config/recent_projects.json", "r") + if(fh) then + settings.recent = json.decode( fh:read("*a") ) fh:close() end - -- Load the project settings into the local config - settings.config = loadconfig(projectpath) + if( projectpath == nil ) then + print("[Error] settings.load invalid projectpath nil, using default settings.") + settings.config = load(default_settings)() + else + + -- Load the project settings into the local config + settings.config = loadconfig(projectpath) + end local title = settings.config.rbuilder.appname.value.." ("..settings.config.rbuilder.version.value..")" settings.config.rbuilder.title = { value = title, slen = 32 } diff --git a/tools/build/rbuilder/projects/default.slp b/tools/build/rbuilder/projects/default.slp deleted file mode 100644 index 1222261..0000000 --- a/tools/build/rbuilder/projects/default.slp +++ /dev/null @@ -1,64 +0,0 @@ - -local platforms = { "Win64", "MacOS", "Linux", "IOS64" } -local resolutions = { "1920x1080", "1680x1050", "1600x900", "1440x900", "1376x768" } -local arch = { "x86", "x64", "arm", "arm64", "arm64be", "ppc", "mips", "mipsel", "mips64", "mips64el", "mips64r6", "mips64r6el" } -local oss = { "Windows", "Linux", "OSX", "BSD", "POSIX", "Other" } - -local default = { - - rbuilder = { - appname = { index = 1, value = "rbuild", slen = 7 }, - version = { index = 2, value = "00.01.snow", slen = 32 }, - }, - - platform = { - target = { index = 1, value = 1, ptype = "combo", plist = platforms }, - srlua_path = { index = 2, value = "../srlua/", ptype = "path", slen = 256 }, -- initially rbuild will run for the tools/build/rbuilder folder - arch = { index = 3, value = 2, ptype = "combo", plist = arch }, - os = { index = 4, value = 1, ptype = "combo", plist = oss }, - }, - - project = { - project_name = { index = 1, value = "default", ptype = "string", slen = 64 }, - project_path = { index = 2, value = ".", ptype = "path", slen = 256 }, -- Always starts empty. Will support a project file. - project_file = { index = 3, value = "default.slp", ptype = "file", pfilter = "*.slp", slen = 64 }, -- Sokol luajit project file - project_start = { index = 4, value = "example1.lua", ptype = "file", pfilter = "*.lua", slen = 128 }, - }, - - graphics = { - display_res = { index = 1, value = 1, ptype = "combo", plist = resolutions }, - display_width = { index = 2, value = 1024, vmin = 640, vmax = 8192, vstep = 32, vinc = 0.1, ptype = "int" }, - display_height = { index = 3, value = 768, vmin = 480, vmax = 8192, vstep = 32, vinc = 0.1, ptype = "int" }, - display_fps = { index = 4, value = 60, vmin = 25, vmax = 200, vstep = 5, vinc = 0.1, ptype = "int" }, - antialias = { index = 5, value = "fxaa", slen = 16 }, - }, - - audio = { - master_volume = { index = 1, value = 1.0, vmin = 0.0, vmax = 1.0, vstep = 0.02, vinc = 0.1, ptype = "float" }, - effects_volume = { index = 2, value = 1.0, vmin = 0.0, vmax = 1.0, vstep = 0.02, vinc = 0.1, ptype = "float" }, - music_volume = { index = 3, value = 1.0, vmin = 0.0, vmax = 1.0, vstep = 0.02, vinc = 0.1, ptype = "float" }, - }, - - sokol = { - sokol_path = { index = 1, value = "../../../../", ptype = "path", slen = 256 }, - sokol_bin = { index = 2, value = "bin/", ptype = "path", slen = 256 }, - sokol_ffi = { index = 3, value = "ffi/", ptype = "path", slen = 256 }, - sokol_lua = { index = 4, value = "lua/", ptype = "path", slen = 256 }, - sokol_examples = { index = 5, value = "examples/", ptype = "path", slen = 256 }, - }, - - remote = { - -- These are futures -- - remote_build = { index = 1, value = "https://mybuildserver.com/sokol_build", slen = 256 }, - remote_data = { index = 2, value = "https://myremotedata.com/data", slen = 256 }, - }, - - -- Assets will be populated by project file - assets = { - lua = {}, - images = {}, - data = {}, - }, -} - -return default diff --git a/tools/build/rbuilder/rbuilder.lua b/tools/build/rbuilder/rbuilder.lua index 3f73c19..9b03c25 100644 --- a/tools/build/rbuilder/rbuilder.lua +++ b/tools/build/rbuilder/rbuilder.lua @@ -46,6 +46,7 @@ local function init(void) sapp.sapp_show_mouse(false) panel.init() + sapp.sapp_set_window_title(panel.config.rbuilder.title.value) end -- -------------------------------------------------------------------------------------- @@ -59,6 +60,7 @@ end local current_ctx = nil local function input(event) + panel.input(event) if(event.type == sapp.SAPP_EVENTTYPE_RESIZED) then nk.snk_handle_event(event) -- folder_select.popup_dim.x = sapp.sapp_width()/2 - folder_select.popup_dim.w/2 @@ -71,7 +73,7 @@ local function input(event) sapp.sapp_show_mouse(true) else nk.snk_handle_event(event) - end + end end -- -------------------------------------------------------------------------------------- @@ -80,7 +82,7 @@ local function frame(void) local ctx = nk.snk_new_frame() current_ctx = ctx - panel.main_ui(ctx) + local config_reset = panel.main_ui(ctx) -- // the sokol_gfx draw pass local pass = ffi.new("sg_pass[1]") @@ -93,6 +95,9 @@ local function frame(void) sg.sg_end_pass() sg.sg_commit() + if(config_reset) then + panel.init() + end ffi.C.Sleep(3) end @@ -105,7 +110,7 @@ app_desc[0].cleanup_cb = cleanup app_desc[0].event_cb = input app_desc[0].width = 1280 app_desc[0].height = 800 -app_desc[0].window_title = panel.config.rbuilder.title.value +app_desc[0].window_title = "" app_desc[0].icon.sokol_default = true app_desc[0].logger.func = slib.slog_func app_desc[0].enable_clipboard = true diff --git a/tools/build/rbuilder/ui/file_selector.lua b/tools/build/rbuilder/ui/file_selector.lua index a04cece..a525c4b 100644 --- a/tools/build/rbuilder/ui/file_selector.lua +++ b/tools/build/rbuilder/ui/file_selector.lua @@ -38,7 +38,12 @@ file_selector.create_file_selector = function( name, rect, start_folder, folders nk.nk_layout_row_dynamic(ctx, dim.h-20, 1) local flags = bit.bor(nk.NK_WINDOW_BORDER, nk.NK_WINDOW_TITLE) flags = bit.bor(flags, nk.NK_WINDOW_NO_SCROLLBAR) - if (nk.nk_group_begin(ctx, name, flags) == true) then + + local full_path = udata.file_selected + if(folders_only) then full_path = udata.folder_path end + local long_name = string.format("%s: %s", name, full_path) + + if (nk.nk_group_begin(ctx, long_name, flags) == true) then nk.nk_layout_row_begin(ctx, nk.NK_DYNAMIC, 25, 2) nk.nk_layout_row_push(ctx, 0.2) @@ -94,7 +99,11 @@ file_selector.create_file_selector = function( name, rect, start_folder, folders if (nk.nk_button_label(ctx, "OK") == true) then udata.popup_active = 0 if(udata.prop) then - udata.prop.value = udata.file_selected + if(folders_only) then + udata.prop.value = udata.folder_path + else + udata.prop.value = udata.file_selected + end udata.prop.ffi = ffi.new("char[?]", udata.prop.slen ) ffi.fill(udata.prop.ffi, udata.prop.slen, 0) ffi.copy(udata.prop.ffi, ffi.string(udata.prop.value)) diff --git a/tools/build/rbuilder/ui/panels.lua b/tools/build/rbuilder/ui/panels.lua index 86742b9..b42b6da 100644 --- a/tools/build/rbuilder/ui/panels.lua +++ b/tools/build/rbuilder/ui/panels.lua @@ -17,9 +17,11 @@ local fsel = require("ui.file_selector") local icons = ffi.new("struct nk_image [?]", 10) -local config = settings.load() local themes = require("lua.themes") +local panel = { + config = nil +} -- -------------------------------------------------------------------------------------- -- Static vars @@ -52,7 +54,7 @@ local tabs = { local bounds = nk.nk_window_get_content_region(ctx) nk.nk_layout_row_dynamic(ctx, bounds.h, 1) - local files = config.assets.lua + local files = panel.config.assets.lua wdgts.widget_list_removeable(ctx, "source_files", nk.NK_WINDOW_BORDER, files, bounds.w -40 ) end, asset_name = "lua", @@ -63,7 +65,7 @@ local tabs = { local bounds = nk.nk_window_get_content_region(ctx) nk.nk_layout_row_dynamic(ctx, bounds.h, 1) - local files = config.assets.images + local files = panel.config.assets.images wdgts.widget_list_removeable(ctx, "source_files", nk.NK_WINDOW_BORDER, files, bounds.w -40 ) end, asset_name = "images", @@ -74,7 +76,7 @@ local tabs = { local bounds = nk.nk_window_get_content_region(ctx) nk.nk_layout_row_dynamic(ctx, bounds.h, 1) - local files = config.assets.data + local files = panel.config.assets.data wdgts.widget_list_removeable(ctx, "source_files", nk.NK_WINDOW_BORDER, files, bounds.w -40 ) end, asset_name = "data", @@ -87,7 +89,7 @@ local tabs = { local function setup_config() - for sectionname, section in pairs(config) do + for sectionname, section in pairs(panel.config) do for key, prop in pairs(section) do -- If ptype is nill or string its a string @@ -120,7 +122,7 @@ end -- -------------------------------------------------------------------------------------- local pix = {} -local function init() +panel.init = function() local base_path = "./" pix["baboon"] = wdgts.icon_load(base_path.."images/baboon.png") @@ -152,6 +154,7 @@ local function init() sapp.sapp_height()/2-40 - popup_high/2, popup_wide, popup_high) file_select = fsel.create_file_selector("Select File", dim2, ".") + panel.config = settings.load() setup_config() end @@ -159,7 +162,7 @@ end local function display_section(ctx, sectionname) - local section = config[sectionname] + local section = panel.config[sectionname] -- Collect the number of properties in the section local count = 0 local sorted = {} @@ -293,7 +296,7 @@ local function assets_panel(ctx) name=ffi.string(udata.folder_path), select = ffi.new("bool[1]", {0}) } - table.insert(config.assets[tabinfo.asset_name], newfolder) + table.insert(panel.config.assets[tabinfo.asset_name], newfolder) end end end @@ -310,7 +313,7 @@ local function assets_panel(ctx) name=ffi.string(udata.file_selected), select = ffi.new("bool[1]", {0}) } - table.insert(config.assets[tabinfo.asset_name], newfile) + table.insert(panel.config.assets[tabinfo.asset_name], newfile) end end end @@ -319,7 +322,7 @@ end -- -------------------------------------------------------------------------------------- -local function main_ui(ctx) +panel.main_ui = function(ctx) if(myfonts == nil) then myfonts = fonts.setup_font(ctx, font_list) @@ -327,6 +330,8 @@ local function main_ui(ctx) themes.tech(ctx) end + local config_reset = nil + wdgts.widget_panel_fixed(ctx, "WinMain", 0, 0, sapp.sapp_width(), sapp.sapp_height(), 0, function(data) folder_select.popup_active = wdgts.widget_popup_panel(ctx, "popup", folder_select.popup_dim, folder_select.ui_func, folder_select, folder_select.popup_active) @@ -343,7 +348,7 @@ local function main_ui(ctx) nk.nk_layout_row_dynamic(ctx, 35, 1) if (nk.nk_menu_item_label(ctx, "New", nk.NK_TEXT_LEFT)) then - init() + config_reset = true end nk.nk_layout_row_dynamic(ctx, 35, 1) if (nk.nk_menu_item_label(ctx, "Open", nk.NK_TEXT_LEFT)) then @@ -416,18 +421,32 @@ local function main_ui(ctx) end, {ctx=ctx}) - return not nk.nk_window_is_closed(ctx, "Overview") + -- return not nk.nk_window_is_closed(ctx, "Overview") + return config_reset end -- -------------------------------------------------------------------------------------- -return { - config = config, +panel.input = function(event) - init = init, - main_ui = main_ui, -} + if(event.type == sapp.SAPP_EVENTTYPE_RESIZED) then + local popup_wide = sapp.sapp_width()* 0.4 + local popup_high = sapp.sapp_height()* 0.7 + + local dim = nk.nk_rect( sapp.sapp_width()/2-8 - popup_wide/2, + sapp.sapp_height()/2-40 - popup_high/2, popup_wide, popup_high) + folder_select.popup_dim = dim + + local dim2 = nk.nk_rect( sapp.sapp_width()/2-8 - popup_wide/2, + sapp.sapp_height()/2-40 - popup_high/2, popup_wide, popup_high) + file_select.popup_dim = dim2 + end +end + +-- -------------------------------------------------------------------------------------- + +return panel -- --------------------------------------------------------------------------------------