Add splash screen option

This commit is contained in:
luboslenco
2023-05-19 21:38:54 +02:00
parent bb1508e177
commit b52b3513b5
7 changed files with 56 additions and 37 deletions
+10 -4
View File
@@ -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)
+1
View File
@@ -40,6 +40,7 @@ package arm;
@:optional public var wrap_mouse: Null<Bool>;
@:optional public var show_asset_names: Null<Bool>;
@:optional public var touch_ui: Null<Bool>;
@:optional public var splash_screen: Null<Bool>;
@:optional public var layout: Array<Int>;
@:optional public var workspace: Null<Int>;
@:optional public var server: String;
-30
View File
@@ -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
+2
View File
@@ -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");
+41 -1
View File
@@ -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() {
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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);