CPImageSprite

org.cosplay.CPImageSprite$
See theCPImageSprite companion class
object CPImageSprite

Companion object contains utility methods.

Attributes

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

Members list

Value members

Concrete methods

def apply(id: String, xf: CPCanvas => Int, yf: CPCanvas => Int, z: Int, img: CPImage, collidable: Boolean, shaders: Seq[CPShader], tags: Set[String]): 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.

Value parameters

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.

tags

Optional set of organizational or grouping tags. By default, the empty set is used.

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.

Attributes

See also
Example

See CPImageCarouselExample class for the example of using images.

See CPImageFormatsExample class for the example of using images.

Source
CPImageSprite.scala