v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Member Functions | Static Public Member Functions | List of all members
Sifteo::BG0Drawable Struct Reference

A VRAM accessor for drawing graphics in the BG0 mode. More...

#include <sifteo/video/bg0.h>

Public Member Functions

CubeID cube () const
 Return the CubeID associated with this drawable.
 
void erase (uint16_t index=0)
 Erase mode-specific VRAM, filling the BG0 buffer with the specified absolute tile index value and resetting the panning registers.
 
void erase (const PinnedAssetImage &image)
 Erase mode-specific VRAM, filling the BG0 buffer with the first tile from the specified PinnedAssetImage and resetting the panning registers.
 
void fill (UInt2 topLeft, UInt2 size, unsigned tileIndex)
 Fill a rectangle of identical tiles, specified as a top-left corner location and a size. More...
 
void fill (UInt2 topLeft, UInt2 size, const PinnedAssetImage &image)
 Fill a rectangle of identical tiles, using the first tile of a pinned asset. More...
 
Int2 getPanning () const
 Retrieve the last value set by setPanning(), modulo the layer size in pixels.
 
void image (UInt2 pos, const AssetImage &image, unsigned frame=0)
 Draw a full AssetImage frame, with its top-left corner at the specified location. More...
 
void image (UInt2 destXY, UInt2 size, const AssetImage &image, UInt2 srcXY, unsigned frame=0)
 Draw part of an AssetImage frame, with its top-left corner at the specified location. More...
 
void plot (UInt2 pos, uint16_t tileIndex)
 Plot a single tile, by absolute tile index, at location 'pos' in tile units. More...
 
void setPanning (Int2 pixels)
 Change the hardware pixel-panning origin for this mode. More...
 
void span (UInt2 pos, unsigned width, unsigned tileIndex)
 Plot a horizontal span of tiles, by absolute tile index, given the position of the leftmost tile and the number of tiles to plot. More...
 
void span (UInt2 pos, unsigned width, const PinnedAssetImage &image)
 Plot a horizontal span of tiles, using the first tile of a pinned asset. More...
 
void text (Int2 topLeft, const AssetImage &font, const char *str, char firstChar= ' ')
 Draw text, using an AssetImage as a fixed width font. More...
 
uint16_t tile (UInt2 pos)
 Retrieve the absolute tile index currently set at the given address. The inverse of plot().
 
uint16_t tileAddr (UInt2 pos)
 Calculate the video buffer address of a particular tile. More...
 
_SYSVideoBuffer & videoBuffer ()
 Return the VideoBuffer associated with this drawable.
 

Static Public Member Functions

static unsigned pixelHeight ()
 Return the height, in pixel, of this mode.
 
static UInt2 pixelSize ()
 Return the size of this mode as a vector, in pixels.
 
static unsigned pixelWidth ()
 Return the width, in pixels, of this mode.
 
static unsigned sizeInBytes ()
 Returns the size of this drawable's tile data, in bytes.
 
static unsigned sizeInWords ()
 Returns the size of this drawable's tile data, in 16-bit words.
 
static unsigned tileHeight ()
 Return the height, in tiles, of this mode.
 
static UInt2 tileSize ()
 Return the size of this mode as a vector, in tiles.
 
static unsigned tileWidth ()
 Return the width, in tiles, of this mode.
 

Detailed Description

A VRAM accessor for drawing graphics in the BG0 mode.

We have an 18x18 tile grid, which wraps around in both axes.

Member Function Documentation

void Sifteo::BG0Drawable::fill ( UInt2  topLeft,
UInt2  size,
unsigned  tileIndex 
)
inline

Fill a rectangle of identical tiles, specified as a top-left corner location and a size.

All coordinates must be in range. This function performs no clipping.

void Sifteo::BG0Drawable::fill ( UInt2  topLeft,
UInt2  size,
const PinnedAssetImage image 
)
inline

Fill a rectangle of identical tiles, using the first tile of a pinned asset.

All coordinates must be in range. This function performs no clipping.

void Sifteo::BG0Drawable::image ( UInt2  pos,
const AssetImage image,
unsigned  frame = 0 
)
inline

Draw a full AssetImage frame, with its top-left corner at the specified location.

Locations are specified in tile units, relative to the top-left of the 18x18 grid.

All coordinates must be in range. This function performs no clipping.

void Sifteo::BG0Drawable::image ( UInt2  destXY,
UInt2  size,
const AssetImage image,
UInt2  srcXY,
unsigned  frame = 0 
)
inline

Draw part of an AssetImage frame, with its top-left corner at the specified location.

Locations are specified in tile units, relative to the top-left of the 18x18 grid.

All coordinates must be in range. This function performs no clipping.

void Sifteo::BG0Drawable::plot ( UInt2  pos,
uint16_t  tileIndex 
)
inline

Plot a single tile, by absolute tile index, at location 'pos' in tile units.

All coordinates must be in range. This function performs no clipping.

void Sifteo::BG0Drawable::setPanning ( Int2  pixels)
inline

Change the hardware pixel-panning origin for this mode.

The supplied vector is interpreted as the location on the tile buffer, in pixels, where the origin of the LCD will begin.

BG0 is an 18x18 buffer that wraps around in both directions.

void Sifteo::BG0Drawable::span ( UInt2  pos,
unsigned  width,
unsigned  tileIndex 
)
inline

Plot a horizontal span of tiles, by absolute tile index, given the position of the leftmost tile and the number of tiles to plot.

All coordinates must be in range. This function performs no clipping.

void Sifteo::BG0Drawable::span ( UInt2  pos,
unsigned  width,
const PinnedAssetImage image 
)
inline

Plot a horizontal span of tiles, using the first tile of a pinned asset.

All coordinates must be in range. This function performs no clipping.

void Sifteo::BG0Drawable::text ( Int2  topLeft,
const AssetImage font,
const char *  str,
char  firstChar = ' ' 
)
inline

Draw text, using an AssetImage as a fixed width font.

Each character is represented by a consecutive 'frame' in the image. Characters not present in the font will be skipped.

uint16_t Sifteo::BG0Drawable::tileAddr ( UInt2  pos)
inline

Calculate the video buffer address of a particular tile.

All coordinates must be in range. This function performs no clipping.


The documentation for this struct was generated from the following file: