mirror of
https://github.com/overte-org/overte.git
synced 2025-04-27 23:55:55 +02:00
* TabletButton.inDebugMode defaults to false * TabletButton now listens to onIsActiveChanged event to flip state of button. * Fixed help.js and tabletTest.js to compensate for the removal of the TabletButton.color property
35 lines
923 B
JavaScript
35 lines
923 B
JavaScript
//
|
|
// tabletTest.js
|
|
//
|
|
// Created by Anthony J. Thibault on 2016-12-15
|
|
// Copyright 2016 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
// Adds a BAM! button to the tablet ui.
|
|
|
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
|
var button = tablet.addButton({
|
|
text: "BAM!!!"
|
|
});
|
|
|
|
// change the name and isActive state every second...
|
|
var names = ["BAM!", "BAM!!", "BAM!!!", "BAM!!!!"];
|
|
var nameIndex = 0;
|
|
Script.setInterval(function () {
|
|
nameIndex = (nameIndex + 1) % names.length;
|
|
button.editProperties({
|
|
isActive: (nameIndex & 0x1) == 0,
|
|
text: names[nameIndex]
|
|
});
|
|
}, 1000);
|
|
|
|
button.clicked.connect(function () {
|
|
print("AJT: BAM!!! CLICK from JS!");
|
|
});
|
|
|
|
Script.scriptEnding.connect(function () {
|
|
tablet.removeButton(button);
|
|
});
|