-
Notifications
You must be signed in to change notification settings - Fork 4
Reference
Constructor:
File must be in data folder.
Ptmx map = new Ptmx(this, "desert.tmx");
Draw map at position (0, 0), just for a quick test.
Draw map on a given PGraphics at position (0, 0).
Draw map at position (left, top).
Draw map on a given PGraphics at position (left, top).
Draw a specific layer at position (left, top).
Draw a specific layer on a given PGraphics at position (left, top).
All this methods need a layer index
Return "layer", "imagelayer" or "objectgroup".
Visible property is ignored when drawing individual layers.
Return null if layer is not a image layer or index is out of bounds
Return null if layer is not a object layer or index is out of bounds
Return black if not defined, layer is not a image layer or index is out of bounds
Return null if layer is not a tile layer or index is out of bounds Attention: Tiled store tiles index as index + 1, so 0 is a "no tile". This is internal data, and looks different than what you get if you use set/getTileIndex.
Opacity is used when drawing individual layers (and on toImage method).
Tile indexes are the same you see on Tiled. -1 for "no tile". Return -2 if coordinates are out of bounds.
Turn a object or tile layer into a image layer. May be useful if you don't need tile or object info, and want a specific opacity on a layer. Opacity is used when creating the image. The created image is truncated to map limits.
Return dimension as number of tiles
Used in hexagonal maps.
Only useful if you want to do some pre-draw calculations, since size is always the size of the last PGraphics (or window).
Default 2. Increase it if tiles are big.
CORNER or CENTER. Default: CORNER. Affect draw coordinates. Draw position corresponds to left-top corner or graphics/window center.
"CANVAS" or "MAP". Default: "CANVAS". Draw coordinates can be relative to the image created when drawing tiles and objects ("CANVAS"). Think as distance in pixels from the left-top corner. In "MAP" PositionMode, coordinates are relative to tiles, so (5, 4) points to the 5th tile from the left, 4th tile from top. Diferences are notorious and useful when using isometric and hexagonal maps.
"COLOR", "CLEAR" or "NONE". Default: "COLOR". Define what happens to the background before draw. "COLOR" - Draw Map background color. "CLEAR" - Drawing to Canvas: Same as "COLOR". Drawing to PGraphics: Clear PGraphics (transparent). "NONE" - Do nothing.
Return last draw position. Dependent of DrawMode and PositionMode