ASAPCabinetFE
 
Loading...
Searching...
No Matches
DependencyFactory Class Reference

Static factory for creating component instances. More...

#include <dependency_factory.h>

+ Collaboration diagram for DependencyFactory:

Static Public Member Functions

static std::unique_ptr< IKeybindProvidercreateKeybindProvider ()
 
static std::unique_ptr< IWindowManagercreateWindowManager (const Settings &settings)
 Creates a window manager instance.
 
static std::unique_ptr< ImGuiManagercreateImGuiManager (IWindowManager *windowManager, IConfigService *configService)
 Creates a GUI manager instance.
 
static std::unique_ptr< IAssetManagercreateAssetManager (IWindowManager *windowManager, TTF_Font *font, IConfigService *configService, size_t index, const std::vector< TableData > &tables, ISoundManager *soundManager)
 Creates an asset manager instance.
 
static std::unique_ptr< IRenderercreateRenderer (IWindowManager *windowManager)
 Creates a renderer instance.
 
static std::unique_ptr< ISoundManagercreateSoundManager (const Settings &settings)
 Creates a sound manager instance.
 
static std::unique_ptr< IConfigServicecreateConfigService (const std::string &configPath, IKeybindProvider *keybindProvider)
 Creates a configuration service instance.
 
static std::unique_ptr< IScreenshotManagercreateScreenshotManager (const std::string &exeDir, IConfigService *configService, IKeybindProvider *keybindProvider, ISoundManager *soundManager)
 Creates a screenshot manager instance.
 
static std::unique_ptr< IInputManagercreateInputManager (IKeybindProvider *keybindProvider)
 Creates an input manager instance.
 
static std::unique_ptr< ConfigUIcreateConfigUI (IConfigService *configService, IKeybindProvider *keybindProvider, IAssetManager *assets, size_t *currentIndex, std::vector< TableData > *tables, App *app, bool &showConfig)
 Creates a configuration UI instance.
 
static std::unique_ptr< ITableLaunchercreateTableLauncher (IConfigService *configService)
 
static std::unique_ptr< ITableCallbackscreateTableCallbacks (IConfigService *configService)
 Creates a table callbacks instance.
 

Detailed Description

Static factory for creating component instances.

This class provides static methods to create instances of key application components, such as IWindowManager, ImGuiManager, IAssetManager, and others, configured with the necessary dependencies. It is used by the App class to initialize the application. The factory supports customization through settings (e.g., via IConfigService) and can be extended with configUI to allow user-defined parameters (e.g., window sizes, asset loading behavior).

Member Function Documentation

◆ createAssetManager()

std::unique_ptr< IAssetManager > DependencyFactory::createAssetManager ( IWindowManager windowManager,
TTF_Font *  font,
IConfigService configService,
size_t  index,
const std::vector< TableData > &  tables,
ISoundManager soundManager 
)
static

Creates an asset manager instance.

Initializes an AssetManager with renderers from the window manager, a TTF font, a configuration service, and table data, then loads assets for the specified table index. The method currently skips asset loading (commented out) but can be extended to support configurable asset paths or preload options via configUI.

Parameters
windowManagerThe window manager for accessing renderers.
fontThe TTF font for text rendering.
configServiceThe configuration service for settings.
indexThe index of the table to load assets for.
tablesThe list of table data.
soundManagerThe sound manager for handling audio assets.
Returns
A unique pointer to an IAssetManager instance.

Initializes an AssetManager with renderers from the window manager, a TTF font, a configuration service, and table data, then loads assets for the specified table index.

Parameters
windowManagerThe window manager for accessing renderers.
fontThe TTF font for text rendering.
configServiceThe configuration service for settings.
indexThe index of the table to load assets for.
tablesThe list of table data.
soundManagerThe sound manager for handling audio assets.
Returns
A unique pointer to an IAssetManager instance.
+ Here is the call graph for this function:

◆ createConfigService()

std::unique_ptr< IConfigService > DependencyFactory::createConfigService ( const std::string &  configPath,
IKeybindProvider keybindProvider 
)
static

Creates a configuration service instance.

Initializes a ConfigService with the specified configuration file path. The service loads and manages settings that could be extended for user customization via configUI.

Parameters
configPathThe file path to the configuration file.
Returns
A unique pointer to a ConfigService instance.

Initializes a ConfigService with the specified configuration file path.

Parameters
configPathThe file path to the configuration file.
Returns
A unique pointer to a ConfigService instance.

◆ createConfigUI()

std::unique_ptr< ConfigUI > DependencyFactory::createConfigUI ( IConfigService configService,
IKeybindProvider keybindProvider,
IAssetManager assets,
size_t *  currentIndex,
std::vector< TableData > *  tables,
App app,
bool &  showConfig 
)
static

Creates a configuration UI instance.

Initializes a ConfigUI with the configuration service, keybind manager (from configService), asset manager, table data, main application instance, and configuration UI visibility flag. This UI allows user interaction with settings and could be enhanced with additional configurable options via configUI.

