Guiliani  Version 2.5 revision 6773 (build 33)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CGUIResourceManager Class Reference

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
 

Detailed Description

Manages resource ID mappings for fonts, images, sounds, etc.

Overview

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 Resource Manager

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):

  1. Create a new ResourceID by adding it to UserImageResource.h (e.g. IMG_MY_FANCY_LOGO)
  2. Call RegisterImageResourcesFromFile() in order to load mappings of resource IDs and resource files Alternatively, register the images by calling RegisterImageResource() manually.
  3. Before usage, call appropriate loader function, e.g. RequestImageResource(), so that the resource data is loaded into RAM if needed.
  4. Use the resource (e.g. Blit it using GETGFX.BlitImg())
  5. 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:

    #include "GUIResourceManager.h"
    // Register Image
    GETRESMANAGER.RegisterImageResource("FancyLogo.png", IMG_MY_FANCY_LOGO);
    // Request image (this will load it, if it is not already present in memory)
    GETRESMANAGER.RequestImageResource(IMG_MY_FANCY_LOGO);
    // Use the image as required
    GETGFX.BlitImg(IMG_MY_FANCY_LOGO, 0,0);
    // free image (this will unload it, if it is not requested by anyone else anymore
    GETRESMANAGER.FreeImageResource(IMG_MY_FANCY_LOGO);

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.

Loading images in background

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.

Dynamic resources

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:

  1. Call RegisterDynamicImage(), RegisterDynamicSound() or RegisterDynamicFont(). These methods return dynamically assigned resource IDs.
  2. Use the returned ID exactly like pre-defined IDs for requesting and releasing resources.
  3. After the request count of the resource reaches zero, it is (by default) unloaded and its information is removed from the resource manager, rendering the resource ID invalid. It must not be used again after that.

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().

Member Function Documentation

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.

Parameters
eIDID of the Image which will be loaded in background.
void CGUIResourceManager::CreateInstance ( )
static

Create instance

void CGUIResourceManager::DeleteInstance ( )
static

Delete instance

void CGUIResourceManager::DynamicFontsMustExist ( eC_Bool  bMustExist)

Enables or disables check if dynamic font exists before registering it.

Parameters
bMustExistif 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.

Parameters
bMustExistif 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.

Parameters
bMustExistif 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.

Parameters
bMustExistif 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
void CGUIResourceManager::EnablePreloading ( const eC_Bool  bPreLoadPermanentData)
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!

Parameters
bPreLoadPermanentDataTrue 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.

Parameters
eFontIDID 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.

Parameters
eResourceIDID 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.

Parameters
eImageIDID 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.

Parameters
eSoundIDid of the sound which is no longer in use.
eC_Bool CGUIResourceManager::GetAddResourceFilePrefix ( void  ) const

is adding of prefix for resourcefiles active?

Returns
true if active
eC_UInt CGUIResourceManager::GetColorValue ( const ColorResource_t eColorID) const

Get the value of a color resource.

Parameters
eColorIDID of the color.
Returns
value of the color that the ID is registered to.
eC_String CGUIResourceManager::GetFontPath ( const FontResource_t eFontID) const

Retrieves the path of the registered font.

Parameters
eFontIDid of the font.
Returns
The font path or an empty string if no font with that ID was registered or the font ID is invalid.
eC_Int CGUIResourceManager::GetFontRequestCount ( const FontResource_t eFontID) const

Get the request count of a font id.

Parameters
eFontIDID of the font.
Returns
Request count of the font or -1 if the font ID is invalid.
eC_String CGUIResourceManager::GetFontsFilename ( ) const

Return the name of the currently active fonts-set

Returns
font-set
eC_UInt CGUIResourceManager::GetFontSize ( const FontResource_t eFontID) const

Retrieves the font size of font.

Parameters
eFontIDid of the font.
Returns
Font size in ppi or 0 if the font ID is invalid.
CFntWrap::GUIFont_t CGUIResourceManager::GetFontStyle ( const FontResource_t eFontID) const

Retrieves the style of the registered font.

Parameters
eFontIDid of the font.
Returns
the font style, CFntWrap::FNT_NORMAL if no font for this id is registered or the font ID is invalid.
eC_String CGUIResourceManager::GetGeneralResourcePath ( const GeneralResource_t eResourceID) const

Get the path of a general resource.

Parameters
eResourceIDID of the general resource.
Returns
Path of the general resource file that the ID is registered to.
eC_Int CGUIResourceManager::GetGeneralResourceRequestCount ( const GeneralResource_t eGeneralResourceID) const

Get the request count of a general resource id.

Parameters
eGeneralResourceIDID of the general resource.
Returns
Request count of the general resource or -1 if the resource ID is invalid.
eC_String CGUIResourceManager::GetGeneralResourcesFilename ( ) const

Return the name of the currently active general resources-set

Returns
general resource-set
eC_String CGUIResourceManager::GetImagePath ( const ImageResource_t eImageID) const

Get the path of an image id.

