Elaztek Developer Hub
Blamite Game Engine - Keystone  00326.06.27.21.0407.blamite
A library that enables the use of Qt in Blamite's editing tools.
BlamKeystone::Resources Namespace Reference

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

Functions

KEYSTONE BlamKeystoneResourceGroup 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...
 
KEYSTONE BlamResult LoadResources (std::string resource_file)
 Loads a new resource group. More...
 
KEYSTONE std::string GetResourcePath (std::string group_id, std::string id)
 Retrieves the file path for a given resource. More...
 
KEYSTONE bool ResourceExists (std::string group_id, std::string id)
 Determines if a resource exists within a given group. More...
 
KEYSTONE BlamKeystoneResourceGroupGetResourceGroup (std::string group_id)
 Retrieves a resource group. More...
 

Detailed Description

Functions used in loading and accessing Keystone resources.

These resources can be anything, though are most often just images or icons. They can be overridden by themes.

Function Documentation

◆ GetResourceGroup()

BlamKeystoneResourceGroup * BlamKeystone::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.

◆ GetResourcePath()

std::string BlamKeystone::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.

◆ LoadResources()

BlamResult BlamKeystone::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.

◆ ParseResourceGroupXML()

BlamKeystoneResourceGroup BlamKeystone::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.

◆ ResourceExists()

bool BlamKeystone::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.