FIFE
2008.0
|
#include <imagemanager.h>
Public Member Functions | |
ImageManager () | |
virtual | ~ImageManager () |
virtual size_t | getMemoryUsed () const |
virtual size_t | getTotalResourcesCreated () const |
virtual size_t | getTotalResourcesLoaded () const |
virtual size_t | getTotalResources () const |
virtual ImagePtr | create (IResourceLoader *loader=0) |
virtual ImagePtr | create (const std::string &name, IResourceLoader *loader=0) |
virtual ImagePtr | load (const std::string &name, IResourceLoader *loader=0) |
virtual ImagePtr | loadBlank (uint32_t width, uint32_t height) |
virtual ImagePtr | loadBlank (const std::string &name, uint32_t width, uint32_t height) |
virtual ImagePtr | add (Image *res) |
virtual bool | exists (const std::string &name) |
virtual bool | exists (ResourceHandle handle) |
virtual void | reload (const std::string &name) |
virtual void | reload (ResourceHandle handle) |
virtual void | reloadAll () |
virtual void | loadUnreferenced () |
virtual void | free (const std::string &name) |
virtual void | free (ResourceHandle handle) |
virtual void | freeAll () |
virtual void | freeUnreferenced () |
virtual void | remove (ImagePtr &resource) |
virtual void | remove (const std::string &name) |
virtual void | remove (ResourceHandle handle) |
virtual void | removeAll () |
virtual void | removeUnreferenced () |
virtual ImagePtr | get (const std::string &name) |
virtual ImagePtr | get (ResourceHandle handle) |
virtual ResourceHandle | getResourceHandle (const std::string &name) |
![]() | |
IResourceManager () | |
An interface for managing images.
Definition at line 54 of file imagemanager.h.
|
inline |
Default constructor.
Definition at line 59 of file imagemanager.h.
|
virtual |
Destructor.
Definition at line 43 of file imagemanager.cpp.
Add an Image to the manager
This function will create a ImagePtr and add the Image to the manager. The manager assumes ownership of the Image so DO NOT delete it.
res | A pointer to the Image |
Definition at line 152 of file imagemanager.cpp.
References exists().
Referenced by create(), and loadBlank().
|
virtual |
Creates a blank Image but does not load it immediately
loader | A pointer to the custom resource loader. The default is NULL. If this parameter is present the resource will use the loader to load instead of the default built in functions. |
Definition at line 92 of file imagemanager.cpp.
References add().
Referenced by load().
|
virtual |
Creates a blank Image but does not load it immediately
name | The resource name. Typically a filename. |
loader | A pointer to the custom resource loader. The default is NULL. If this parameter is present the resource will use the loader to load instead of the default built in functions. |
Definition at line 97 of file imagemanager.cpp.
|
virtual |
Checks to see if an Image exists
This function will search the manager for Images that match the parameter
name | The name of the Image |
Definition at line 171 of file imagemanager.cpp.
Referenced by add(), and create().
|
virtual |
Checks to see if an Image exists
This function will search the manager for Images that match the parameter
handle | The handle of the Image |
Definition at line 180 of file imagemanager.cpp.
|
virtual |
Frees an Image from memory
The Image is not deleted but it's data is freed. This calls the Image::free() function and it is up to the resource to properly free it's memory. The manager keeps a reference to the Image in case its required in the future.
name | The name of the Image |
Definition at line 244 of file imagemanager.cpp.
|
virtual |
Frees an Image from memory
The Image is not deleted but it's data is freed. This calls the Image::free() function and it is up to the resource to properly free it's memory. The manager keeps a reference to the Image in case its required in the future.
handle | The handle of the Image |
Definition at line 257 of file imagemanager.cpp.
|
virtual |
Frees all Images
This calls the Image::free() function for every Image the manager is managing. It does not remove them from the manager.
Definition at line 269 of file imagemanager.cpp.
|
virtual |
Frees all unreferenced Image
This calls the IResource::free() function for Images that have no external references to them. It does not remove them from the manager.
Definition at line 285 of file imagemanager.cpp.
|
virtual |
|
virtual |
Gets a shared pointer to the Image
If the resource is not defined it returns an empty (or invalid) ImagePtr and makes an entry in the log.
handle | The handle of the resource |
Definition at line 411 of file imagemanager.cpp.
|
virtual |
Gets the total amount of memory used by resources
This function uses the IResource's getSize() function to calculate the total memory used. It does not include memory used by the internal resource manager book keeping structures. This value is only accurate if the resources getSize() function returns an accurate result.
Implements FIFE::IResourceManager.
Definition at line 47 of file imagemanager.cpp.
|
virtual |
Gets an Image handle by name
Returns the Image handle associated with the name
name | The name of the Image |
Definition at line 449 of file imagemanager.cpp.
|
virtual |
Returns the number of defined resources
Gets the total number of resources managed by the manager.
Implements FIFE::IResourceManager.
Definition at line 88 of file imagemanager.cpp.
|
virtual |
Returns the number of unloaded resources
Gets the total number of resources created but not loaded. These resources have been defined in the resource manager but have yet to be loaded from disk.
Implements FIFE::IResourceManager.
Definition at line 60 of file imagemanager.cpp.
|
virtual |
Returns the number of loaded resources
Gets the total number of resources created and loaded. These resources have been defined in the resource manager have been loaded from disk.
Implements FIFE::IResourceManager.
Definition at line 74 of file imagemanager.cpp.
|
virtual |
Creates a blank resource and loads it from disk
This function will create the Image if necessary and load the Image from disk. If the Image is not defined it will call ImageManager::create() before loading.
name | The resource name. Typically a filename. |
loader | A pointer to the custom resource loader. The default is NULL. If this parameter is present the resource will use the loader to load instead of the default built in functions. |
Definition at line 107 of file imagemanager.cpp.
References create().
Referenced by get().
|
virtual |
Loads a blank resource
width | |
height |
Definition at line 130 of file imagemanager.cpp.
References add().
|
virtual |
Loads a blank resource
name | |
width | |
height |
Definition at line 139 of file imagemanager.cpp.
References add().
|
virtual |
Loads all unreferenced Images
All Images that have no external references will be loaded into memory.
Definition at line 230 of file imagemanager.cpp.
|
virtual |
Reloads an Image
This function will reload an Image if it is managed by the manager. If not it creates an entry in the log specifying that the Image could not be found. It will load the Image if it is not already loaded.
name | The name of the resource |
Definition at line 189 of file imagemanager.cpp.
|
virtual |
Reloads a resource
This function will reload an Image if it is managed by the manager. If not it creates an entry in the log specifying that the Image could not be found. It will load the Image if it is not already loaded.
handle | The handle of the resource |
Definition at line 203 of file imagemanager.cpp.
|
virtual |
Reloads all Images
This function will reload all Images managed by the manager. It will load an Image if it is not already loaded.
Definition at line 218 of file imagemanager.cpp.
|
virtual |
Removes an Image from the manager
This removes all references to the Image from the manager. It does not however guarantee that the resources destructor is called. If the client has any left over references to the resource it will not be freed.
resource | A ImagePtr to the image to be removed from the manager |
Definition at line 300 of file imagemanager.cpp.
|
virtual |
Removes an Image from the manager
This removes all references to the Image from the manager. It does not however guarantee that the resources destructor is called. If the client has any left over references to the resource it will not be freed.
name | The name of the Image |
Definition at line 317 of file imagemanager.cpp.
|
virtual |
Removes an Image from the manager
This removes all references to the Image from the manager. It does not however guarantee that the resources destructor is called. If the client has any left over references to the resource it will not be freed.
handle | The handle of the Image |
Definition at line 339 of file imagemanager.cpp.
|
virtual |
Removes all Images from the manager
This effectively removes all references to all Images from the manager. If there are left over shared pointers to any resources they will not be deleted.
Definition at line 362 of file imagemanager.cpp.
|
virtual |
Removes all unreferenced Images
This effectively removes all Images that dont have an external reference. The resources will be deleted.
Definition at line 374 of file imagemanager.cpp.