SpriteLayer

General-purpose sprite controller and renderer.

Constructors

this
this(RenderingMode renderMode)

Default ctor

Members

Aliases

DisplayList
alias DisplayList = SortedList!(DisplayListItem, "a < b", false)
Undocumented in source.

Functions

addSprite
Box addSprite(ABitmap sprt, int n, int x, int y, ushort paletteSel, ubyte paletteSh, ubyte alpha, int scaleHoriz, int scaleVert, RenderingMode renderMode)

Creates a sprite from a bitmap with the given data, then places it to the display list. (New architecture)

checkAllSprites
void checkAllSprites()

Checks all sprites for whether they're on screen or not. Called every time the layer is being scrolled.

checkSprite
bool checkSprite(int n)
bool checkSprite(DisplayListItem sprt)

Checks whether a sprite would be displayed on the screen, then updates the display list. Returns true if it's on screen.

clear
void clear()

Clears all sprite from the layer.

getDisplayListItem
DisplayListItem getDisplayListItem(int n)

Searches the DisplayListItem by priority and returns it. Can be used for external use without any safety issues.

getLayerType
LayerType getLayerType()
Undocumented in source. Be warned that the author may not have intended to support it.
getPaletteID
ushort getPaletteID(int n)

Returns the selected paletteID of the sprite.

getScaleSpriteHoriz
int getScaleSpriteHoriz(int n)

Gets the sprite's current horizontal scale value

getScaleSpriteVert
int getScaleSpriteVert(int n)

Gets the sprite's current vertical scale value

getSlice
Coordinate getSlice(int n)

Returns the displayed portion of the sprite.

getSpriteCoordinate
Box getSpriteCoordinate(int n)
Undocumented in source. Be warned that the author may not have intended to support it.
getSpriteRenderingFunc
RenderFunc getSpriteRenderingFunc(int n)

Returns the sprite rendering function.

moveSprite
void moveSprite(int n, int x, int y)

Moves a sprite to the given position.

relMoveSprite
void relMoveSprite(int n, int x, int y)

Moves a sprite by the given amount.

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.

removeSprite
void removeSprite(int n)

Removes a sprite from both displaylists by priority.

replaceSprite
void replaceSprite(ABitmap s, int n)

Replaces the bitmap of the given sprite.

replaceSprite
void replaceSprite(ABitmap s, int n, int x, int y)

Ditto with move

replaceSprite
void replaceSprite(ABitmap s, int n, Coordinate c)

Ditto with move

scaleSpriteHoriz
int scaleSpriteHoriz(int n, int hScl)

Scales sprite horizontally. Returns the new size, or -1 if the scaling value is invalid, or -2 if spriteID not found.

scaleSpriteVert
int scaleSpriteVert(int n, int vScl)

Scales sprite vertically. Returns the new size, or -1 if the scaling value is invalid, or -2 if spriteID not found.

scroll
void scroll(int x, int y)

Absolute scrolling.

setPaletteID
ushort setPaletteID(int n, ushort paletteID)

Sets the paletteID of the sprite. Returns the new ID, which is truncated to the possible values with a simple binary and operation Palette must exist in the parent Raster, otherwise AccessError might happen during

setSlice
Coordinate setSlice(int n, Coordinate slice)

Writes the displayed portion of the sprite. Returns the new slice, if invalid (greater than the bitmap, etc.) returns Coordinate.init.

setSpriteRenderingFunc
RenderFunc setSpriteRenderingFunc(int n, RenderFunc func)

Sets the sprite's rendering function. Can be a custom one.

setSpriteRenderingMode
RenderFunc setSpriteRenderingMode(int n, RenderingMode mode)

Sets the sprite's rendering function from a predefined ones.

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

Structs

DisplayListItem
struct DisplayListItem

Helps to determine the displaying properties and order of sprites.

Variables

allSprites
DisplayList allSprites;

All sprites of this layer

src
Color[2048] src;

Local buffer for scaling

Meta