Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches

◆ getTexture()

GPUTexture & Flint::AssetManager::getTexture ( const std::string & path)

Return a GPU texture for path, uploading it on first access.

Subsequent calls with the same path return the cached texture without re-uploading.

Warning
The referenced texture is reassigned in place when hot-reload replaces the asset, so a reference held across frames may point at different GPU resources than when it was obtained. Re-call getTexture() each frame rather than caching the reference.
Parameters
pathAsset path relative to the loader's root.
Returns
Reference to the cached GPUTexture.
Exceptions
std::runtime_errorif the asset cannot be retrieved or uploaded.