ScummVM API documentation
Feature flags

Description

Enumerations

enum  OSystem::Feature {
  OSystem::kFeatureFullscreenMode, OSystem::kFeatureAspectRatioCorrection, OSystem::kFeatureFilteringMode, OSystem::kFeatureStretchMode,
  OSystem::kFeatureVirtualKeyboard, OSystem::kFeatureCursorPalette, OSystem::kFeatureCursorAlpha, OSystem::kFeatureCursorMask,
  OSystem::kFeatureCursorMaskInvert, OSystem::kFeatureCursorMaskPaletteXorColorXnor, OSystem::kFeatureOverlaySupportsAlpha, OSystem::kFeatureIconifyWindow,
  OSystem::kFeatureOpenGLForGame, OSystem::kFeatureShadersForGame, OSystem::kFeatureVSync, OSystem::kFeatureFullscreenToggleKeepsContext,
  OSystem::kFeatureDisplayLogFile, OSystem::kFeatureClipboardSupport, OSystem::kFeatureOpenUrl, OSystem::kFeatureTouchpadMode,
  OSystem::kFeatureKbdMouseSpeed, OSystem::kFeatureJoystickDeadzone, OSystem::kFeatureScalers, OSystem::kFeatureShaders,
  OSystem::kFeatureDLC, OSystem::kFeatureSystemBrowserDialog, OSystem::kFeatureNoQuit, OSystem::kFeatureTouchscreen,
  OSystem::kFeatureCpuNEON, OSystem::kFeatureCpuSSE2, OSystem::kFeatureCpuSSE41, OSystem::kFeatureCpuAVX2,
  OSystem::kFeatureCpuAltivec
}
 

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.

kFeatureCursorAlpha 

Backends supporting this feature allow cursors to contain an alpha channel.

kFeatureCursorMask 

Backends supporting this feature allow specifying a mask for a cursor instead of a key color.

kFeatureCursorMaskInvert 

Backends supporting this feature allow cursor masks to use mode kCursorMaskInvert in mask values, which inverts the destination pixel.

kFeatureCursorMaskPaletteXorColorXnor 

Backends supporting this feature allow cursor masks to use mode kCursorMaskPaletteXorColorXnor in the mask values, which uses (Color XOR Destination) for CLUT8 blending and (Color XNOR Destination) for RGB blending. This is equivalent to Classic MacOS behavior for pixel colors other than black and white.

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.

kFeatureShadersForGame 

This feature flag can be used to check if shaders are 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.

kFeatureTouchpadMode 

Mouse emulation mode.

kFeatureKbdMouseSpeed 

Keyboard mouse and joystick mouse speed.

kFeatureJoystickDeadzone 

Change analog joystick deadzone.

kFeatureScalers 

Scalers.

kFeatureShaders 

Shaders.

kFeatureDLC 

Support for downloading DLC packages.

kFeatureSystemBrowserDialog 

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

kFeatureNoQuit 

For platforms that should not have a Quit button.

kFeatureTouchscreen 

The presence of this feature indicates that the backend uses a touchscreen.

This feature has no associated state.

kFeatureCpuNEON 

Arm-v8 requires NEON extensions, but before that, NEON was just optional, so this signifies that the processor can use NEON.

kFeatureCpuSSE2 

For x86/x86_64 platforms that have SSE2 support

kFeatureCpuSSE41 

For x86/x86_64 platforms that have SSE4.1 support

kFeatureCpuAVX2 

For x86_64 platforms that have AVX2 support

kFeatureCpuAltivec 

For PowerPC platforms that have the altivec standard as of 1999. Covers a wide range of platforms, Apple Macs, XBox 360, PS3, and more

Function Documentation

◆ hasFeature()

◆ 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.

Reimplemented in OSystem_Wii, OSystem_N64, N3DS::OSystem_3DS, OSystem_iOS7, OSystem_Dreamcast, OSystem_DS, OSystem_PSP, ModularGraphicsBackend, OSystem_PSP2, OSystem_SDL_Miyoo, OSystem_SDL_Opendingux, OSystem_Switch, and OSystem_Emscripten.

◆ 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.

Reimplemented in OSystem_Wii, OSystem_N64, N3DS::OSystem_3DS, OSystem_iOS7, OSystem_Dreamcast, OSystem_DS, OSystem_PSP, ModularGraphicsBackend, OSystem_PSP2, OSystem_SDL_Miyoo, OSystem_SDL_Opendingux, OSystem_Switch, and OSystem_Emscripten.