LoginSignup
0
0

More than 3 years have passed since last update.

Magic Leap MagicScript Landscape Application. URI schema

Posted at

Prepare
Magic Leap One
https://www.magicleap.com/magic-leap-one

mlsdk v.0.20.0
https://creator.magicleap.com/downloads/lumin-sdk/overview

magic-script-cli v2.0.1
https://www.npmjs.com/package/magic-script-cli

magic-script-polyfills v2.2.0
https://www.npmjs.com/package/magic-script-polyfills

Create Project

magic-script init my-uri org.magicscript.uri "URI"
cd my-uri

Code

Change app.js

import { LandscapeApp, ui } from 'lumin';
const { UiText, EclipseLabelType, Alignment, 
                         HorizontalTextAlignment } = ui;

export class App extends LandscapeApp {
  onAppStart (initArg) {
    const prism = this.requestNewPrism([0.5, 0.5, 0.5]);
    let uri = initArg.getUri();
    let value = 'Not URI';

    if (uri)
    {
        uri = uri.split("://");
        value = `App:${uri[0]} \nArgs:${uri[1]}`;
    }

    const text = UiText.CreateEclipseLabel(
      prism,
      value,
      EclipseLabelType.kT7
    );
    text.setAlignment(Alignment.CENTER_CENTER);
    text.setTextAlignment(HorizontalTextAlignment.kCenter);
    prism.getRootNode().addChild(text);
  }
}

Change manifest.xml

<manifest xmlns:ml="magicleap"
          ml:package="org.magicscript.uri"
          ml:version_name="0.0.1"
          ml:version_code="1">
  <application ml:visible_name="URI"
               ml:application_type="untrusted"
               ml:sdk_version="1.0">
    <component ml:name=".universe"
               ml:visible_name="URI"
               ml:binary_name="bin/index.js"
               ml:type="Universe">
      <mode ml:shareable="true"/>
      <icon ml:model_folder=""
            ml:portal_folder=""/>
      <schema ml:name="my-uri://" />
    </component>
    <uses-privilege ml:name="MagicScript"/>
  </application>
</manifest>

Build

magic-script build -i

Run
Access with Helio Browser. Click on Startup.
http://tokufxug.sakura.ne.jp/magicscript/uri.html

Reference
getUri() (MagicScript API)
https://docs.magicscript.org/lumin.InitArg.html#getUri

Manually Declare your Manifest and Privileges
https://creator.magicleap.com/learn/guides/declare-your-manifest

magicscript
https://www.magicscript.org/

Thanks!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0