diff --git a/base/Sources/arm/App.hx b/base/Sources/arm/App.hx index 323e6983..3e4ebfca 100644 --- a/base/Sources/arm/App.hx +++ b/base/Sources/arm/App.hx @@ -244,10 +244,14 @@ class App { Args.run(); - if (Config.raw.touch_ui) { - if (Config.raw.recent_projects.length > 0) { - arm.ui.BoxProjects.show(); - } + #if (krom_android || krom_ios) + var hasProjects = Config.raw.recent_projects.length > 0; + #else + var hasProjects = true; + #end + + if (Config.raw.splash_screen && hasProjects) { + arm.ui.BoxProjects.show(); } }); }); @@ -973,8 +977,10 @@ class App { raw.layer_res = Res2048; #if (krom_android || krom_ios) raw.touch_ui = true; + raw.splash_screen = true; #else raw.touch_ui = false; + raw.splash_screen = false; #end #if (is_paint || is_sculpt) diff --git a/base/Sources/arm/ConfigFormat.hx b/base/Sources/arm/ConfigFormat.hx index 29e97a01..b025f16b 100644 --- a/base/Sources/arm/ConfigFormat.hx +++ b/base/Sources/arm/ConfigFormat.hx @@ -40,6 +40,7 @@ package arm; @:optional public var wrap_mouse: Null; @:optional public var show_asset_names: Null; @:optional public var touch_ui: Null; + @:optional public var splash_screen: Null; @:optional public var layout: Array; @:optional public var workspace: Null; @:optional public var server: String; diff --git a/base/Sources/arm/Project.hx b/base/Sources/arm/Project.hx index 2df70e80..cd37a10e 100644 --- a/base/Sources/arm/Project.hx +++ b/base/Sources/arm/Project.hx @@ -86,36 +86,6 @@ class Project { }); } - public static function projectOpenRecentBox() { - UIBox.showCustom(function(ui: Zui) { - if (ui.tab(Id.handle(), tr("Recent Projects"))) { - for (path in Config.raw.recent_projects) { - var file = path; - #if krom_windows - file = path.replace("/", "\\"); - #else - file = path.replace("\\", "/"); - #end - file = file.substr(file.lastIndexOf(Path.sep) + 1); - if (ui.button(file, Left)) { - var current = @:privateAccess kha.graphics2.Graphics.current; - if (current != null) current.end(); - - ImportArm.runProject(path); - - if (current != null) current.begin(false); - UIBox.hide(); - } - if (ui.isHovered) ui.tooltip(path); - } - if (ui.button(tr("Clear"), Left)) { - Config.raw.recent_projects = []; - Config.save(); - } - } - }, 400, 320); - } - public static function projectSave(saveAndQuit = false) { if (filepath == "") { #if krom_ios diff --git a/base/Sources/arm/ui/BoxPreferences.hx b/base/Sources/arm/ui/BoxPreferences.hx index a64a58fd..12f1496c 100644 --- a/base/Sources/arm/ui/BoxPreferences.hx +++ b/base/Sources/arm/ui/BoxPreferences.hx @@ -93,6 +93,8 @@ class BoxPreferences { } #end + Config.raw.splash_screen = ui.check(Id.handle({ selected: Config.raw.splash_screen }), tr("Splash Screen")); + // ui.text("Node Editor"); // var gridSnap = ui.check(Id.handle({ selected: false }), "Grid Snap"); diff --git a/base/Sources/arm/ui/BoxProjects.hx b/base/Sources/arm/ui/BoxProjects.hx index 5a089f82..a9369e69 100644 --- a/base/Sources/arm/ui/BoxProjects.hx +++ b/base/Sources/arm/ui/BoxProjects.hx @@ -3,6 +3,7 @@ package arm.ui; import zui.Zui; import zui.Id; import arm.io.ImportArm; +import arm.sys.Path; class BoxProjects { @@ -20,8 +21,17 @@ class BoxProjects { iconMap = null; } + #if (krom_android || krom_ios) + var draggable = false; + #else + var draggable = true; + #end + UIBox.showCustom(function(ui: Zui) { + + #if (krom_android || krom_ios) alignToFullScreen(); + #end if (ui.tab(htab, tr("Projects"), true)) { @@ -153,7 +163,37 @@ class BoxProjects { ui._y += 150; } } - }, 600, 400, null, false); + }, 600, 400, null, draggable); + } + + public static function showRecent() { + UIBox.showCustom(function(ui: Zui) { + if (ui.tab(Id.handle(), tr("Recent Projects"))) { + for (path in Config.raw.recent_projects) { + var file = path; + #if krom_windows + file = path.replace("/", "\\"); + #else + file = path.replace("\\", "/"); + #end + file = file.substr(file.lastIndexOf(Path.sep) + 1); + if (ui.button(file, Left)) { + var current = @:privateAccess kha.graphics2.Graphics.current; + if (current != null) current.end(); + + ImportArm.runProject(path); + + if (current != null) current.begin(false); + UIBox.hide(); + } + if (ui.isHovered) ui.tooltip(path); + } + if (ui.button(tr("Clear"), Left)) { + Config.raw.recent_projects = []; + Config.save(); + } + } + }, 400, 320); } static function alignToFullScreen() { diff --git a/base/Sources/arm/ui/UIBase.hx b/base/Sources/arm/ui/UIBase.hx index 4c69528a..75212665 100644 --- a/base/Sources/arm/ui/UIBase.hx +++ b/base/Sources/arm/ui/UIBase.hx @@ -244,7 +244,7 @@ class UIBase { if (Operator.shortcut(Config.keymap.file_save_as)) Project.projectSaveAs(); else if (Operator.shortcut(Config.keymap.file_save)) Project.projectSave(); else if (Operator.shortcut(Config.keymap.file_open)) Project.projectOpen(); - else if (Operator.shortcut(Config.keymap.file_open_recent)) Project.projectOpenRecentBox(); + else if (Operator.shortcut(Config.keymap.file_open_recent)) BoxProjects.showRecent(); else if (Operator.shortcut(Config.keymap.file_reimport_mesh)) Project.reimportMesh(); else if (Operator.shortcut(Config.keymap.file_reimport_textures)) Project.reimportTextures(); else if (Operator.shortcut(Config.keymap.file_new)) Project.projectNewBox(); diff --git a/base/Sources/arm/ui/UIMenu.hx b/base/Sources/arm/ui/UIMenu.hx index d9672a92..c2941729 100644 --- a/base/Sources/arm/ui/UIMenu.hx +++ b/base/Sources/arm/ui/UIMenu.hx @@ -55,7 +55,7 @@ class UIMenu { if (menuCategory == MenuFile) { if (menuButton(ui, tr("New Project..."), Config.keymap.file_new)) Project.projectNewBox(); if (menuButton(ui, tr("Open..."), Config.keymap.file_open)) Project.projectOpen(); - if (menuButton(ui, tr("Open Recent..."), Config.keymap.file_open_recent)) Project.projectOpenRecentBox(); + if (menuButton(ui, tr("Open Recent..."), Config.keymap.file_open_recent)) BoxProjects.showRecent(); if (menuButton(ui, tr("Save"), Config.keymap.file_save)) Project.projectSave(); if (menuButton(ui, tr("Save As..."), Config.keymap.file_save_as)) Project.projectSaveAs(); menuSeparator(ui);