CRM64Pro GDK v0.14.0
A free cross-platform game development kit built on top of SDL 3.0
Loading...
Searching...
No Matches

Description

Configuration Manager and Screen objects for general, audio and video settings [v26.01.0].

Overview

The Config module provides centralized management for all GDK configuration settings. It handles general behavior options, audio system parameters, and video/screen management. The module also provides methods for saving and loading the complete configuration state to/from external files.

Key features

  • General settings: Modify the behavior of general GDK settings (e.g., ConfigMgr::iMTFriendly)
  • Audio configuration: Enable/disable the audio system and configure its attributes
  • Video management: Add, modify and release screens (a screen is a top-level entity containing a SDL_Window and SDL_Renderer plus all its attributes)
  • Persistence: Save and load complete configuration state (general, audio and video)

Configuration areas

GeneralCore behavior settings affecting the overall GDK operation
AudioAudio system initialization, driver selection, sampling, frequency, channels and volume
VideoScreen management including window properties, renderer settings and display options

Default configuration

The ConfigMgr automatically applies the following default values:


General settings

iMTFriendly0 (disabled)


Audio settings

Audio.bInitfalse (disabled)
Audio.iDriver0 (use default audio driver)
Audio.eASAS_16 (16 bit sampling)
Audio.eAFAF_NORMAL (22050Hz)
Audio.eAMAM_STEREO
Audio.fMasterGain1.0 (range: 0.0 to 2.0)
Audio.fMusicGain1.0 (range: 0.0 to 2.0)
Audio.fSFXGain1.0 (range: 0.0 to 2.0)
Audio.fVoiceGain1.0 (range: 0.0 to 2.0)
Audio.fCustomGain1.0 (range: 0.0 to 2.0)


Default screen settings

DriverCRD_DEFAULT (use default renderer driver)
Width x Height800 x 600
Logical presentation size800 x 600
PositionSDL_WINDOWPOS_UNDEFINED
NameCRM64Pro GDK Application
Window flagsSDL_WINDOW_SHOWN
Window border1 (show window border)
Vertical sync0 (disabled)
Icondefault GDK icon
Clip regionno clip region set
Logical presentation modedisabled
Logical presentation qualitynearest pixel sampling

Manager type

This is a standard manager: objects are not shared and must be unique using its name as the key. You cannot create an object with the same name as another one already created.

Best practices

Note
The Configuration Manager is a singleton, automatically created once Main is instantiated. You can get a reference to this manager using Main::IConfigMgr() method.
The Configuration Manager is automatically released when Main::Terminate() is called. At this time, any resource still loaded will be released, avoiding resource leaks.

Classes

class  CRM64Pro::Screen
 Screen Object class. More...
class  CRM64Pro::ConfigMgr
 Config Manager class. More...

Enumerations

enum  CRM64Pro::eConfigAudioDriver { CRM64Pro::CAD_DEFAULT = 0 , CRM64Pro::CAD_WASAPI = 1 , CRM64Pro::CAD_DIRECTSOUND = 2 , CRM64Pro::CAD_ERROR = -1 }
 Audio drivers. More...
enum  CRM64Pro::eAudioFreq { CRM64Pro::AF_DEFAULT = 0 , CRM64Pro::AF_NORMAL = 22050 , CRM64Pro::AF_HIGH = 44100 , CRM64Pro::AF_ULTRA = 48000 }
 Audio frequency. More...
enum  CRM64Pro::eAudioSample { CRM64Pro::AS_DEFAULT = 0 , CRM64Pro::AS_8 = SDL_AUDIO_U8 , CRM64Pro::AS_16 = SDL_AUDIO_S16 , CRM64Pro::AS_32 = SDL_AUDIO_F32 }
 Audio sample. More...
enum  CRM64Pro::eAudioMode {
  CRM64Pro::AM_DEFAULT = 0 , CRM64Pro::AM_MONO = 1 , CRM64Pro::AM_STEREO = 2 , CRM64Pro::AM_SURROUND21 = 3 ,
  CRM64Pro::AM_QUAD = 4 , CRM64Pro::AM_SURROUND41 = 5 , CRM64Pro::AM_SURROUND51 = 6 , CRM64Pro::AM_SURROUND61 = 7 ,
  CRM64Pro::AM_SURROUND71 = 8
}
 Audio mode. More...
