Jet Link Simulations

Jet Link Simulations

  • Docs
  • API Reference
  • Help

Instrument

An instrument is a device that displays some data. Instruments have sprites has a base image and animating elements are used to show some state. The instrument acts as a container to all related elements that make up an instrument.

JLS.core.Instrument

new Instrument(options)

  // Implementation example
  import { Instrument } from 'path/to/core'

  const engineN1  = new Instrument({
    origin: { ref: 'engine-n1', x: 60, y: 37, w: 268, h: 108 },
    baseImagePrefix: 'eicas-unit',
    baseImageKey: 'images.spritesheet.engine-n1',
  })

options

The word "options" is used somewhat loosely here as most of the fields are required. Actual optional parameters will have an optional flag.

NameTypeDefaultDescription
originobject{ ref: undefined }References used to setup and position the instrument. Keys: ref, x, y, w, h. See originRef, originX, originY, originW, and originH
baseImagePrefixstringnulloptional The prefix to use when retrieving a global asset from the global asset loader.
baseImageKeystringnulloptional The key of the image according to the texture atlas. Sprites are automatically located at images.spritesheet.[key] when loaded with the global asset loader.
baseImageIdstringnulloptional The key of the image according to the texture atlas. Sprites are automatically located at images.spritesheet.[key] when loaded with the global asset loader. When no prefix is needed, use this.
bgImagestringnulloptional The background image to set and use for this instrument.
bgColorstringnulloptional The background color to set and use for this instrument.
clippingImagestringnulloptional [pending implementation]
bootPriorityinteger,string1optional [pending implementation]
visibilityinteger1optional The visibility of this instrument.

Members

originRef

A string reference that can be set to uniquely identify this object.

originX

The X position of this object on a canvas.

originY

The Y position of this object on a canvas.

originW

The width of the object when displayed on a canvas.

originH

The height of the ojbect when displayed on a canvas.

baseImagePrefix

The prefix to use when retrieving a global asset from the global asset loader.

baseImageKey

The key of the image according to the texture atlas. Sprites are automatically located at images.spritesheet.[key] when loaded with the global asset loader.

baseImageId

The key of the image according to the texture atlas. Sprites are automatically located at images.spritesheet.[key] when loaded with the global asset loader. When the prefix doesn't need to be changed, use this.

bgImage

The background image to set and use for this instrument.

bgColor

The background color to set and use for this instrument.

clippingImage

// TODO: determine if clipping images are needed. this is not implemented and may no longer be required.

bootPriority

[pending implementation] // TODO: implement boot loader script and assign instruments a boot priority, which can be random

visibility

The visibility of this instrument.

elements

A directory of local elements for this particular instrument.

sprites

A directory of local sprites for this particular instrument.

Methods

debugModeOn

Shows the colored debug regions.

debugModeOff

Hides the colored debug regions.

addAnimatedElement(element)

Adds an animating element to the instrument. This does not immediately make the element show or added to the stage. Only a reference to signify that the element belongs to this instrument is made. The element is positioned and shown later in the setup method.

NameTypeDefaultDescription
elementJLS.elements.{any}---the element to add and use on this instrument.

load

Initializes the instrument. Called automagically by the parent device display. Only caveat is that .load must be called on parent device when assets are finished loading.

  • new Instrument(options)
  • Members
    • originRef
    • originX
    • originY
    • originW
    • originH
    • baseImagePrefix
    • baseImageKey
    • baseImageId
    • bgImage
    • bgColor
    • clippingImage
    • bootPriority
    • visibility
    • elements
    • sprites
  • Methods
    • debugModeOn
    • debugModeOff
    • addAnimatedElement(element)
    • load
Jet Link Simulations
Docs
Getting StartedGuidesAPI Reference
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Copyright © 2020 Name or Your Company Name