diff --git a/source/Paths.hx b/source/Paths.hx index 0ab227fa15..4728228e3b 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -18,7 +18,7 @@ import openfl.display3D.textures.RectangleTexture; class Paths { public static var currentLevel:String = "preload"; - public static var bitmaps:Map = new Map(); + public static var bitmaps:Map = new Map(); public static function getPath(file:String, type:AssetType, library:Null):String { if (library != null) @@ -107,10 +107,8 @@ class Paths { return file; } @:privateAccess { - if (bitmaps.exists(file)) { - bitmap = bitmaps.get(file); - } else { - //trace('loading $file to the gpu', DEBUG); + if(!bitmaps.exists(file)){ + trace('loading $file to the gpu', DEBUG); bitmap.lock(); if (bitmap.__texture == null) { bitmap.image.premultiplied = true; @@ -121,12 +119,16 @@ class Paths { bitmap.image.data = null; bitmap.image = null; bitmap.readable = true; // hashlink fix - bitmaps.set(file, bitmap); } - } + else{ + bitmap = null; + return bitmaps.get(file); + } + } var graphic:FlxGraphic = FlxGraphic.fromBitmapData(bitmap, false, file, false); graphic.persist = true; - return file; + bitmaps.set(file, graphic); + return graphic; } inline static public function font(key:String):String diff --git a/source/ui/Alphabet.hx b/source/ui/Alphabet.hx index 83380f4f68..f46ea78486 100644 --- a/source/ui/Alphabet.hx +++ b/source/ui/Alphabet.hx @@ -210,7 +210,7 @@ class AlphaCharacter extends FlxSprite { super(x, y); this.scaleMult = scaleMult; - frames = Paths.getSparrowAtlas('alphabet'); + frames = Paths.getSparrowAtlas('alphabet', "preload", true); antialiasing = Options.getData("antialiasing");