Jet Link Simulations

Jet Link Simulations

  • Docs
  • API Reference
  • Help

Screen

The screen is the top-most level container that holds all devices.

JLS.core.Screen

new Screen(options)

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

    const CenterTouchScreen         = new JLS.Screen(CONFIG, {
        origin: { ref: 'center-touchscreen', x: 0, y: 0, w: 1920, h: 1080 },
        enableHotActions: true,
        resources: {
            images: {
                background: 'RJ45_CenterTouchscreen_background_PROD.png',
            },
        },
    });

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, x: undefined, y: undefined, w: undefined, h: undefined }References used to setup and position the screen relative to its parent. Keys: ref, x, y, w, h. See originRef, originX, originY, originW, and originH.
enableHotActionsbooleanfalseEnables the ability to trigger functionality on the screen at each corner of the screen's canvas region. Touching this region will trigger whatever is set in the config options.
resourcesobject{ images: {}, sounds: {} }A directory of all the resources that should be used to initialize the screen on the setup method. Items here are loaded by the JLS.AssetLoader and the name is the flatten reference to the data property. For example: resources.images.background is given a key name of [screen originRef].images.background

Members

config

The config.json's data passed to the screen on construction.

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.

enableHotActions

Enables the ability to trigger functionality on the screen at each corner of the screen's canvas region. Touching this region will trigger whatever is set in the config options.

resources

A directory of all the resources that should be used to initialize the screen on the setup method.

activeDevice

A convenience member to check the active device the user is interacting with. Currently, the active device stays the same unless another device is interacted with. // TODO: have option to set timeout to clear active device after a specified time.

overlays

A directory of all the overlays that make are a part of or are available on the screen.

displays

A directory of all the displays that make up the screen.

isDebugging

A convenience member to check whether a device is in debug mode.

Methods

showScreenActionRegions()

Highlights the screen's hot action regions, which are red (if applicable).

hideScreenActionRegions()

Hides the screen's hot action regions (if applicable).

toggleDebugRegions()

Shows or hide colored debug regions for screen, devices, and it's children. Colors: Hot Action Regions = red; Devices = magenta; Instruments = white; Display Elements = orange; actuators = green.

toggleDebugOverlay()

Shows or hide the debug overlay with additional info available at runtime for debugging.

toggleDebugOverlay()

// TODO: [pending implementation]

toggleEducateOverlay()

// TODO: [pending implementation]

getAllDataRefs()

Retrieves all the datarefs that the screen and it's children is using.

setActiveDevice(originRef)

Sets the active device on the screen. If argument is null, device selection will clear and activeDevice will be set to null.

parameters

NameTypeDefaultDescription
originRefstring---the unique identifier of the device.

clearActiveDevice

Clears the active device selection on the screen and the isActiveDevice state on the device.

addDevice(device)

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

parameters

NameTypeDefaultDescription
deviceJLS.core.Device---the device to add as a child of the screen.

run

Runs the JLS.GameEngine and sends a command to run the simulation via the JLS.DataStreamClient.

pause()

Sends a command via the JLS.DataStreamClient after pausing rendering via the JLS.GameEngine.

stop()

Ends the screen and simulation by sending a command to the JLS.DataStreamClient after stopping the JLS.GameEngine.

load()

Calls the setup method to setup the display/interaction elements. Load only be called when all assets are finished loading.

boot()

// TODO: boot loader script that mimicks the boot sequence of a real screen

shutdown()

Simulates a graceful shutdown of devices.

// TODO: grace shutdown of a screen -- mimicking a real screen

  • new Screen(options)
  • Members
    • config
    • originRef
    • originX
    • originY
    • originW
    • originH
    • enableHotActions
    • resources
    • activeDevice
    • overlays
    • displays
    • isDebugging
  • Methods
    • showScreenActionRegions()
    • hideScreenActionRegions()
    • toggleDebugRegions()
    • toggleDebugOverlay()
    • toggleDebugOverlay()
    • toggleEducateOverlay()
    • getAllDataRefs()
    • setActiveDevice(originRef)
    • clearActiveDevice
    • addDevice(device)
    • run
    • pause()
    • stop()
    • load()
    • boot()
    • shutdown()
Jet Link Simulations
Docs
Getting StartedGuidesAPI Reference
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Copyright © 2020 Name or Your Company Name