IndigoSandbox

indigo.IndigoSandbox
trait IndigoSandbox[StartUpData, Model] extends GameLauncher[StartUpData, Model, Unit]

A trait representing a minimal set of functions to get your game running

Type parameters

Model

The class type representing your game's model

StartUpData

The class type representing your successful startup data

Attributes

Example

object MyGame extends IndigoSandbox[StartUpData, Model]

Graph
Supertypes
trait GameLauncher[StartUpData, Model, Unit]
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def animations: Set[Animation]

A fixed set of animations your game will be able to play

A fixed set of animations your game will be able to play

Attributes

def assets: Set[AssetType]

A fixed set of assets that will be loaded before the game starts

A fixed set of assets that will be loaded before the game starts

Attributes

Your game's configuration settings.

Your game's configuration settings.

Attributes

def fonts: Set[FontInfo]

A fixed set of fonts that your game will be able to render

A fixed set of fonts that your game will be able to render

Attributes

def initialModel(startupData: StartUpData): Outcome[Model]

Set up of your initial model state

Set up of your initial model state

Value parameters

startupData

Access to Startup data in case you need it for the model

Attributes

Returns

An instance of your game model

def present(context: FrameContext[StartUpData], model: Model): Outcome[SceneUpdateFragment]

A pure function for presenting your game. The result is a side effect free declaration of what you intend to be presented to the player next.

A pure function for presenting your game. The result is a side effect free declaration of what you intend to be presented to the player next.

Value parameters

context

The context the frame should be produced in, including the time, input state, a dice instance, the state of the inputs, and a read only reference to your start up data.

model

The latest version of the model to read from.

viewModel

The latest version of the view model to read from.

Attributes

Returns

A function that produces a description of what to present next, and encapsuates failures or resulting events within the Outcome wrapper.

def setup(assetCollection: AssetCollection, dice: Dice): Outcome[Startup[StartUpData]]

The setup function is your only opportunity to do an initial work to set up your game. For example, perhaps one of your assets was a JSON description of a map or an animation sequence, you could process that now, which is why you have access to the AssetCollection object. setup is typically only called when new assets are loaded. In a simple game this may only be once, but if assets are dynamically loaded, set up will be called again.

The setup function is your only opportunity to do an initial work to set up your game. For example, perhaps one of your assets was a JSON description of a map or an animation sequence, you could process that now, which is why you have access to the AssetCollection object. setup is typically only called when new assets are loaded. In a simple game this may only be once, but if assets are dynamically loaded, set up will be called again.

Value parameters

assetCollection

Access to the Asset collection in order to, for example, parse text files.

dice

Psuedorandom number generator

Attributes

Returns

Return start up data, which can include animations and fonts that could not be declared statically declared.

def shaders: Set[Shader]

A fixed set of custom shaders you will be able to render with

A fixed set of custom shaders you will be able to render with

Attributes

def updateModel(context: FrameContext[StartUpData], model: Model): GlobalEvent => Outcome[Model]

A pure function for updating your game's model in the context of the running frame and the events acting upon it.

A pure function for updating your game's model in the context of the running frame and the events acting upon it.

Value parameters

context

The context the frame should be produced in, including the time, input state, a dice instance, the state of the inputs, and a read only reference to your start up data.

model

The latest version of the model to read from.

Attributes

Returns

A function that maps GlobalEvent's to the next version of your model, and encapsuates failures or resulting events within the Outcome wrapper.

Concrete methods

protected def ready(flags: Map[String, String]): Element => GameEngine[StartUpData, Model, Unit]

Inherited methods

def halt(): Unit

Attributes

Inherited from:
GameLauncher
def launch(element: Element, flags: (String, String)*): Unit

Attributes

Inherited from:
GameLauncher
def launch(containerId: String, flags: (String, String)*): Unit

Attributes

Inherited from:
GameLauncher
def launch(element: Element, flags: Map[String, String]): Unit

Attributes

Inherited from:
GameLauncher
def launch(containerId: String, flags: Map[String, String]): Unit

Attributes

Inherited from:
GameLauncher
def launch(element: Element, flags: Dictionary[String]): Unit

Attributes

Inherited from:
GameLauncher
def launch(containerId: String, flags: Dictionary[String]): Unit

Attributes

Inherited from:
GameLauncher
def launch(element: Element): Unit

Attributes

Inherited from:
GameLauncher
def launch(containerId: String): Unit

Attributes

Inherited from:
GameLauncher