Parameters
configServiceThe configuration service for settings.
assetsThe asset manager for accessing textures and video players.
currentIndexPointer to the current table index.
tablesPointer to the list of table data.
appThe main application instance.
showConfigReference to the configuration UI visibility flag.
Returns
A unique pointer to a ConfigUI instance.

Initializes a ConfigUI with the configuration service, keybind manager (from configService), asset manager, table data, main application instance, and configuration UI visibility flag.

Parameters
configServiceThe configuration service for settings.
assetsThe asset manager for accessing textures and video players.
currentIndexPointer to the current table index.
tablesPointer to the list of table data.
appThe main application instance.
showConfigReference to the configuration UI visibility flag.
Returns
A unique pointer to a ConfigUI instance.

◆ createImGuiManager()

std::unique_ptr< ImGuiManager > DependencyFactory::createImGuiManager ( IWindowManager windowManager,
IConfigService configService 
)
static

Creates a GUI manager instance.

Initializes a ImGuiManager with the provided window manager and configuration service, and calls its initialize method to set up the ImGui context. The configuration service provides settings (e.g., UI theme) that could be user-customizable via configUI.

Parameters
windowManagerThe window manager for accessing SDL windows and renderers.
configServiceThe configuration service for accessing settings.
Returns
A unique pointer to a ImGuiManager instance.

Initializes a ImGuiManager with the provided window manager and configuration service, and calls its initialize method to set up the ImGui context.

Parameters
windowManagerThe window manager for accessing SDL windows and renderers.
configServiceThe configuration service for accessing settings.
Returns
A unique pointer to a ImGuiManager instance.

◆ createInputManager()

std::unique_ptr< IInputManager > DependencyFactory::createInputManager ( IKeybindProvider keybindProvider)
static

Creates an input manager instance.

Initializes an InputManager with the keybind manager (from configService)

Returns
A unique pointer to an InputManager instance.

◆ createRenderer()

std::unique_ptr< IRenderer > DependencyFactory::createRenderer ( IWindowManager windowManager)
static

Creates a renderer instance.

Initializes a Renderer with renderers from the window manager for playfield, backglass, and DMD displays. Future enhancements could allow renderer settings (e.g., resolution, effects) to be configurable via configUI.

Parameters
windowManagerThe window manager for accessing renderers.
Returns
A unique pointer to a Renderer instance.

Initializes a Renderer with renderers from the window manager for playfield, backglass, and DMD displays.

Parameters
windowManagerThe window manager for accessing renderers.
Returns
A unique pointer to a Renderer instance.
+ Here is the call graph for this function:

◆ createScreenshotManager()

std::unique_ptr< IScreenshotManager > DependencyFactory::createScreenshotManager ( const std::string &  exeDir,
IConfigService configService,
IKeybindProvider keybindProvider,
ISoundManager soundManager 
)
static

Creates a screenshot manager instance.

Initializes a ScreenshotManager with the executable directory, configuration service, keybind manager (from configService), and sound manager. The manager handles screenshot capture and could support configurable save paths or formats via configUI.

Parameters
exeDirThe executable directory for resolving screenshot paths.
configServiceThe configuration service for settings.
soundManagerThe sound manager for screenshot-related sounds.
Returns
A unique pointer to an IScreenshotManager instance.

Initializes a ScreenshotManager with the executable directory, configuration service, keybind manager (from configService), and sound manager.

Parameters
exeDirThe executable directory for resolving screenshot paths.
configServiceThe configuration service for settings.
soundManagerThe sound manager for screenshot-related sounds.
Returns
A unique pointer to an IScreenshotManager instance.

◆ createSoundManager()

std::unique_ptr< ISoundManager > DependencyFactory::createSoundManager ( const Settings settings)
static

Creates a sound manager instance.

Initializes a PulseAudioPlayer with the executable directory and settings, then loads sound resources. Settings may include volume or sound file paths, which could be user-configurable via configUI.

Parameters
settingsThe application settings for sound configuration.
Returns
A unique pointer to an ISoundManager instance.

Initializes a PulseAudioPlayer with the executable directory and settings, then loads sound resources.

Parameters
settingsThe application settings for sound configuration.
Returns
A unique pointer to an ISoundManager instance.

◆ createTableCallbacks()

std::unique_ptr< ITableCallbacks > DependencyFactory::createTableCallbacks ( IConfigService configService)
static

Creates a table callbacks instance.

Initializes an AsapIndexManager with the configuration service to handle table data persistence.

Parameters
configServiceThe configuration service for settings.
Returns
A unique pointer to an ITableCallbacks instance.
+ Here is the call graph for this function:

◆ createWindowManager()

std::unique_ptr< IWindowManager > DependencyFactory::createWindowManager ( const Settings settings)
static

Creates a window manager instance.

Initializes a WindowManager with the provided settings for configuring SDL windows and renderers (e.g., playfield, backglass, DMD). The settings can include resolution, fullscreen mode, and other display options, which may be made configurable via configUI in the future.

Parameters
settingsThe application settings for window configuration.
Returns
A unique pointer to an IWindowManager instance.

Initializes a WindowManager with the provided settings for configuring SDL windows and renderers.

Parameters
settingsThe application settings for window configuration.
Returns
A unique pointer to an IWindowManager instance.

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