CPStarStreak

org.cosplay.prefabs.shaders.CPStarStreak
case class CPStarStreak(ch: Char, colors: Seq[CPColor], ratio: Float, steps: Int, speed: (Float, Float), z: Int)

An individual streak descriptor used by CPStarStreakShader.

Value parameters

ch

Character to use to draw stars in this streak.

colors

Set of initial color for fading from. Colors will be randomly chosen for each star.

ratio

Percentage of stars visible at the same time. For example, the value of 0.04 means 4%, and if the camera frame size is 100x50 characters then 4% ratio will result in 200 stars showing at any given time.

speed

Tuple defining the X and Y-axis increment on each frame. This tuples defines both the speed and the direction stars in this streak will move with.

steps

Number of frames that it takes for entire star lifecycle in this streak.

z

Z-index at which to draw the stars in this streak.

Attributes

See also
Example

See CPShaderExample class for the example of using shaders.

See org.cosplay.games.snake.CPSnakeTitleScene game scene for example of using this shader.

Source
CPStarStreakShader.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product