diff --git a/flixel/system/FlxAssets.hx b/flixel/system/FlxAssets.hx index a30cfc4a74..3c0bba835c 100644 --- a/flixel/system/FlxAssets.hx +++ b/flixel/system/FlxAssets.hx @@ -19,6 +19,10 @@ import haxe.Json; import haxe.xml.Access; import openfl.Assets; import openfl.utils.ByteArray; +import haxe.io.Path; +#if hxWebP +import webp.WebP; +#end using StringTools; @@ -260,7 +264,17 @@ class FlxAssets public static inline function getBitmapData(id:String):BitmapData { if (Assets.exists(id)) - return Assets.getBitmapData(id, false); + { + switch (Path.extension(id)) + { + #if hxWebP + case 'webp': + return WebP.getBitmapDataFromBytes(Assets.getBytes(id)); // WebP.getBitmapData(id); is broken as of rn + #end + default: + return Assets.getBitmapData(id, false); + } + } FlxG.log.error('Could not find a BitmapData asset with ID \'$id\'.'); return null; } diff --git a/include.xml b/include.xml index 652ec226db..b99220d984 100644 --- a/include.xml +++ b/include.xml @@ -22,6 +22,8 @@ + +
diff --git a/tests/unit/src/FlxAssert.hx b/tests/unit/src/FlxAssert.hx index 136ceaee2e..507e3565ce 100644 --- a/tests/unit/src/FlxAssert.hx +++ b/tests/unit/src/FlxAssert.hx @@ -23,7 +23,7 @@ class FlxAssert && areNearHelper(expected.y, actual.y, margin) && areNearHelper(expected.width, actual.width, margin) && areNearHelper(expected.height, actual.height, margin); - + if (areNear) Assert.assertionCount++; else