#include <sdl-graphics.h>
Classes | |
struct | State |
Public Member Functions | |
SdlGraphicsManager (SdlEventSource *source, SdlWindow *window) | |
virtual void | activateManager () |
virtual void | deactivateManager () |
virtual void | notifyVideoExpose ()=0 |
virtual void | notifyResize (const int width, const int height) |
virtual bool | notifyMousePosition (Common::Point &mouse) |
Common::RotationMode | getRotationMode () const override |
virtual bool | showMouse (bool visible) override |
bool | lockMouse (bool lock) override |
virtual bool | saveScreenshot (const Common::Path &filename) const |
void | saveScreenshot () override |
bool | notifyEvent (const Common::Event &event) override |
State | getState () const |
bool | setState (const State &state) |
SdlWindow * | getWindow () const |
void | initSizeHint (const Graphics::ModeList &modes) override |
Common::Keymap * | getKeymap () |
Public Member Functions inherited from WindowedGraphicsManager | |
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::GraphicsMode * | getSupportedGraphicsModes () 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::GraphicsMode * | getSupportedStretchModes () 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 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::Surface * | lockScreen ()=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) |
Public Member Functions inherited from PaletteManager | |
void | setPalette (const Graphics::Palette &pal, uint start=0) |
Graphics::Palette | grabPalette (uint start, uint num) |
Public Member Functions inherited from Common::EventObserver | |
virtual void | notifyPoll () |
Protected Member Functions | |
Common::Rect | getPreferredFullscreenResolution () |
bool | defaultGraphicsModeConfig () const |
void | getWindowSizeFromSdl (int *width, int *height) const |
virtual void | showSystemMouseCursor (bool visible) |
void | setSystemMousePosition (const int x, const int y) override |
void | notifyActiveAreaChanged () override |
void | handleResizeImpl (const int width, const int height) override |
Protected Member Functions inherited from WindowedGraphicsManager | |
virtual bool | gameNeedsAspectRatioCorrection () const =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 () |
bool | showMouse (bool visible) override |
void | warpMouse (int x, int y) override |
void | setMousePosition (int x, int y) |
Protected Attributes | |
SDL_Surface * | _hwScreen |
SdlEventSource * | _eventSource |
SdlWindow * | _window |
Protected Attributes inherited from WindowedGraphicsManager | |
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 |
Base class for a SDL based graphics manager.
|
virtual |
Makes this graphics manager active. That means it should be ready to process inputs now. However, even without being active it should be able to query the supported modes and other bits.
|
virtual |
Makes this graphics manager inactive. This should allow another graphics manager to become active again.
|
pure virtual |
Notify the graphics manager that the graphics needs to be redrawn, since the application window was modified.
This is basically called when SDL_VIDEOEXPOSE was received.
Implemented in SurfaceSdlGraphicsManager, and OpenGLSdlGraphicsManager.
|
inlinevirtual |
Notify the graphics manager about a resize event.
It is noteworthy that the requested width/height should actually be set up as is and not changed by the graphics manager, since otherwise it may lead to odd behavior for certain window managers.
It is only required to overwrite this method in case you want a resizable window. The default implementation just does nothing.
width | Requested window width. |
height | Requested window height. |
Reimplemented in SurfaceSdlGraphicsManager, and OpenGLSdlGraphicsManager.
|
virtual |
Notifies the graphics manager about a mouse position change.
The passed point must be converted from window coordinates to virtual coordinates in order for the event to be processed correctly by the game engine. Just use convertWindowToVirtual
for this unless you need to do something special.
mouse | The mouse position in window coordinates, which must be converted synchronously to virtual coordinates. |
|
overridevirtual |
Notify the observer of an incoming event.
An observer is supposed to 'eat' the event, with returning true, when it wants to prevent other observers from receiving the event. A usage example here is the keymapper: If it processes an Event, it should 'eat' it and create a new event, which the EventDispatcher will then catch.
event | The event that is incoming. |
true | If the event should not be passed to other observers, false otherwise. |
Implements Common::EventObserver.
Reimplemented in SurfaceSdlGraphicsManager.
State SdlGraphicsManager::getState | ( | ) | const |
Gets the current state of the graphics manager.
bool SdlGraphicsManager::setState | ( | const State & | state | ) |
Sets up a basic state of the graphics manager.
|
inline |
|
protected |
Obtain the user configured fullscreen resolution, or default to the desktop resolution
|
inlineprotected |
Gets the dimensions of the window directly from SDL instead of from the values stored by the graphics manager.
|
overrideprotectedvirtual |
Sets the position of the hardware mouse cursor in the host system, relative to the window.
x | X coordinate in window coordinates. |
y | Y coordinate in window coordinates. |
Implements WindowedGraphicsManager.
|
overrideprotectedvirtual |
Called whenever the active area has changed.
Reimplemented from WindowedGraphicsManager.
|
overrideprotectedvirtual |
Backend-specific implementation for updating internal surfaces that need to reflect the new window size.
Implements WindowedGraphicsManager.
Reimplemented in SurfaceSdlGraphicsManager.