PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
PixelBullet::Link Class Reference

Manages alias mappings for asset paths. This allows to use short “links” (e.g. @tex) that resolve to full directory paths. More...

#include <Link.hpp>

Public Member Functions

std::string ResolveAssetPath (const std::string &assetPath) const
 Resolve an asset path that may begin with an alias (e.g. "@tex/icons/...").
 
void RegisterAssetLink (const std::string &alias, const std::string &path)
 Register or override an asset link mapping.
 
void LoadAssetLinksFromFile (const std::string &filename)
 Load asset link mappings from a file.
 

Detailed Description

Manages alias mappings for asset paths. This allows to use short “links” (e.g. @tex) that resolve to full directory paths.

Member Function Documentation

◆ LoadAssetLinksFromFile()

void PixelBullet::Link::LoadAssetLinksFromFile ( const std::string & filename)

Load asset link mappings from a file.

◆ RegisterAssetLink()

void PixelBullet::Link::RegisterAssetLink ( const std::string & alias,
const std::string & path )

Register or override an asset link mapping.

Parameters
aliasThe alias (without the '@') e.g. "tex"
pathThe directory path that the alias should map to (e.g. "assets/textures").

◆ ResolveAssetPath()

std::string PixelBullet::Link::ResolveAssetPath ( const std::string & assetPath) const

Resolve an asset path that may begin with an alias (e.g. "@tex/icons/...").

If the path starts with '@', it is expected to be in the format: "@alias/some/path" The alias is looked up in the mapping table, and if found, replaced with the mapped path.

Parameters
assetPathThe asset path (may start with an alias).
Returns
The resolved asset path.

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