Info

backend.Info (Class)

Clay backend implementation providing platform and asset information.

This class supplies information about:

  • System capabilities and storage locations
  • Supported asset file extensions
  • Platform-specific audio format support

The audio format detection on web platforms dynamically tests browser capabilities to determine which formats can be played, accounting for different browser implementations and versions.

Instance Members

clay
storageDirectory(): String

Gets the platform-specific directory for persistent storage.

On SDL platforms (desktop), returns the user preferences directory where the application can store settings and save data.

Returns Description
String The storage directory path, or null if not available

clay
imageExtensions(): Array<String>

Gets the list of supported image file extensions.

Returns Description
Array<String> Array of extensions: ['png', 'jpg', 'jpeg']

clay
textExtensions(): Array<String>

Gets the list of file extensions treated as text assets.

These files are loaded as text rather than binary data.

Returns Description
Array<String> Array of extensions: ['txt', 'json', 'fnt', 'atlas']

clay
soundExtensions(): Array<String>

Gets the list of supported audio file extensions.

On web platforms, this dynamically detects browser audio capabilities by testing audio format support. The detection code is ported from howler.js and handles browser-specific quirks:

  • Old Opera versions that don't support MP3
  • Safari version compatibility
  • Format support varies by browser

On native platforms, returns all common formats.

Returns Description
Array<String> Array of supported extensions (e.g., ['ogg', 'mp3', 'wav'])

clay
shaderExtensions(): Array<String>

Gets the list of shader file extensions.

Returns Description
Array<String> Array of extensions: ['frag', 'vert'] for fragment and vertex shaders

clay
new(): Void