gotta fix flxanimate... again

This commit is contained in:
Yoshman29
2023-03-25 16:55:05 +01:00
parent 836089c0e4
commit 043fcf7151
4 changed files with 49 additions and 621 deletions
+5
View File
@@ -19,6 +19,11 @@ class FlxAnimate extends flxanimate.FlxAnimate {
FlxG.signals.preStateSwitch.add(onSwitch);
}
public override function destroy() {
FlxG.bitmap.remove(graphic);
super.destroy();
}
private static function onSwitch() {
for(p in loadedPaths) {
Assets.cache.clear(p);
+42 -2
View File
@@ -55,6 +55,7 @@ class FunkinCache extends AssetCache {
public function clearSecondLayer() {
for(k=>b in bitmapData2) {
FlxG.bitmap.removeByKey(k);
LimeAssets.cache.image.remove(k);
}
for(k=>f in font2) {
@@ -69,8 +70,6 @@ class FunkinCache extends AssetCache {
sound2 = [];
}
/**
Retrieves a cached BitmapData.
@@ -160,4 +159,45 @@ class FunkinCache extends AssetCache {
{
return sound.exists(id) || sound2.exists(id);
}
/**
Removes a BitmapData from the cache.
@param id The ID of a BitmapData asset
@return `true` if the asset was removed, `false` if it was not in the cache
**/
public override function removeBitmapData(id:String):Bool
{
#if lime
LimeAssets.cache.image.remove(id);
#end
return bitmapData.remove(id) || bitmapData2.remove(id);
}
/**
Removes a Font from the cache.
@param id The ID of a Font asset
@return `true` if the asset was removed, `false` if it was not in the cache
**/
public override function removeFont(id:String):Bool
{
#if lime
LimeAssets.cache.font.remove(id);
#end
return font.remove(id) || font2.remove(id);
}
/**
Removes a Sound from the cache.
@param id The ID of a Sound asset
@return `true` if the asset was removed, `false` if it was not in the cache
**/
public override function removeSound(id:String):Bool
{
#if lime
LimeAssets.cache.audio.remove(id);
#end
return sound.remove(id) || sound2.remove(id);
}
}
@@ -10,6 +10,8 @@ class FlixelInfo extends FramerateCategory {
_text = 'State: ${Type.getClassName(Type.getClass(FlxG.state))}';
_text += '\nObject Count: ${FlxG.state.members.length}';
_text += '\nCamera Count: ${FlxG.cameras.list.length}';
@:privateAccess
_text += '\nFlxG.game Childs Count: ${FlxG.game.numChildren}';
this.text.text = _text;
super.__enterFrame(t);