testing file sources.
This commit is contained in:
parent
fb6659908c
commit
cef1333bd5
@ -122,6 +122,7 @@ local function cleanup()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- --------------------------------------------------------------------------------------
|
-- --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
local current_ctx = nil
|
local current_ctx = nil
|
||||||
local function input(event)
|
local function input(event)
|
||||||
if(event.type == sapp.SAPP_EVENTTYPE_RESIZED) then
|
if(event.type == sapp.SAPP_EVENTTYPE_RESIZED) then
|
||||||
@ -137,7 +138,6 @@ local function input(event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------------------------------------
|
-- --------------------------------------------------------------------------------------
|
||||||
-- Extract config and build ffi objects for them
|
-- Extract config and build ffi objects for them
|
||||||
-- Each config property shall have a shadow ffi property labeled with _ffi
|
-- Each config property shall have a shadow ffi property labeled with _ffi
|
||||||
@ -245,8 +245,39 @@ local function project_panel(ctx)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- --------------------------------------------------------------------------------------
|
-- --------------------------------------------------------------------------------------
|
||||||
local curr_tab = 1
|
local curr_tab = 1
|
||||||
local tabs = { { name = "Lua Source" }, { name = "Images" }, { name = "Data" } }
|
local files = {}
|
||||||
|
|
||||||
|
-- Fill with temp file list of dir /b
|
||||||
|
local fh = io.popen("dir /b", "r")
|
||||||
|
local d = fh:read("*a")
|
||||||
|
fh:close()
|
||||||
|
|
||||||
|
for f in string.gmatch(d, "(.-)\n") do
|
||||||
|
local newfile = { name = ffi.string(f)}
|
||||||
|
newfile.select = ffi.new("nk_bool[1]")
|
||||||
|
newfile.select[0] = nk.nk_false
|
||||||
|
table.insert(files, newfile)
|
||||||
|
end
|
||||||
|
|
||||||
|
local tabs = {
|
||||||
|
{
|
||||||
|
name = "Lua Source",
|
||||||
|
func = function(ctx)
|
||||||
|
local bounds = nk.nk_window_get_content_region(ctx)
|
||||||
|
nk.nk_layout_row_dynamic(ctx, bounds.h, 1)
|
||||||
|
wdgts.widget_list_selectable(ctx, "source_files", nk.NK_WINDOW_BORDER, files, bounds.w -40 )
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "Images"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "Data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
local function assets_panel(ctx)
|
local function assets_panel(ctx)
|
||||||
|
|
||||||
@ -332,7 +363,7 @@ app_desc[0].cleanup_cb = cleanup
|
|||||||
app_desc[0].event_cb = input
|
app_desc[0].event_cb = input
|
||||||
app_desc[0].width = 1280
|
app_desc[0].width = 1280
|
||||||
app_desc[0].height = 800
|
app_desc[0].height = 800
|
||||||
app_desc[0].window_title = config.title
|
app_desc[0].window_title = config.rbuilder.title.value
|
||||||
app_desc[0].icon.sokol_default = true
|
app_desc[0].icon.sokol_default = true
|
||||||
app_desc[0].logger.func = slib.slog_func
|
app_desc[0].logger.func = slib.slog_func
|
||||||
app_desc[0].enable_clipboard = true
|
app_desc[0].enable_clipboard = true
|
||||||
|
|||||||
@ -179,7 +179,7 @@ widgets.widget_notebook = function(ctx, tab_name, tabs, current_tab, height, tab
|
|||||||
ctx[0].style.window.spacing = nk.nk_vec2(0,0)
|
ctx[0].style.window.spacing = nk.nk_vec2(0,0)
|
||||||
local rounding = ctx[0].style.button.rounding
|
local rounding = ctx[0].style.button.rounding
|
||||||
ctx[0].style.button.rounding = 0
|
ctx[0].style.button.rounding = 0
|
||||||
nk.nk_layout_row_begin(ctx, nk.NK_STATIC, 20, 3)
|
nk.nk_layout_row_begin(ctx, nk.NK_STATIC, 24, 3)
|
||||||
for i, v in ipairs(tabs) do
|
for i, v in ipairs(tabs) do
|
||||||
-- /* make sure button perfectly fits text */
|
-- /* make sure button perfectly fits text */
|
||||||
local f = ctx[0].style.font
|
local f = ctx[0].style.font
|
||||||
@ -234,6 +234,22 @@ widgets.widget_combo_box = function(ctx, items, selected_item, height)
|
|||||||
return selected_item
|
return selected_item
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
widgets.widget_list_selectable = function(ctx, title, flags, items, width)
|
||||||
|
|
||||||
|
if (nk.nk_group_begin(ctx, title, flags) == true) then
|
||||||
|
for i, item in ipairs(items) do
|
||||||
|
nk.nk_layout_row_static(ctx, 22, width, 1)
|
||||||
|
if(nk.nk_selectable_label(ctx, item.name, nk.NK_TEXT_LEFT, item.select) == true) then
|
||||||
|
-- changed
|
||||||
|
print("changed:"..i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
nk.nk_group_end(ctx)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- returns struct nk_image
|
-- returns struct nk_image
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user