[Scummvm-devel] PORTERS: Newly added OSystem::getOverlayFormat
Johannes Schickel
lordhoto at gmail.com
Mon Nov 3 15:03:08 CET 2008
Hi,
as you might have noticed I introduced a new structure to describe a pixel
color format, called Graphics::PixelFormat. In turn we added a function to
OSystem which can be used to query the pixel format used by the backends
overlay screen: OSystem::getOverlayFormat. This function has to be
implemenet *properly* by all ports.
For documentation on Graphics::PixelFormat check out graphics/colormasks.h.
It features some documentation on its relation to Graphics::ColorMasks.
As the name itself suggets Graphics::getOverlayFormat, should return a
correctly filled Graphics::PixelFormat structure. For this you have to
setup the members of Graphics::PixelFormat accordingly. Basically you have
two choices to do so:
-> Use Graphics::createPixelFromat
This way you can easily create a properly filled out
Graphics::PixelFormat by specifing a bit format for a Graphics::ColorMasks
structure.
For example for a 1555 pixel format used by NDS and PSP one would implement
OSystem::getOverlayFormat via:
Graphics::PixelFormat OSystem_FOO::getOverlayFormat() const {
return Graphics::createPixelFormat<1555>();
}
Of course it would work the very same for 4444 (DC) and other modes
-> Setup the structure on your own
The SDL backend does that for example. Check out
graphics/platform/sdl/graphics.cpp ll399-409. It sets up a member
called '_overlayFormat' which is returned in the
OSystem_SDL::getOverlayFormat implementation in graphics/platform/sdl/sdl.h
Note for backends subclassing the SDL backend: if you overload
OSystem_SDL::loadGFXMode, be sure you update your implementation to also
fill out OSystem_SDL::_overlayFormat accordingly.
// Johannes
PS: On further questions just ask.
More information about the Scummvm-devel
mailing list