Skip to content

Commit

Permalink
AssetStorage documentation improvements. #259
Browse files Browse the repository at this point in the history
  • Loading branch information
czyzby committed Feb 23, 2021
1 parent 46ca2f4 commit e737368
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions assets-async/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ fun loadAssets() {
val assetStorage = AssetStorage(asyncContext = newAsyncContext(threads = 2))

// Instead of using Kotlin's built-in `async`, you can also use
// the `loadAsync` method of AssetStorage with is a shortcut for
// the `loadAsync` method of AssetStorage which is a shortcut for
// `async(assetStorage.asyncContext) { assetStorage.load }`:
val texture = assetStorage.loadAsync<Texture>("images/logo.png")
val font = assetStorage.loadAsync<BitmapFont>("fonts/font.fnt")
Expand Down Expand Up @@ -589,7 +589,7 @@ fun createCustomAssetStorage(): AssetStorage {
It is completely safe to call `load` and `loadAsync` multiple times with the same asset data, even just to obtain
asset instances. In that sense, they can be used as an alternative to `getAsync` inside coroutines.

Instead of loading the same asset multiple times, `AssetStorage` will just increase the reference count
Instead of loading the same asset multiple times, `AssetStorage` will just increase the count of references
to the asset and return the same instance on each request. This also works concurrently - the storage will
always load just _one_ asset instance, regardless of how many different threads and coroutines called `load`
in parallel.
Expand Down Expand Up @@ -883,8 +883,8 @@ Closest equivalents in `AssetManager` and `AssetStorage` APIs:

`AssetManager` | `AssetStorage` | Note
:---: | :---: | ---
`get<T>(String)` | `get<T>(String)` |
`get(String, Class<T>)` | `get(Identifier<T>)` |
`get<T>(String)` | `get<T>(String)` | `AssetStorage` uses reified types to prevent from runtime class cast exceptions.
`get(String, Class<T>)` | `get(Identifier<T>)` | `Identifier` pairs file path and asset type to identify an asset.
`get(AssetDescriptor<T>)` | `get(AssetDescriptor<T>)` |
`load(String, Class<T>)` | `loadAsync<T>(String)` | `load<T>(String)` can also be used as an alternative within coroutines.
`load(String, Class<T>, AssetLoaderParameters<T>)` | `loadAsync<T>(String, AssetLoaderParameters<T>)` | `load<T>(String, AssetLoaderParameters<T>)` can also be used as an alternative within coroutines.
Expand All @@ -909,8 +909,8 @@ Closest equivalents in `AssetManager` and `AssetStorage` APIs:
##### Integration with LibGDX and known unsupported features

`AssetStorage` does its best to integrate with LibGDX APIs - including the `AssetLoader` implementations, which were
designed for the `AssetManager`. [A dedicated wrapper](src/main/kotlin/ktx/assets/async/wrapper.kt) extends and
overrides `AssetManager`, delegating a subset of supported methods to `AssetStorage`. The official `AssetLoader`
designed for the `AssetManager`. [A dedicated wrapper](src/main/kotlin/ktx/assets/async/AssetManagerWrapper.kt) extends
and overrides `AssetManager`, delegating a subset of supported methods to `AssetStorage`. The official `AssetLoader`
implementations use supported methods such as `get`, but please note that some third-party loaders might not
work out of the box with `AssetStorage`. Exceptions related to broken loaders include `UnsupportedMethodException`
and `MissingDependencyException`.
Expand Down

0 comments on commit e737368

Please sign in to comment.