Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion flixel/system/FlxAssets.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import haxe.Json;
import haxe.xml.Access;
import openfl.Assets;
import openfl.utils.ByteArray;
import webp.WebP;
import haxe.io.Path;

using StringTools;

Expand Down Expand Up @@ -260,7 +262,15 @@ class FlxAssets
public static inline function getBitmapData(id:String):BitmapData
{
if (Assets.exists(id))
return Assets.getBitmapData(id, false);
{
switch (Path.extension(id))
{
case 'webp':
return WebP.getBitmapDataFromBytes(Assets.getBytes(id)); // WebP.getBitmapData(id); is broken as of rn
default:
return Assets.getBitmapData(id, false);
}
}
FlxG.log.error('Could not find a BitmapData asset with ID \'$id\'.');
return null;
}
Expand Down
2 changes: 2 additions & 0 deletions include.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

<haxelib name="openfl" unless="create" />
<haxelib name="hscript" unless="create || coverage2" optional="true" />

<haxelib name="hxWebP" />

<haxeflag name="--macro" value="flixel.system.macros.FlxDefines.run()" />

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/src/FlxAssert.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down