Parameters
eImageIDID of the image.
Returns
Path of the image file that the id is registered to.
eC_Int CGUIResourceManager::GetImageRequestCount ( const ImageResource_t eImageID) const

Get the request count of an image id.

Parameters
eImageIDID of the image.
Returns
Request count of the image or -1 if the image ID is invalid.
eC_String CGUIResourceManager::GetImagesFilename ( ) const

Return the name of the currently active images-set

Returns
image-set
eC_UInt CGUIResourceManager::GetNofImagesInPrefetchList ( )

Get the number of images contained in the prefetch queue of the background image loader.

Returns
The remaining number of images in the prefetch queue.
eC_Bool CGUIResourceManager::GetPredictResourceFileExtension ( void  ) const

is prediction of extensions for resourcefiles active?

Returns
true if active
eC_String CGUIResourceManager::GetSoundPath ( const SoundResource_t eSoundID) const

Get the path of a sound resource.

Parameters
eSoundIDID of the sound.
Returns
Path of the sound file that the ID is registered to.
eC_Int CGUIResourceManager::GetSoundRequestCount ( const SoundResource_t eSoundID) const

Get the request count of a sound id.

Parameters
eSoundIDID of the sound.
Returns
Request count of the sound or -1 if the sound ID is invalid.
eC_String CGUIResourceManager::GetSoundsFilename ( ) const

Return the name of the currently active sounds-set

Returns
sound-set
eC_Bool CGUIResourceManager::IsDynamicColor ( ColorResource_t  eColorID)

Checks whether an ID was created for a dynamically registered color.

Parameters
eColorIDThe color ID to be checked.
Returns
True if eColorID is a dynamic ID, otherwise False.
eC_Bool CGUIResourceManager::IsDynamicFont ( FontResource_t  eFontID)

Checks whether an ID was created for a dynamically registered font.

Parameters
eFontIDThe font ID to be checked.
Returns
True if eFontID is a dynamic ID, otherwise False.
eC_Bool CGUIResourceManager::IsDynamicGeneralResource ( GeneralResource_t  eResourceID)

Checks whether an ID was created for a dynamically registered general resource.

Parameters
eResourceIDThe general resource ID to be checked.
Returns
True if eResourceID is a dynamic ID, otherwise False.
eC_Bool CGUIResourceManager::IsDynamicImage ( ImageResource_t  eImageID)

Checks whether an ID was created for a dynamically registered image.

Parameters
eImageIDThe image ID to be checked.
Returns
True if eImageID is a dynamic ID, otherwise False.
eC_Bool CGUIResourceManager::IsDynamicSound ( SoundResource_t  eSoundID)

Checks whether an ID was created for a dynamically registered sound.

Parameters
eSoundIDThe sound ID to be checked.
Returns
True if eSoundID is a dynamic ID, otherwise False.
eC_Bool CGUIResourceManager::IsFontPermanent ( const FontResource_t eFontID) const

Checks whether the permanent flag for a font is set.

Parameters
eFontIDThe font to be checked.
Returns
True if the font is permanent, otherwise False.
eC_Bool CGUIResourceManager::IsGeneralResourcePermanent ( const GeneralResource_t eResourceID) const

Checks whether the permanent flag for a general resource is set.

Parameters
eResourceIDThe general resource to be checked.
Returns
True if the general resource is permanent, otherwise False.
eC_Bool CGUIResourceManager::IsImagePermanent ( const ImageResource_t eImageID) const

Checks whether the permanent flag for an image is set.

Parameters
eImageIDThe image to be checked.
Returns
True if the image is permanent, otherwise False.
eC_Bool CGUIResourceManager::IsSoundPermanent ( const SoundResource_t eSoundID) const

Checks whether the permanent flag for a sound is set.

Parameters
eSoundIDThe sound to be checked.
Returns
True if the sound is permanent, otherwise False.
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.

Parameters
bKeepTrue 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.

Parameters
bKeepTrue 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.

Parameters
bKeepTrue 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.

Parameters
bKeepTrue 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.

Parameters
bOverwriteTrue 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.

Parameters
bOverwriteTrue 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.

Parameters
bOverwriteTrue 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.

Parameters
bOverwriteTrue 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

Parameters
eImageIDID of the image
pkMemorymemory
void CGUIResourceManager::RegisterColorResource ( const eC_UInt &  uiValue,
const ColorResource_t  eColorID 
)

Use this method to register a general resource ID to a path.

Parameters
uiValuevalue of the color
eColorIDID 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.

Parameters
rkPathPath to the source file.
Exceptions
CGUIExceptionif source file could not be opened, or errors occurred while reading the file.
See Also
CGUIStreamReader
Returns
Always True
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.

Parameters
ruiValuecolor-value
Returns
ResourceID under which this color resource will now be available.
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.

Parameters
kPathto the font file.
uiFontSizeSize of the font
eFontStyleas defined in CFntWrap::GUIFont_t
bPermanentIf the flag is true the ResourceManager will not unload the resource. (true by default).
Returns
FontID under which this font will now be available.
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.

