ASAPCabinetFE
 
Loading...
Searching...
No Matches
AssetManager Class Reference
+ Inheritance diagram for AssetManager:
+ Collaboration diagram for AssetManager:

Public Member Functions

 AssetManager (SDL_Renderer *playfield, SDL_Renderer *backglass, SDL_Renderer *dmd, SDL_Renderer *topper, TTF_Font *f, ISoundManager *soundManager)
 
SDL_Texture * getPlayfieldTexture () override
 Retrieves the texture used for the playfield.
 
SDL_Texture * getWheelTexture (SDL_Renderer *renderer) override
 Retrieves the texture used for the wheel for a specific renderer.
 
SDL_Texture * getBackglassTexture () override
 Retrieves the texture used for the backglass.
 
SDL_Texture * getDmdTexture () override
 Retrieves the texture used for the dot matrix display (DMD).
 
SDL_Texture * getTopperTexture () override
 Retrieves the texture used for the topper display.
 
SDL_Texture * getTitleTexture (SDL_Renderer *renderer) override
 Retrieves the texture used for the title for a specific renderer.
 
IVideoPlayergetPlayfieldVideoPlayer () override
 Retrieves the video player associated with the playfield.
 
IVideoPlayergetBackglassVideoPlayer () override
 Retrieves the video player associated with the backglass.
 
IVideoPlayergetDmdVideoPlayer () override
 Retrieves the video player associated with the dot matrix display (DMD).
 
IVideoPlayergetTopperVideoPlayer () override
 Retrieves the video player associated with the topper display.
 
IConfigServicegetSettingsManager () override
 Retrieves the configuration service that manages application settings.
 
SDL_Rect getTitleRect () override
 Retrieves the rectangle that specifies the title's position and dimensions (x, y, width, height).
 
void setTitlePosition (int x, int y) override
 Sets the title's position on the display.
 
void setFont (TTF_Font *font) override
 Sets the current font for text rendering.
 
void reloadTitleTexture (const std::string &title, SDL_Color color, SDL_Rect &titleRect) override
 Reloads the title texture using a new title string and color, updating the title rectangle accordingly.
 
void reloadAssets (IWindowManager *windowManager, TTF_Font *font, const std::vector< TableData > &tables, size_t index) override
 Reloads all relevant assets with updated settings, fonts, and table data.
 
void setSettingsManager (IConfigService *cm) override
 Sets the configuration service (settings manager) responsible for application settings.
 
void loadTableAssets (size_t index, const std::vector< TableData > &tables) override
 Loads assets for a specific table based on its index and associated table data.
 
void clearOldVideoPlayers () override
 Clears any existing video players to free resources before initializing new ones.
 
void cleanupVideoPlayers () override
 Cleans up video players, releasing allocated resources appropriately.
 
void setSoundManager (ISoundManager *soundManager) override
 Sets the sound manager for audio playback.
 
void playTableMusic (size_t index, const std::vector< TableData > &tables) override
 Plays table-specific music.
 
void applyVideoAudioSettings () override
 Applies audio settings to all active video players.
 
void clearVideoCache ()
 
void clearTextureCache ()
 
SDL_Renderer * getPlayfieldRenderer ()
 
SDL_Renderer * getBackglassRenderer ()
 
SDL_Renderer * getDMDRenderer ()
 
SDL_Renderer * getTopperRenderer ()
 
void setPlayfieldRenderer (SDL_Renderer *renderer)
 
void setBackglassRenderer (SDL_Renderer *renderer)
 
void setDMDRenderer (SDL_Renderer *renderer)
 
void setTopperRenderer (SDL_Renderer *renderer)
 
- Public Member Functions inherited from IAssetManager
virtual ~IAssetManager ()=default
 Virtual destructor to ensure derived classes can clean up properly.
 

Member Function Documentation

◆ applyVideoAudioSettings()

void AssetManager::applyVideoAudioSettings ( )
overridevirtual

Applies audio settings to all active video players.

Updates the volume and mute state of playfield, backglass, and DMD video players based on the current mediaAudioVol and mediaAudioMute settings.

Implements IAssetManager.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanupVideoPlayers()

void AssetManager::cleanupVideoPlayers ( )
overridevirtual

Cleans up video players, releasing allocated resources appropriately.

Implements IAssetManager.

◆ clearOldVideoPlayers()

void AssetManager::clearOldVideoPlayers ( )
overridevirtual

Clears any existing video players to free resources before initializing new ones.

Implements IAssetManager.

◆ getBackglassTexture()

SDL_Texture * AssetManager::getBackglassTexture ( )
inlineoverridevirtual

Retrieves the texture used for the backglass.

Returns
SDL_Texture* Pointer to the backglass texture.

Implements IAssetManager.

◆ getBackglassVideoPlayer()

IVideoPlayer * AssetManager::getBackglassVideoPlayer ( )
inlineoverridevirtual

Retrieves the video player associated with the backglass.

Returns
IVideoPlayer* Pointer to the backglass video player.
See also
IVideoPlayer

Implements IAssetManager.

◆ getDmdTexture()

SDL_Texture * AssetManager::getDmdTexture ( )
inlineoverridevirtual

Retrieves the texture used for the dot matrix display (DMD).

Returns
SDL_Texture* Pointer to the DMD texture.

Implements IAssetManager.

◆ getDmdVideoPlayer()

