Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
Blam::EngineResources Namespace Reference

Namespace for things related to game engine resources. More...

Functions

BLAM bool LoadEngineResources ()
 Loads all required engine resources. More...
 
BLAM void ReleaseEngineResources ()
 Releases all engine resources. More...
 
BLAM BlamResource GetResource (std::string file_path)
 Retrieves a resource. More...
 
BLAM BlamResourceGetResourcePointer (std::string file_path)
 Retrieves a pointer to a resource. More...
 
BLAM bool SaveResource (std::string file_path)
 Saves a resource back to the disk. More...
 

Detailed Description

Namespace for things related to game engine resources.

Engine resources are, in a sense, a form of content - although not entirely. They refer to any sort of data used for the engine itself, rather than for any specific game - for instance, default engine globals, the colormap, UI schemes, engine strings, and engine configuration files.

Function Documentation

◆ GetResource()

BlamResource Blam::EngineResources::GetResource ( std::string  file_path)

Retrieves a resource.

Parameters
file_path- The file path of the resource. This MUST be identical to the path used to load the resource originally. Alternatively, the resource ID can be used instead.
Returns
The associated BlamResource

◆ GetResourcePointer()

BlamResource * Blam::EngineResources::GetResourcePointer ( std::string  file_path)

Retrieves a pointer to a resource.

The resource actually stores a pointer in the first place, so you generally won't need to use this except for cases where you plan to alter a resource (and do so in such a way that requires changing the resource's size).

Parameters
file_path- The file path of the resource. This MUST be identical to the path used to load the resource originally. Alternatively, the resource ID can be used instead.
Returns
A pointer to the associated BlamResource, or nullptr if no matching resource was found.

◆ LoadEngineResources()

bool Blam::EngineResources::LoadEngineResources ( )

Loads all required engine resources.

This function will load any and all engine resources. This should be run before starting up any other engine components, as those components may depend on one or more of these resources. In the past, resources were loaded as part of each component's initialization process. Going forward all data files that the engine needs to utilize should be loaded here - nowhere else.

Returns
true if all resources were loaded without error, otherwise returns false. Engine initialization should be aborted if this function fails.

◆ ReleaseEngineResources()

void Blam::EngineResources::ReleaseEngineResources ( )

Releases all engine resources.

Just as how LoadEngineResources() is called earliest, this function should be called last. It will release and, thus, invalidate all loaded engine resources.

◆ SaveResource()

bool Blam::EngineResources::SaveResource ( std::string  file_path)

Saves a resource back to the disk.

If a resource has been modified, this can be used to save the file back to local storage. Otherwise, any changes will be lost at engine shutdown.

Parameters
file_path- The file path of the resource. This MUST be identical to the path used to load the resource originally. Alternatively, the resource ID can be used instead.
Returns
true if the resource was saved successfully, otherwise returns false.