openMSX
Public Member Functions | Static Public Member Functions | List of all members
openmsx::SpriteConverter< Pixel > Class Template Reference

Utility class for converting VRAM contents to host pixels. More...

#include <SpriteConverter.hh>

Public Member Functions

 SpriteConverter (SpriteChecker &spriteChecker_)
 Constructor. More...
 
void setTransparency (bool enabled)
 Update the transparency setting. More...
 
void setDisplayMode (DisplayMode newMode)
 Notify SpriteConverter of a display mode change. More...
 
void setPalette (const Pixel *newPalette)
 Set palette to use for converting sprites. More...
 
void drawMode1 (int absLine, int minX, int maxX, Pixel *pixelPtr)
 Draw sprites in sprite mode 1. More...
 
template<unsigned MODE>
void drawMode2 (int absLine, int minX, int maxX, Pixel *pixelPtr)
 Draw sprites in sprite mode 2. More...
 

Static Public Member Functions

static bool clipPattern (int &x, SpriteChecker::SpritePattern &pattern, int minX, int maxX)
 

Detailed Description

template<class Pixel>
class openmsx::SpriteConverter< Pixel >

Utility class for converting VRAM contents to host pixels.

Definition at line 19 of file SpriteConverter.hh.

Constructor & Destructor Documentation

◆ SpriteConverter()

template<class Pixel>
openmsx::SpriteConverter< Pixel >::SpriteConverter ( SpriteChecker spriteChecker_)
inlineexplicit

Constructor.

After construction, also call the various set methods to complete initialisation.

Parameters
spriteChecker_Delivers the sprite data to be rendered.

Definition at line 29 of file SpriteConverter.hh.

Member Function Documentation

◆ clipPattern()

template<class Pixel>
static bool openmsx::SpriteConverter< Pixel >::clipPattern ( int &  x,
SpriteChecker::SpritePattern pattern,
int  minX,
int  maxX 
)
inlinestatic

◆ drawMode1()

template<class Pixel>
void openmsx::SpriteConverter< Pixel >::drawMode1 ( int  absLine,
int  minX,
int  maxX,
Pixel pixelPtr 
)
inline

Draw sprites in sprite mode 1.

Parameters
absLineAbsolute line number. Range is [0..262) for NTSC and [0..313) for PAL.
minXMinimum X coordinate to draw (inclusive).
maxXMaximum X coordinate to draw (exclusive).
pixelPtrPointer to memory to draw to.

Definition at line 92 of file SpriteConverter.hh.

References openmsx::SpriteConverter< Pixel >::clipPattern(), openmsx::SpriteChecker::SpriteInfo::colorAttrib, openmsx::SpriteChecker::getSprites(), openmsx::SpriteChecker::SpriteInfo::pattern, and openmsx::SpriteChecker::SpriteInfo::x.

◆ drawMode2()

template<class Pixel>
template<unsigned MODE>
void openmsx::SpriteConverter< Pixel >::drawMode2 ( int  absLine,
int  minX,
int  maxX,
Pixel pixelPtr 
)
inline

Draw sprites in sprite mode 2.

Make sure the pixel pointers point to a large enough memory area: 256 pixels for ZOOM_256 and ZOOM_REAL in 256-pixel wide modes; 512 pixels for ZOOM_REAL in 512-pixel wide modes.

Parameters
absLineAbsolute line number. Range is [0..262) for NTSC and [0..313) for PAL.
minXMinimum X coordinate to draw (inclusive).
maxXMaximum X coordinate to draw (exclusive).
pixelPtrPointer to memory to draw to.

Definition at line 143 of file SpriteConverter.hh.

References openmsx::SpriteConverter< Pixel >::clipPattern(), openmsx::SpriteChecker::SpriteInfo::colorAttrib, openmsx::SpriteChecker::getSprites(), openmsx::DisplayMode::GRAPHIC5, openmsx::DisplayMode::GRAPHIC6, likely, openmsx::SpriteChecker::SpriteInfo::pattern, and openmsx::SpriteChecker::SpriteInfo::x.

◆ setDisplayMode()

template<class Pixel>
void openmsx::SpriteConverter< Pixel >::setDisplayMode ( DisplayMode  newMode)
inline

Notify SpriteConverter of a display mode change.

Parameters
newModeThe new display mode.

Definition at line 45 of file SpriteConverter.hh.

◆ setPalette()

template<class Pixel>
void openmsx::SpriteConverter< Pixel >::setPalette ( const Pixel newPalette)
inline

Set palette to use for converting sprites.

This palette is stored by reference, so any modifications to it will be used while drawing.

Parameters
newPalette16-entry array containing the sprite palette.

Definition at line 55 of file SpriteConverter.hh.

◆ setTransparency()

template<class Pixel>
void openmsx::SpriteConverter< Pixel >::setTransparency ( bool  enabled)
inline

Update the transparency setting.

Parameters
enabledThe new value.

Definition at line 37 of file SpriteConverter.hh.


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