diff --git a/flixel/FlxSprite.hx b/flixel/FlxSprite.hx index 332c85c63c..8095317a0a 100644 --- a/flixel/FlxSprite.hx +++ b/flixel/FlxSprite.hx @@ -28,7 +28,7 @@ import flixel.util.FlxColor; import flixel.util.FlxDestroyUtil; import openfl.display.Tilesheet; -@:bitmap("assets/images/logo/default.png") +@:keep @:bitmap("assets/images/logo/default.png") private class GraphicDefault extends BitmapData {} // TODO: add updateSizeFromFrame bool which will tell sprite whether to update it's size to frame's size (when frame setter is called) or not (useful for sprites with adjusted hitbox) diff --git a/flixel/FlxState.hx b/flixel/FlxState.hx index 1fffa3b0ee..fdfd3d21f2 100644 --- a/flixel/FlxState.hx +++ b/flixel/FlxState.hx @@ -7,6 +7,7 @@ import flixel.util.FlxColor; * This is the basic game "state" object - e.g. in a simple game you might have a menu state and a play state. * It is for all intents and purpose a fancy FlxGroup. And really, it's not even that fancy. */ +@:keepSub // workaround for HaxeFoundation/haxe#3749 class FlxState extends FlxGroup { /** diff --git a/flixel/effects/particles/FlxParticle.hx b/flixel/effects/particles/FlxParticle.hx index a37411e5c6..fdcb928a17 100644 --- a/flixel/effects/particles/FlxParticle.hx +++ b/flixel/effects/particles/FlxParticle.hx @@ -76,6 +76,7 @@ class FlxParticle extends FlxSprite implements IFlxParticle * Instantiate a new particle. Like FlxSprite, all meaningful creation * happens during loadGraphic() or makeGraphic() or whatever. */ + @:keep public function new() { super(); diff --git a/flixel/input/android/FlxAndroidKeyList.hx b/flixel/input/android/FlxAndroidKeyList.hx index 48d09b498e..01cfe765c5 100644 --- a/flixel/input/android/FlxAndroidKeyList.hx +++ b/flixel/input/android/FlxAndroidKeyList.hx @@ -7,6 +7,7 @@ import flixel.input.FlxBaseKeyList; * A helper class for Android key input (back button and menu button). * Provides optimized key checking using direct array access. */ +@:keep class FlxAndroidKeyList extends FlxBaseKeyList { public var BACK(get, never):Bool; inline function get_BACK() { return check(FlxAndroidKey.BACK); } diff --git a/flixel/input/keyboard/FlxKeyList.hx b/flixel/input/keyboard/FlxKeyList.hx index ea8653833f..1bf17c4594 100644 --- a/flixel/input/keyboard/FlxKeyList.hx +++ b/flixel/input/keyboard/FlxKeyList.hx @@ -6,6 +6,7 @@ import flixel.input.FlxBaseKeyList; * A helper class for keyboard input. * Provides optimized key checking using direct array access. */ +@:keep class FlxKeyList extends FlxBaseKeyList { public var A (get, never):Bool; inline function get_A() { return check(FlxKey.A); } diff --git a/flixel/math/FlxPoint.hx b/flixel/math/FlxPoint.hx index bdf8830de1..ff7db38215 100644 --- a/flixel/math/FlxPoint.hx +++ b/flixel/math/FlxPoint.hx @@ -53,6 +53,7 @@ class FlxPoint implements IFlxPooled private var _weak:Bool = false; private var _inPool:Bool = false; + @:keep public function new(X:Float = 0, Y:Float = 0) { set(X, Y); diff --git a/flixel/math/FlxRect.hx b/flixel/math/FlxRect.hx index b0cb109ede..a9c4433fb0 100644 --- a/flixel/math/FlxRect.hx +++ b/flixel/math/FlxRect.hx @@ -67,6 +67,7 @@ class FlxRect implements IFlxPooled private var _weak:Bool = false; private var _inPool:Bool = false; + @:keep public function new(X:Float = 0, Y:Float = 0, Width:Float = 0, Height:Float = 0) { set(X, Y, Width, Height); diff --git a/flixel/system/FlxAssets.hx b/flixel/system/FlxAssets.hx index 414ca96e4f..14414f8ceb 100644 --- a/flixel/system/FlxAssets.hx +++ b/flixel/system/FlxAssets.hx @@ -17,21 +17,21 @@ import flixel.graphics.frames.FlxTileFrames; import openfl.Assets; import openfl.utils.ByteArray; -@:font("assets/fonts/nokiafc22.ttf") +@:keep @:font("assets/fonts/nokiafc22.ttf") private class FontDefault extends Font {} #if !FLX_NO_DEBUG -@:font("assets/fonts/arial.ttf") +@:keep @:font("assets/fonts/arial.ttf") private class FontDebugger extends Font {} #end -@:bitmap("assets/images/logo/logo.png") -class GraphicLogo extends BitmapData { } +@:keep @:bitmap("assets/images/logo/logo.png") +class GraphicLogo extends BitmapData {} -@:bitmap("assets/images/ui/virtual-input.png") -class GraphicVirtualInput extends BitmapData { } +@:keep @:bitmap("assets/images/ui/virtual-input.png") +class GraphicVirtualInput extends BitmapData {} @:file("assets/images/ui/virtual-input.txt") -class VirtualInputData extends ByteArray { } +class VirtualInputData extends ByteArray {} #end class FlxAssets @@ -189,8 +189,7 @@ class FlxAssets */ public static inline function getBitmapFromClass(source:Class):BitmapData { - var bitmap:BitmapData = Type.createInstance(source, [0, 0]); - return bitmap; + return Type.createInstance(source, [0, 0]); } /** diff --git a/flixel/system/FlxPreloader.hx b/flixel/system/FlxPreloader.hx index aba86f9902..347f2ee1ac 100644 --- a/flixel/system/FlxPreloader.hx +++ b/flixel/system/FlxPreloader.hx @@ -50,7 +50,6 @@ class FlxPreloader extends FlxBasePreloader // super(0, ["test.com", FlxPreloaderBase.LOCAL]); // example of site-locking // super(10); // example of long delay (10 seconds) - } /** diff --git a/flixel/system/ui/FlxFocusLostScreen.hx b/flixel/system/ui/FlxFocusLostScreen.hx index fe7c7f9e25..091cd8305e 100644 --- a/flixel/system/ui/FlxFocusLostScreen.hx +++ b/flixel/system/ui/FlxFocusLostScreen.hx @@ -9,6 +9,7 @@ import flixel.system.FlxAssets; class FlxFocusLostScreen extends Sprite { + @:keep public function new() { super(); diff --git a/flixel/system/ui/FlxSoundTray.hx b/flixel/system/ui/FlxSoundTray.hx index da4d181ed8..b6d20b23ab 100644 --- a/flixel/system/ui/FlxSoundTray.hx +++ b/flixel/system/ui/FlxSoundTray.hx @@ -44,6 +44,7 @@ class FlxSoundTray extends Sprite /** * Sets up the "sound tray", the little volume meter that pops down sometimes. */ + @:keep public function new() { super(); diff --git a/flixel/tile/FlxTilemap.hx b/flixel/tile/FlxTilemap.hx index 95d591228d..df049122f4 100644 --- a/flixel/tile/FlxTilemap.hx +++ b/flixel/tile/FlxTilemap.hx @@ -30,11 +30,11 @@ import openfl.display.BlendMode; import openfl.display.Tilesheet; import openfl.geom.ColorTransform; -@:bitmap("assets/images/tile/autotiles.png") +@:keep @:bitmap("assets/images/tile/autotiles.png") class GraphicAuto extends BitmapData {} -@:bitmap("assets/images/tile/autotiles_alt.png") -class GraphicAutoAlt extends BitmapData { } +@:keep @:bitmap("assets/images/tile/autotiles_alt.png") +class GraphicAutoAlt extends BitmapData {} // TODO: try to solve "tile tearing problem" (1px gap between tile at certain conditions) on native targets diff --git a/flixel/ui/FlxButton.hx b/flixel/ui/FlxButton.hx index 6c87b079b6..606171166a 100644 --- a/flixel/ui/FlxButton.hx +++ b/flixel/ui/FlxButton.hx @@ -20,7 +20,7 @@ import flixel.system.FlxSound; import flixel.text.FlxText; import flixel.util.FlxDestroyUtil; -@:bitmap("assets/images/ui/button.png") +@:keep @:bitmap("assets/images/ui/button.png") class GraphicButton extends BitmapData {} /**