ScummVM API documentation
OSystem_SDL Class Reference

#include <sdl.h>

Inheritance diagram for OSystem_SDL:
ModularMixerBackend ModularGraphicsBackend BaseBackend BaseBackend OSystem OSystem Common::NonCopyable Common::NonCopyable 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

void init () override
 
bool hasFeature (Feature f) override
 
void setFeatureState (Feature f, bool enable) override
 
bool getFeatureState (Feature f) override
 
void initBackend () override
 
void engineInit () override
 
void engineDone () override
 
void quit () override
 
void fatalError () override
 
Common::KeymapArray getGlobalKeymaps () override
 
Common::HardwareInputSetgetHardwareInputSet () override
 
void logMessage (LogMessageType::Type type, const char *message) override
 
Common::String getSystemLanguage () const override
 
void setWindowCaption (const Common::U32String &caption) override
 
void addSysArchivesToSearchSet (Common::SearchSet &s, int priority=0) override
 
Common::MutexInternalcreateMutex () override
 
uint32 getMillis (bool skipRecord=false) override
 
void delayMillis (uint msecs) override
 
void getTimeAndDate (TimeDate &td, bool skipRecord=false) const override
 
MixerManagergetMixerManager () override
 
Common::TimerManagergetTimerManager () override
 
Common::SaveFileManagergetSavefileManager () override
 
uint32 getDoubleClickTime () const override
 
virtual Common::Path getDefaultIconsPath ()
 
virtual Common::Path getDefaultDLCsPath ()
 
virtual Common::Path getScreenshotsPath ()
 
- Public Member Functions inherited from ModularMixerBackend
Audio::MixergetMixer () override final
 
- Public Member Functions inherited from BaseBackend
bool setScaler (const char *name, int factor) override final
 
- Public Member Functions inherited from OSystem
void destroy ()
 
bool backendInitialized () const
 
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)
 
Common::EventManagergetEventManager ()
 
virtual Common::KeymapperDefaultBindingsgetKeymapperDefaultBindings ()
 
AudioCDManagergetAudioCDManager ()
 
virtual Common::TextToSpeechManagergetTextToSpeechManager ()
 
virtual Common::DialogManagergetDialogManager ()
 
virtual DLC::StoregetDLCStore ()
 
virtual FilesystemFactorygetFilesystemFactory ()
 
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 void applyBackendSettings ()
 
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 bool isConnectionLimited ()
 
- Public Member Functions inherited from ModularGraphicsBackend
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
 
void displayMessageOnOSD (const Common::U32String &msg) override final
 
void displayActivityIconOnOSD (const Graphics::Surface *icon) override final
 
void saveScreenshot () override final
 

Protected Member Functions

virtual void initSDL ()
 
virtual AudioCDManagercreateAudioCDManager ()
 
virtual Common::WriteStreamcreateLogFile ()
 
virtual uint32 getOSDoubleClickTime () const
 
virtual const char *const * buildHelpDialogData () override
 

Protected Attributes

bool _inited
 
bool _initedSDL
 
Common::Path _logFilePath
 
SdlEventSource_eventSource
 
Common::EventSource_eventSourceWrapper
 
SdlWindow_window
 
SdlGraphicsManager::State _gfxManagerState
 
Backends::Log::Log_logger
 
- Protected Attributes inherited from ModularMixerBackend
MixerManager_mixerManager
 
- 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
 
- Protected Attributes inherited from ModularGraphicsBackend
GraphicsManager_graphicsManager
 

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 OSystem class for all SDL ports.

Member Function Documentation

◆ init()

void OSystem_SDL::init ( )
overridevirtual

Pre-initialize backend. It should be called after instantiating the backend. Early needed managers are created here.

Reimplemented from OSystem.

Reimplemented in OSystem_Win32, and OSystem_Switch.

◆ hasFeature()

bool OSystem_SDL::hasFeature ( Feature  f)
overridevirtual

Determine whether the backend supports the specified feature.

Reimplemented from ModularGraphicsBackend.

Reimplemented in OSystem_Win32, and OSystem_Switch.

◆ setFeatureState()

void OSystem_SDL::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 ModularGraphicsBackend.

◆ getFeatureState()

bool OSystem_SDL::getFeatureState ( Feature  f)
overridevirtual

Query the state of the specified feature.

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

Reimplemented from ModularGraphicsBackend.

◆ initBackend()

void OSystem_SDL::initBackend ( )
overridevirtual

The following method is called once, from main.cpp, after all config data (including command line params etc.) is fully loaded.

Note
Subclasses should always invoke the implementation of their parent class. They should do so near the end of their own implementation.

Reimplemented from BaseBackend.

Reimplemented in OSystem_Win32, and OSystem_Switch.

◆ engineInit()

void OSystem_SDL::engineInit ( void  )
overridevirtual

Allow the backend to perform engine-specific initialization.

Called just before the engine is run.

Reimplemented from OSystem.

◆ engineDone()

void OSystem_SDL::engineDone ( )
overridevirtual

Allow the backend to perform engine-specific deinitialization.

Called after the engine finishes.

Reimplemented from OSystem.

◆ quit()

void OSystem_SDL::quit ( )
overridevirtual

Quit (exit) the application.

Implements OSystem.

◆ fatalError()

void OSystem_SDL::fatalError ( )
overridevirtual

Signal that a fatal error inside the client code has occurred.

This should quit the application.

Reimplemented from OSystem.

◆ getGlobalKeymaps()

Common::KeymapArray OSystem_SDL::getGlobalKeymaps ( )
overridevirtual

