Elaztek Developer Hub
Blamite Game Engine - Strings  00402.09.29.23.0627.blamite
A library containing general purpose utilities and classes for use in multiple projects.
BlamStrings::Resources Namespace Reference

Functions used in loading and accessing resources. More...

Namespaces

 Strings
 Namespace containing functions for Blamite string resources.
 
 VersionInfo
 Namespace containing functions related to product versions.
 

Functions

STRINGS_API BlamResourceGroup ParseResourceGroupXML (std::string base_dir, std::string resource_file, rapidxml::xml_node<> *root_node, BlamResult *result)
 Parses a resource group from the resource group's XML file. More...
 
STRINGS_API BlamResult LoadResources (std::string resource_file)
 Loads a new resource group. More...
 
STRINGS_API std::string GetResourcePath (std::string group_id, std::string id)
 Retrieves the file path for a given resource. More...
 
STRINGS_API bool ResourceExists (std::string group_id, std::string id)
 Determines if a resource exists within a given group. More...
 
STRINGS_API BlamResourceGroupGetResourceGroup (std::string group_id)
 Retrieves a resource group. More...
 
STRINGS_API std::map< std::string, BlamResourceGroupGetResourceGroups ()
 Retrieves the map of all resource groups. More...
 

Detailed Description

Functions used in loading and accessing resources.

These resources can refer to any kind of file, though the most common use case is images or icons. This system was originally restricted to the Keystone library for use with theming, but is now accessible to the entire engine in order to aid in the use of cross-platform resources.

Function Documentation

◆ GetResourceGroup()

BlamResourceGroup * BlamStrings::Resources::GetResourceGroup ( std::string  group_id)

Retrieves a resource group.

Parameters
group_id- The ID of the desired resource group.
Returns
Pointer to the resource group if it exists, otherwise returns nullptr.

◆ GetResourceGroups()

std::map< std::string, BlamResourceGroup > BlamStrings::Resources::GetResourceGroups ( )

Retrieves the map of all resource groups.

The key of the map represents the group name, while the value stores the resource group data.

Returns
The map of all available resource groups.

◆ GetResourcePath()

std::string BlamStrings::Resources::GetResourcePath ( std::string  group_id,
std::string  id 
)

Retrieves the file path for a given resource.

Parameters
group_id- The ID of the group the resource belongs to.
id- The ID of the resource.
Returns
The path to the resource. If the resource does not exist, a fallback icon path is used instead.
+ Here is the call graph for this function:

◆ LoadResources()

BlamResult BlamStrings::Resources::LoadResources ( std::string  resource_file)

Loads a new resource group.

Parameters
resource_file- The path to the resource file to load.
Returns
#BlamResult::Success_OK if the resource file was loaded without error, otherwise returns an error code.
+ Here is the call graph for this function:

◆ ParseResourceGroupXML()

BlamResourceGroup BlamStrings::Resources::ParseResourceGroupXML ( std::string  base_dir,
std::string  resource_file,
rapidxml::xml_node<> *  root_node,
BlamResult result 
)

Parses a resource group from the resource group's XML file.

Parameters
base_dir- The base directory of the resource group. This is prefixed onto all resource file paths.
resource_file- The path to the resource file. Used in debug log messages.
root_node- The root XML node of this resource group.
result- This is set to the parse result of the group.
Returns
The resulting resource group. The result parameter should be verified before use.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ResourceExists()

bool BlamStrings::Resources::ResourceExists ( std::string  group_id,
std::string  id 
)

Determines if a resource exists within a given group.

Parameters
group_id- The ID of the group the resource belongs to.
id- The ID of the resource.
Returns
true if the resource exists, otherwise returns false.
+ Here is the caller graph for this function: