working
This commit is contained in:
parent
e01cc817ef
commit
3c35a616cc
@ -18,5 +18,13 @@ class Main extends Sprite {
|
||||
|
||||
var testAsset = openfl.Assets.getText("img/placeholder.txt");
|
||||
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)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,14 +19,19 @@ import sys.FileSystem;
|
||||
var manifestDirPath = Path.join(["manifest"]);
|
||||
var manifests = FileSystem.readDirectory(manifestDirPath);
|
||||
for (manifest in manifests) {
|
||||
trace(manifest);
|
||||
if (StringTools.endsWith(manifest, ".json")) {
|
||||
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)) {
|
||||
trace("Manifest file not found: " + manifestPath);
|
||||
return;
|
||||
@ -38,8 +43,8 @@ import sys.FileSystem;
|
||||
var library = AssetLibrary.fromManifest(manifest);
|
||||
if (library != null) {
|
||||
preloadLibraries.push(library);
|
||||
preloadLibraryNames.push("default");
|
||||
LimeAssets.registerLibrary("default", library);
|
||||
preloadLibraryNames.push(manifestName);
|
||||
LimeAssets.registerLibrary(manifestName, library);
|
||||
}
|
||||
}
|
||||
} catch (e:Dynamic) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user