FinalEngine.Resources
2023.4.0-pre
dotnet add package FinalEngine.Resources --version 2023.4.0-pre
NuGet\Install-Package FinalEngine.Resources -Version 2023.4.0-pre
<PackageReference Include="FinalEngine.Resources" Version="2023.4.0-pre" />
paket add FinalEngine.Resources --version 2023.4.0-pre
#r "nuget: FinalEngine.Resources, 2023.4.0-pre"
// Install FinalEngine.Resources as a Cake Addin #addin nuget:?package=FinalEngine.Resources&version=2023.4.0-pre&prerelease // Install FinalEngine.Resources as a Cake Tool #tool nuget:?package=FinalEngine.Resources&version=2023.4.0-pre&prerelease
FinalEngine.Resources
FinalEngine.Resources provides a set of classes and interfaces that can be used to manager resources within a Final Engine game. The general goal of this library is to provide users with an IResourceManager
used to load and unload references to resources.
Getting started
Below you'll find instructions on how to take advantage of this package. Please note that Final Engine is in active development and a full release is still underway.
Prerequisites
First off, you need to make sure you register a resource loader to the resource manager. Standard resource loaders can be found in the FinalEngine.Extensions.Resources package. So, just install the package and you're good to go.
Additionally, you can implement your own resource loader by creating your own implementation of the ResourceLoaderBase<TResource>
class. Note that TResource
refers to a generic of type IResource
.
Usage
Once the additional dependencies have been implemented you can now use the resource manager. To get started, we need to register any and all resource loaders we wish to use. This should be done before loading any resources.
// If for some reason you haven't yet created a file system object, create one.
var fileSystem = new FileSystem();
// Now let's create and register a sound resource loader.
var loader = new SoundResourceLoader(fileSystem);
ResourceManager.Instance.RegisterLoader<ISound>(loader);
Cool, so once all resource loaders are registered you can load and unload resources like so:
// Load a sound.
var sound = ResourceManager.Instance.LoadResource<ISound>("sound.mp3");
// Later on we can unload
ResourceManager.Instance.UnloadResource(sound);
Additional documentation
- Remember to unload your resources when you're done with them to remove unnecessary references to the resource and free up memory.
- Refrain from using the
Dispose
function provided by a loaded resource; this will most likely be omitted in a future release. The resource manager should be responsible for the lifecycle of any and all resources it manages.
Feedback
Want to provide feedback? Perhaps you have a found a bug or wish to provide a feature request? Look no further!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on FinalEngine.Resources:
Package | Downloads |
---|---|
FinalEngine.Audio
This is a library containing interfaces used to handle audio for Final Engine games. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2023.4.0-pre | 113 | 7/11/2023 |