Class/Object

io.scalajs.dom.html.phaser

Cache

Related Docs: object Cache | package phaser

Permalink

class Cache extends Object

Phaser has one single cache in which it stores all assets.

The cache is split up into sections, such as images, sounds, video, json, etc. All assets are stored using a unique string-based key as their identifier. Assets stored in different areas of the cache can have the same key, for example 'playerWalking' could be used as the key for both a sprite sheet and an audio file, because they are unique data types.

The cache is automatically populated by the Phaser.Loader. When you use the loader to pull in external assets such as images they are automatically placed into their respective cache. Most common Game Objects, such as Sprites and Videos automatically query the cache to extract the assets they need on instantiation.

You can access the cache from within a State via this.cache. From here you can call any public method it has, including adding new entries to it, deleting them or querying them.

Understand that almost without exception when you get an item from the cache it will return a reference to the item stored in the cache, not a copy of it. Therefore if you retrieve an item and then modify it, the original object in the cache will also be updated, even if you don't put it back into the cache again.

By default when you change State the cache is not cleared, although there is an option to clear it should your game require it. In a typical game set-up the cache is populated once after the main game has loaded and then used as an asset store.

Annotations
@RawJSType() @native() @JSName( "Phaser.Cache" )
See also

https://phaser.io/docs/2.6.2/Phaser.Cache.html

Linear Supertypes
Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Cache
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Cache(game: Phaser.Game)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. var game: Phaser.Game

    Permalink
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  21. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  22. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped