SpriteLayer

General-purpose sprite controller and renderer.

Constructors

this
this(RenderingMode renderMode)

Default ctor

Members

Aliases

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

Functions

addSprite
void addSprite(ABitmap s, int n, Box c, ushort paletteSel, int scaleHoriz, int scaleVert)
void addSprite(ABitmap s, int n, int x, int y, ushort paletteSel, int scaleHoriz, int scaleVert)

Adds a sprite to the layer.

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.

getDisplayListItem_internal
DisplayListItem* getDisplayListItem_internal(int n)

Searches the DisplayListItem by priority and returns it. Intended for internal use, as it returns it as a reference value.

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
Coordinate getSpriteCoordinate(int n)
Undocumented in source. Be warned that the author may not have intended to support it.
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

setRasterizer
void setRasterizer(int rX, int rY)
Undocumented in source. Be warned that the author may not have intended to support it.
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.

setSpriteRenderingMode
void setSpriteRenderingMode(int n, RenderingMode mode)

Sets the rendering function for the sprite (defaults to the layer's rendering function)

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

displayedSprites
OnScreenList displayedSprites;

Sprites that are being displayed

src
Color[2048] src;

Local buffer for scaling

Meta