Return a platform-specific global keymap.

Returns
Keymap with actions appropriate for the platform.

The caller will use and delete the return object.

For more information, see keymapper.

Reimplemented from OSystem.

◆ getHardwareInputSet()

Common::HardwareInputSet* OSystem_SDL::getHardwareInputSet ( )
overridevirtual

Register hardware inputs with keymapper.

Returns
HardwareInputSet with all keys and recommended mappings.

For more information, see keymapper.

Reimplemented from OSystem.

Reimplemented in OSystem_Switch.

◆ logMessage()

void OSystem_SDL::logMessage ( LogMessageType::Type  type,
const char *  message 
)
overridevirtual

Log the given message.

It is up to the backend where to log the different messages. The backend should aim at using a non-buffered output for it, so that no log data is lost in case of a crash.

The default implementation outputs them on stdout/stderr.

Parameters
typeType of the message.
messageThe message itself.

Implements OSystem.

Reimplemented in OSystem_Win32, and OSystem_Switch.

◆ getSystemLanguage()

Common::String OSystem_SDL::getSystemLanguage ( ) const
overridevirtual

Return the language of the system.

This returns the currently set language of the system on which ScummVM is run.

The format is an ISO 639 language code, optionally followed by an ISO 3166-1 country code in the form language_country.

For information about POSIX locales, see the following link: https://en.wikipedia.org/wiki/ISO_639 https://en.wikipedia.org/wiki/ISO_3166-1

The default implementation returns "en_US".

Returns
Locale of the system.

Reimplemented from OSystem.

Reimplemented in OSystem_Win32, and OSystem_Switch.

◆ setWindowCaption()

void OSystem_SDL::setWindowCaption ( const Common::U32String caption)
overridevirtual

Set a window caption or any other comparable status display to the given value.

Parameters
captionThe window caption to use.

Reimplemented from OSystem.

◆ addSysArchivesToSearchSet()

void OSystem_SDL::addSysArchivesToSearchSet ( Common::SearchSet s,
int  priority = 0 
)
overridevirtual

Add system-specific Common::Archive objects to the given SearchSet. For example, on Unix, the directory corresponding to DATA_PATH (if set), or, on macOS, the 'Resource' dir in the app bundle.

Parameters
sSearchSet to which the system-specific dirs, if any, are added.
priorityPriority with which those dirs are added.

Reimplemented from OSystem.

Reimplemented in OSystem_Win32.

◆ createMutex()

Common::MutexInternal* OSystem_SDL::createMutex ( )
overridevirtual

Create a new mutex.

Returns
The newly created mutex, or 0 if an error occurred.

Implements OSystem.

◆ getMillis()

uint32 OSystem_SDL::getMillis ( bool  skipRecord = false)
overridevirtual

Get the number of milliseconds since the program was started.

Parameters
skipRecordSkip recording of this value by the event recorder. This might be needed particularly when we are in an on-screen GUI loop where the player can pause the recording.

Implements OSystem.

◆ delayMillis()

void OSystem_SDL::delayMillis ( uint  msecs)
overridevirtual

Delay/sleep for the specified amount of milliseconds.

Implements OSystem.

◆ getTimeAndDate()

void OSystem_SDL::getTimeAndDate ( TimeDate td,
bool  skipRecord = false 
) const
overridevirtual

Get the current time and date, in the local timezone.

On many systems, this corresponds to the combination of time() and localtime().

Implements OSystem.

◆ getTimerManager()

Common::TimerManager* OSystem_SDL::getTimerManager ( )
overridevirtual

Return the timer manager singleton.

For more information, see TimerManager.

Reimplemented from OSystem.

◆ getSavefileManager()

Common::SaveFileManager* OSystem_SDL::getSavefileManager ( )
overridevirtual

Return the SaveFileManager, which is used to store and load savestates and other modifiable persistent game data.

For more information, see SaveFileManager.

Reimplemented from OSystem.

◆ getDoubleClickTime()

uint32 OSystem_SDL::getDoubleClickTime ( ) const
overridevirtual

Get the system-configured double-click time interval. If the system doesn't support configuring double-click time, returns 0.

Reimplemented from OSystem.

◆ initSDL()

virtual void OSystem_SDL::initSDL ( )
protectedvirtual

Initialize the SDL library.

◆ createAudioCDManager()

virtual AudioCDManager* OSystem_SDL::createAudioCDManager ( )
protectedvirtual

Create the audio CD manager

Reimplemented in OSystem_MacOSX, OSystem_Win32, OSystem_POSIX, and OSystem_KolibriOS.

◆ buildHelpDialogData()

virtual const char* const* OSystem_SDL::buildHelpDialogData ( )
overrideprotectedvirtual

Return list of strings used for building help dialog

The strings represented in triplets:

  • Name of a tab (will be translated)
  • ZIP pack name with images (optional)
  • Text of the tab with Markdown formatting (also be translated)

The string list is null-terminated.

Reimplemented from OSystem.

Member Data Documentation

◆ _logFilePath

Common::Path OSystem_SDL::_logFilePath
protected

The path of the currently open log file, if any.

Note
This is currently a Path and not an FSNode for simplicity; e.g. we don't need to include fs.h here, and currently the only use of this value is to use it to open the log file in an editor; for that, we need it only as a path anyway.

◆ _eventSource

SdlEventSource* OSystem_SDL::_eventSource
protected

The event source we use for obtaining SDL events.

◆ _window

SdlWindow* OSystem_SDL::_window
protected

The SDL output window.


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