More work on the editor/builder. Will park this for a bit. Next Worlds, Scenes, Models and Assets
This commit is contained in:
parent
f09326afbf
commit
48279f91f6
@ -1,5 +1,5 @@
|
||||
[Info] settings.load projectpath nil, using default settings.
|
||||
[Info] Found Sokol-luajit: F:\dev\luajit\repos\sokol-luajit
|
||||
[Info] Auto filling sokol paths...
|
||||
[Info] Found Sokol-luajit: F:\dev\luajit\repos\sokol-luajit
|
||||
[Info] Auto filling sokol paths...
|
||||
[Error] settings.save - Failed to save config: .
|
||||
[Info] panel.saveconfig: Saved path - .
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
local ffi = require("ffi")
|
||||
local json = require("lua.json")
|
||||
local logging = require("engine.utils.logging")
|
||||
local utils = require("engine.utils.general")
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -17,7 +18,7 @@ local settings = {
|
||||
-- Default settings if none are loaded or found
|
||||
local platforms = { "Win64", "MacOS", "Linux", "IOS64" }
|
||||
local buildtypes = { "Release", "Debug", "Release Remotery", "Debug Remotery" }
|
||||
local resolutions = { "1920x1080", "1680x1050", "1600x900", "1440x900", "1376x768", "Custom" }
|
||||
local resolutions = { "Auto-detect", "4096×2160", "3840×2160","3440×1440", "2560×1600", "2560x1440", "1920x1080", "1680x1050", "1600x900", "1440x900", "1376x768", "Custom" }
|
||||
local arch = { "x86", "x64", "arm", "arm64", "arm64be", "ppc", "mips", "mipsel", "mips64", "mips64el", "mips64r6", "mips64r6el" }
|
||||
local oss = { "Windows", "Linux", "OSX", "BSD", "POSIX", "Other" }
|
||||
local optimisations = { "None", "Level 1", "Level 2", "Level 3" }
|
||||
@ -179,8 +180,8 @@ settings.load = function( projectpath )
|
||||
end
|
||||
end
|
||||
|
||||
local title = settings.config.rbuilder.appname.value.." ("..settings.config.rbuilder.version.value..")"
|
||||
settings.config.rbuilder.title = { value = title, slen = 32 }
|
||||
-- local title = settings.config.rbuilder.appname.value.." ("..settings.config.rbuilder.version.value..")"
|
||||
-- settings.config.rbuilder.title = { value = title, slen = 32 }
|
||||
|
||||
return settings.config
|
||||
end
|
||||
|
||||
@ -62,8 +62,9 @@ local recent_files = nil
|
||||
local function setup_config()
|
||||
|
||||
for sectionname, section in pairs(panel.config) do
|
||||
|
||||
-- print(sectionname, section)
|
||||
for key, prop in pairs(section) do
|
||||
-- print(key, prop)
|
||||
-- If ptype is nill or string its a string
|
||||
if(prop.ptype == "string") then
|
||||
prop.ffi = ffi.new("char[?]", prop.slen )
|
||||
@ -183,6 +184,17 @@ end
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
|
||||
panel.do_popups = function(ctx)
|
||||
|
||||
panel.build.active = wdgts.widget_popup_panel(ctx, "popup_build", folder_select.popup_dim, panel.build.ui_func, panel.build, panel.build.active)
|
||||
folder_select.popup_active = wdgts.widget_popup_panel(ctx, "popup_folder", folder_select.popup_dim, folder_select.ui_func, folder_select, folder_select.popup_active)
|
||||
file_select.popup_active = wdgts.widget_popup_panel(ctx, "popup_fileselect", file_select.popup_dim, file_select.ui_func, file_select, file_select.popup_active)
|
||||
recent_files.popup_active = wdgts.widget_popup_panel(ctx, "popup_recentfiles", recent_files.popup_dim, recent_files.ui_func, recent_files, recent_files.popup_active)
|
||||
|
||||
end
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
|
||||
panel.main_ui = function(ctx)
|
||||
|
||||
if(myfonts == nil) then
|
||||
@ -191,10 +203,7 @@ panel.main_ui = function(ctx)
|
||||
|
||||
wdgts.widget_panel_fixed(ctx, "WinMain", 0, 0, sapp.sapp_width(), sapp.sapp_height(), 0, function(data)
|
||||
|
||||
panel.build.active = wdgts.widget_popup_panel(ctx, "popup_build", folder_select.popup_dim, panel.build.ui_func, panel.build, panel.build.active)
|
||||
folder_select.popup_active = wdgts.widget_popup_panel(ctx, "popup_folder", folder_select.popup_dim, folder_select.ui_func, folder_select, folder_select.popup_active)
|
||||
file_select.popup_active = wdgts.widget_popup_panel(ctx, "popup_fileselect", file_select.popup_dim, file_select.ui_func, file_select, file_select.popup_active)
|
||||
recent_files.popup_active = wdgts.widget_popup_panel(ctx, "popup_recentfiles", recent_files.popup_dim, recent_files.ui_func, recent_files, recent_files.popup_active)
|
||||
panel.do_popups(ctx)
|
||||
|
||||
-- /* menubar */
|
||||
local menu_states = { MENU_DEFAULT = 0, MENU_WINDOWS = 1}
|
||||
@ -381,6 +390,8 @@ end
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
|
||||
build.panels = panel
|
||||
|
||||
return panel
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
|
||||
@ -85,8 +85,9 @@ assets.panel = function(ctx)
|
||||
-- nk.nk_style_set_font(ctx, assets.font[3].handle)
|
||||
|
||||
local r = nk.nk_window_get_content_region(ctx)
|
||||
print(r.w, r.h)
|
||||
local flags = nk.NK_WINDOW_BORDER
|
||||
assets.curr_tab, named_tab = wdgts.widget_notebook(ctx, "assets", flags, tabs, assets.curr_tab, r.h-60, 120)
|
||||
assets.curr_tab, named_tab = wdgts.widget_notebook(ctx, "assets", flags, tabs, assets.curr_tab, r.h-80, 120)
|
||||
|
||||
nk.nk_layout_row_dynamic(ctx, 25, 2)
|
||||
if (nk.nk_button_label(ctx, "Add Folder") == true) then
|
||||
|
||||
@ -10,6 +10,8 @@ local slib = require("sokol_libs") -- Warn - always after gfx!!
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
|
||||
local gen = require("engine.utils.general")
|
||||
|
||||
local settings = require("engine.config.settings")
|
||||
local wdgts = require("engine.utils.widgets")
|
||||
local fonts = require("engine.utils.fonts")
|
||||
@ -56,16 +58,83 @@ local build = {
|
||||
end,
|
||||
}
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
local function new_project(ctx)
|
||||
|
||||
local inp = ctx[0].input
|
||||
local r = nk.nk_window_get_content_region(ctx)
|
||||
|
||||
nk.nk_layout_space_begin(ctx, nk.NK_STATIC, 27, 1)
|
||||
nk.nk_layout_space_push(ctx, nk.nk_rect(r.w-100, -139, 27, 27))
|
||||
local bounds = nk.nk_widget_bounds(ctx)
|
||||
|
||||
nk.nk_style_set_font(ctx, build.font[1].handle)
|
||||
if(nk.nk_button_label(ctx, "") == true) then
|
||||
build.panels.newconfig()
|
||||
end
|
||||
nk.nk_style_set_font(ctx, build.font[3].handle)
|
||||
nk.nk_layout_space_end(ctx)
|
||||
|
||||
if (nk.nk_input_is_mouse_hovering_rect(inp, bounds) == true) then
|
||||
nk.nk_tooltip(ctx, " Create Project...")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
local function load_project(ctx)
|
||||
|
||||
local inp = ctx[0].input
|
||||
local r = nk.nk_window_get_content_region(ctx)
|
||||
|
||||
nk.nk_layout_space_begin(ctx, nk.NK_STATIC, 27, 1)
|
||||
nk.nk_layout_space_push(ctx, nk.nk_rect(r.w-70, -166, 27, 27))
|
||||
local bounds = nk.nk_widget_bounds(ctx)
|
||||
|
||||
nk.nk_style_set_font(ctx, build.font[1].handle)
|
||||
if(nk.nk_button_label(ctx, "") == true) then
|
||||
build.panels.loadconfig()
|
||||
end
|
||||
nk.nk_style_set_font(ctx, build.font[3].handle)
|
||||
nk.nk_layout_space_end(ctx)
|
||||
if (nk.nk_input_is_mouse_hovering_rect(inp, bounds) == true) then
|
||||
nk.nk_tooltip(ctx, " Load Project...")
|
||||
end
|
||||
end
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
local function save_project(ctx)
|
||||
|
||||
local inp = ctx[0].input
|
||||
local r = nk.nk_window_get_content_region(ctx)
|
||||
|
||||
nk.nk_layout_space_begin(ctx, nk.NK_STATIC, 27, 1)
|
||||
nk.nk_layout_space_push(ctx, nk.nk_rect(r.w-40, -193, 27, 27))
|
||||
local bounds = nk.nk_widget_bounds(ctx)
|
||||
|
||||
nk.nk_style_set_font(ctx, build.font[1].handle)
|
||||
if(nk.nk_button_label(ctx, "") == true) then
|
||||
build.panels.saveconfig()
|
||||
end
|
||||
nk.nk_style_set_font(ctx, build.font[3].handle)
|
||||
nk.nk_layout_space_end(ctx)
|
||||
if (nk.nk_input_is_mouse_hovering_rect(inp, bounds) == true) then
|
||||
nk.nk_tooltip(ctx, " Save Project...")
|
||||
end
|
||||
end
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
-- Attempts to find sokol in nearby folders (up max 4 directories from builder)
|
||||
-- Sets all the sokol properties if it does find it
|
||||
local function search_sokol(ctx)
|
||||
|
||||
local inp = ctx[0].input
|
||||
local r = nk.nk_window_get_content_region(ctx)
|
||||
build.run_config = nil
|
||||
|
||||
nk.nk_layout_space_begin(ctx, nk.NK_STATIC, 27, 1)
|
||||
nk.nk_layout_space_push(ctx, nk.nk_rect(r.w-40, -195, 27, 27))
|
||||
local bounds = nk.nk_widget_bounds(ctx)
|
||||
|
||||
nk.nk_style_set_font(ctx, build.font[1].handle)
|
||||
if(nk.nk_button_label(ctx, "") == true) then
|
||||
@ -73,18 +142,21 @@ local function search_sokol(ctx)
|
||||
local found = dirtools.find_folder(".", 5, "sokol-luajit")
|
||||
if(found) then
|
||||
found = dirtools.combine_path(found, "sokol-luajit")
|
||||
logging.info(string.format("Found Sokol-luajit: %s",found))
|
||||
logging.info(string.format("Found Sokol-luajit: %s", found))
|
||||
logging.info("Auto filling sokol paths...")
|
||||
build.config["sokol"].sokol_path.value = found
|
||||
build.config["sokol"].sokol_bin.value = dirtools.combine_path(found, "bin")
|
||||
build.config["sokol"].sokol_ffi.value = dirtools.combine_path(found, "ffi")
|
||||
build.config["sokol"].sokol_lua.value = dirtools.combine_path(found, "lua")
|
||||
build.config["sokol"].sokol_examples.value = dirtools.combine_path(found, "examples")
|
||||
gen.ffi_string(build.config["sokol"].sokol_path, found)
|
||||
gen.ffi_string(build.config["sokol"].sokol_bin, dirtools.combine_path(found, "bin"))
|
||||
gen.ffi_string(build.config["sokol"].sokol_ffi, dirtools.combine_path(found, "ffi"))
|
||||
gen.ffi_string(build.config["sokol"].sokol_lua, dirtools.combine_path(found, "lua"))
|
||||
gen.ffi_string(build.config["sokol"].sokol_examples, dirtools.combine_path(found, "examples"))
|
||||
build.run_config = true
|
||||
end
|
||||
end
|
||||
nk.nk_style_set_font(ctx, build.font[3].handle)
|
||||
nk.nk_layout_space_end(ctx)
|
||||
if (nk.nk_input_is_mouse_hovering_rect(inp, bounds) == true) then
|
||||
nk.nk_tooltip(ctx, " Search For Sokol")
|
||||
end
|
||||
end
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
@ -178,6 +250,9 @@ local project_tabs = {
|
||||
name = "Settings",
|
||||
func = function(ctx)
|
||||
display_section(ctx, "project")
|
||||
new_project(ctx)
|
||||
load_project(ctx)
|
||||
save_project(ctx)
|
||||
display_section(ctx, "sokol")
|
||||
search_sokol(ctx)
|
||||
display_section(ctx, "graphics")
|
||||
@ -206,6 +281,8 @@ build.panel = function(ctx)
|
||||
|
||||
nk.nk_style_set_font(ctx, build.font[3].handle)
|
||||
|
||||
if(build.panels) then build.panels.do_popups(ctx) end
|
||||
|
||||
local r = nk.nk_window_get_content_region(ctx)
|
||||
local flags = nk.NK_WINDOW_BORDER
|
||||
build.curr_tab = wdgts.widget_notebook(ctx, "assets", flags, project_tabs, build.curr_tab, r.h-60, 120)
|
||||
|
||||
@ -19,10 +19,22 @@ local function tdump(o, level)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
|
||||
local function ffi_string( data, str )
|
||||
|
||||
data.ffi = ffi.new("char[?]", #str, str)
|
||||
data.len_ffi = ffi.new("int[1]", { #str} )
|
||||
return data
|
||||
end
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
tdump = tdump,
|
||||
|
||||
ffi_string = ffi_string,
|
||||
}
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
@ -1,30 +0,0 @@
|
||||
{
|
||||
"groups": [
|
||||
{
|
||||
"tags": "default,all",
|
||||
"id": 0,
|
||||
"name": "default"
|
||||
}
|
||||
],
|
||||
"scripts": [
|
||||
{
|
||||
"ref": "Global",
|
||||
"script": "engine.script.global",
|
||||
"id": 0,
|
||||
"name": "global"
|
||||
},
|
||||
{
|
||||
"ref": "Default",
|
||||
"script": "engine.script.scene",
|
||||
"id": 1,
|
||||
"name": "scene"
|
||||
}
|
||||
],
|
||||
"entities": [],
|
||||
"scenes": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Default"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
{
|
||||
"paths": {
|
||||
"config": "F:\\dev\\luajit\\Thunc\\sokol-luajit\\projects\\MegaProject\\config",
|
||||
"worlds": [
|
||||
{
|
||||
"filename": "F:\\dev\\luajit\\Thunc\\sokol-luajit\\projects\\MegaProject\\data\\worlds\\MasterWorld.json",
|
||||
"name": "MasterWorld"
|
||||
}
|
||||
],
|
||||
"data": "F:\\dev\\luajit\\Thunc\\sokol-luajit\\projects\\MegaProject\\data",
|
||||
"assets": "F:\\dev\\luajit\\Thunc\\sokol-luajit\\projects\\MegaProject\\assets",
|
||||
"project": "F:\\dev\\luajit\\Thunc\\sokol-luajit\\projects\\MegaProject",
|
||||
"cache": "F:\\dev\\luajit\\Thunc\\sokol-luajit\\projects\\MegaProject\\cache",
|
||||
"build": "F:\\dev\\luajit\\Thunc\\sokol-luajit\\projects\\MegaProject\\build"
|
||||
},
|
||||
"filename": "F:\\dev\\luajit\\Thunc\\sokol-luajit\\projects\\MegaProject\\project.slp",
|
||||
"name": "MegaProject"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user