Jet Link Simulations

Jet Link Simulations

  • Docs
  • API Reference
  • Help

›Guides

Getting Started

  • Home
  • Installation
  • The Basics
  • Developer Guidelines

Guides

  • Create a New Application
  • Sending & Receiving Data

API Reference

  • Introduction to API
  • Actuators
  • Core
  • Elements
  • Engines
  • Events
  • Loaders
  • Utilities

Create a New Application

This guide shows how to create a new application using the SDK.

Modules Required

  1. JLS.engines.DisplayEngine
  2. JLS.loaders.AssetLoader
  3. JLS.core.Screen
  4. JLS.core.Device
  5. JLS.core.Instrument
  6. JLS.elements.[any]

Basic SDK Example


// Create an instance of the display engine
const displayEngine = new JLS.DisplayEngine({
    displayArea: 'fill',
    width: 1920,
    height: 1080,
    canvasScaling: 'autoScale',
    allowScaleDown: true,
});


// Create any devices you wish to use along with it's displays
const ND737_UNIT = new JLS.Device({
  // your options here. Don't forget to point to spritesheet
});

const ND737_UNIT_DISPLAY_1 = new JLS.DeviceDisplay({
  // your options here. Must have unique origin.ref
});

// Create elements that will be animating
const mfd737Map = new JLS.MapElement({
  // your options here
});

const groundSpeedText = new JLS.TextElement({
  // your options here
});

// Create an instrument to hold animating elements
const mfd737MapInstrument = new JLS.Instrument({
  // your options here
});

  mfd737MapInstrument.addAnimatedElement(mfd737Map);

const mfdAirspeedInstrument = new JLS.Instrument({
  // your options here
});

  mfdAirspeedInstrument.addAnimatedElement(groundSpeedText);


// Add objects where they belong
ND737_UNIT_DISPLAY_1.addInstrument(mfd737MapInstrument);
ND737_UNIT_DISPLAY_1.addInstrument(mfdAirspeedInstrument);


// Initialize the device with the screens
ND737_UNIT.init([ ND737_UNIT_DISPLAY_1 ]);


// Create screen and add devices to it
const TestScreen = new JLS.Screen([config or null], {
  // your options here
});

    // TestScreen.load();
    TestScreen.addDevice(ND737_UNIT);



// Load any assets needed to be loaded and when finished start everything
JLS.AssetManager.shared
    .addObjAssets('device', ND737_UNIT, ND737_UNIT.load)
    .load(() => {
        TestScreen.load();

        // Here the display engine's root container is set to the Screen
        displayEngine.set(TestScreen);

        // Boot the screen. This "turns on the devices"
        TestScreen.boot();

        // Start the game engine, hence rendering the main display
        JLS.GameEngine.register(displayEngine.render);

        // You can register other functions to run in game loop
        JLS.GameEngine.register(start);
    });



function start() {
  // you can do stuff here. Runs in game loop
}

← Developer GuidelinesSending & Receiving Data →
  • Modules Required
  • Basic SDK Example
Jet Link Simulations
Docs
Getting StartedGuidesAPI Reference
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Copyright © 2020 Name or Your Company Name