enum  CRM64Pro::eConfigRendererDriver {
  CRM64Pro::CRD_DEFAULT = 0 , CRM64Pro::CRD_SOFTWARE = 1 , CRM64Pro::CRD_OPENGL = 2 , CRM64Pro::CRD_OPENGLES2 = 3 ,
  CRM64Pro::CRD_VULKAN = 4 , CRM64Pro::CRD_DIRECT3D = 5 , CRM64Pro::CRD_DIRECT3D11 = 6 , CRM64Pro::CRD_DIRECT3D12 = 7 ,
  CRM64Pro::CRD_X11 = 8 , CRM64Pro::CRD_METAL = 9 , CRM64Pro::CRD_GPU3D = 10 , CRM64Pro::CRD_ERROR = -1
}
 Screen renderer drivers. More...
enum  CRM64Pro::eConfigScreenMode { CRM64Pro::CSM_WINDOW = 0 , CRM64Pro::CSM_FULLSCREEN = 1 , CRM64Pro::CSM_FULLSCREENEXCLUSIVE = 2 }
 Screen modes. More...

Functions

Sint32 CRM64Pro::ConfigMgr::save (const string &sConfigXML, const string &sCDCFile="")
 Save current audio/screens configuration.
Sint32 CRM64Pro::ConfigMgr::loadFromFile (const string &sConfigXML)
 Load audio/screen configuration from a file.
Sint32 CRM64Pro::ConfigMgr::load (const string &sCDCFile, const string &sConfigXML)
 Load audio/screen configuration from a CDC file.
Sint32 CRM64Pro::ConfigMgr::load (const Sint32 idCDC, const string &sConfigXML)
 Load audio/screen configuration from a CDC file.
Sint32 CRM64Pro::ConfigMgr::setup (const string &sConfigXML, Sint32 idConfigCDC, const string &sCustomSetupXML="")
 Open the setup window for configuring audio/screen settings.
Sint32 CRM64Pro::ConfigMgr::setup (const string &sConfigXML, const string &sConfigCDC="", const string &sCustomSetupXML="")
 Open the setup window for configuring audio/screen settings.

Enumeration Type Documentation

◆ eConfigAudioDriver

Audio drivers.

Enumerator
CAD_DEFAULT 

Config::audioSetDriver(): use the platform default (WASAPI on Win64, PulseAudio on Linux, CoreAudio on macOS).

CAD_WASAPI 

Config::audioSetDriver(): force WASAPI. Win64 only.

CAD_DIRECTSOUND 

Config::audioSetDriver(): force DirectSound. Audio settings are adjustable. Win64 only.

CAD_ERROR 

Returned by Config::audioGetDriver() when the call fails.

◆ eAudioFreq

Audio frequency.

Enumerator
AF_DEFAULT 

Default sample rate.

AF_NORMAL 

22050 Hz output.

AF_HIGH 

44100 Hz output.

AF_ULTRA 

48000 Hz output.

◆ eAudioSample

Audio sample.

Enumerator
AS_DEFAULT 

Default sample format.

AS_8 

8-bit samples.

AS_16 

16-bit samples.

AS_32 

32-bit floating-point samples.

◆ eAudioMode

Audio mode.

Enumerator
AM_DEFAULT 

Default mode.

AM_MONO 

Mono output.

AM_STEREO 

Stereo output.

AM_SURROUND21 

Surround 2.1 output.

AM_QUAD 

Quad output.

AM_SURROUND41 

Surround 4.1 output.

AM_SURROUND51 

Surround 5.1 output.

AM_SURROUND61 

Surround 6.1 output.

AM_SURROUND71 

Surround 7.1 output.

◆ eConfigRendererDriver

Screen renderer drivers.

Enumerator
CRD_DEFAULT 

Screen::setDriver(): use the default renderer driver (default value).

CRD_SOFTWARE 

Screen::setDriver(): software renderer driver. Slow but works on all platforms.

CRD_OPENGL 

Screen::setDriver(): OpenGL renderer. Supported on Win64/Linux/macOS.

CRD_OPENGLES2 

Screen::setDriver(): OpenGL ES v2.0 renderer. Supported on Android/iOS.

CRD_VULKAN 

Screen::setDriver(): Vulkan renderer. Supported on Win64/Linux/macOS.

