TileLayer

General purpose TileLayer with palette support, mainly for backgrounds. Use multiple of this class for paralax scrolling. Can use any kind of bitmaps thanks to code restructuring.

Constructors

this
this(int tX, int tY, LayerRenderingMode renderMode)

Constructor. tX , tY : Set the size of the tiles on the layer.

Members

Functions

addTile
void addTile(ABitmap tile, wchar id)

Adds a tile to the tileSet. t : The tile. id : The ID in wchar to differentiate between different tiles.

getMX
int getMX()
Undocumented in source. Be warned that the author may not have intended to support it.
getMY
int getMY()
Undocumented in source. Be warned that the author may not have intended to support it.
getMapping
MappingElement[] getMapping()
Undocumented in source. Be warned that the author may not have intended to support it.
getTX
int getTX()
Undocumented in source. Be warned that the author may not have intended to support it.
getTY
int getTY()
Undocumented in source. Be warned that the author may not have intended to support it.
getTileHeight
int getTileHeight()
Undocumented in source. Be warned that the author may not have intended to support it.
getTileWidth
int getTileWidth()
Undocumented in source. Be warned that the author may not have intended to support it.
loadMapping
void loadMapping(int x, int y, MappingElement[] mapping)

Writes to the map. x , y : Position. w : ID of the tile. Loads a mapping from an array. x , y : Sizes of the mapping. map : an array representing the elements of the map. x*y=map.length

readMapping
MappingElement readMapping(int x, int y)

Gets the the ID of the given element from the mapping. x , y : Position.

removeTile
void removeTile(wchar id)

Removes the tile with the ID from the set.

setWarpMode
void setWarpMode(bool w)

Warpmode: if enabled, the layer will be turned into an "infinite" mode.

tileByPixel
MappingElement tileByPixel(int x, int y)

Returns which tile is at the given pixel

updateRaster
void updateRaster(void* workpad, int pitch, Color* palette, int[] threads)

Returns the tile's attribute at the given pixel

writeMapping
void writeMapping(int x, int y, MappingElement w)

Writes to the map. x , y : Position. w : ID of the tile.

Structs

DisplayListItem
struct DisplayListItem
Undocumented in source.

Variables

displayList
BinarySearchTree!(wchar, DisplayListItem) displayList;
mX
int mX;
mY
int mY;
Undocumented in source.
mapping
MappingElement[] mapping;
Undocumented in source.
src
Color[] src;
Undocumented in source.
tileX
int tileX;
tileY
int tileY;
Undocumented in source.
totalX
int totalX;
totalY
int totalY;
Undocumented in source.
warpMode
bool warpMode;
Undocumented in source.

Inherited Members

From Layer

mainRenderingFunction
void function(uint* src, uint* dest, size_t length) mainRenderingFunction;

Used to get around some readability issues. (void* src, void* dest, int length)

mainColorLookupFunction
void function(ushort* src, uint* dest, uint* palette, size_t length) mainColorLookupFunction;
Undocumented in source.
main8BitColorLookupFunction
void function(ubyte* src, uint* dest, uint* palette, size_t length) main8BitColorLookupFunction;
Undocumented in source.
main4BitColorLookupFunction
void function(ubyte* src, uint* dest, uint* palette, size_t length, int offset) main4BitColorLookupFunction;
Undocumented in source.
renderMode
LayerRenderingMode renderMode;
Undocumented in source.
sX
int sX;
sY
int sY;
rasterX
int rasterX;
rasterY
int rasterY;
Undocumented in source.
setRasterizer
void setRasterizer(int rX, int rY)

Sets the main rasterizer

setRenderingMode
void setRenderingMode(LayerRenderingMode mode)

Sets the rendering mode

scroll
void scroll(int x, int y)

Absolute scrolling.

relScroll
void relScroll(int x, int y)

Relative scrolling. Positive values scrolls the layer left and up, negative values scrolls the layer down and right.

getSX
int getSX()

Getter for the X scroll position.

getSY
int getSY()

Getter for the Y scroll position.

updateRaster
void updateRaster(void* workpad, int pitch, Color* palette, int[] threads)

Override this to enable output to the raster

flipHorizontal
void flipHorizontal(uint* src, int length)

Standard algorithm for horizontal mirroring

From ITileLayer

getMapping
MappingElement[] getMapping()
Undocumented in source.
readMapping
MappingElement readMapping(int x, int y)

Reads the mapping element from the given area.

writeMapping
void writeMapping(int x, int y, MappingElement w)

Writes the given element into the mapping at the given location.

loadMapping
void loadMapping(int x, int y, MappingElement[] mapping)

Loads the mapping, primarily used for deserialization.

removeTile
void removeTile(wchar id)

Removes the tile from the display list with the given ID.

tileByPixel
MappingElement tileByPixel(int x, int y)

Returns the tile ID from the location by pixel.

getTileWidth
int getTileWidth()

Returns the width of the tiles.

getTileHeight
int getTileHeight()

Returns the height of the tiles.

getMX
int getMX()

Returns the width of the mapping.

getMY
int getMY()

Returns the height of the mapping.

getTX
int getTX()

Returns the total width of the tile layer.

getTY
int getTY()

Returns the total height of the tile layer.

addTile
void addTile(ABitmap tile, wchar id)

Adds a tile.

Meta