IVideoPlayer * AssetManager::getDmdVideoPlayer ( )
inlineoverridevirtual

Retrieves the video player associated with the dot matrix display (DMD).

Returns
IVideoPlayer* Pointer to the DMD video player.
See also
IVideoPlayer

Implements IAssetManager.

◆ getPlayfieldTexture()

SDL_Texture * AssetManager::getPlayfieldTexture ( )
inlineoverridevirtual

Retrieves the texture used for the playfield.

Returns
SDL_Texture* Pointer to the playfield texture.

Implements IAssetManager.

◆ getPlayfieldVideoPlayer()

IVideoPlayer * AssetManager::getPlayfieldVideoPlayer ( )
inlineoverridevirtual

Retrieves the video player associated with the playfield.

Returns
IVideoPlayer* Pointer to the playfield video player.
See also
IVideoPlayer

Implements IAssetManager.

◆ getSettingsManager()

IConfigService * AssetManager::getSettingsManager ( )
inlineoverridevirtual

Retrieves the configuration service that manages application settings.

Returns
IConfigService* Pointer to the settings manager.
See also
IConfigService

Implements IAssetManager.

◆ getTitleRect()

SDL_Rect AssetManager::getTitleRect ( )
inlineoverridevirtual

Retrieves the rectangle that specifies the title's position and dimensions (x, y, width, height).

Returns
SDL_Rect The rectangle representing the title's size and position.

Implements IAssetManager.

◆ getTitleTexture()

SDL_Texture * AssetManager::getTitleTexture ( SDL_Renderer *  renderer)
inlineoverridevirtual

Retrieves the texture used for the title for a specific renderer.

Parameters
rendererThe SDL renderer to get the texture for.
Returns
SDL_Texture* Pointer to the title texture.

Implements IAssetManager.

◆ getTopperTexture()

SDL_Texture * AssetManager::getTopperTexture ( )
inlineoverridevirtual

Retrieves the texture used for the topper display.

Returns
SDL_Texture* Pointer to the topper texture.

Implements IAssetManager.

◆ getTopperVideoPlayer()

IVideoPlayer * AssetManager::getTopperVideoPlayer ( )
inlineoverridevirtual

Retrieves the video player associated with the topper display.

Returns
IVideoPlayer* Pointer to the topper video player.
See also
IVideoPlayer

Implements IAssetManager.

◆ getWheelTexture()

SDL_Texture * AssetManager::getWheelTexture ( SDL_Renderer *  renderer)
inlineoverridevirtual

Retrieves the texture used for the wheel for a specific renderer.

Parameters
rendererThe SDL renderer to get the texture for.
Returns
SDL_Texture* Pointer to the wheel texture.

Implements IAssetManager.

◆ loadTableAssets()

void AssetManager::loadTableAssets ( size_t  index,
const std::vector< TableData > &  tables 
)
overridevirtual

Loads assets for a specific table based on its index and associated table data.

Parameters
indexThe index of the table to load assets for.
tablesA vector containing table data.

Implements IAssetManager.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ playTableMusic()

void AssetManager::playTableMusic ( size_t  index,
const std::vector< TableData > &  tables 
)
overridevirtual

Plays table-specific music.

Parameters
indexThe index of the table to play music for.
tablesA vector containing table data with music paths.

Implements IAssetManager.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reloadAssets()

void AssetManager::reloadAssets ( IWindowManager windowManager,
TTF_Font *  font,
const std::vector< TableData > &  tables,
size_t  index 
)
overridevirtual

Reloads all relevant assets with updated settings, fonts, and table data.

Parameters
windowManagerPointer to the window manager used for rendering.
fontPointer to the TTF_Font used for text rendering.
tablesA vector containing table data necessary for asset creation.
indexThe index of the table data to reload assets for.
See also
IWindowManager

Implements IAssetManager.

+ Here is the call graph for this function:

◆ reloadTitleTexture()

void AssetManager::reloadTitleTexture ( const std::string &  title,
SDL_Color  color,
SDL_Rect &  titleRect 
)
overridevirtual

Reloads the title texture using a new title string and color, updating the title rectangle accordingly.

Parameters
titleThe new title string.
colorThe color used for text rendering.
titleRect[in,out] Parameter that is updated to reflect the new title's dimensions (width and height) after the texture is reloaded.

Implements IAssetManager.

◆ setFont()

void AssetManager::setFont ( TTF_Font *  font)
inlineoverridevirtual

Sets the current font for text rendering.

Parameters
fontPointer to the TTF_Font object to be set.

Implements IAssetManager.

◆ setSettingsManager()

void AssetManager::setSettingsManager ( IConfigService cm)
overridevirtual

Sets the configuration service (settings manager) responsible for application settings.

Parameters
cmPointer to the new IConfigService instance.
See also
IConfigService

Implements IAssetManager.

◆ setSoundManager()

void AssetManager::setSoundManager ( ISoundManager soundManager)
overridevirtual

Sets the sound manager for audio playback.

Parameters
soundManagerPointer to the ISoundManager instance.
See also
ISoundManager

Implements IAssetManager.

◆ setTitlePosition()

void AssetManager::setTitlePosition ( int  x,
int  y 
)
inlineoverridevirtual

Sets the title's position on the display.

Parameters
xThe new x-coordinate for the title.
yThe new y-coordinate for the title.

Implements IAssetManager.


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