SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
ImageManager Class Reference

Manages the loading, retrieval, and deletion of Image objects. More...

#include <ImageManager.h>

Static Public Member Functions

static Image * Get (MapKey key)
 Retrieves an Image object by its key.
 
static void Load (MapKey key, Texture *tex)
 Loads an Image object from a Texture.
 
static void Load (MapKey key, Texture *tex, Rect *r)
 Loads an Image object from a Texture and a Rect.
 

Static Public Attributes

static const MapKey defaultImageKey = AssetDefaults::DefaultImageKey
 Default key for the default image.
 

Private Member Functions

 ImageManager (const ImageManager &)=delete
 
ImageManageroperator= (const ImageManager &)=delete
 
void privDelete ()
 
Image * privGet (MapKey key)
 
void privLoad (MapKey key, Texture *tex)
 
void privLoad (MapKey key, Texture *tex, Rect *r)
 

Static Private Member Functions

static ImageManagerInstance ()
 
static void Delete ()
 Deletes all managed Image objects and the singleton instance.
 

Private Attributes

std::map< MapKey, Image * > storageMap
 Map storing Image objects associated with their keys.
 

Static Private Attributes

static ImageManagerptrInstance = nullptr
 

Friends

class ImageManagerAttorney
 

Detailed Description

Manages the loading, retrieval, and deletion of Image objects.

The ImageManager class is responsible for managing Image objects, including loading images from textures, retrieving images by key, and deleting all managed images. It follows the Singleton design pattern.

Member Function Documentation

◆ Get()

static Image * ImageManager::Get ( MapKey key)
inlinestatic

Retrieves an Image object by its key.

Parameters
keyThe key associated with the Image object.
Returns
A pointer to the Image object, or nullptr if the key is not found.
Here is the caller graph for this function:

◆ Load() [1/2]

static void ImageManager::Load ( MapKey key,
Texture * tex )
inlinestatic

Loads an Image object from a Texture.

Parameters
keyThe key to associate with the Image object.
texA pointer to the Texture object.
Here is the caller graph for this function:

◆ Load() [2/2]

static void ImageManager::Load ( MapKey key,
Texture * tex,
Rect * r )
inlinestatic

Loads an Image object from a Texture and a Rect.

Parameters
keyThe key to associate with the Image object.
texA pointer to the Texture object.
rA pointer to the Rect object defining the image region.

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