ScummVM API documentation
Feature flags

Description

Enumerations

enum  OSystem::Feature {
  OSystem::kFeatureFullscreenMode, OSystem::kFeatureAspectRatioCorrection, OSystem::kFeatureFilteringMode, OSystem::kFeatureStretchMode,
  OSystem::kFeatureVirtualKeyboard, OSystem::kFeatureCursorPalette, OSystem::kFeatureOverlaySupportsAlpha, OSystem::kFeatureIconifyWindow,
  OSystem::kFeatureOpenGLForGame, OSystem::kFeatureVSync, OSystem::kFeatureFullscreenToggleKeepsContext, OSystem::kFeatureDisplayLogFile,
  OSystem::kFeatureClipboardSupport, OSystem::kFeatureOpenUrl, OSystem::kFeatureOnScreenControl, OSystem::kFeatureTouchpadMode,
  OSystem::kFeatureSwapMenuAndBackButtons, OSystem::kFeatureKbdMouseSpeed, OSystem::kFeatureJoystickDeadzone, OSystem::kFeatureShader,
  OSystem::kFeatureSystemBrowserDialog, OSystem::kFeatureNoQuit
}
 

Functions

virtual bool OSystem::hasFeature (Feature f)
 
virtual void OSystem::setFeatureState (Feature f, bool enable)
 
virtual bool OSystem::getFeatureState (Feature f)
 

Enumeration Type Documentation

◆ Feature

A feature in this context means an ability of the backend which can be either on or off.

Examples include:

  • Fullscreen mode
  • Aspect ration correction
  • Virtual keyboard for text entry (on PDAs)

There is a difference between the availability of a feature that can be checked using hasFeature(), and its state. For example, the SDL backend has the kFeatureFullscreenMode, so hasFeature returns true for it. On the other hand, fullscreen mode may be active or not. This can be determined by checking the state using getFeatureState(). Finally, to switch between fullscreen and windowed mode, use setFeatureState().

Some features, for example kFeatureClipboardSupport and kFeatureOpenUrl have no state and can only be used to check if the corresponding feature is available or not. Calling getFeatureState() or setFeatureState() for them is pointless.

Enumerator
kFeatureFullscreenMode 

If supported, this feature flag can be used to switch between windowed and fullscreen mode.

kFeatureAspectRatioCorrection 

Control aspect ratio correction.

Aspect ratio correction is used for correcting games running at 320x200 (i.e with an aspect ratio of 8:5), but which on their original hardware were displayed with the standard 4:3 ratio (which means that the original graphics used non-square pixels). When the backend supports this, then games running at 320x200 pixels should be scaled up to 320x240 pixels. For all other resolutions, ignore this feature flag.

Note
Backend implementors can find utility functions in common/scaler.h. These functions can be used to implement aspect ratio correction. You can use stretch200To240() can stretch a rect, including (very fast) particular, interpolation, and works in-place.
kFeatureFilteringMode 

If supported, this flag can be used to switch between unfiltered and filtered graphics modes.

kFeatureStretchMode 

Indicate if stretch modes are supported by the backend.

kFeatureVirtualKeyboard 

Determine whether a virtual keyboard is to be shown or not. This would mostly be implemented by backends for handheld devices, like PocketPC, Palms, Symbian phones like the P800, Zaurus, etc.

kFeatureCursorPalette 

Backends supporting this feature allow specifying a custom palette for the cursor. The custom palette is used if the feature state is set to true by the client code using setFeatureState().

It is currently used only by some Macintosh versions of Humongous Entertainment games. If the backend doesn't implement this feature then the engine switches to b/w versions of cursors. The GUI also relies on this feature for mouse cursors.

kFeatureOverlaySupportsAlpha 

A backend has this feature if its overlay pixel format has an alpha channel which offers at least 3-4 bits of accuracy (as opposed to just a single alpha bit).

This feature has no associated state.

kFeatureIconifyWindow 

Client code can set the state of this feature to true in order to iconify the application window.

kFeatureOpenGLForGame 

This feature flag can be used to check if hardware-accelerated OpenGL is supported and can be used for 3D game rendering.

kFeatureVSync 

If supported, this feature flag can be used to check if waiting for vertical sync before refreshing the screen to reduce tearing is enabled.

kFeatureFullscreenToggleKeepsContext 

When a backend supports this feature, it guarantees the graphics context is not destroyed when switching to and from fullscreen.

For OpenGL, that means the context is kept with all of its content: texture, programs, etc.

For TinyGL, that means the backbuffer surface is kept.

kFeatureDisplayLogFile 

The presence of this feature indicates whether the displayLogFile() call is supported.

This feature has no associated state.

kFeatureClipboardSupport 

The presence of this feature indicates whether the system clipboard is available.

If this feature is not present, the hasTextInClipboard(), getTextFromClipboard(), and setTextInClipboard() calls can still be used, however it should not be used in scenarios where the user is expected to copy data outside of the application.

This feature has no associated state.

kFeatureOpenUrl 

The presence of this feature indicates whether the openUrl() call is supported.

This feature has no associated state.

kFeatureOnScreenControl 

Show on-screen control.

kFeatureTouchpadMode 

Mouse emulation mode.

kFeatureSwapMenuAndBackButtons 

Swap menu and back buttons.

kFeatureKbdMouseSpeed 

Keyboard mouse and joystick mouse speed.

kFeatureJoystickDeadzone 

Change analog joystick deadzone.

kFeatureShader 

Shaders.

kFeatureSystemBrowserDialog 

Support for using the native system file browser dialog through the DialogManager.

kFeatureNoQuit 

For platforms that should not have a Quit button.

Function Documentation

◆ hasFeature()

virtual bool OSystem::hasFeature ( Feature  f)
inlinevirtual

Determine whether the backend supports the specified feature.

◆ setFeatureState()

virtual void OSystem::setFeatureState ( Feature  f,
bool  enable 
)
inlinevirtual

Enable or disable the specified feature.

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

◆ getFeatureState()

virtual bool OSystem::getFeatureState ( Feature  f)
inlinevirtual

Query the state of the specified feature.

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