Skip to content

Commit

Permalink
FlxStrip / FlxDrawTrianglesItem: remove unnecessary conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
Gama11 committed Feb 11, 2016
1 parent dce1b5c commit 1dbcf9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 30 deletions.
18 changes: 4 additions & 14 deletions flixel/FlxStrip.hx
Expand Up @@ -20,30 +20,20 @@ class FlxStrip extends FlxSprite
/**
* A Vector of Floats where each pair of numbers is treated as a coordinate location (an x, y pair).
*/
public var vertices:DrawData<Float>;
public var vertices:DrawData<Float> = new DrawData<Float>();
/**
* A Vector of integers or indexes, where every three indexes define a triangle.
*/
public var indices:DrawData<Int>;
public var indices:DrawData<Int> = new DrawData<Int>();
/**
* A Vector of normalized coordinates used to apply texture mapping.
*/
public var uvtData:DrawData<Float>;
public var uvtData:DrawData<Float> = new DrawData<Float>();

public var colors:DrawData<Int>;
public var colors:DrawData<Int> = new DrawData<Int>();

public var repeat:Bool = false;

public function new(X:Float = 0, Y:Float = 0, ?SimpleGraphic:FlxGraphicAsset)
{
super(X, Y, SimpleGraphic);

vertices = new #if flash Vector #else Array #end<Float>();
indices = new #if flash Vector #else Array #end<Int>();
uvtData = new #if flash Vector #else Array #end<Float>();
colors = new #if flash Vector #else Array #end<Int>();
}

override public function destroy():Void
{
vertices = null;
Expand Down
20 changes: 4 additions & 16 deletions flixel/graphics/tile/FlxDrawTrianglesItem.hx
Expand Up @@ -23,10 +23,10 @@ class FlxDrawTrianglesItem extends FlxDrawBaseItem<FlxDrawTrianglesItem>
private static var point:FlxPoint = FlxPoint.get();
private static var rect:FlxRect = FlxRect.get();

public var vertices:DrawData<Float>;
public var indices:DrawData<Int>;
public var uvtData:DrawData<Float>;
public var colors:DrawData<Int>;
public var vertices:DrawData<Float> = new DrawData<Float>();
public var indices:DrawData<Int> = new DrawData<Int>();
public var uvtData:DrawData<Float> = new DrawData<Float>();
public var colors:DrawData<Int> = new DrawData<Int>();

public var verticesPosition:Int = 0;
public var indicesPosition:Int = 0;
Expand All @@ -38,18 +38,6 @@ class FlxDrawTrianglesItem extends FlxDrawBaseItem<FlxDrawTrianglesItem>
{
super();
type = FlxDrawItemType.TRIANGLES;

#if flash
vertices = new Vector<Float>();
indices = new Vector<Int>();
uvtData = new Vector<Float>();
colors = new Vector<Int>();
#else
vertices = new Array<Float>();
indices = new Array<Int>();
uvtData = new Array<Float>();
colors = new Array<Int>();
#end
}

override public function render(camera:FlxCamera):Void
Expand Down

0 comments on commit 1dbcf9c

Please sign in to comment.