AgBitmapTextureManager

Class in charge of automatically handling AGTexture<->Bitmap conversion.

To simplify texture storage (which usually require uploading to the GPU, and releasing it once not used), the AgBitmapTextureManager allows to get temporal textures that are available while referenced in the previous framesBetweenGC frames, typically 60.

If it has been framesBetweenGC frames without being referenced, the textures are collected. This greatly simplifies texture management, but might have an impact in performance. If you want to keep a Bitmap or an atlas in the GPU so there is no impact on uploading when required, you can just call any of the getTexture* methods here each frame, even if not using it in the current frame.

You can also manage Texture manually, but you should release the textures manually by calling Texture.close so the resources are freed.

If maxCachedMemory is not 0L, that value will be used to keep some textures in the cache even if they were not referenced in the past frames since GC.

Constructors

Link copied to clipboard
constructor(ag: AG)

Properties

Link copied to clipboard
val ag: AG
Link copied to clipboard

Number of frames between each Texture Garbage Collection step

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
Link copied to clipboard

Obtains a temporal TextureBase from bitmap. The texture shouldn't be stored, but used for drawing since it will be destroyed once not used anymore.

Link copied to clipboard
fun removeBitmap(bmp: Bitmap, reason: String)
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard