Skip to content

Commit

Permalink
Add @:keep metadata to support -dce full, closes #1397
Browse files Browse the repository at this point in the history
  • Loading branch information
Gama11 committed Jan 12, 2015
1 parent 3b29114 commit 637e4a5
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion flixel/FlxSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions flixel/FlxState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/**
Expand Down
1 change: 1 addition & 0 deletions flixel/effects/particles/FlxParticle.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions flixel/input/android/FlxAndroidKeyList.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
1 change: 1 addition & 0 deletions flixel/input/keyboard/FlxKeyList.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
1 change: 1 addition & 0 deletions flixel/math/FlxPoint.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions flixel/math/FlxRect.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 8 additions & 9 deletions flixel/system/FlxAssets.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -189,8 +189,7 @@ class FlxAssets
*/
public static inline function getBitmapFromClass(source:Class<Dynamic>):BitmapData
{
var bitmap:BitmapData = Type.createInstance(source, [0, 0]);
return bitmap;
return Type.createInstance(source, [0, 0]);
}

/**
Expand Down
1 change: 0 additions & 1 deletion flixel/system/FlxPreloader.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)

}

/**
Expand Down
1 change: 1 addition & 0 deletions flixel/system/ui/FlxFocusLostScreen.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import flixel.system.FlxAssets;

class FlxFocusLostScreen extends Sprite
{
@:keep
public function new()
{
super();
Expand Down
1 change: 1 addition & 0 deletions flixel/system/ui/FlxSoundTray.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions flixel/tile/FlxTilemap.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion flixel/ui/FlxButton.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

/**
Expand Down

0 comments on commit 637e4a5

Please sign in to comment.