-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
still no inst():Sound fix yet cuz thats for next weekend, but if you want it now, idk make a pr for it
- Loading branch information
1 parent
fbdfb8e
commit 7901ebf
Showing
33 changed files
with
623 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
package; | ||
|
||
import haxe.io.Bytes; | ||
import haxe.io.Path; | ||
import lime.utils.AssetBundle; | ||
import lime.utils.AssetLibrary; | ||
import lime.utils.AssetManifest; | ||
import lime.utils.Assets; | ||
|
||
#if sys | ||
import sys.FileSystem; | ||
#end | ||
|
||
#if disable_preloader_assets | ||
@:dox(hide) class ManifestResources { | ||
public static var preloadLibraries:Array<Dynamic>; | ||
public static var preloadLibraryNames:Array<String>; | ||
public static var rootPath:String; | ||
|
||
public static function init (config:Dynamic):Void { | ||
preloadLibraries = new Array (); | ||
preloadLibraryNames = new Array (); | ||
} | ||
} | ||
#else | ||
@:access(lime.utils.Assets) | ||
|
||
|
||
@:keep @:dox(hide) class ManifestResources { | ||
public static var preloadLibraries:Array<AssetLibrary>; | ||
public static var preloadLibraryNames:Array<String>; | ||
public static var rootPath:String; | ||
|
||
|
||
public static function init (config:Dynamic):Void { | ||
|
||
preloadLibraries = new Array (); | ||
preloadLibraryNames = new Array (); | ||
|
||
rootPath = null; | ||
|
||
if (config != null && Reflect.hasField (config, "rootPath")) { | ||
rootPath = Reflect.field (config, "rootPath"); | ||
if(!StringTools.endsWith (rootPath, "/")) { | ||
rootPath += "/"; | ||
} | ||
} | ||
|
||
if (rootPath == null) { | ||
#if (ios || tvos || webassembly) | ||
rootPath = "assets/"; | ||
#elseif android | ||
rootPath = ""; | ||
#elseif (console || sys) | ||
rootPath = lime.system.System.applicationDirectory; | ||
rootPath = haxe.io.Path.normalize(Sys.getCwd() + '/'); | ||
#else | ||
rootPath = "./"; | ||
#end | ||
} | ||
|
||
#if (openfl && !flash && !display) | ||
::if (assets != null)::::foreach assets::::if (type == "font")::openfl.text.Font.registerFont (__ASSET__OPENFL__::flatName::); | ||
::end::::end::::end:: | ||
#end | ||
|
||
var data, manifest, library, bundle; | ||
|
||
::if (assets != null)::::foreach assets::::if (type == "manifest")::::if (embed)::data = '::data::'; | ||
manifest = AssetManifest.parse (data, rootPath); | ||
library = AssetLibrary.fromManifest (manifest); | ||
Assets.registerLibrary ("::library::", library); | ||
::else::Assets.libraryPaths["::library::"] = rootPath + "::resourceName::"; | ||
::end::::end::::if (type == "bundle")::::if (embed):: | ||
bundle = AssetBundle.fromBytes (#if flash Bytes.ofData (new __ASSET__::flatName:: () #else new __ASSET__::flatName:: () #end)); | ||
library = AssetLibrary.fromBundle (bundle); | ||
Assets.registerLibrary ("::library::", library); | ||
::else::Assets.bundlePaths["::library::"] = rootPath + "::resourceName::"; | ||
::end::::end::::end::::end:: | ||
|
||
::foreach libraries::::if (preload)::library = Assets.getLibrary ("::name::"); | ||
if (library != null) preloadLibraries.push (library); | ||
else preloadLibraryNames.push ("::name::"); | ||
::end::::end:: | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
#if !display | ||
#if flash | ||
|
||
::foreach assets::::if (embed != false)::::if (type == "image")::@:keep @:bind @:noCompletion #if display private #end class __ASSET__::flatName:: extends flash.display.BitmapData { public function new () { super (0, 0, true, 0); } }::else::@:keep @:bind @:noCompletion #if display private #end class __ASSET__::flatName:: extends ::flashClass:: { }::end:: | ||
::end::::end:: | ||
|
||
#elseif (desktop || cpp) | ||
|
||
::if (assets != null)::::foreach assets::::if (embed)::@:keep ::if (type == "image")::@:image("::sourcePath::") @:noCompletion #if display private #end class __ASSET__::flatName:: extends lime.graphics.Image {} | ||
::elseif (type == "sound")::@:file("::sourcePath::") @:noCompletion #if display private #end class __ASSET__::flatName:: extends haxe.io.Bytes {} | ||
::elseif (type == "music")::@:file("::sourcePath::") @:noCompletion #if display private #end class __ASSET__::flatName:: extends haxe.io.Bytes {} | ||
::elseif (type == "font")::@:font("::sourcePath::") @:noCompletion #if display private #end class __ASSET__::flatName:: extends lime.text.Font {} | ||
::else::@:file("::sourcePath::") @:noCompletion #if display private #end class __ASSET__::flatName:: extends haxe.io.Bytes {} | ||
::end::::end::::end::::end:: | ||
::if (assets != null)::::foreach assets::::if (!embed)::::if (type == "font")::@:keep @:noCompletion #if display private #end class __ASSET__::flatName:: extends lime.text.Font { public function new () { ::if (targetPath != null)::__fontPath = ManifestResources.rootPath + "::targetPath::";::else::::if (library != null)::__fontID = "::library:::::id::";::else::__fontID = "::id::";::end::::end:: ::if (fontName)::name = "::fontName::";::end:: super (); }} | ||
::end::::end::::end::::end:: | ||
|
||
#else | ||
|
||
::if (assets != null)::::foreach assets::::if (type == "font")::@:keep @:expose('__ASSET__::flatName::') @:noCompletion #if display private #end class __ASSET__::flatName:: extends lime.text.Font { public function new () { #if !html5 __fontPath = "::targetPath::"; #else ascender = ::ascender::; descender = ::descender::; height = ::height::; numGlyphs = ::numGlyphs::; underlinePosition = ::underlinePosition::; underlineThickness = ::underlineThickness::; unitsPerEM = ::unitsPerEM::; #end::if (fontName):: name = "::fontName::";::end:: super (); }} | ||
::end::::end::::end:: | ||
|
||
#end | ||
|
||
#if (openfl && !flash) | ||
|
||
#if html5 | ||
::if (assets != null)::::foreach assets::::if (type == "font")::@:keep @:expose('__ASSET__OPENFL__::flatName::') @:noCompletion #if display private #end class __ASSET__OPENFL__::flatName:: extends openfl.text.Font { public function new () {::if (embed):: __fromLimeFont (new __ASSET__::flatName:: ());::else::::if (fontName):: name = "::fontName::";::end::::end:: super (); }} | ||
::end::::end::::end:: | ||
#else | ||
::if (assets != null)::::foreach assets::::if (type == "font")::@:keep @:expose('__ASSET__OPENFL__::flatName::') @:noCompletion #if display private #end class __ASSET__OPENFL__::flatName:: extends openfl.text.Font { public function new () {::if (embed):: __fromLimeFont (new __ASSET__::flatName:: ());::else:: ::if (targetPath != null)::__fontPath = ManifestResources.rootPath + "::targetPath::";::else::::if (library != null)::__fontID = "::library:::::id::";::else::__fontID = "::id::";::end::::end::::if (fontName):: name = "::fontName::";::end::::end:: super (); }} | ||
::end::::end::::end:: | ||
#end | ||
|
||
#end | ||
#end | ||
|
||
#end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.