Skip to main content
 Warning: Unmaintained Version
Version: 0.4.2

AssetEntry

The AssetEntry is a specialized interface that extends the StaticEntry. It is primarily used for handling static assets within the game. Assets can include various types of files such as images, sounds, or other external resources that are crucial to enhancing the game environment and player experience. The key attribute of AssetEntry is the path, which specifies the location of the asset.

Usage

Here's a generic example of creating and using an AssetEntry:

Defining an AssetEntry

@Entry("example_asset", "An example asset entry.", Colors.PINK, Icons.PERSON_WALKING)
class ExampleAssetEntry(
override val path: String = "",
): AssetEntry

Accessing the Artifact's Content

To get the asset from the entry, you can use the following code:

import org.koin.java.KoinJavaComponent.get

val assetManager = get<AssetManager>(AssetManager::class.java)

val id = // ID of the entry
val entry = Query.findById<ExampleAssetEntry>(id)
val content: String = assetManager.fetchAsset(entry)