← API Reference Class

template<typename T> asge::game::asset::Asset final

A loaded value paired with the virtual path it was loaded from.

#include <Asset.hpp>

The asset-handle type ECS components and scenes hold instead of a hardcoded path: wraps whatever a loader (e.g. Image::Load, Font::Load) produced, alongside the virtual path (see filesystem::VirtualFileSystem) it was resolved from. Always shared_ptr-managed (see Create()) so enable_shared_from_this is safe to use.

Public Types

#using value_type = T

Private Attributes

#str::String m_VirtualPathprivate
#T m_Valueprivate

Public Member Functions

#Asset(PrivateTag, str::String inVirtualPath, T inValue)

Passkey-gated constructor; use Create() instead of calling this directly.

#Asset(Asset const &)=delete
#Asset & operator=(Asset const &)=delete
#Asset(Asset &&)=default
#Asset & operator=(Asset &&)=default
#T const & Get() const noexcept

Returns the wrapped value.

#T & Get() noexcept

Returns the wrapped value.

#str::StringView VirtualPath() const noexcept

Returns the virtual path this asset was loaded from.

Static Public Member Functions

#static std::shared_ptr< Asset< T > > Create(str::String inVirtualPath, T inValue) noexcept

Wraps an already-loaded value with the virtual path it came from, returning it shared_ptr-managed.