Jet Link Simulations

Jet Link Simulations

  • Docs
  • API Reference
  • Help

DeviceDisplay

Creates the structural layout of a singular screen that makes up a Device and acts as a container that holds instruments. Its only job is to group instruments needed for a particular display to make switching between displays easier and more efficient. The DeviceDisplay is a direct child of the Device and should be added by calling the `Device.init() method with an array of device displays as the argument.

JLS.core.DeviceDisplay

new DeviceDisplay(options)

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

  const EICAS_DISPLAY_1           = new DeviceDisplay({
    origin: { ref: 'eicas-display-1' },
    layout: [
      {
          type: 'line',
          coord: [350, 15, 350, 340],
          lineColor: 'FFFFFF',
          lineThickness: 2,
      },
      {
          type: 'line',
          coord: [350, 345, 350, 500],
          lineColor: 'FFFFFF',
          lineThickness: 2,
      },
      . . .
    ],
  })

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 device display. Keys: ref, x, y, w, h. See originRef, originX, originY, originW, and originH
backgroundColorstringnulloptional The background color of the device, which is a a 6-character hexcode without the "#" key (i.e.: "000000").
layoutarray[]optional Instructions on what static elements to draw and on the display.
isActiveDisplaybooleanfalseoptional A convenience member to check whether or not a device is the current screen being rendered and visible on the device container.
instrumentsobject{}optional A directory of instruments for this particular device display.
spritesobject{}optional A directory of local sprites for this particular device display.

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.

backgroundColor

The background color of the device.

layout

The instructions that the device display should draw.

instruments

A directory of instruments for this particular device display.

sprites

A directory of local sprites for this particular device display.

isActiveDisplay

A convenience member to check whether or not a device is the current screen being rendered and visible on the device container.

Methods

getParentDevice

Returns the parent device the display is a part of. 'parent.parent' is used since the display is a child of the screen region of the device. Therefore we are first accessing the screen region (which is another container) with the first call to parent, then the device with the second call.

addInstrument(instrument)

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

NameTypeDefaultDescription
instrumentJLS.core.Instrument---The instrument to add and use on this particular device display.

load

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

  • new DeviceDisplay(options)
  • Members
    • originRef
    • originX
    • originY
    • originW
    • originH
    • backgroundColor
    • layout
    • instruments
    • sprites
    • isActiveDisplay
  • Methods
    • getParentDevice
    • addInstrument(instrument)
    • load
Jet Link Simulations
Docs
Getting StartedGuidesAPI Reference
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Copyright © 2020 Name or Your Company Name