CPImageSprite

org.cosplay.CPImageSprite$
See theCPImageSprite companion class

Companion object contains utility methods.

Attributes

Companion:
class
Source:
CPImageSprite.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Concrete methods

def apply(id: String, xf: CPCanvas => Int, yf: CPCanvas => Int, z: Int, img: CPImage, collidable: Boolean, shaders: Seq[CPShader]): CPImageSprite

A convenient shortcut constructor for the image sprite that works in adaptive scene.

A convenient shortcut constructor for the image sprite that works in adaptive scene.

Instead of concrete XY-coordinates this method takes two functions that each takes an instance of CPCanvas class and produce X or Y coordinate. This way this image sprite can update its position on the canvas on each frame. See CPScene on details about adaptive scenes.

Attributes

collidable

Whether or not this sprite has a collision shape. Default is false.

id

ID of the sprite.

img

The image to render. It can be changed later.

shaders

Optional sequence of shaders for this sprite. Default value is an empty sequence.

xf

X-coordinate producing function that takes CPCanvas parameter.

yf

Y-coordinate producing function that takes CPCanvas parameter.

z

Z-index at which to render the image.

See also:
Example:

See CPImageCarouselExample class for the example of using images.

See CPImageFormatsExample class for the example of using images.

Source:
CPImageSprite.scala