CPBorderShader

org.cosplay.prefabs.shaders.CPBorderShader
class CPBorderShader(entireFrame: Boolean, width: Int, compensateWidth: Boolean, colorMixPerStep: Float, autoStart: Boolean) extends CPShader

Border shade shader.

This shader creates a gradually shaded border by dimming the background color of the pixels closer to the border of the frame or object.

Value parameters

autoStart

Whether to start shader right away. Default value is false.

colorMixPerStep

Float value in [0,1] range indicating the color change per each step in the border.

compensateWidth

Whether or not to compensate for non-square form of the character "pixel". If true then for each horizontal line there will be 2 vertical lines giving the visual effect of the both horizontal and vertical border lines having the same width.

entireFrame

Whether apply to the entire camera frame or just the object this shader is attached to.

width

How many lines (vertical and horizontal) the shaded border width will be.

Attributes

See also
Example

See CPBirdGame class for the example of using this shader.

See CPShaderExample class for the example of using shaders.

Source
CPBorderShader.scala
Graph
Supertypes
trait CPShader
trait CPAsset
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def isActive: Boolean

Tests whether or not shader is currently active.

Tests whether or not shader is currently active.

Attributes

Source
CPBorderShader.scala
override def render(ctx: CPSceneObjectContext, objRect: CPRect, inCamera: Boolean): Unit

Called on each frame pass on scene object that has this shaders attached to it. This callback is called regardless of whether or not the scene object is visible or in camera frame.

Called on each frame pass on scene object that has this shaders attached to it. This callback is called regardless of whether or not the scene object is visible or in camera frame.

Attributes

Definition Classes
Source
CPBorderShader.scala
def start(): Unit

Starts the shader effect.

Starts the shader effect.

Attributes

See also
Source
CPBorderShader.scala
def stop(): Unit

Stops the shader effect without waiting for the duration.

Stops the shader effect without waiting for the duration.

Attributes

See also
Source
CPBorderShader.scala
def toggle(): Unit

Toggles this shader effect on and off by calling either start or stop methods.

Toggles this shader effect on and off by calling either start or stop methods.

Attributes

See also
Source
CPBorderShader.scala

Inherited fields

override val getOrigin: String

Gets the origin of this asset. Typically, this should be a URL, file name or class name for in-code assets like array images, animations or system font.

Gets the origin of this asset. Typically, this should be a URL, file name or class name for in-code assets like array images, animations or system font.

Attributes

Inherited from:
CPShader
Source
CPShader.scala