openMSX
|
Utility class for converting VRAM contents to host pixels. More...
#include <SpriteConverter.hh>
Public Types | |
using | Pixel = uint32_t |
Public Member Functions | |
SpriteConverter (SpriteChecker &spriteChecker_, std::span< const Pixel, 16 > pal) | |
Constructor. | |
void | setTransparency (bool enabled) |
Update the transparency setting. | |
void | setDisplayMode (DisplayMode newMode) |
Notify SpriteConverter of a display mode change. | |
void | setPalette (std::span< const Pixel, 16 > newPalette) |
Set palette to use for converting sprites. | |
void | drawMode1 (int absLine, int minX, int maxX, std::span< Pixel > pixelPtr) const |
Draw sprites in sprite mode 1. | |
template<unsigned MODE> | |
void | drawMode2 (int absLine, int minX, int maxX, std::span< Pixel > pixelPtr) const |
Draw sprites in sprite mode 2. | |
Static Public Member Functions | |
static bool | clipPattern (int &x, SpriteChecker::SpritePattern &pattern, int minX, int maxX) |
Utility class for converting VRAM contents to host pixels.
Definition at line 20 of file SpriteConverter.hh.
using openmsx::SpriteConverter::Pixel = uint32_t |
Definition at line 23 of file SpriteConverter.hh.
|
inlineexplicit |
Constructor.
After construction, also call the various set methods to complete initialisation.
spriteChecker_ | Delivers the sprite data to be rendered. |
pal | The initial palette. Can later be changed via setPallette(). |
Definition at line 33 of file SpriteConverter.hh.
|
inlinestatic |
Definition at line 66 of file SpriteConverter.hh.
Referenced by drawMode1(), drawMode2(), and openmsx::ImGuiSpriteViewer::paint().
|
inline |
Draw sprites in sprite mode 1.
absLine | Absolute line number. Range is [0..262) for NTSC and [0..313) for PAL. |
minX | Minimum X coordinate to draw (inclusive). |
maxX | Maximum X coordinate to draw (exclusive). |
pixelPtr | Pointer to memory to draw to. |
Definition at line 96 of file SpriteConverter.hh.
References clipPattern(), openmsx::SpriteChecker::getSprites(), and view::reverse().
Referenced by openmsx::SDLRasterizer::drawSprites().
|
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.
absLine | Absolute line number. Range is [0..262) for NTSC and [0..313) for PAL. |
minX | Minimum X coordinate to draw (inclusive). |
maxX | Maximum X coordinate to draw (exclusive). |
pixelPtr | Pointer to memory to draw to. |
Definition at line 142 of file SpriteConverter.hh.
References clipPattern(), openmsx::SpriteChecker::SpriteInfo::colorAttrib, openmsx::SpriteChecker::getSprites(), openmsx::DisplayMode::GRAPHIC5, openmsx::DisplayMode::GRAPHIC6, openmsx::SpriteChecker::SpriteInfo::pattern, and openmsx::SpriteChecker::SpriteInfo::x.
|
inline |
Notify SpriteConverter of a display mode change.
newMode | The new display mode. |
Definition at line 51 of file SpriteConverter.hh.
Referenced by openmsx::SDLRasterizer::setDisplayMode().
|
inline |
Set palette to use for converting sprites.
This palette is stored by reference, so any modifications to it will be used while drawing.
newPalette | 16-entry array containing the sprite palette. |
Definition at line 61 of file SpriteConverter.hh.
Referenced by openmsx::SDLRasterizer::setDisplayMode().
|
inline |
Update the transparency setting.
enabled | The new value. |
Definition at line 43 of file SpriteConverter.hh.
Referenced by openmsx::SDLRasterizer::reset(), and openmsx::SDLRasterizer::setTransparency().