class
#include <Jazz2/ContentResolver.h>
ContentResolver Manages loading of assets.
Public static variables
-
static std::
int32_t PaletteCount constexpr - Maximum number of palettes.
-
static std::
int32_t ColorsPerPalette constexpr - Number of colors per palette.
-
static std::
int32_t InvalidValue constexpr - Invalid value.
Public static functions
- static auto Get() -> ContentResolver&
- Returns static instance of main content resolver.
Constructors, destructors, conversion operators
Public functions
- void Release()
- Releases all cached assets.
- auto GetContentPath() const -> StringView
- Returns path to
"Content"
directory. - auto GetCachePath() const -> StringView
- Returns path to
"Cache"
directory. - auto GetSourcePath() const -> StringView
- Returns path to
"Source"
directory. - auto IsHeadless() const -> bool
- Returns
true
if the application is running in headless mode (i.e., without any display) - void SetHeadless(bool value)
- Sets whether the application is running in headless mode.
- void RemountPaks()
- Scans the
"Content"
and"Cache"
directories for.pak
files and mounts them -
auto OpenContentFile(StringView path) -> std::
unique_ptr<Stream> - Tries to find and open a file specified by the path.
- void BeginLoading()
- Marks beginning of the loading assets.
- void EndLoading()
- Marks end of the loading assets.
- void PreloadMetadataAsync(StringView path)
- Preloads specified metadata and its linked assets to cache.
- auto RequestMetadata(StringView path) -> Metadata*
- Loads specified metadata and its linked assets if not in cache already and returns it.
-
auto RequestGraphics(StringView path,
std::
uint16_t paletteOffset) -> GenericGraphicResource* - Loads specified graphics asset if not in cache already and returns it.
-
auto RequestTileSet(StringView path,
std::
uint16_t captionTileId, bool applyPalette, const std:: uint8_t* paletteRemapping = nullptr) -> std:: unique_ptr<Tiles:: TileSet> - Loads specified tile set and its palette.
- auto LevelExists(StringView episodeName, StringView levelName) -> bool
- Returns
true
if specified level exists. - auto TryLoadLevel(StringView path, GameDifficulty difficulty, LevelDescriptor& descriptor) -> bool
- Loads specified level into a level descriptor.
- void ApplyDefaultPalette()
- Loads default (sprite) palette.
-
auto GetEpisode(StringView name,
bool withImages = false) -> std::
optional<Episode> - Returns specified episode by name.
-
auto GetEpisodeByPath(StringView path,
bool withImages = false) -> std::
optional<Episode> - Returns specified episode by full path.
-
auto GetMusic(StringView path) -> std::
unique_ptr<AudioStreamPlayer> - Loads specified music.
-
auto GetFont(FontType fontType) -> UI::
Font* - Returns specified font type.
- auto GetShader(PrecompiledShader shader) -> Shader*
- Returns specified precompiled shader.
- void CompileShaders()
- Precompiles all required shaders.
-
auto GetNoiseTexture() -> std::
unique_ptr<Texture> - Returns a noise texture with random pixels.
-
auto GetPalettes() const -> const std::
uint32_t* - Returns currently loaded palette.