ScummVM API documentation
ModularGraphicsBackend Class Reference

#include <modular-backend.h>

Inheritance diagram for ModularGraphicsBackend:
BaseBackend OSystem Common::NonCopyable OSystem_Android OSystem_Atari OSystem_iOS7 OSystem_libretro OSystem_SDL OSystem_AmigaOS OSystem_KolibriOS OSystem_MorphOS OSystem_POSIX OSystem_PS3 OSystem_PSP2 OSystem_RISCOS OSystem_SDL_Miyoo OSystem_SDL_Opendingux OSystem_SDL_Sailfish OSystem_Switch OSystem_Win32

Public Member Functions

Features
bool hasFeature (Feature f) override
 
void setFeatureState (Feature f, bool enable) override
 
bool getFeatureState (Feature f) override
 
Graphics
GraphicsManagergetGraphicsManager ()
 
const GraphicsModegetSupportedGraphicsModes () const override
 
int getDefaultGraphicsMode () const override
 
bool setGraphicsMode (int mode, uint flags=kGfxModeNoFlags) override
 
int getGraphicsMode () const override
 
bool setShader (const Common::Path &name) override final
 
const GraphicsModegetSupportedStretchModes () const override final
 
int getDefaultStretchMode () const override final
 
bool setStretchMode (int mode) override final
 
int getStretchMode () const override final
 
uint getDefaultScaler () const override final
 
uint getDefaultScaleFactor () const override final
 
bool setScaler (uint mode, int factor) override final
 
uint getScaler () const override final
 
uint getScaleFactor () const override final
 
void initSize (uint width, uint height, const Graphics::PixelFormat *format=NULL) override final
 
void initSizeHint (const Graphics::ModeList &modes) override final
 
int getScreenChangeID () const override final
 
void beginGFXTransaction () override final
 
OSystem::TransactionError endGFXTransaction () override final
 
int16 getHeight () override final
 
int16 getWidth () override final
 
PaletteManagergetPaletteManager () override final
 
void copyRectToScreen (const void *buf, int pitch, int x, int y, int w, int h) override final
 
Graphics::SurfacelockScreen () override final
 
void unlockScreen () override final
 
void fillScreen (uint32 col) override final
 
void fillScreen (const Common::Rect &r, uint32 col) override final
 
void updateScreen () override final
 
void setShakePos (int shakeXOffset, int shakeYOffset) override final
 
void setFocusRectangle (const Common::Rect &rect) override final
 
void clearFocusRectangle () override final
 
void showOverlay (bool inGUI) override final
 
void hideOverlay () override final
 
bool isOverlayVisible () const override final
 
Graphics::PixelFormat getOverlayFormat () const override final
 
void clearOverlay () override final
 
void grabOverlay (Graphics::Surface &surface) override final
 
void copyRectToOverlay (const void *buf, int pitch, int x, int y, int w, int h) override final
 
int16 getOverlayHeight () override final
 
int16 getOverlayWidth () override final
 
float getHiDPIScreenFactor () const override final
 
bool showMouse (bool visible) override final
 
void warpMouse (int x, int y) override final
 
void setMouseCursor (const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale=false, const Graphics::PixelFormat *format=NULL, const byte *mask=NULL) override final
 
void setCursorPalette (const byte *colors, uint start, uint num) override final
 
bool lockMouse (bool lock) override final
 
Miscellaneous
void displayMessageOnOSD (const Common::U32String &msg) override final
 
void displayActivityIconOnOSD (const Graphics::Surface *icon) override final
 
void saveScreenshot () override final
 
- Public Member Functions inherited from BaseBackend
void initBackend () override
 
bool setScaler (const char *name, int factor) override final
 
- Public Member Functions inherited from OSystem
void destroy ()
 
virtual void init ()
 
bool backendInitialized () const
 
virtual void engineInit ()
 
virtual void engineDone ()
 
virtual void taskStarted (Task)
 
virtual void taskFinished (Task)
 
virtual void updateStartSettings (const Common::String &executable, Common::String &command, Common::StringMap &startSettings, Common::StringArray &additionalArgs)
 
bool setGraphicsMode (const char *name)
 
Graphics::PixelFormat getScreenFormat () const
 
Common::List< Graphics::PixelFormatgetSupportedFormats () const
 
virtual Common::Array< uint > getSupportedAntiAliasingLevels () const
 
virtual OpenGL::ContextType getOpenGLType () const
 
bool setStretchMode (const char *name)
 
virtual uint32 getDoubleClickTime () const
 
virtual uint32 getMillis (bool skipRecord=false)=0
 
virtual void delayMillis (uint msecs)=0
 
virtual void getTimeAndDate (TimeDate &td, bool skipRecord=false) const =0
 
virtual Common::TimerManagergetTimerManager ()
 
Common::EventManagergetEventManager ()
 
virtual Common::HardwareInputSetgetHardwareInputSet ()
 
virtual Common::KeymapArray getGlobalKeymaps ()
 
virtual Common::KeymapperDefaultBindingsgetKeymapperDefaultBindings ()
 
virtual Common::MutexInternalcreateMutex ()=0
 
virtual Audio::MixergetMixer ()=0
 
AudioCDManagergetAudioCDManager ()
 
virtual void quit ()=0
 
virtual void fatalError ()
 
virtual void setWindowCaption (const Common::U32String &caption)
 
virtual Common::SaveFileManagergetSavefileManager ()
 
virtual Common::TextToSpeechManagergetTextToSpeechManager ()
 
virtual Common::DialogManagergetDialogManager ()
 
virtual DLC::StoregetDLCStore ()
 
virtual FilesystemFactorygetFilesystemFactory ()
 
virtual void addSysArchivesToSearchSet (Common::SearchSet &s, int priority=0)
 
virtual Common::SeekableReadStreamcreateConfigReadStream ()
 
virtual Common::WriteStreamcreateConfigWriteStream ()
 
virtual Common::Path getDefaultConfigFileName ()
 
virtual Common::Path getDefaultLogFileName ()
 
virtual void registerDefaultSettings (const Common::String &target) const
 
virtual GUI::OptionsContainerWidgetbuildBackendOptionsWidget (GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const
 
virtual const char *const * buildHelpDialogData ()
 
virtual void applyBackendSettings ()
 
virtual void logMessage (LogMessageType::Type type, const char *message)=0
 
virtual void messageBox (LogMessageType::Type type, const char *message)
 
virtual bool displayLogFile ()
 
virtual bool hasTextInClipboard ()
 
virtual Common::U32String getTextFromClipboard ()
 
virtual bool setTextInClipboard (const Common::U32String &text)
 
virtual bool openUrl (const Common::String &url)
 
virtual Common::String getSystemLanguage () const
 
virtual bool isConnectionLimited ()
 

Protected Attributes

Managers variables
GraphicsManager_graphicsManager
 
- Protected Attributes inherited from OSystem
AudioCDManager_audiocdManager
 
Common::EventManager_eventManager
 
Common::TimerManager_timerManager
 
Common::SaveFileManager_savefileManager
 
Common::TextToSpeechManager_textToSpeechManager
 
Common::DialogManager_dialogManager
 
FilesystemFactory_fsFactory
 
DLC::Store_dlcStore
 
Common::U32String _clipboard
 
bool _dummyUnused
 

Additional Inherited Members

- Public Types inherited from OSystem
enum  Task { kLocalServer, kCloudDownload, kDataPackDownload }
 
enum  Feature {
  kFeatureFullscreenMode, kFeatureAspectRatioCorrection, kFeatureFilteringMode, kFeatureStretchMode,
  kFeatureVirtualKeyboard, kFeatureCursorPalette, kFeatureCursorAlpha, kFeatureCursorMask,
  kFeatureCursorMaskInvert, kFeatureCursorMaskPaletteXorColorXnor, kFeatureOverlaySupportsAlpha, kFeatureIconifyWindow,
  kFeatureOpenGLForGame, kFeatureShadersForGame, kFeatureVSync, kFeatureFullscreenToggleKeepsContext,
  kFeatureDisplayLogFile, kFeatureClipboardSupport, kFeatureOpenUrl, kFeatureTouchpadMode,
  kFeatureKbdMouseSpeed, kFeatureJoystickDeadzone, kFeatureScalers, kFeatureShaders,
  kFeatureDLC, kFeatureSystemBrowserDialog, kFeatureNoQuit, kFeatureTouchscreen,
  kFeatureCpuNEON, kFeatureCpuSSE2, kFeatureCpuSSE41, kFeatureCpuAVX2,
  kFeatureCpuAltivec, kFeatureRotationMode
}
 
enum  GfxModeFlags { kGfxModeNoFlags = 0, kGfxModeRender3d = (1 << 0) }
 
enum  TransactionError {
  kTransactionSuccess = 0, kTransactionAspectRatioFailed = (1 << 0), kTransactionFullscreenFailed = (1 << 1), kTransactionModeSwitchFailed = (1 << 2),
  kTransactionSizeChangeFailed = (1 << 3), kTransactionFormatNotSupported = (1 << 4), kTransactionFilteringFailed = (1 << 5), kTransactionStretchModeSwitchFailed = (1 << 6),
  kTransactionShaderChangeFailed = (1 << 7), kTransactionVSyncFailed = (1 << 8)
}
 

Detailed Description

Base classes for modular backends.

They wrap most functions to their manager equivalent, but not all OSystem functions are implemented here.

A backend derivated from these classes, will need to implement these functions on its own: OSystem::pollEvent() OSystem::createMutex() OSystem::getMillis() OSystem::delayMillis() OSystem::getTimeAndDate() OSystem::quit()

And, it should also initialize all the managers variables declared in this class, or override their related functions.

Member Function Documentation

◆ hasFeature()

bool ModularGraphicsBackend::hasFeature ( Feature  f)
overridevirtual

◆ setFeatureState()

void ModularGraphicsBackend::setFeatureState ( Feature  f,
bool  enable 
)
overridevirtual

Enable or disable the specified feature.

For example, this may be used to enable fullscreen mode or to deactivate aspect correction, etc.

Reimplemented from OSystem.

Reimplemented in OSystem_Android, OSystem_iOS7, OSystem_SDL, OSystem_SDL_Miyoo, OSystem_SDL_Opendingux, and OSystem_Emscripten.

◆ getFeatureState()

bool ModularGraphicsBackend::getFeatureState ( Feature  f)
overridevirtual

Query the state of the specified feature.

For example, test whether fullscreen mode is active or not.

Reimplemented from OSystem.

Reimplemented in OSystem_Android, OSystem_iOS7, OSystem_SDL, OSystem_SDL_Miyoo, OSystem_SDL_Opendingux, and OSystem_Emscripten.

◆ getSupportedGraphicsModes()

const GraphicsMode* ModularGraphicsBackend::getSupportedGraphicsModes ( void  ) const
overridevirtual

Retrieve a list of all graphics modes supported by this backend.

This can be both video modes as well as graphic filters/scalers. It is completely up to the backend maintainer to decide what is appropriate here and what not. The list is terminated by an all-zero entry.

Returns
List of supported graphics modes.

Reimplemented from OSystem.

Reimplemented in OSystem_Android.

◆ getDefaultGraphicsMode()

int ModularGraphicsBackend::getDefaultGraphicsMode ( ) const
overridevirtual

Return the ID of the 'default' graphics mode. What exactly this means is up to the backend. This mode is set by the client code when no user overrides are present (i.e. if no custom graphics mode is selected using the command line or a config file).

Returns
ID of the 'default' graphics mode.

Reimplemented from OSystem.

Reimplemented in OSystem_Android.

◆ setGraphicsMode()

bool ModularGraphicsBackend::setGraphicsMode ( int  mode,
uint  flags = kGfxModeNoFlags 
)
overridevirtual

Switch to the specified graphics mode.

If switching to the new mode fails, this method returns false.

The flag 'kGfxModeRender3d' is optional. It allows to switch to 3D-only rendering mode. In this mode, the game engine is allowed to use OpenGL(ES) directly.

Parameters
modeID of the new graphics mode.
flagsFlags for the new graphics mode.
Returns
True if the switch was successful, false otherwise.

Reimplemented from OSystem.

Reimplemented in OSystem_Android, and OSystem_iOS7.

◆ getGraphicsMode()

int ModularGraphicsBackend::getGraphicsMode ( ) const
overridevirtual

Determine which graphics mode is currently active.

Returns
ID of the active graphics mode.

Reimplemented from OSystem.

Reimplemented in OSystem_Android.

◆ setShader()

bool ModularGraphicsBackend::setShader ( const Common::Path fileName)
finaloverridevirtual

Load the specified shader.

If loading the new shader fails, this method returns false.

Parameters
fileNodeFile node of the new shader.
Returns
True if the switch was successful, false otherwise.

Reimplemented from OSystem.

◆ getSupportedStretchModes()

const GraphicsMode* ModularGraphicsBackend::getSupportedStretchModes ( ) const
finaloverridevirtual

Retrieve a list of all stretch modes supported by this backend.

It is completely up to the backend maintainer to decide what is appropriate here and what not. The list is terminated by an all-zero entry.

Returns
a list of supported stretch modes

Reimplemented from OSystem.

◆ getDefaultStretchMode()

int ModularGraphicsBackend::getDefaultStretchMode ( ) const
finaloverridevirtual

Return the ID of the 'default' stretch mode.

What exactly this means is up to the backend. This mode is set by the client code when no user overrides are present (i.e. if no custom stretch mode is selected using the command line or a config file).

Returns
ID of the 'default' graphics mode.

Reimplemented from OSystem.

◆ setStretchMode()

bool ModularGraphicsBackend::setStretchMode ( int  mode)
finaloverridevirtual

Switch to the specified stretch mode.

If switching to the new mode fails, this method returns false.

Parameters
modeID of the new graphics mode.
Returns
True if the switch was successful, false otherwise.

Reimplemented from OSystem.

◆ getStretchMode()

int ModularGraphicsBackend::getStretchMode ( ) const
finaloverridevirtual

Determine which stretch mode is currently active.

Returns
ID of the active stretch mode.

Reimplemented from OSystem.

◆ getDefaultScaler()

uint ModularGraphicsBackend::getDefaultScaler ( ) const
finaloverridevirtual

Return the ID of the 'default' scaler.

This mode is set by the client code when no user overrides are present (i.e. if no custom scaler is selected using the command line or a config file).

Returns
ID of the 'default' scaler.

Reimplemented from OSystem.

◆ getDefaultScaleFactor()

uint ModularGraphicsBackend::getDefaultScaleFactor ( ) const
finaloverridevirtual

Return the 'default' scale factor.

This mode is set by the client code when no user overrides are present (i.e. if no custom scaler is selected using the command line or a config file).

Returns
The 'default' scale factor.

Reimplemented from OSystem.

◆ setScaler()

bool ModularGraphicsBackend::setScaler ( uint  mode,
int  factor 
)
finaloverridevirtual

Switch to the specified scaler.

If switching to the new mode fails, this method returns false.

Parameters
modeID of the new scaler.
factorThe scale factor to use
Returns
True if the switch was successful, false otherwise.

Reimplemented from OSystem.

◆ getScaler()

uint ModularGraphicsBackend::getScaler ( ) const
finaloverridevirtual

Determine which scaler is currently active.

Returns
ID of the active stretch mode.

Reimplemented from OSystem.

◆ getScaleFactor()

uint ModularGraphicsBackend::getScaleFactor ( ) const
finaloverridevirtual

Determine which scale factor is currently active.

Returns
The active scale factor.

Reimplemented from OSystem.

◆ initSize()

void ModularGraphicsBackend::initSize ( uint  width,
uint  height,
const Graphics::PixelFormat format = NULL 
)
finaloverridevirtual

Set the size and color format of the virtual screen.

Typical sizes include:

  • 320x200 (e.g. for most SCUMM games, and Simon)
  • 320x240 (e.g. for FM-TOWN SCUMM games)
  • 640x480 (e.g. for Curse of Monkey Island)

This is the resolution for which the client code generates data. This is not necessarily equal to the actual display size. For example, a backend may magnify the graphics to fit on the screen (see also the GraphicsMode), stretch the data to perform aspect ratio correction, or shrink it to fit on small screens (in cell phones).

Typical formats include:

  • CLUT8 (e.g. 256 color, for most games)
  • RGB555 (e.g. 16-bit color, for later SCUMM HE games)
  • RGB565 (e.g. 16-bit color, for Urban Runner)

This is the pixel format for which the client code generates data. It is not necessarily equal to the hardware pixel format. For example, a backend may perform color lookup of 8-bit graphics before pushing a screen to hardware, or correct the ARGB color order.

Parameters
widthNew virtual screen width.
heightNew virtual screen height.
formatNew virtual screen pixel format.

Implements OSystem.

◆ initSizeHint()

void ModularGraphicsBackend::initSizeHint ( const Graphics::ModeList modes)
finaloverridevirtual

Send a list of graphics modes to the backend so it can make a decision about the best way to set up the display hardware.

Engines that switch between different virtual screen sizes during a game should call this function prior to any call to initSize. Engines that use only a single screen size do not need to call this function.

Parameters
modesList of graphics modes the engine will probably use.

Reimplemented from OSystem.

◆ getScreenChangeID()

int ModularGraphicsBackend::getScreenChangeID ( ) const
finaloverridevirtual

Return an int value that is changed whenever any screen parameters (like the resolution) change, i.e. whenever EVENT_SCREEN_CHANGED is sent.

You can track this value in your code to detect screen changes in case you do not have full control over the event loop(s) being used (like the GUI code).

Returns
Integer that can be used to track screen changes.
Note
Backends that generate EVENT_SCREEN_CHANGED events must overload this method appropriately.

Reimplemented from OSystem.

◆ beginGFXTransaction()

void ModularGraphicsBackend::beginGFXTransaction ( )
finaloverridevirtual

Begin a new GFX transaction, which is a sequence of GFX mode changes.

The idea behind GFX transactions is to make it possible to activate several different GFX changes at once as a "batch" operation. For example, assume we are running in 320x200 with a 2x scaler (thus using 640x400 pixels in total). Now, we want to switch to 640x400 with the 1x scaler. Without transactions, we have to choose whether we want to first switch the scaler mode, or first to 640x400 mode. In either case, depending on the backend implementation, problems may occur. For example, the window might briefly switch to 320x200 or 1280x800. Using transactions, this can be avoided.

Note
Transaction support is optional, and the default implementations of the relevant methods simply do nothing.
See also
endGFXTransaction

Reimplemented from OSystem.

◆ endGFXTransaction()

OSystem::TransactionError ModularGraphicsBackend::endGFXTransaction ( )
finaloverridevirtual

End (and thereby commit) the current GFX transaction.

See also
beginGFXTransaction
kTransactionError
Returns
ORed combination of TransactionError values or 0 on success.

Reimplemented from OSystem.

◆ getHeight()

int16 ModularGraphicsBackend::getHeight ( )
finaloverridevirtual

Return the currently set virtual screen height.

See also
initSize
Returns
Currently set virtual screen height.

Implements OSystem.

◆ getWidth()

int16 ModularGraphicsBackend::getWidth ( )
finaloverridevirtual

Return the currently set virtual screen width.

See also
initSize
Returns
Currently set virtual screen width.

Implements OSystem.

◆ getPaletteManager()

PaletteManager* ModularGraphicsBackend::getPaletteManager ( )
finaloverridevirtual

Return the palette manager singleton.

For more information, see PaletteManager.

Implements OSystem.

◆ copyRectToScreen()

void ModularGraphicsBackend::copyRectToScreen ( const void *  buf,
int  pitch,
int  x,
int  y,
int  w,
int  h 
)
finaloverridevirtual

Blit a bitmap to the virtual screen.

The real screen will not immediately be updated to reflect the changes. Client code must call updateScreen to ensure any changes are visible to the user. This can be used to optimize drawing and reduce flicker.

If the current pixel format has one byte per pixel, the graphics data uses 8 bits per pixel, using the palette specified via setPalette. If more than one byte per pixel is in use, the graphics data uses the pixel format returned by getScreenFormat.

Parameters
bufBuffer containing the graphics data source.
pitchPitch of the buffer (number of bytes in a scanline).
xx coordinate of the destination rectangle.
yy coordinate of the destination rectangle.
wWidth of the destination rectangle.
hHeight of the destination rectangle.
Note
The specified destination rectangle must be completly contained in the visible screen space, and must be non-empty. If not, a backend may or may not perform clipping, trigger an assert, or silently corrupt memory.
See also
updateScreen
getScreenFormat

Implements OSystem.

◆ lockScreen()

Graphics::Surface* ModularGraphicsBackend::lockScreen ( )
finaloverridevirtual

Lock the active screen framebuffer and return a Graphics::Surface representing it.

The caller can then perform arbitrary graphics transformations on the framebuffer (blitting, scrolling, etc.). Must be followed by a matching call to unlockScreen(). Code that is calling this should make sure to only lock the framebuffer for the shortest time possible, as the whole system is potentially stalled while the lock is active.

Returns
0 if an error occurs. Otherwise, a surface with the pixel format described by getScreenFormat is returned.

The returned surface must not be deleted by the client code.

See also
getScreenFormat

Implements OSystem.

◆ unlockScreen()

void ModularGraphicsBackend::unlockScreen ( )
finaloverridevirtual

Unlock the screen framebuffer, and mark it as dirty, i.e. during the next updateScreen() call, the whole screen will be updated.

Implements OSystem.

◆ fillScreen() [1/2]

void ModularGraphicsBackend::fillScreen ( uint32  col)
finaloverridevirtual

Fill the screen with the given color value.

Reimplemented from BaseBackend.

◆ fillScreen() [2/2]

void ModularGraphicsBackend::fillScreen ( const Common::Rect r,
uint32  col 
)
finaloverridevirtual

Fill the specified area of the screen with the given color value.

Reimplemented from BaseBackend.

◆ updateScreen()

void ModularGraphicsBackend::updateScreen ( )
finaloverridevirtual

Flush the whole screen, i.e. render the current content of the screen framebuffer to the display.

This method may be called very often by engines. Backends are hence supposed to only perform any redrawing if it is necessary and otherwise return immediately. See https://wiki.scummvm.org/index.php/HOWTO-Backends#updateScreen.28.29_method

Implements OSystem.

◆ setShakePos()

void ModularGraphicsBackend::setShakePos ( int  shakeXOffset,
int  shakeYOffset 
)
finaloverridevirtual

Set current shake position, a feature needed for screen effects in some engines.

The effect causes the displayed graphics to be shifted downwards and rightwards by the specified offsets (the offsets can be negative to shift upwards or leftwards). The area at the border of the screen which is moved into view by this (for example at the bottom when moving upward) is filled with black. This does not cause any graphic data to be lost. To restore the original view, the game engine only has to call this method again with offset equal to zero. No calls to copyRectToScreen are necessary.

Parameters
shakeXOffsetShake x offset.
shakeYOffsetShake y offset.
Note
This is currently used in the SCUMM, QUEEN, KYRA, SCI, DREAMWEB, SUPERNOVA, TEENAGENT, TOLTECS, ULTIMA, and PETKA engines.

Implements OSystem.

◆ setFocusRectangle()

void ModularGraphicsBackend::setFocusRectangle ( const Common::Rect rect)
finaloverridevirtual

Set the area of the screen that has the focus.

For example, when a character is speaking, they will have the focus. This allows for pan-and-scan style views where the backend can follow the speaking character or area of interest on the screen.

The backend is responsible for clipping the rectangle and deciding how best to zoom the screen to show any shape and size rectangle the engine provides.

Parameters
rectRectangle on the screen to be focused on.
See also
clearFocusRectangle

Reimplemented from OSystem.

◆ clearFocusRectangle()

void ModularGraphicsBackend::clearFocusRectangle ( )
finaloverridevirtual

Clear the focus set by a call to setFocusRectangle().

This allows the engine to clear the focus when no particular area of the screen has the focus.

See also
setFocusRectangle

Reimplemented from OSystem.

◆ showOverlay()

void ModularGraphicsBackend::showOverlay ( bool  inGUI)
finaloverridevirtual

Activate the overlay mode.

Implements OSystem.

◆ hideOverlay()

void ModularGraphicsBackend::hideOverlay ( )
finaloverridevirtual

Deactivate the overlay mode.

Implements OSystem.

◆ isOverlayVisible()

bool ModularGraphicsBackend::isOverlayVisible ( ) const
finaloverridevirtual

Return true if the overlay mode is activated, false otherwise.

Implements OSystem.

◆ getOverlayFormat()

Graphics::PixelFormat ModularGraphicsBackend::getOverlayFormat ( ) const
finaloverridevirtual

Return the pixel format description of the overlay.

See also
Graphics::PixelFormat

Implements OSystem.

◆ clearOverlay()

void ModularGraphicsBackend::clearOverlay ( )
finaloverridevirtual

Reset the overlay.

After calling this method while the overlay mode is active, the user should be seeing only the game graphics. How this is achieved depends on how the backend implements the overlay. It either sets all pixels of the overlay to be transparent (when alpha blending is used) or, in case of fake alpha blending, it might just put a copy of the current game graphics screen into the overlay.

Implements OSystem.

◆ grabOverlay()

void ModularGraphicsBackend::grabOverlay ( Graphics::Surface surface)
finaloverridevirtual

Copy the content of the overlay into a surface provided by the caller.

This is only used to implement fake alpha blending.

Implements OSystem.

◆ copyRectToOverlay()

void ModularGraphicsBackend::copyRectToOverlay ( const void *  buf,
int  pitch,
int  x,
int  y,
int  w,
int  h 
)
finaloverridevirtual

Blit a graphics buffer to the overlay.

In a sense, this is the reverse of grabOverlay.

Parameters
bufBuffer containing the graphics data source.
pitchPitch of the buffer (number of bytes in a scanline).
xx coordinate of the destination rectangle.
yy coordinate of the destination rectangle.
wWidth of the destination rectangle.
hHeight of the destination rectangle.
See also
copyRectToScreen
grabOverlay

Implements OSystem.

◆ getOverlayHeight()

int16 ModularGraphicsBackend::getOverlayHeight ( )
finaloverridevirtual

Return the height of the overlay.

See also
getHeight

Implements OSystem.

◆ getOverlayWidth()

int16 ModularGraphicsBackend::getOverlayWidth ( )
finaloverridevirtual

Return the width of the overlay.

See also
getWidth

Implements OSystem.

◆ getHiDPIScreenFactor()

float ModularGraphicsBackend::getHiDPIScreenFactor ( ) const
finaloverridevirtual

Return the scale factor for HiDPI screens. Returns 1 for non-HiDPI screens, or if HiDPI display is not supported by the backend.

Reimplemented from OSystem.

◆ showMouse()

bool ModularGraphicsBackend::showMouse ( bool  visible)
finaloverridevirtual

Show or hide the mouse cursor.

Currently, the backend is not required to immediately draw the mouse cursor on showMouse(true).

See also
Graphics::CursorManager::showMouse

Implements OSystem.

◆ warpMouse()

void ModularGraphicsBackend::warpMouse ( int  x,
int  y 
)
finaloverridevirtual

Move ("warp") the mouse cursor to the specified position in virtual screen coordinates.

Parameters
xNew x position of the mouse.
yNew y position of the mouse.

Implements OSystem.

◆ setMouseCursor()

void ModularGraphicsBackend::setMouseCursor ( const void *  buf,
uint  w,
uint  h,
int  hotspotX,
int  hotspotY,
uint32  keycolor,
bool  dontScale = false,
const Graphics::PixelFormat format = NULL,
const byte *  mask = NULL 
)
finaloverridevirtual

Set the bitmap used for drawing the cursor.

Parameters
bufPixmap data to be used.
wWidth of the mouse cursor.
hHeight of the mouse cursor.
hotspotXHorizontal offset from the left side to the hotspot.
hotspotYVertical offset from the top side to the hotspot.
keycolorTransparency color value. This should not exceed the maximum color value of the specified format. In case it does, the behavior is undefined. The backend might just error out or simply ignore the value. (The SDL backend will just assert to prevent abuse of this). This parameter does nothing if a mask is provided.
dontScaleWhether the cursor should never be scaled. An exception is high ppi displays, where the cursor might be too small to notice otherwise, these are allowed to scale the cursor anyway.
formatPointer to the pixel format that the cursor graphic uses (0 means CLUT8).
maskA mask containing values from the CursorMaskValue enum for each cursor pixel.

Implements OSystem.

◆ setCursorPalette()

void ModularGraphicsBackend::setCursorPalette ( const byte *  colors,
uint  start,
uint  num 
)
finaloverridevirtual

Replace the specified range of cursor palette with new colors.

The palette entries from 'start' till (start+num-1) will be replaced - so a full palette update is accomplished via start=0, num=256.

Backends which implement this should have the kFeatureCursorPalette flag set.

See also
setPalette
kFeatureCursorPalette

Reimplemented from OSystem.

◆ lockMouse()

bool ModularGraphicsBackend::lockMouse ( bool  lock)
finaloverridevirtual

Lock or unlock the mouse cursor within the window.

Reimplemented from OSystem.

◆ displayMessageOnOSD()

void ModularGraphicsBackend::displayMessageOnOSD ( const Common::U32String msg)
finaloverridevirtual

Display a message in an 'on-screen display'.

Displays a message in such a way that it is visible on or near the screen, for example in a transparent rectangle over the regular screen content, or in a message box beneath it.

The message is expected to be provided in the current TranslationManager charset.

Note
There is a default implementation in BaseBackend that uses a TimedMessageDialog to display the message. Hence, implementing this is optional.
Parameters
msgThe message to display on the screen.

Reimplemented from BaseBackend.

◆ displayActivityIconOnOSD()

void ModularGraphicsBackend::displayActivityIconOnOSD ( const Graphics::Surface icon)
finaloverridevirtual

Display an icon that indicates background activity.

The icon is displayed in an 'on-screen display'. It is visible above the regular screen content or near it.

The caller keeps ownership of the icon. It is acceptable to free the surface just after the call.

There is no preferred pixel format for the icon. The backend should convert its copy of the icon to an appropriate format.

The caller must call this method again with a null pointer as a parameter to indicate the icon should no longer be displayed.

Parameters
iconThe icon to display on the screen.

Reimplemented from BaseBackend.

◆ saveScreenshot()

void ModularGraphicsBackend::saveScreenshot ( )
finaloverridevirtual

Instruct the backend to capture a screenshot of the current screen.

The backend can persist it the way it considers appropriate.

Reimplemented from OSystem.


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