This commit is contained in:
Andreas Schaafsma 2025-04-12 00:20:20 +02:00
parent e01cc817ef
commit 3c35a616cc
2 changed files with 17 additions and 4 deletions

View File

@ -18,5 +18,13 @@ class Main extends Sprite {
var testAsset = openfl.Assets.getText("img/placeholder.txt"); var testAsset = openfl.Assets.getText("img/placeholder.txt");
trace("Successfully loaded asset: " + testAsset); trace("Successfully loaded asset: " + testAsset);
// var testLogo = Assets.logo;
// trace("Successfully loaded logo asset: " + testLogo);
// var testImage = Assets.images + "/logo.png";
var testImage = openfl.Assets.getPath("logo.png");
trace("Successfully loaded image asset: " + testImage);
this.addChild(new openfl.display.Bitmap(openfl.Assets.getBitmapData(testImage)));
} }
} }

View File

@ -19,14 +19,19 @@ import sys.FileSystem;
var manifestDirPath = Path.join(["manifest"]); var manifestDirPath = Path.join(["manifest"]);
var manifests = FileSystem.readDirectory(manifestDirPath); var manifests = FileSystem.readDirectory(manifestDirPath);
for (manifest in manifests) { for (manifest in manifests) {
trace(manifest);
if (StringTools.endsWith(manifest, ".json")) { if (StringTools.endsWith(manifest, ".json")) {
var manifestPath = Path.join([manifestDirPath, manifest]); var manifestPath = Path.join([manifestDirPath, manifest]);
loadManifest(manifestPath); loadManifest(manifestPath, manifest);
}
else{
throw("we eating shit tonight");
} }
} }
} }
public static function loadManifest(manifestPath) { public static function loadManifest(manifestPath, manifestName) {
if (!FileSystem.exists(manifestPath)) { if (!FileSystem.exists(manifestPath)) {
trace("Manifest file not found: " + manifestPath); trace("Manifest file not found: " + manifestPath);
return; return;
@ -38,8 +43,8 @@ import sys.FileSystem;
var library = AssetLibrary.fromManifest(manifest); var library = AssetLibrary.fromManifest(manifest);
if (library != null) { if (library != null) {
preloadLibraries.push(library); preloadLibraries.push(library);
preloadLibraryNames.push("default"); preloadLibraryNames.push(manifestName);
LimeAssets.registerLibrary("default", library); LimeAssets.registerLibrary(manifestName, library);
} }
} }
} catch (e:Dynamic) { } catch (e:Dynamic) {