Manages resource ID mappings for fonts, images, sounds, etc. More...
#include <GUIResourceManager.h>
Public Member Functions | |
void | AddToPrefetchQueue (const ImageResource_t eID) |
void | DynamicFontsMustExist (eC_Bool bMustExist) |
void | DynamicGeneralResourcesMustExist (eC_Bool bMustExist) |
void | DynamicImagesMustExist (eC_Bool bMustExist) |
void | DynamicSoundsMustExist (eC_Bool bMustExist) |
void | EnablePreloading (const eC_Bool bPreLoadPermanentData) |
void | FreeFontResource (const FontResource_t eFontID) |
void | FreeGeneralResource (const GeneralResource_t eResourceID) |
void | FreeImageResource (const ImageResource_t eImageID) |
void | FreeSoundResource (const SoundResource_t eSoundID) |
eC_Bool | GetAddResourceFilePrefix (void) const |
eC_UInt | GetColorValue (const ColorResource_t &eColorID) const |
eC_String | GetFontPath (const FontResource_t &eFontID) const |
eC_Int | GetFontRequestCount (const FontResource_t &eFontID) const |
eC_String | GetFontsFilename () const |
eC_UInt | GetFontSize (const FontResource_t &eFontID) const |
CFntWrap::GUIFont_t | GetFontStyle (const FontResource_t &eFontID) const |
eC_String | GetGeneralResourcePath (const GeneralResource_t &eResourceID) const |
eC_Int | GetGeneralResourceRequestCount (const GeneralResource_t &eGeneralResourceID) const |
eC_String | GetGeneralResourcesFilename () const |
eC_String | GetImagePath (const ImageResource_t &eImageID) const |
eC_Int | GetImageRequestCount (const ImageResource_t &eImageID) const |
eC_String | GetImagesFilename () const |
eC_UInt | GetNofImagesInPrefetchList () |
eC_Bool | GetPredictResourceFileExtension (void) const |
eC_String | GetSoundPath (const SoundResource_t &eSoundID) const |
eC_Int | GetSoundRequestCount (const SoundResource_t &eSoundID) const |
eC_String | GetSoundsFilename () const |
eC_Bool | IsDynamicColor (ColorResource_t eColorID) |
eC_Bool | IsDynamicFont (FontResource_t eFontID) |
eC_Bool | IsDynamicGeneralResource (GeneralResource_t eResourceID) |
eC_Bool | IsDynamicImage (ImageResource_t eImageID) |
eC_Bool | IsDynamicSound (SoundResource_t eSoundID) |
eC_Bool | IsFontPermanent (const FontResource_t &eFontID) const |
eC_Bool | IsGeneralResourcePermanent (const GeneralResource_t &eResourceID) const |
eC_Bool | IsImagePermanent (const ImageResource_t &eImageID) const |
eC_Bool | IsSoundPermanent (const SoundResource_t &eSoundID) const |
void | KeepDynamicFonts (eC_Bool bKeep) |
void | KeepDynamicGeneralResources (eC_Bool bKeep) |
void | KeepDynamicImages (eC_Bool bKeep) |
void | KeepDynamicSounds (eC_Bool bKeep) |
void | OverwriteDynamicFonts (eC_Bool bOverwrite) |
void | OverwriteDynamicGeneralResources (eC_Bool bOverwrite) |
void | OverwriteDynamicImages (eC_Bool bOverwrite) |
void | OverwriteDynamicSounds (eC_Bool bOverwrite) |
void | PrintReloadCounts () |
Only available in debug builds: Prints the count of reloads for each image. | |
void | PrintRequestCounts () |
Only available in debug builds: Prints the count of currently requested images. | |
void | RefreshImageResource (const ImageResource_t &eImageID, void *pkMemory) |
void | RegisterColorResource (const eC_UInt &uiValue, const ColorResource_t eColorID) |
eC_Bool | RegisterColorResourcesFromFile (const eC_String &rkPath) |
ColorResource_t | RegisterDynamicColor (const eC_UInt &ruiValue) |
FontResource_t | RegisterDynamicFont (const eC_String &kPath, eC_UInt uiFontSize, const CFntWrap::GUIFont_t &eFontStyle, eC_Bool bPermanent=true) |
GeneralResource_t | RegisterDynamicGeneralResource (const eC_String &rkPath, eC_Bool bPermanent=false) |
ImageResource_t | RegisterDynamicImage (const eC_String &kPath, const eC_Bool bPermanent=false) |
ImageResource_t | RegisterDynamicImage (void *pkMemory, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &eImageType, const eC_Bool bPermanent=true) |
SoundResource_t | RegisterDynamicSound (const eC_String &kPath, const eC_Bool bPermanent=false) |
void | RegisterFontResource (const eC_String &kPath, const FontResource_t eFontID, const eC_UInt uiFontSize, const CFntWrap::GUIFont_t &eFontStyle, const eC_Bool bPermanent=true) |
eC_Bool | RegisterFontResourcesFromFile (const eC_String &rkPath) |
void | RegisterGeneralResource (const eC_String &rkPath, const GeneralResource_t eResourceID, eC_Bool bPermanent=false) |
eC_Bool | RegisterGeneralResourcesFromFile (const eC_String &rkPath) |
void | RegisterImageResource (const eC_String &kPath, const ImageResource_t eImageID, const eC_Bool bPermanent=false) |
void | RegisterImageResource (void *pkMemory, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &eImageType, const ImageResource_t eImageID, const eC_Bool bPermanent) |
eC_Bool | RegisterImageResourcesFromFile (const eC_String &rkPath) |
void | RegisterSoundResource (const eC_String &pcPath, const SoundResource_t eSoundID, const eC_Bool bPermanent=false) |
eC_Bool | RegisterSoundResourcesFromFile (const eC_String &rkPath) |
eC_Bool | RemoveFromPrefetchQueue (const ImageResource_t eID) |
void | RequestFontResource (const FontResource_t eFontID) |
void | RequestGeneralResource (const GeneralResource_t eResourceID) |
void | RequestImageResource (const ImageResource_t eImageID) |
void | RequestSoundResource (const SoundResource_t eSoundID) |
void | SetAddResourceFilePrefix (const eC_Bool &bAddResourceFilePrefix) |
void | SetFontStyle (const FontResource_t &eFontID, const CFntWrap::GUIFont_t &eStyle) |
void | SetGlobalColor (const ColorResource_t &eColorID, eC_UInt uiValue) |
void | SetPredictResourceFileExtension (const eC_Bool &bPredictResourceFileExtension) |
void | SetPrefetchDelay (eC_UInt uiDelay) |
eC_Bool | WriteColorResourcesToFile (const eC_String &rkPath) |
void | WriteDialogToFile (const eC_String &pkStreamingFile, CGUIObject *pkDialog) |
void | WriteDialogToFile (eC_File *pkFile, CGUIObject *pkDialog) |
eC_Bool | WriteFontResourcesToFile (const eC_String &kPath) |
eC_Bool | WriteGeneralResourcesToFile (const eC_String &rkPath) |
eC_Bool | WriteImageResourcesToFile (const eC_String &kPath) |
eC_Bool | WriteSoundResourcesToFile (const eC_String &kPath) |
Static Public Member Functions | |
static void | CreateInstance () |
static void | DeleteInstance () |
Friends | |
class | CGUI |
class | CGUIComponentManager |
Manages resource ID mappings for fonts, images, sounds, etc.
A GUI usually consists of a variety of resources such as images, fonts and sounds which it uses to visualize itself. An efficient management of these resources is required to optimize the memory and CPU usage of your application. This is critical especially on embedded systems, where system resources are typically very limited.
Guiliani enables you to share resources among various objects within the GUI and allows you to tune the way in which they are loaded / unloaded so that it best matches your target setup. Usually this will be a trade-off between loading-times and amount of memory usage.
The ResourceManager maps abstract resource identifiers (ImageResource_t, SoundResource_t, FontResource_t) to file names. For example calling RegisterImageResource("FancyLogo.png", IMG_MY_FANCY_LOGO) will make the image in FancyLogo.png available throughout your application under the abstract ID IMG_MY_FANCY_LOGO. These relations can be set manually or can be read from an initfile. Objects can request and free resources by ID. The ResourceManager keeps a reference count of all resources and causes their loading (upon first request) or unloading (if a resource is no longer in use by any object.)
Typical use-case (for images):
Free the resource data by calling appropriate unloader function, e.g. FreeImageResource(), so that resource data will be freed if no longer in use by the application.
Example usage:
If the application decides to instantiate an image cache (see CGUIImageCache::CreateInstance()), loading and unloading of images is managed by the image cache instead of the resource manager. To learn more, see CGUIImageCacheImpl.
If you wish to optimize the flow of your application further, you may want to use the ResourceManager's AddToPrefetchQueue() method. This tells the framework to load the given image in a low-priority background thread, so that it is already available in memory once it gets requested for the first time. A typical use-case for this would for example be to prefetch the images of the GUI-screen which the user is most likely to enter next.
As outlined above, there is typically one pre-defined resource ID per resource. If an application needs to load images or other resources that were unknown at build time, there are no pre-defined IDs for these resources. To facilitate registering and loading of such resources, the resource manager provides the so-called dynamic resource management. It takes the following steps:
In some cases, it might be necessary to keep dynamic resources around for reloading even if their request count reaches zero in-between. To instruct the resource manager to keep resource information, call one of the following methods: KeepDynamicImages(), KeepDynamicSounds() or KeepDynamicFonts().
void CGUIResourceManager::AddToPrefetchQueue | ( | const ImageResource_t | eID) |
Use this method to add an image resource (which you expect to be required soon) to the prefetch queue. The image will be loaded in a low-priority background thread, so that the loading does not interrupt the GUI execution but the image will be already available once it gets requested. Note that prefetching does not automatically request an image. This means that its reference count remains zero and it may be unloaded any time, until you explicitly request it.
eID | ID of the Image which will be loaded in background. |
|
static |
Create instance
|
static |
Delete instance
void CGUIResourceManager::DynamicFontsMustExist | ( | eC_Bool | bMustExist) |
Enables or disables check if dynamic font exists before registering it.
bMustExist | if True then dynamic font must exist when they are registered. If they don't exist the registering-process will fail with an error-message and return a dummy-resource |
void CGUIResourceManager::DynamicGeneralResourcesMustExist | ( | eC_Bool | bMustExist) |
Enables or disables check if dynamic general resource exists before registering it.
bMustExist | if True then dynamic general resource must exist when they are registered. If they don't exist the registering-process will fail with an error-message and return a dummy-resource |
void CGUIResourceManager::DynamicImagesMustExist | ( | eC_Bool | bMustExist) |
Enables or disables check if dynamic image exists before registering it.
bMustExist | if True then dynamic images must exist when they are registered. If they don't exist the registering-process will fail with an error-message and return a dummy-resource |
void CGUIResourceManager::DynamicSoundsMustExist | ( | eC_Bool | bMustExist) |
Enables or disables check if dynamic sound exists before registering it.
bMustExist | if True then dynamic sound must exist when they are registered. If they don't exist the registering-process will fail with an error-message and return a dummy-resource |
|
inline |
Enable and disable preloading of permanent data. If enabled, permanent data is loaded on registration. Attention! If you enable preloading after registration of permanent data, this data will not be loaded if it is requested. Set this flag before any registration to avoid this!
bPreLoadPermanentData | True if permanent |
void CGUIResourceManager::FreeFontResource | ( | const FontResource_t | eFontID) |
Use this method to free a font resource. If the requestcounter of a resource is 0 and the resource is not declared as permanent, the ResourceManager will call the GFXWrapper to unload the Resource. If the resource was dynamic, it's ID will be freed to make it usable again.
eFontID | ID of the font which is no longer in use. |
void CGUIResourceManager::FreeGeneralResource | ( | const GeneralResource_t | eResourceID) |
Use this method to free a general resource.
If the referencecounter of a resource is 0 and the resource is not declared as permanent, the ResourceManager will call the interpreters unload method.
If the resource was dynamic, it's ID will be freed to make it usable again.
eResourceID | ID of the general resource is no longer in use. |
void CGUIResourceManager::FreeImageResource | ( | const ImageResource_t | eImageID) |
Use this method to free an image resource. If the requestcounter of a resource is 0 and the resource is not declared as permanent, the ResourceManager will call the GFXWrapper to unload the resource. If the resource was dynamic, it's ID will be freed to make it usable again.
eImageID | ID of the image which is no longer in use. |
void CGUIResourceManager::FreeSoundResource | ( | const SoundResource_t | eSoundID) |
Use this method to free an sound resource. If the requestcounter of a resource is 0 and the resource is not declared as permanent, the resourcemanager will call the SoundWrapper to unload the resource. If the resource was dynamic, it's ID will be freed to make it usable again.
eSoundID | id of the sound which is no longer in use. |
eC_Bool CGUIResourceManager::GetAddResourceFilePrefix | ( | void | ) | const |
is adding of prefix for resourcefiles active?
eC_UInt CGUIResourceManager::GetColorValue | ( | const ColorResource_t & | eColorID) | const |
Get the value of a color resource.
eColorID | ID of the color. |
eC_String CGUIResourceManager::GetFontPath | ( | const FontResource_t & | eFontID) | const |
Retrieves the path of the registered font.
eFontID | id of the font. |
eC_Int CGUIResourceManager::GetFontRequestCount | ( | const FontResource_t & | eFontID) | const |
Get the request count of a font id.
eFontID | ID of the font. |
eC_String CGUIResourceManager::GetFontsFilename | ( | ) | const |
Return the name of the currently active fonts-set
eC_UInt CGUIResourceManager::GetFontSize | ( | const FontResource_t & | eFontID) | const |
Retrieves the font size of font.
eFontID | id of the font. |
CFntWrap::GUIFont_t CGUIResourceManager::GetFontStyle | ( | const FontResource_t & | eFontID) | const |
Retrieves the style of the registered font.
eFontID | id of the font. |
eC_String CGUIResourceManager::GetGeneralResourcePath | ( | const GeneralResource_t & | eResourceID) | const |
Get the path of a general resource.
eResourceID | ID of the general resource. |
eC_Int CGUIResourceManager::GetGeneralResourceRequestCount | ( | const GeneralResource_t & | eGeneralResourceID) | const |
Get the request count of a general resource id.
eGeneralResourceID | ID of the general resource. |
eC_String CGUIResourceManager::GetGeneralResourcesFilename | ( | ) | const |
Return the name of the currently active general resources-set
eC_String CGUIResourceManager::GetImagePath | ( | const ImageResource_t & | eImageID) | const |
Get the path of an image id.
eImageID | ID of the image. |
eC_Int CGUIResourceManager::GetImageRequestCount | ( | const ImageResource_t & | eImageID) | const |
Get the request count of an image id.
eImageID | ID of the image. |
eC_String CGUIResourceManager::GetImagesFilename | ( | ) | const |
Return the name of the currently active images-set
eC_UInt CGUIResourceManager::GetNofImagesInPrefetchList | ( | ) |
Get the number of images contained in the prefetch queue of the background image loader.
eC_Bool CGUIResourceManager::GetPredictResourceFileExtension | ( | void | ) | const |
is prediction of extensions for resourcefiles active?
eC_String CGUIResourceManager::GetSoundPath | ( | const SoundResource_t & | eSoundID) | const |
Get the path of a sound resource.
eSoundID | ID of the sound. |
eC_Int CGUIResourceManager::GetSoundRequestCount | ( | const SoundResource_t & | eSoundID) | const |
Get the request count of a sound id.
eSoundID | ID of the sound. |
eC_String CGUIResourceManager::GetSoundsFilename | ( | ) | const |
Return the name of the currently active sounds-set
eC_Bool CGUIResourceManager::IsDynamicColor | ( | ColorResource_t | eColorID) |
Checks whether an ID was created for a dynamically registered color.
eColorID | The color ID to be checked. |
eC_Bool CGUIResourceManager::IsDynamicFont | ( | FontResource_t | eFontID) |
Checks whether an ID was created for a dynamically registered font.
eFontID | The font ID to be checked. |
eC_Bool CGUIResourceManager::IsDynamicGeneralResource | ( | GeneralResource_t | eResourceID) |
Checks whether an ID was created for a dynamically registered general resource.
eResourceID | The general resource ID to be checked. |
eC_Bool CGUIResourceManager::IsDynamicImage | ( | ImageResource_t | eImageID) |
Checks whether an ID was created for a dynamically registered image.
eImageID | The image ID to be checked. |
eC_Bool CGUIResourceManager::IsDynamicSound | ( | SoundResource_t | eSoundID) |
Checks whether an ID was created for a dynamically registered sound.
eSoundID | The sound ID to be checked. |
eC_Bool CGUIResourceManager::IsFontPermanent | ( | const FontResource_t & | eFontID) | const |
Checks whether the permanent flag for a font is set.
eFontID | The font to be checked. |
eC_Bool CGUIResourceManager::IsGeneralResourcePermanent | ( | const GeneralResource_t & | eResourceID) | const |
Checks whether the permanent flag for a general resource is set.
eResourceID | The general resource to be checked. |
eC_Bool CGUIResourceManager::IsImagePermanent | ( | const ImageResource_t & | eImageID) | const |
Checks whether the permanent flag for an image is set.
eImageID | The image to be checked. |
eC_Bool CGUIResourceManager::IsSoundPermanent | ( | const SoundResource_t & | eSoundID) | const |
Checks whether the permanent flag for a sound is set.
eSoundID | The sound to be checked. |
void CGUIResourceManager::KeepDynamicFonts | ( | eC_Bool | bKeep) |
Enables or disables keeping of dynamic font information. By default, a dynamic font is removed once the request count for the font reaches zero. By enabling keeping, the font path is kept even if the request count reaches zero. At this point, the font is unloaded if it is not permanent, but keeping the path makes it possible to reload it by requesting the font again using the same dynamically assigned ID. The downside of this behaviour is that (very small) portions of memory stay occupied for the font path and other font information.
bKeep | True for enabling keeping, false for disabling it. When disabling, each dynamic font path whose request count is zero is removed. |
void CGUIResourceManager::KeepDynamicGeneralResources | ( | eC_Bool | bKeep) |
Enables or disables keeping of dynamic abstract resources. It depends on the implementation of the resource file interpreter how to cache the resource then, just the flag of keeping of dynamic resources is provided by ResourceManager.
bKeep | True for forcing the given interpreter to keep the resource data, False otherwise. |
void CGUIResourceManager::KeepDynamicImages | ( | eC_Bool | bKeep) |
Enables or disables keeping of dynamic image information. By default, a dynamic image is removed once the request count for the image reaches zero. By enabling keeping, the image path is kept even if the request count reaches zero. At this point, the image is unloaded if it is not permanent, but keeping the path makes it possible to reload it by requesting the image again using the same dynamically assigned ID. The downside of this behaviour is that (very small) portions of memory stay occupied for the image path and other image information.
bKeep | True for enabling keeping, false for disabling it. When disabling, each dynamic image path whose request count is zero is removed. |
void CGUIResourceManager::KeepDynamicSounds | ( | eC_Bool | bKeep) |
Enables or disables keeping of dynamic sound information. By default, a dynamic sound is removed once the request count for the sound reaches zero. By enabling keeping, the sound path is kept even if the request count reaches zero. At this point, the sound is unloaded if it is not permanent, but keeping the path makes it possible to reload it by requesting the sound again using the same dynamically assigned ID. The downside of this behaviour is that (very small) portions of memory stay occupied for the sound path and other sound information.
bKeep | True for enabling keeping, false for disabling it. When disabling, each dynamic sound path whose request count is zero is removed. |
void CGUIResourceManager::OverwriteDynamicFonts | ( | eC_Bool | bOverwrite) |
Enables or disables overwriting dynamic fonts which have the same name.
bOverwrite | True if dynamic fonts should be overwritten, if another font with the same name and properties is to be registered. |
void CGUIResourceManager::OverwriteDynamicGeneralResources | ( | eC_Bool | bOverwrite) |
Enables or disables overwriting dynamic general resources which have the same name.
bOverwrite | True if dynamic general resources should be overwritten, if another general resource with the same name is to be registered. |
void CGUIResourceManager::OverwriteDynamicImages | ( | eC_Bool | bOverwrite) |
Enables or disables overwriting dynamic images which have the same name.
bOverwrite | True if dynamic images should be overwritten, if another image with the same name is to be registered. |
void CGUIResourceManager::OverwriteDynamicSounds | ( | eC_Bool | bOverwrite) |
Enables or disables overwriting dynamic sounds which have the same name.
bOverwrite | True if dynamic sounds should be overwritten, if another sound with the same name is to be registered. |
void CGUIResourceManager::RefreshImageResource | ( | const ImageResource_t & | eImageID, |
void * | pkMemory | ||
) |
Use this method to refresh an image bound to a memory-location
eImageID | ID of the image |
pkMemory | memory |
void CGUIResourceManager::RegisterColorResource | ( | const eC_UInt & | uiValue, |
const ColorResource_t | eColorID | ||
) |
Use this method to register a general resource ID to a path.
uiValue | value of the color |
eColorID | ID which should be mapped to the color. |
eC_Bool CGUIResourceManager::RegisterColorResourcesFromFile | ( | const eC_String & | rkPath) |
Reads ColorResources and their attributes from file and registers the colors. GUIStreamReader has to be initialized.
rkPath | Path to the source file. |
CGUIException | if source file could not be opened, or errors occurred while reading the file. |
ColorResource_t CGUIResourceManager::RegisterDynamicColor | ( | const eC_UInt & | ruiValue) |
This method generates a dynamic general resource identifier for the given resource file and automatically registers it.
ruiValue | color-value |
FontResource_t CGUIResourceManager::RegisterDynamicFont | ( | const eC_String & | kPath, |
eC_UInt | uiFontSize, | ||
const CFntWrap::GUIFont_t & | eFontStyle, | ||
eC_Bool | bPermanent = true |
||
) |
This method generates a dynamic font identifier for the given font and automatically registers it.
kPath | to the font file. |
uiFontSize | Size of the font |
eFontStyle | as defined in CFntWrap::GUIFont_t |
bPermanent | If the flag is true the ResourceManager will not unload the resource. (true by default). |
GeneralResource_t CGUIResourceManager::RegisterDynamicGeneralResource | ( | const eC_String & | rkPath, |
eC_Bool | bPermanent = false |
||
) |
This method generates a dynamic general resource identifier for the given resource file and automatically registers it.
rkPath | To the general resource file. |
bPermanent | If the flag is true the ResourceManager will not unload the resource. (False is default). |
ImageResource_t CGUIResourceManager::RegisterDynamicImage | ( | const eC_String & | kPath, |
const eC_Bool | bPermanent = false |
||
) |
This method generates a dynamic image identifier for the given image and automatically registers it.
kPath | to the image file. |
bPermanent | If the flag is true the ResourceManager will not unload the resource when the request-count is decremented to 0 (false by default). |
ImageResource_t CGUIResourceManager::RegisterDynamicImage | ( | void * | pkMemory, |
const eC_UInt & | uiWidth, | ||
const eC_UInt & | uiHeight, | ||
const eC_UInt & | eImageType, | ||
const eC_Bool | bPermanent = true |
||
) |
This method generates a dynamic image identifier for the given image and automatically registers it.
pkMemory | memory-location |
uiWidth | |
uiHeight | |
eImageType | |
bPermanent | If the flag is true the ResourceManager will not unload the resource when the request-count is decremented to 0 (true by default). |
SoundResource_t CGUIResourceManager::RegisterDynamicSound | ( | const eC_String & | kPath, |
const eC_Bool | bPermanent = false |
||
) |
This method generates a dynamic sound identifier for the given sound and automatically registers it.
kPath | to the sound file. |
bPermanent | If the flag is true the ResourceManager will not unload the resource when the request count is decremented to 0 (false by default). |
void CGUIResourceManager::RegisterFontResource | ( | const eC_String & | kPath, |
const FontResource_t | eFontID, | ||
const eC_UInt | uiFontSize, | ||
const CFntWrap::GUIFont_t & | eFontStyle, | ||
const eC_Bool | bPermanent = true |
||
) |
Use this method to register a font resource ID to a path.
kPath | to the font file. |
eFontID | ID which should be mapped to the font. |
uiFontSize | Size of the font |
eFontStyle | as defined in CFntWrap::GUIFont_t |
bPermanent | If the flag is true the ResourceManager will not unload the resource. (true by default). |
eC_Bool CGUIResourceManager::RegisterFontResourcesFromFile | ( | const eC_String & | rkPath) |
Reads FontResources and their attributes from file and registers the fonts. GUIStreamReader has to be initialized.
rkPath | Path to the source file. |
CGUIException | if source file could not be opened, or errors occurred while reading the file. |
void CGUIResourceManager::RegisterGeneralResource | ( | const eC_String & | rkPath, |
const GeneralResource_t | eResourceID, | ||
eC_Bool | bPermanent = false |
||
) |
Use this method to register a general resource ID to a path.
rkPath | Path to the general resource file. |
eResourceID | ID which should be mapped to the resource file. |
bPermanent | If the flag is true, the ResourceManager will not unload the resource. (false by default). |
eC_Bool CGUIResourceManager::RegisterGeneralResourcesFromFile | ( | const eC_String & | rkPath) |
Reads GeneralResources and their attributes from file and registers the resources. GUIStreamReader has to be initialized.
rkPath | Path to the source file. |
CGUIException | If source file could not be opened, or errors occurred while reading the file. |
void CGUIResourceManager::RegisterImageResource | ( | const eC_String & | kPath, |
const ImageResource_t | eImageID, | ||
const eC_Bool | bPermanent = false |
||
) |
Use this method to register an image resource ID to a path.
kPath | to the image file. |
eImageID | ID which should be mapped to the image file. |
bPermanent | If the flag is true the ResourceManager will not unload the resource if the request-count is decremented to 0 (false by default). |
void CGUIResourceManager::RegisterImageResource | ( | void * | pkMemory, |
const eC_UInt & | uiWidth, | ||
const eC_UInt & | uiHeight, | ||
const eC_UInt & | eImageType, | ||
const ImageResource_t | eImageID, | ||
const eC_Bool | bPermanent | ||
) |
Use this method to register an image resource ID to a memory-location.
pkMemory | memory-location |
uiWidth | width of the image-data |
uiHeight | height of the image-data |
eImageType | color-format of the image |
eImageID | ID which should be mapped to the image file. |
bPermanent | If the flag is true the ResourceManager will not unload the resource if the request-count is decremented to 0 (false by default). |
eC_Bool CGUIResourceManager::RegisterImageResourcesFromFile | ( | const eC_String & | rkPath) |
Reads ImageResources and their paths from file and registers them. A CGUIStreamReader has to be initialized.
rkPath | Path to the source file. |
void CGUIResourceManager::RegisterSoundResource | ( | const eC_String & | pcPath, |
const SoundResource_t | eSoundID, | ||
const eC_Bool | bPermanent = false |
||
) |
Use this method to register a sound resource ID to a path.
pcPath | path to the soundFile. |
eSoundID | id which should be mapped to the soundfile. |
bPermanent | if the flag is true the resourcemanager will not unload the resource. (false by default). |
eC_Bool CGUIResourceManager::RegisterSoundResourcesFromFile | ( | const eC_String & | rkPath) |
Reads SoundResources and their attributes from file and registers the sounds. GUIStreamReader has to be initialized.
rkPath | Path to the source file. |
CGUIException | if source file could not be opened, or errors occurred while reading the file. |
eC_Bool CGUIResourceManager::RemoveFromPrefetchQueue | ( | const ImageResource_t | eID) |
Use this method to remove an image resource from the prefetch queue. If the image ID is still in the prefetch queue it will be simply removed. If it has been already loaded and is not used so far, the image will be marked as released and unloaded during the next call of PrefetchNow()
eID | ID of the Image which will be loaded in background. |
void CGUIResourceManager::RequestFontResource | ( | const FontResource_t | eFontID) |
Use this method to request a font resource. If a resource is requested for the first time and a font was registered before, the ResourceManager will call the GfxWrapper to load the resource. If the GFXWrapper could not load the resouce, it will use GUILOG to issue a warning.
eFontID | ID of the requested font. |
void CGUIResourceManager::RequestGeneralResource | ( | const GeneralResource_t | eResourceID) |
Use this method to request a general resource.
If a resource is requested for the first time and a resource was registered before, the ResourceManager will call the given interpreter to handle the resource.
If the interpreter could not load the resource, it will use GUILOG to issue a warning.
eResourceID | ID of the requested general resource. |
void CGUIResourceManager::RequestImageResource | ( | const ImageResource_t | eImageID) |
Use this method to request an image resource. If a resource is requested for the first time and an image was registered before, the ResourceManager will call the GfxWrapper to load the resource. If the GFXWrapper could not load the resouce, it will use GUILOG to issue a warning.
eImageID | ID of the Requested Image. |
void CGUIResourceManager::RequestSoundResource | ( | const SoundResource_t | eSoundID) |
Use this method to request a sound resource. If a resource is requested for the first time and a sound was registered before, the ResourceManager will call the SoundWrapper the resource. If the SoundWrapper could not load the resouce, it will use GUILOG to issue a warning.
eSoundID | ID of the requested sound. |
void CGUIResourceManager::SetAddResourceFilePrefix | ( | const eC_Bool & | bAddResourceFilePrefix) |
set if CGUIResourceManager should add the prefix for resource-files
bAddResourceFilePrefix | if true add prefix |
void CGUIResourceManager::SetFontStyle | ( | const FontResource_t & | eFontID, |
const CFntWrap::GUIFont_t & | eStyle | ||
) |
Set the style for the font.
eFontID | ID of the font. |
eStyle | The font style. |
void CGUIResourceManager::SetGlobalColor | ( | const ColorResource_t & | eColorID, |
eC_UInt | uiValue | ||
) |
Set color with id to value
eColorID | color-id |
uiValue | value |
void CGUIResourceManager::SetPredictResourceFileExtension | ( | const eC_Bool & | bPredictResourceFileExtension) |
set if CGUIResourceManager should determine the extension for resource-files from the currently used stream-reader (xml or bin)
bPredictResourceFileExtension | if true predict extension |
void CGUIResourceManager::SetPrefetchDelay | ( | eC_UInt | uiDelay) |
Sets the time in milliseconds that has to pass between prefetching one image and the next in the queue. By default this is set to 50 ms.
uiDelay | Delay between image prefetch calls in milliseconds. |
eC_Bool CGUIResourceManager::WriteColorResourcesToFile | ( | const eC_String & | rkPath) |
Writes all registered ColorResources of the GUI to File. A CGUIStreamWriter has to be initialized.
rkPath | Path to the destination file. |
CGUIException | If destination file could not be opened. |
void CGUIResourceManager::WriteDialogToFile | ( | const eC_String & | pkStreamingFile, |
CGUIObject * | pkDialog | ||
) |
Writes a GUIObject (and in case of a CompositeObject all of its children) to streaming file. This file can be used with the GUIFactory to create the GUI at runtime.
pkStreamingFile | Filename and path of destination file. |
pkDialog | Pointer to the dialog which should be written |
void CGUIResourceManager::WriteDialogToFile | ( | eC_File * | pkFile, |
CGUIObject * | pkDialog | ||
) |
Writes a GUIObject (and in case of a CompositeObject all of its children) to streaming file. This file can be used with the GUIFactory to create the GUI at runtime.
pkFile | eC_File* of destination file. |
pkDialog | Pointer to the dialog which should be written |
eC_Bool CGUIResourceManager::WriteFontResourcesToFile | ( | const eC_String & | kPath) |
Writes all registered FontResources of the GUI to File. A CGUIStreamWriter has to be initialized.
kPath | Path to the destination file. |
CGUIException | if destination file could not be opened. |
eC_Bool CGUIResourceManager::WriteGeneralResourcesToFile | ( | const eC_String & | rkPath) |
Writes all registered GeneralResources of the GUI to File. A CGUIStreamWriter has to be initialized.
rkPath | Path to the destination file. |
CGUIException | If destination file could not be opened. |
eC_Bool CGUIResourceManager::WriteImageResourcesToFile | ( | const eC_String & | kPath) |
Writes all registered ImageResources of the GUI to File. A CGUIStreamWriter has to be initialized.
kPath | Path to the destination file. |
CGUIException | if destination file could not be opened. |
eC_Bool CGUIResourceManager::WriteSoundResourcesToFile | ( | const eC_String & | kPath) |
Writes all registered SoundResources of the GUI to File. A CGUIStreamWriter has to be initialized.
kPath | Path to the destination file. |
CGUIException | if destination file could not be opened. |
|
friend |
|
friend |