Skip to content

Commit 82581df

Browse files
committed
Add FLX_FREE_IMAGE_BUFFER
1 parent 7ac1bdb commit 82581df

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

flixel/graphics/FlxGraphic.hx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,10 @@ class FlxGraphic implements IFlxDestroyable
633633
FlxG.log.warn('Graphic dimensions (${width}x${height}) exceed the maximum allowed size (${max}x${max}), which may cause rendering issues.');
634634
}
635635
#end
636+
637+
#if FLX_FREE_IMAGE_BUFFER
638+
freeImageBuffer();
639+
#end
636640
}
637641

638642
return value;

flixel/system/macros/FlxDefines.hx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ private enum UserDefines
5858
* If this flag is set to any string, that is used for the file extension
5959
*/
6060
FLX_DEFAULT_SOUND_EXT;
61+
/**
62+
* If enabled, FlxGraphic instances will automatically call `FlxGraphic.freeImageBuffer()`.
63+
* This significantly decreases RAM usage but makes the bitmap uneditable.
64+
* Call `FlxGraphic.refresh()` to restore functionality for drawing on the bitmap.
65+
*/
66+
FLX_FREE_IMAGE_BUFFER;
6167
}
6268

6369
/**

0 commit comments

Comments
 (0)