Improve config handling

This commit is contained in:
luboslenco
2020-01-24 12:51:18 +01:00
parent 1925d040b0
commit e4220b1765
2 changed files with 5 additions and 8 deletions
+3 -6
View File
@@ -21,6 +21,7 @@ class Main {
static var tasks: Int;
public static function main() {
Krom.setApplicationName("ArmorPaint");
tasks = 1;
tasks++; Config.load(function() { tasks--; start(); });
#if arm_physics
@@ -47,7 +48,7 @@ class Main {
if (lasti >= 0) title = title.substr(lasti + 1);
if (title.endsWith(".exe")) title = title.substr(0, title.length - 4);
#else
var title = "ArmorPaint";
var title = "untitled - ArmorPaint";
#end
var options: kha.SystemOptions = {
@@ -67,13 +68,9 @@ class Main {
};
System.start(options, function(window: Window) {
#if (!arm_player)
kha.Window.get(0).title = "untitled - ArmorPaint";
#end
Krom.setApplicationName("ArmorPaint");
iron.App.init(function() {
Scene.setActive("Scene", function(o: Object) {
if (Path.isProtected()) Config.load(function() {}, true);
Config.init();
Uniforms.init();
var path = new RenderPath();
Inc.init(path);
+2 -2
View File
@@ -17,9 +17,9 @@ class Config {
public static var keymap: Dynamic;
public static var configLoaded = false;
public static function load(done: Void->Void, fromSavePath = false) {
public static function load(done: Void->Void) {
try {
Data.getBlob((fromSavePath ? Krom.savePath() : "") + "config.arm", function(blob: kha.Blob) {
Data.getBlob((Path.isProtected() ? Krom.savePath() : "") + "config.arm", function(blob: kha.Blob) {
configLoaded = true;
raw = Json.parse(blob.toString());
done();