Parameters
rkPathTo the general resource file.
bPermanentIf the flag is true the ResourceManager will not unload the resource. (False is default).
Returns
ResourceID under which this general resource will now be available.
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.

Parameters
kPathto the image file.
bPermanentIf the flag is true the ResourceManager will not unload the resource when the request-count is decremented to 0 (false by default).
Returns
ImageID under which this image will now be available.
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.

Parameters
pkMemorymemory-location
uiWidth
uiHeight
eImageType
bPermanentIf the flag is true the ResourceManager will not unload the resource when the request-count is decremented to 0 (true by default).
Returns
ImageID under which this image will now be available.
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.

Parameters
kPathto the sound file.
bPermanentIf the flag is true the ResourceManager will not unload the resource when the request count is decremented to 0 (false by default).
Returns
SoundID under which this sound will now be available.
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.

Parameters
kPathto the font file.
eFontIDID which should be mapped to the font.
uiFontSizeSize of the font
eFontStyleas defined in CFntWrap::GUIFont_t
bPermanentIf 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.

Parameters
rkPathPath to the source file.
Exceptions
CGUIExceptionif source file could not be opened, or errors occurred while reading the file.
See Also
CGUIStreamReader
Returns
Always True
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.

Parameters
rkPathPath to the general resource file.
eResourceIDID which should be mapped to the resource file.
bPermanentIf 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.

Parameters
rkPathPath to the source file.
Exceptions
CGUIExceptionIf source file could not be opened, or errors occurred while reading the file.
See Also
CGUIStreamReader
Returns
Always True
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.

Parameters
kPathto the image file.
eImageIDID which should be mapped to the image file.
bPermanentIf 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.

Parameters
pkMemorymemory-location
uiWidthwidth of the image-data
uiHeightheight of the image-data
eImageTypecolor-format of the image
eImageIDID which should be mapped to the image file.
bPermanentIf 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.

Parameters
rkPathPath to the source file.
See Also
CGUIStreamReader
Returns
Always True
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.

Parameters
pcPathpath to the soundFile.
eSoundIDid which should be mapped to the soundfile.
bPermanentif 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.

Parameters
rkPathPath to the source file.
Exceptions
CGUIExceptionif source file could not be opened, or errors occurred while reading the file.
See Also
CGUIStreamReader
Returns
Always True
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()

Parameters
eIDID of the Image which will be loaded in background.
Returns
True if the image resource has been removed from the queue, False if it is not in the list and could not been unloaded
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.

Parameters
eFontIDID 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.

Parameters
eResourceIDID 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.

Parameters
eImageIDID 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.

Parameters
eSoundIDID of the requested sound.
void CGUIResourceManager::SetAddResourceFilePrefix ( const eC_Bool &  bAddResourceFilePrefix)

set if CGUIResourceManager should add the prefix for resource-files

Parameters
bAddResourceFilePrefixif true add prefix
void CGUIResourceManager::SetFontStyle ( const FontResource_t eFontID,
const CFntWrap::GUIFont_t eStyle 
)

Set the style for the font.

Parameters
eFontIDID of the font.
eStyleThe font style.
void CGUIResourceManager::SetGlobalColor ( const ColorResource_t eColorID,
eC_UInt  uiValue 
)

Set color with id to value

Parameters
eColorIDcolor-id
uiValuevalue
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)

Parameters
bPredictResourceFileExtensionif 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.

Parameters
uiDelayDelay 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.

Parameters
rkPathPath to the destination file.
Exceptions
CGUIExceptionIf destination file could not be opened.
See Also
CGUIStreamWriter
Returns
Always True
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.

Parameters
pkStreamingFileFilename and path of destination file.
pkDialogPointer 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.

Parameters
pkFileeC_File* of destination file.
pkDialogPointer 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.

Parameters
kPathPath to the destination file.
Exceptions
CGUIExceptionif destination file could not be opened.
See Also
CGUIStreamWriter
Returns
Always True
eC_Bool CGUIResourceManager::WriteGeneralResourcesToFile ( const eC_String &  rkPath)

Writes all registered GeneralResources of the GUI to File. A CGUIStreamWriter has to be initialized.

Parameters
rkPathPath to the destination file.
Exceptions
CGUIExceptionIf destination file could not be opened.
See Also
CGUIStreamWriter
Returns
Always True
eC_Bool CGUIResourceManager::WriteImageResourcesToFile ( const eC_String &  kPath)

Writes all registered ImageResources of the GUI to File. A CGUIStreamWriter has to be initialized.

Parameters
kPathPath to the destination file.
Exceptions
CGUIExceptionif destination file could not be opened.
See Also
CGUIStreamWriter
Returns
Always True
eC_Bool CGUIResourceManager::WriteSoundResourcesToFile ( const eC_String &  kPath)

Writes all registered SoundResources of the GUI to File. A CGUIStreamWriter has to be initialized.

Parameters
kPathPath to the destination file.
Exceptions
CGUIExceptionif destination file could not be opened.
See Also
CGUIStreamWriter
Returns
Always True

Friends And Related Function Documentation

friend class CGUI
friend
friend class CGUIComponentManager
friend

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