me.TMXRenderer(cols, rows, tilewidth, tileheight)

new TMXRenderer(cols, rows, tilewidth, tileheight)

The map renderer base class

Parameters:
Name Type Description
cols Number

width of the tilemap in tiles

rows Number

height of the tilemap in tiles

tilewidth Number

width of each tile in pixels

tileheight Number

height of each tile in pixels

Extends

Methods

canRender(component) → {boolean}

return true if the renderer can render the specified layer

Parameters:
Name Type Description
component me.TMXTileMap | me.TMXLayer

TMX Map or Layer

Returns:
boolean

drawTile(renderer, x, y, tile)

draw the given tile at the specified layer

Parameters:
Name Type Description
renderer me.CanvasRenderer | me.WebGLRenderer

a renderer object

x Number

X coordinate where to draw the tile

y Number

Y coordinate where to draw the tile

tile me.Tile

the tile object to draw

drawTileLayer(renderer, layer, rect)

draw the given TMX Layer for the given area

Parameters:
Name Type Description
renderer me.CanvasRenderer | me.WebGLRenderer

a renderer object

layer me.TMXLayer

a TMX Layer object

rect me.Rect

the area of the layer to draw

pixelToTileCoords(x, y, vectoropt) → {me.Vector2d}

return the tile position corresponding to the specified pixel

Parameters:
Name Type Attributes Description
x Number

X coordinate

y Number

Y coordinate

vector me.Vector2d <optional>

an optional vector object where to put the return values

Returns:
me.Vector2d

tileToPixelCoords(col, row, vectoropt) → {me.Vector2d}

return the pixel position corresponding of the specified tile

Parameters:
Name Type Attributes Description
col Number

tile horizontal position

row Number

tile vertical position

vector me.Vector2d <optional>

an optional vector object where to put the return values

Returns:
me.Vector2d