fixed dumb caching issue

This commit is contained in:
Yoshman29
2023-04-18 20:15:52 +02:00
parent ee8608d3b9
commit b3aee374a6
2 changed files with 5 additions and 3 deletions
@@ -29,15 +29,17 @@ class GraphicCacheSprite extends FlxSprite {
if (graphic != null) {
// make their useCount one time higher to prevent them from auto being cleared from cache
graphic.useCount++;
graphic.destroyOnNoUse = false;
cachedGraphics.push(graphic);
nonRenderedCachedGraphics.push(graphic);
}
}
public override function destroy() {
for(g in cachedGraphics)
// make their usecount 1 time lower so that it can be cleared again
for(g in cachedGraphics) {
g.destroyOnNoUse = true;
g.useCount--;
}
graphic = null;
super.destroy();
}
+1 -1
View File
@@ -570,7 +570,7 @@ class PlayState extends MusicBeatState
// PRECACHING
#if REGION
for(content in Paths.getFolderContent('images/game/score/', true, true))
graphicCache.cache(content);
graphicCache.cache(Paths.getPath(content));
for(i in 1...4) {
FlxG.sound.load(Paths.sound('missnote' + Std.string(i)));