indigo.shared.scenegraph

Type members

Classlikes

final case class AmbientLight(color: RGBA) extends Light

Ambient light isn't emitted from anywhere in particular, it is the base amount of illumination. It's important for a dark cave to light enough for your player to appreciate just how dark it really is.

Ambient light isn't emitted from anywhere in particular, it is the base amount of illumination. It's important for a dark cave to light enough for your player to appreciate just how dark it really is.

Companion:
object
Companion:
class
sealed trait Blend
Companion:
object
object Blend
Companion:
class
final case class Blending(entity: Blend, layer: Blend, blendMaterial: BlendMaterial, clearColor: Option[RGBA])

Blending instances tell Indigo how to blend the entities onto a layer, and then how to blend the layer onto the layers below it.

Blending instances tell Indigo how to blend the entities onto a layer, and then how to blend the layer onto the layers below it.

Companion:
object
object Blending
Companion:
class
sealed trait Camera

Parent type of camera instances. Cameras are used to look around your games graphics / levels / scenes.

Parent type of camera instances. Cameras are used to look around your games graphics / levels / scenes.

Companion:
object
object Camera
Companion:
class
final case class Clip[M <: Material](size: Size, sheet: ClipSheet, playMode: ClipPlayMode, material: M, eventHandlerEnabled: Boolean, eventHandler: (Clip[_], GlobalEvent) => Option[GlobalEvent], position: Point, rotation: Radians, scale: Vector2, depth: Depth, ref: Point, flip: Flip) extends EntityNode[Clip[M]] with Cloneable with SpatialModifiers[Clip[M]]
Companion:
object
object Clip
Companion:
class
Companion:
class
Companion:
object
Companion:
class
final case class ClipSheet(frameCount: Int, frameDuration: Seconds, wrapAt: Int, arrangement: ClipSheetArrangement, startOffset: Int)
Companion:
object
object ClipSheet
Companion:
class
Companion:
class
final case class CloneBatch(id: CloneId, depth: Depth, cloneData: Array[CloneBatchData], staticBatchKey: Option[BindingKey]) extends DependentNode[CloneBatch]

Represents many clones of the same clone blank, differentiated only by their transform data.

Represents many clones of the same clone blank, differentiated only by their transform data.

Companion:
object
object CloneBatch
Companion:
class
final case class CloneBatchData(x: Int, y: Int, rotation: Radians, scaleX: Double, scaleY: Double)

Represents the standard allowable transformations of a clone.

Represents the standard allowable transformations of a clone.

Companion:
object
Companion:
class
final case class CloneBlank(id: CloneId, cloneable: () => Cloneable, isStatic: Boolean)

Used as the blueprint for any clones that want to copy it.

Used as the blueprint for any clones that want to copy it.

Value parameters:
cloneable

The primitive to clone, can be a Shape, Graphic or Sprite, or any custom entity that extends Cloneable

id

The CloneId of this blank

isStatic

Static clone blanks are only processed once and cached. This means that static sprites will never play their animations!

Companion:
object
object CloneBlank
Companion:
class
object CloneId
final case class CloneTileData(x: Int, y: Int, rotation: Radians, scaleX: Double, scaleY: Double, cropX: Int, cropY: Int, cropWidth: Int, cropHeight: Int)

Represents the allowable transformations of a tile clone.

Represents the allowable transformations of a tile clone.

Companion:
object
Companion:
class
final case class CloneTiles(id: CloneId, depth: Depth, cloneData: Array[CloneTileData], staticBatchKey: Option[BindingKey]) extends DependentNode[CloneTiles]

Represents many clones of the same cloneblank, differentiated by their transform data and which part of the texture it is cropped on.

Represents many clones of the same cloneblank, differentiated by their transform data and which part of the texture it is cropped on.

Companion:
object
object CloneTiles
Companion:
class
trait Cloneable

Used to distingush between cloneable and non-clonable scene graph nodes.

Used to distingush between cloneable and non-clonable scene graph nodes.

trait DependentNode[T <: SceneNode] extends SceneNode

DependentNodes are built-in node types where Indigo understands how to build the shader data, and the bounds are dependant on the contents of the node.

DependentNodes are built-in node types where Indigo understands how to build the shader data, and the bounds are dependant on the contents of the node.

Companion:
object
Companion:
class
final case class DirectionLight(color: RGBA, specular: RGBA, rotation: Radians) extends Light

Direction lights apply light to a scene evenly from a particular direction, as if from a point a very long way away, e.g. the sun.

Direction lights apply light to a scene evenly from a particular direction, as if from a point a very long way away, e.g. the sun.

Companion:
object
Companion:
class
trait EntityNode[T <: SceneNode] extends RenderNode[T]

EntityNodes can be extended to create custom scene elements.

EntityNodes can be extended to create custom scene elements.

Can be made cloneable by extending Cloneable.

Companion:
object
object EntityNode
Companion:
class
sealed trait Falloff

Represents different lighting falloff models, also known as attenuation, i.e. how much a light power decays over distance.