CRD_DIRECT3D 

Screen::setDriver(): Direct3D v9 renderer. Win64 only.

CRD_DIRECT3D11 

Screen::setDriver(): Direct3D v11 renderer. Win64 only (Windows 8+).

CRD_DIRECT3D12 

Screen::setDriver(): Direct3D v12 renderer. Win64 only (Windows 10+).

CRD_X11 

Screen::setDriver(): X11 renderer. Linux only.

CRD_METAL 

Screen::setDriver(): Metal renderer. macOS only.

CRD_GPU3D 

Screen::setDriver(): GPU 3D renderer. Supported on Win64/Linux/macOS.

CRD_ERROR 

Returned by Screen::getDriver() on error.

◆ eConfigScreenMode

Screen modes.

Enumerator
CSM_WINDOW 

Screen::setMode(): windowed mode (default).

CSM_FULLSCREEN 

Screen::setMode(): fullscreen window that matches desktop size. Recommended fullscreen mode.

CSM_FULLSCREENEXCLUSIVE 

Screen::setMode(): exclusive fullscreen that switches the monitor mode to the closest match for the requested resolution.

Function Documentation

◆ save()

Sint32 CRM64Pro::ConfigMgr::save ( const string & sConfigXML,
const string & sCDCFile = "" )

Save current audio/screens configuration.

Parameters
sConfigXMLstring containing the [directory]+filename+[extension] of the config XML file. Directory separators '\' and '/' are supported.
sCDCFilestring containing the [directory]+filename+[extension] of a CDC file where the config XML will be saved. Optional.
Returns
0 on success, or a negative error code on failure.

◆ loadFromFile()

Sint32 CRM64Pro::ConfigMgr::loadFromFile ( const string & sConfigXML)

Load audio/screen configuration from a file.

Parameters
sConfigXMLstring containing the [directory]+filename+[extension] of the config XML file. Directory separators '\' and '/' are supported.
Returns
0 on success, or a negative error code on failure.
Note
If audio or screens are already initialized, they are re-initialized using these new settings.

◆ load() [1/2]

Sint32 CRM64Pro::ConfigMgr::load ( const string & sCDCFile,
const string & sConfigXML )

Load audio/screen configuration from a CDC file.

Parameters
sCDCFilestring containing the [directory]+filename+[extension] of a CDC file that contains the config XML file.
sConfigXMLstring containing the name of the config XML file.
Returns
0 on success, or a negative error code on failure.
Note
If audio or screens are already initialized, they are re-initialized using these new settings.

◆ load() [2/2]

Sint32 CRM64Pro::ConfigMgr::load ( const Sint32 idCDC,
const string & sConfigXML )

Load audio/screen configuration from a CDC file.

Parameters
idCDCCDC id of an open CDC file that contains the config XML file.
sConfigXMLstring containing the name of the config XML file.
Returns
0 on success, or a negative error code on failure.
Note
If audio or screens are already initialized, they are re-initialized using these new settings.

◆ setup() [1/2]

Sint32 CRM64Pro::ConfigMgr::setup ( const string & sConfigXML,
Sint32 idConfigCDC,
const string & sCustomSetupXML = "" )

Open the setup window for configuring audio/screen settings.

Parameters
sConfigXMLstring containing the name of the config XML file.
idConfigCDCid of an open CDC file that contains the config XML and custom setup XML files. Using id instead of CDC name allows opening secured CDC files.
sCustomSetupXMLstring containing the name of the custom setup XML file. Optional.
Returns
0 when configuration is saved or exited with OK, or a negative value when no configuration saved or exit button clicked.
Note
By default, uses a built-in layout.

◆ setup() [2/2]

Sint32 CRM64Pro::ConfigMgr::setup ( const string & sConfigXML,
const string & sConfigCDC = "",
const string & sCustomSetupXML = "" )

Open the setup window for configuring audio/screen settings.

Parameters
sConfigXMLstring containing the name of the config XML file.
sConfigCDCstring containing the [directory]+filename+[extension] of a CDC file that contains the config and custom setup XML files. Directory separators '\' and '/' are supported.
sCustomSetupXMLstring containing the name of the custom setup XML file. Optional.
Returns
0 when configuration is saved or exited with OK, or a negative value when no configuration saved or exit button clicked.
Note
By default, uses a built-in layout.