TileLayer

Undocumented in source.

Constructors

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

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

Members

Aliases

DisplayList
alias DisplayList = TreeMap!(wchar, DisplayListItem, true)
Undocumented in source.

Functions

addTile
void addTile(ABitmap tile, wchar id, ubyte paletteSh)

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

clearTilemap
void clearTilemap()
Undocumented in source. Be warned that the author may not have intended to support it.
getLayerType
LayerType getLayerType()
Undocumented in source. Be warned that the author may not have intended to support it.
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
size_t getTX()
Undocumented in source. Be warned that the author may not have intended to support it.
getTY
size_t getTY()
Undocumented in source. Be warned that the author may not have intended to support it.
getTile
ABitmap getTile(wchar id)

Returns a tile from the displaylist

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.
getWarpMode
WarpMode getWarpMode()

Returns the currently used warp mode.

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

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
WarpMode setWarpMode(WarpMode mode)

Sets the warp mode. Returns the new warp mode that is being used.

tileByPixel
MappingElement tileByPixel(int x, int y)

Returns which tile is at the given pixel

updateRaster
void updateRaster(void* workpad, int pitch, Color* palette)
Undocumented in source. Be warned that the author may not have intended to support it.
writeMapping
void writeMapping(int x, int y, MappingElement w)

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

writeTextToMap
void writeTextToMap(int x, int y, ubyte color, wstring text, BitmapAttrib atrb)

Writes a text to the map. This function is a bit rudamentary, as it doesn't handle word breaks, and needs per-line writing. Requires the text to be in 16 bit format

Structs

DisplayListItem
struct DisplayListItem

Implements a single tile to be displayed. Is ordered in a BinarySearchTree for fast lookup.

Variables

displayList
DisplayList displayList;

displaylist using a BST to allow skipping elements

hBlankInterrupt
void delegate(int line, ref int sX0, ref int sY0) hBlankInterrupt;

Emulates horizontal blanking interrupt effects, like per-line scrolling. line no -1 indicates that no lines have been drawn yet.

mX
int mX;

Map width

mY
int mY;

Map height

mapping
MappingElement[] mapping;

Contains the mapping data

masterVal
ubyte masterVal;

Sets the master alpha value for the layer

paletteOffset
ushort paletteOffset;

Enables the TileLayer to access other parts of the palette if needed. Does not effect 16 bit bitmaps, but effects all 4 and 8 bit bitmap within the layer, so use with caution to avoid memory leakages.

src
Color[] src;

Local buffer

tileX
int tileX;

Tile width

tileY
int tileY;

Tile height

totalX
size_t totalX;

Total width of the tilelayer in pixels

totalY
size_t totalY;

Total height of the tilelayer in pixels

warpMode
WarpMode warpMode;

Sets the warp mode of the layer. Can repeat the whole layer, a single tile, or be turned off completely.

Inherited Members

From Layer

mainRenderingFunction
RenderFunc mainRenderingFunction;

Used to implement changeable renderers for each layers

mainColorLookupFunction
alias mainColorLookupFunction = colorLookup!(ushort, uint)
Undocumented in source.
main8BitColorLookupFunction
alias main8BitColorLookupFunction = colorLookup!(ubyte, uint)
Undocumented in source.
main4BitColorLookupFunction
alias main4BitColorLookupFunction = colorLookup4Bit!uint
Undocumented in source.
renderMode
RenderingMode renderMode;
Undocumented in source.
sX
int sX;

Horizontal scroll position

sY
int sY;

Vertical scroll position

rasterX
int rasterX;

Raster width (visible)

rasterY
int rasterY;

Haster height

setRasterizer
void setRasterizer(int rX, int rY)

Sets up the layer for the current rasterizer.

setRenderingMode
void setRenderingMode(RenderingMode mode)

Sets the global rendering mode for this layer.

scroll
void scroll(int x, int y)

Scrolls the layer to the given position.

relScroll
void relScroll(int x, int y)

Relatively scrolls the layer by the given amount. Formula is: [sX,sY] = [sX,sY] + [x,y]

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)

Renders the layer's output to the raster. Function is called sequentially for all layers. Layers with higher priority number will render to the raster in a later time. Function is marked as @nogc, as render-time allocation has negative impact on performance. For errors, either use asserts for unrecoverable errors, or errorcodes for less severe cases.

getLayerType
LayerType getLayerType()

Returns the type of the layer. Useful with certain scripting languages.

flipHorizontal
void flipHorizontal(T[] target)

Standard algorithm for horizontal mirroring, used for tile mirroring

Meta