Represents different lighting falloff models, also known as attenuation, i.e. how much a light power decays over distance.

Quadratic is the most physically accurate, but possibly least useful for 2D games! All other models are unrealistic, but possibly easier to work with.

Note that "intensity" will feel different in different lighting models. Try smooth with intensity 1 or 2, Linear 5, or Quadratic 500 and compare.

Companion:
object
object Falloff
Companion:
class
final case class Graphic[M <: Material](material: M, crop: Rectangle, eventHandlerEnabled: Boolean, eventHandler: (Graphic[_], GlobalEvent) => Option[GlobalEvent], position: Point, rotation: Radians, scale: Vector2, depth: Depth, ref: Point, flip: Flip) extends RenderNode[Graphic[M]] with Cloneable with SpatialModifiers[Graphic[M]]

Graphics are used to draw images on the screen, in a cheap efficient but expressive way. Graphic's party trick is it's ability to crop images.

Graphics are used to draw images on the screen, in a cheap efficient but expressive way. Graphic's party trick is it's ability to crop images.

Companion:
object
object Graphic
Companion:
class
final case class Group(children: List[SceneNode], eventHandlerEnabled: Boolean, eventHandler: (Group, GlobalEvent) => Option[GlobalEvent], position: Point, rotation: Radians, scale: Vector2, depth: Depth, ref: Point, flip: Flip) extends DependentNode[Group] with SpatialModifiers[Group]

Used to group elements to allow them to be manipulated as a collection.

Used to group elements to allow them to be manipulated as a collection.

Companion:
object
object Group
Companion:
class
final case class Layer(nodes: List[SceneNode], lights: List[Light], key: Option[BindingKey], magnification: Option[Int], depth: Option[Depth], visible: Option[Boolean], blending: Option[Blending], camera: Option[Camera])

A layers are used to stack collections screen elements on top of one another.

A layers are used to stack collections screen elements on top of one another.

During the scene render, each layer in depth order is blended into the one below it, a bit like doing a foldLeft over a list. You can control how the blend is performed to create effects.

Layer fields are all either Lists or options to denote that you can have them but that it isn't necessary. Layers are "monoids" which just means that they can be empty and they can be combined. It is important to note that when they combine they are left bias in the case of all optional fields, which means, that if you do: a.show |+| b.hide, the layer will be visible. This may look odd, and maybe it is (time will tell!), but the idea is that you can set empty placeholder layers early in your scene and then add things to them, confident of the outcome.

Value parameters:
blending

Optionally describes how to blend this layer onto the one below, by default, simply overlays on onto the other.

camera

Optional camera specifically for this layer. If None, fallback to scene camera, or default camera.

depth

Specifically set the depth, defaults to scene order.

key

Optionally set a binding key, allows you to target specific layers when merging SceneUpdateFragments.

lights

Layer level dynamic lights

magnification

Optionally set the magnification, defaults to scene magnification.

nodes

Nodes to render in this layer.

visible

Optionally set the visiblity, defaults to visible

Companion:
object
object Layer
Companion:
class
sealed trait Light

Parent type for all lights

Parent type for all lights

final case class Mutants(id: CloneId, depth: Depth, uniformBlocks: Array[List[UniformBlock]]) extends DependentNode[Mutants]

Represents many identical clones of the same clone blank, differentiated only by their shader data. Intended for use with custom entities in particular.

Represents many identical clones of the same clone blank, differentiated only by their shader data. Intended for use with custom entities in particular.

Companion:
object
object Mutants
Companion:
class

Scene audio can either be played on a loop, or be silenced.

Scene audio can either be played on a loop, or be silenced.

final case class PointLight(position: Point, color: RGBA, specular: RGBA, intensity: Double, falloff: Falloff) extends Light

Point lights emit light evenly in all directions from a point in space.

Point lights emit light evenly in all directions from a point in space.

Companion:
object
object PointLight
Companion:
class
trait RenderNode[T <: SceneNode] extends SceneNode

RenderNodes are built-in node types that have their own size, and where Indigo understands how to build the shader data.

RenderNodes are built-in node types that have their own size, and where Indigo understands how to build the shader data.

Companion:
object
object RenderNode
Companion:
class
final case class SceneAudio(sourceA: SceneAudioSource, sourceB: SceneAudioSource, sourceC: SceneAudioSource)

Describes what audio is currently being played by the scene as part of a SceneUpdateFragment. Can play up to three audio sources at once.

Describes what audio is currently being played by the scene as part of a SceneUpdateFragment. Can play up to three audio sources at once.

Companion:
object
object SceneAudio
Companion:
class
final case class SceneAudioSource(bindingKey: BindingKey, playbackPattern: PlaybackPattern, masterVolume: Volume)

Represents a single audio source, how it is being played, and at what volume. You could implement a cross fade between two audio sources.

Represents a single audio source, how it is being played, and at what volume. You could implement a cross fade between two audio sources.

Companion:
object
Companion:
class
sealed trait SceneNode

The parent type of all nodes a user might use or create. Defines the fields needed to draw something onto the screen.

The parent type of all nodes a user might use or create. Defines the fields needed to draw something onto the screen.

Companion:
object
object SceneNode
Companion:
class
final case class SceneUpdateFragment(layers: List[Layer], lights: List[Light], audio: SceneAudio, blendMaterial: Option[BlendMaterial], cloneBlanks: List[CloneBlank], camera: Option[Camera])

A description of what the engine should next present to the player.

A description of what the engine should next present to the player.

SceneUpdateFragments are predicatably composable, so you can make a scene in pieces and then combine them all at the end.

Note that a SceneUpdateFragment represents what is to happen next. It is not a diff. If you remove a sprite from the definition it will not be drawn.

Value parameters:
audio

Background audio.

blendMaterial

Optional blend material that describes how to render the scene to the screen.

camera

Scene level camera enabling pan and zoom.

cloneBlanks

A list of elements that will be referenced by clones in the main layers.

layers

The layers game elements are placed on.

lights

Dynamic lights.

Companion:
object
Companion:
class
sealed trait Shape[T <: Shape[_]] extends RenderNode[T] with Cloneable with SpatialModifiers[T]

Parent type for all Shapes, which are visible elements draw mathematically that require no textures. Shapes are quite versitile and support different fills and stroke effects, even lighting. Due to the way strokes around shapes are drawn, the corners are always rounded.

Parent type for all Shapes, which are visible elements draw mathematically that require no textures. Shapes are quite versitile and support different fills and stroke effects, even lighting. Due to the way strokes around shapes are drawn, the corners are always rounded.

Companion:
object
object Shape
Companion:
class
final case class SpotLight(position: Point, color: RGBA, specular: RGBA, intensity: Double, angle: Radians, rotation: Radians, falloff: Falloff) extends Light

Spot lights emit light like a lamp, they are essentially a point light, where the light is only allow to escape in a particular anglular range.

Spot lights emit light like a lamp, they are essentially a point light, where the light is only allow to escape in a particular anglular range.

Companion:
object
object SpotLight
Companion:
class
final case class Sprite[M <: Material](bindingKey: BindingKey, material: M, animationKey: AnimationKey, animationActions: List[AnimationAction], eventHandlerEnabled: Boolean, eventHandler: (Sprite[_], GlobalEvent) => Option[GlobalEvent], position: Point, rotation: Radians, scale: Vector2, depth: Depth, ref: Point, flip: Flip) extends DependentNode[Sprite[M]] with Cloneable with SpatialModifiers[Sprite[M]]

Sprites are used to represented key-frame animated screen elements.

Sprites are used to represented key-frame animated screen elements.

Companion:
object
object Sprite
Companion:
class
final case class Text[M <: Material](text: String, alignment: TextAlignment, fontKey: FontKey, material: M, eventHandlerEnabled: Boolean, eventHandler: (Text[_], GlobalEvent) => Option[GlobalEvent], position: Point, rotation: Radians, scale: Vector2, depth: Depth, ref: Point, flip: Flip) extends DependentNode[Text[M]] with SpatialModifiers[Text[M]]

Used to draw text onto the screen based on font sprite sheets (images / textures) and a character mapping instance called FontInfo. Text instances are a bit of work to set up, but give super crisp pixel perfect results.

Used to draw text onto the screen based on font sprite sheets (images / textures) and a character mapping instance called FontInfo. Text instances are a bit of work to set up, but give super crisp pixel perfect results.

Companion:
object
object Text
Companion:
class
final case class TextBox(text: String, style: TextStyle, size: Size, eventHandlerEnabled: Boolean, eventHandler: (TextBox, GlobalEvent) => Option[GlobalEvent], position: Point, rotation: Radians, scale: Vector2, depth: Depth, ref: Point, flip: Flip) extends RenderNode[TextBox] with SpatialModifiers[TextBox]

Used to draw text on the screen quickly based on a font. Much quicker and eaiser to use that Text, however suffers from all the problems of browser rendered fonts, most notably, you cannot have pixel perfect fonts (fine for mock-ups of HD UI layers perhaps).

Used to draw text on the screen quickly based on a font. Much quicker and eaiser to use that Text, however suffers from all the problems of browser rendered fonts, most notably, you cannot have pixel perfect fonts (fine for mock-ups of HD UI layers perhaps).

Companion:
object
object TextBox
Companion:
class
final case class TextLine(text: String, lineBounds: Rectangle)

Represents a single line of text.

Represents a single line of text.

object Zoom

Types

opaque type CloneId

A CloneId is used to connect a Clone instance to a CloneBlank.

A CloneId is used to connect a Clone instance to a CloneBlank.

opaque type Zoom

Zoom your camera in and out! Behaves like physical camera's zoom, so x2 means "make everything twice as big". Unlike a real camera, you can zoom in or our infinitely!

Zoom your camera in and out! Behaves like physical camera's zoom, so x2 means "make everything twice as big". Unlike a real camera, you can zoom in or our infinitely!