A helper object to keep tilemap drawing performance decent across the new multi-camera system. Pretty much don't even have to think about this class unless you are doing some crazy hacking.

Constructor

@:value({ scaleY : 1.0, scaleX : 1.0 })new(tileWidth:Int, tileHeight:Int, widthInTiles:Int, heightInTiles:Int, ?camera:FlxCamera, scaleX:Float = 1.0, scaleY:Float = 1.0)

Instantiates a new camera-specific buffer for storing the visual tilemap data.

Parameters:

tileWidth

The width of the tiles in this tilemap.

tileHeight

The height of the tiles in this tilemap.

widthInTiles

How many tiles wide the tilemap is.

heightInTiles

How many tiles tall the tilemap is.

camera

Which camera this buffer relates to.

Variables

@:value(false)antialiasing:Bool = false

@:value(0)columns:Int = 0

How many columns of tiles fit in this buffer.

@:value(false)dirty:Bool = false

Whether the buffer needs to be redrawn.

@:value(0)height:Float = 0

The height of the buffer (usually just a few tiles taller than the camera).

pixelPerfectRender:Null<Bool>

Whether or not the coordinates should be rounded during draw(), true by default (recommended for pixel art). Only affects tilesheet rendering and rendering using BitmapData.draw() in blitting. (copyPixels() only renders on whole pixels by nature). Causes draw() to be used if false, which is more expensive.

read onlypixels:BitmapData

The actual buffer BitmapData. (Only used if FlxG.renderBlit == true)

@:value(0)rows:Int = 0

How many rows of tiles fit in this buffer.

@:value(0)width:Float = 0

The width of the buffer (usually just a few tiles wider than the camera).

@:value(0)x:Float = 0

The current X position of the buffer.

@:value(0)y:Float = 0

The current Y position of the buffer.

Methods

destroy():Void

Clean up memory.

@:value({ scaleY : 1.0, scaleX : 1.0 })draw(camera:FlxCamera, flashPoint:Point, scaleX:Float = 1.0, scaleY:Float = 1.0):Void

Just stamps this buffer onto the specified camera at the specified location.

Parameters:

camera

Which camera to draw the buffer onto.

flashPoint

Where to draw the buffer at in camera coordinates.

@:value({ color : FlxColor.TRANSPARENT })fill(color:FlxColor = FlxColor.TRANSPARENT):Void

Fill the buffer with the specified color. Default value is transparent.

Parameters:

color

What color to fill with, in 0xAARRGGBB hex format.

isDirty<Tile>(tilemap:FlxTypedTilemap<Tile>, camera:FlxCamera):Bool

Check if tilemap or camera has changed (scrolled, moved, resized or scaled) since the previous frame. If so, then it means that we need to redraw this buffer.

Parameters:

tilemap

Tilemap to check against. It's a tilemap this buffer belongs to.

camera

Camera to check against. It's a camera this buffer is used for drawing on.

Returns:

The value of dirty flag.

isPixelPerfectRender(?camera:FlxCamera):Bool

Check if object is rendered pixel perfect on a specific camera.

@:value({ scaleY : 1.0, scaleX : 1.0 })resize(tileWidth:Int, tileHeight:Int, widthInTiles:Int, heightInTiles:Int, ?camera:FlxCamera, scaleX:Float = 1.0, scaleY:Float = 1.0):Void

Creates a bitmapData buffer from the tilemap's info.

Parameters:

tileWidth

The width of the tiles in this tilemap.

tileHeight

The height of the tiles in this tilemap.

widthInTiles

How many tiles wide the tilemap is.

heightInTiles

How many tiles tall the tilemap is.

camera

Which camera this buffer relates to.

@:value({ scaleX : 1.0 })@:access(flixel.FlxCamera.viewWidth)updateColumns(tileWidth:Int, widthInTiles:Int, scaleX:Float = 1.0, ?camera:FlxCamera):Void

@:value({ scaleY : 1.0 })@:access(flixel.FlxCamera.viewHeight)updateRows(tileHeight:Int, heightInTiles:Int, scaleY:Float = 1.0, ?camera:FlxCamera):Void