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

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

#include <sifteo/video/bg0rom.h>

Public Types

enum  ColorMode
 Color modes, XOR'ed with the tile IDs below.
 
enum  Palette
 Palette IDs, XOR'ed with the tile IDs below.
 
enum  Tiles {
  FONT_SPACE = 0, SOLID_BG = 0, SOLID_FG = 104, V_BARGRAPH = 224,
  H_BARGRAPH = 231
}
 Well-known tile numbers. More...
 

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 value 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...
 
Int2 getPanning () const
 Retrieve the last value set by setPanning(), modulo the layer size in pixels.
 
void hBargraph (Int2 topLeft, unsigned pixelWidth, enum Palette palette=BLACK, unsigned tileHeight=1)
 Draw a horizontal bargraph, with its top-left corner position specified in tiles, and its width in pixels. More...
 
void plot (UInt2 pos, uint16_t tileIndex)
 Plot a single tile, 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, given the position of the leftmost tile, and the number of tiles to plot. More...
 
void text (Int2 topLeft, const char *str, enum Palette palette=BLACK)
 Draw text, using the builtin ROM font, starting at location 'topLeft' in tiles. More...
 
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 uint16_t charTile (char c, enum Palette palette=BLACK)
 Calculate the tile index of one character in the ROM font.
 
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_ROM mode.

We have an 18x18 tile grid, just like the normal BG0 mode, but the tile data in our case comes from a built-in image ROM in the cube firmware.

This mode can be used to draw specific built-in graphics, or it can be used to draw debug text using the cube's built-in ROM font.

Member Function Documentation

void Sifteo::BG0ROMDrawable::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::BG0ROMDrawable::hBargraph ( Int2  topLeft,
unsigned  pixelWidth,
enum Palette  palette = BLACK,
unsigned  tileHeight = 1 
)
inline

Draw a horizontal bargraph, with its top-left corner position specified in tiles, and its width in pixels.

The progress bar is drawn using tiles from the ROM. Fully empty tiles are not drawn. Completely full tiles are drawn using a SOLID_FG tile, and partially full tiles use the BARGRAPH series of tile images.

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

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

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

void Sifteo::BG0ROMDrawable::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::BG0ROMDrawable::span ( UInt2  pos,
unsigned  width,
unsigned  tileIndex 
)
inline

Plot a horizontal span of tiles, 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::BG0ROMDrawable::text ( Int2  topLeft,
const char *  str,
enum Palette  palette = BLACK 
)
inline

Draw text, using the builtin ROM font, starting at location 'topLeft' in tiles.

Drawing characters not present in the ROM font will have undefined results.

uint16_t Sifteo::BG0ROMDrawable::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: