ScummVM API documentation
WindowedGraphicsManager Class Referenceabstract
Inheritance diagram for WindowedGraphicsManager:
GraphicsManager PaletteManager Common::NonCopyable OpenGL::OpenGLGraphicsManager SdlGraphicsManager AndroidGraphicsManager iOSGraphicsManager OpenGLSdlGraphicsManager OpenGLSdlGraphicsManager SurfaceSdlGraphicsManager MiyooMiniGraphicsManager OpenDinguxGraphicsManager OPGraphicsManager RISCOSSdlGraphicsManager

Classes

struct  DisplayArea
 

Public Member Functions

void showOverlay (bool inGUI) override
 
void hideOverlay () override
 
bool isOverlayVisible () const override
 
void setShakePos (int shakeXOffset, int shakeYOffset) override
 
int getWindowWidth () const
 
int getWindowHeight () const
 
- Public Member Functions inherited from GraphicsManager
virtual bool hasFeature (OSystem::Feature f) const =0
 
virtual void setFeatureState (OSystem::Feature f, bool enable)=0
 
virtual bool getFeatureState (OSystem::Feature f) const =0
 
virtual const OSystem::GraphicsModegetSupportedGraphicsModes () const
 
virtual int getDefaultGraphicsMode () const
 
virtual bool setGraphicsMode (int mode, uint flags=OSystem::kGfxModeNoFlags)
 
virtual int getGraphicsMode () const
 
virtual bool setShader (const Common::Path &fileName)
 
virtual const OSystem::GraphicsModegetSupportedStretchModes () const
 
virtual int getDefaultStretchMode () const
 
virtual bool setStretchMode (int mode)
 
virtual int getStretchMode () const
 
virtual uint getDefaultScaler () const
 
virtual uint getDefaultScaleFactor () const
 
virtual bool setScaler (uint mode, int factor)
 
virtual uint getScaler () const
 
virtual uint getScaleFactor () const
 
virtual void initSize (uint width, uint height, const Graphics::PixelFormat *format=NULL)=0
 
virtual void initSizeHint (const Graphics::ModeList &modes)
 
virtual int getScreenChangeID () const =0
 
virtual void beginGFXTransaction ()=0
 
virtual OSystem::TransactionError endGFXTransaction ()=0
 
virtual int16 getHeight () const =0
 
virtual int16 getWidth () const =0
 
virtual void setPalette (const byte *colors, uint start, uint num)=0
 
virtual void grabPalette (byte *colors, uint start, uint num) const =0
 
virtual void copyRectToScreen (const void *buf, int pitch, int x, int y, int w, int h)=0
 
virtual Graphics::SurfacelockScreen ()=0
 
virtual void unlockScreen ()=0
 
virtual void fillScreen (uint32 col)=0
 
virtual void fillScreen (const Common::Rect &r, uint32 col)=0
 
virtual void updateScreen ()=0
 
virtual void setFocusRectangle (const Common::Rect &rect)=0
 
virtual void clearFocusRectangle ()=0
 
virtual Graphics::PixelFormat getOverlayFormat () const =0
 
virtual void clearOverlay ()=0
 
virtual void grabOverlay (Graphics::Surface &surface) const =0
 
virtual void copyRectToOverlay (const void *buf, int pitch, int x, int y, int w, int h)=0
 
virtual int16 getOverlayHeight () const =0
 
virtual int16 getOverlayWidth () const =0
 
virtual float getHiDPIScreenFactor () const
 
virtual void setMouseCursor (const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale=false, const Graphics::PixelFormat *format=nullptr, const byte *mask=nullptr)=0
 
virtual void setCursorPalette (const byte *colors, uint start, uint num)=0
 
virtual void displayMessageOnOSD (const Common::U32String &msg)
 
virtual void displayActivityIconOnOSD (const Graphics::Surface *icon)
 
virtual void saveScreenshot ()
 
virtual bool lockMouse (bool lock)
 

Protected Member Functions

virtual bool gameNeedsAspectRatioCorrection () const =0
 
virtual void handleResizeImpl (const int width, const int height)=0
 
Common::Point convertVirtualToWindow (const int x, const int y) const
 
Common::Point convertWindowToVirtual (int x, int y) const
 
frac_t getDesiredGameAspectRatio () const
 
virtual int getGameRenderScale () const
 
void handleResize (const int width, const int height)
 
virtual void recalculateDisplayAreas ()
 
virtual void setSystemMousePosition (const int x, const int y)=0
 
virtual void notifyActiveAreaChanged ()
 
bool showMouse (bool visible) override
 
void warpMouse (int x, int y) override
 
void setMousePosition (int x, int y)
 

Protected Attributes

int _windowWidth
 
int _windowHeight
 
int _screenAlign
 
bool _overlayVisible
 
bool _overlayInGUI
 
int _gameScreenShakeXOffset
 
int _gameScreenShakeYOffset
 
Common::Rect _gameDrawRect
 
Common::Rect _overlayDrawRect
 
DisplayArea _activeArea
 
bool _forceRedraw
 
bool _cursorVisible
 
bool _cursorNeedsRedraw
 
bool _cursorLastInActiveArea
 
int _cursorX
 
int _cursorY
 

Member Function Documentation

◆ gameNeedsAspectRatioCorrection()

virtual bool WindowedGraphicsManager::gameNeedsAspectRatioCorrection ( ) const
protectedpure virtual
Returns
whether or not the game screen must have aspect ratio correction applied for correct rendering.

Implemented in OpenGL::OpenGLGraphicsManager, and SurfaceSdlGraphicsManager.

◆ handleResizeImpl()

virtual void WindowedGraphicsManager::handleResizeImpl ( const int  width,
const int  height 
)
protectedpure virtual

Backend-specific implementation for updating internal surfaces that need to reflect the new window size.

Implemented in OpenGL::OpenGLGraphicsManager, SdlGraphicsManager, SurfaceSdlGraphicsManager, and OpenGLSdlGraphicsManager.

◆ convertVirtualToWindow()

Common::Point WindowedGraphicsManager::convertVirtualToWindow ( const int  x,
const int  y 
) const
inlineprotected

Converts the given point from the active virtual screen's coordinate space to the window's coordinate space (i.e. game-to-window or overlay-to-window).

◆ convertWindowToVirtual()

Common::Point WindowedGraphicsManager::convertWindowToVirtual ( int  x,
int  y 
) const
inlineprotected

Converts the given point from the window's coordinate space to the active virtual screen's coordinate space (i.e. window-to-game or window-to-overlay).

◆ getDesiredGameAspectRatio()

frac_t WindowedGraphicsManager::getDesiredGameAspectRatio ( ) const
inlineprotected
Returns
the desired aspect ratio of the game surface.

◆ getGameRenderScale()

virtual int WindowedGraphicsManager::getGameRenderScale ( ) const
inlineprotectedvirtual
Returns
the scale used between the game size and the surface on which it is rendered.

Reimplemented in OpenGL::OpenGLGraphicsManager, and SurfaceSdlGraphicsManager.

◆ handleResize()

void WindowedGraphicsManager::handleResize ( const int  width,
const int  height 
)
inlineprotected

Called after the window has been updated with new dimensions.

Parameters
widthThe new width of the window, excluding window decoration.
heightThe new height of the window, excluding window decoration.

◆ recalculateDisplayAreas()

virtual void WindowedGraphicsManager::recalculateDisplayAreas ( )
inlineprotectedvirtual

Recalculates the display areas for the game and overlay surfaces within the window.

Reimplemented in OpenGL::OpenGLGraphicsManager.

◆ setSystemMousePosition()

virtual void WindowedGraphicsManager::setSystemMousePosition ( const int  x,
const int  y 
)
protectedpure virtual

Sets the position of the hardware mouse cursor in the host system, relative to the window.

Parameters
xX coordinate in window coordinates.
yY coordinate in window coordinates.

Implemented in SdlGraphicsManager, AndroidGraphicsManager, and iOSGraphicsManager.

◆ notifyActiveAreaChanged()

virtual void WindowedGraphicsManager::notifyActiveAreaChanged ( )
inlineprotectedvirtual

Called whenever the active area has changed.

Reimplemented in SdlGraphicsManager.

◆ warpMouse()

void WindowedGraphicsManager::warpMouse ( int  x,
int  y 
)
inlineoverrideprotectedvirtual

Move ("warp") the mouse cursor to the specified position.

Parameters
xThe new X position of the mouse in virtual screen coordinates.
yThe new Y position of the mouse in virtual screen coordinates.

Implements GraphicsManager.

◆ setMousePosition()

void WindowedGraphicsManager::setMousePosition ( int  x,
int  y 
)
inlineprotected

Sets the position of the rendered mouse cursor in the window.

Parameters
xX coordinate in window coordinates.
yY coordinate in window coordinates.

Member Data Documentation

◆ _windowWidth

int WindowedGraphicsManager::_windowWidth
protected

The width of the window, excluding window decoration.

◆ _windowHeight

int WindowedGraphicsManager::_windowHeight
protected

The height of the window, excluding window decoration.

◆ _screenAlign

int WindowedGraphicsManager::_screenAlign
protected

How the overlay and game screens are aligned in the window. Centered vertically and horizontally by default.

◆ _overlayVisible

bool WindowedGraphicsManager::_overlayVisible
protected

Whether the overlay (i.e. launcher, including the out-of-game launcher) is visible or not.

◆ _overlayInGUI

bool WindowedGraphicsManager::_overlayInGUI
protected

Whether when overlay is shown, mouse coordinates depend on window or game screen size

◆ _gameScreenShakeXOffset

int WindowedGraphicsManager::_gameScreenShakeXOffset
protected

The offset by which the screen is moved horizontally.

◆ _gameScreenShakeYOffset

int WindowedGraphicsManager::_gameScreenShakeYOffset
protected

The offset by which the screen is moved vertically.

◆ _gameDrawRect

Common::Rect WindowedGraphicsManager::_gameDrawRect
protected

The scaled draw rectangle for the game surface within the window.

◆ _overlayDrawRect

Common::Rect WindowedGraphicsManager::_overlayDrawRect
protected

The scaled draw rectangle for the overlay (launcher) surface within the window.

◆ _activeArea

DisplayArea WindowedGraphicsManager::_activeArea
protected

Display area information about the currently active virtual screen. This will be the overlay screen when the overlay is active, and the game screen otherwise.

◆ _forceRedraw

bool WindowedGraphicsManager::_forceRedraw
protected

Whether the screen must be redrawn on the next frame.

◆ _cursorVisible

bool WindowedGraphicsManager::_cursorVisible
protected

Whether the cursor is actually visible.

◆ _cursorNeedsRedraw

bool WindowedGraphicsManager::_cursorNeedsRedraw
protected

Whether the mouse cursor needs to be redrawn on the next frame.

◆ _cursorLastInActiveArea

bool WindowedGraphicsManager::_cursorLastInActiveArea
protected

Whether the last position of the system cursor was within the active area of the window.

◆ _cursorX

int WindowedGraphicsManager::_cursorX
protected

The position of the mouse cursor, in window coordinates.


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