Skip to content

Instantly share code, notes, and snippets.

View fayeli's full-sized avatar

Faye Li fayeli

View GitHub Profile
@fayeli
fayeli / gemstoneApp.js
Last active February 8, 2017 22:25
tabletAppTutorialStep1
(function() {
// Every great app starts with a great name (keep it short so that it can fit in the tablet button)
var APP_NAME = "GEMSTONE";
// Get a reference to the tablet
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
// "Install" your cool new app to the tablet
// The following lines create a button on the tablet's menu screen
var button = tablet.addButton({
@fayeli
fayeli / gemstoneApp.js
Last active February 7, 2017 20:11
tabletAppTutorialStep3
(function() {
// Every great app starts with a great name (keep it short so that it can fit in the tablet button)
var APP_NAME = "GEMSTONE";
// Link to your app's HTML file
var APP_URL = "https://hifi-content.s3.amazonaws.com/faye/gemstoneMagicMaker/gemstoneMagicMaker.html";
// Get a reference to the tablet
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
// "Install" your cool new app to the tablet
@fayeli
fayeli / snippetFromGemstoneMagicMaker.html
Last active February 8, 2017 22:33
tabletAppTutorialStep5
<body>
<div class="top-bar">
<h4>Gemstone Magic Maker</h4>
</div>
<div class="content">
<p>Pick a gemstone from our curated collection:<p>
<p><input type="button" class="gemstone-button white" value="Emerald"></p>
<p><input type="button" class="gemstone-button red" value="Ruby"></p>
<p><input type="button" class="gemstone-button blue" value="Sapphire"></p>
<p><input type="button" class="gemstone-button white" value="Quartz"></p>
@fayeli
fayeli / snippetFromGemstoneApp.js
Last active February 8, 2017 00:47
tabletAppTutorialStep6
// Helper function that gives us a position right in front of the user
function getPositionToCreateEntity() {
var direction = Quat.getFront(MyAvatar.orientation);
var distance = 0.3;
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(direction, distance));
position.y += 0.5;
return position;
}
@fayeli
fayeli / snippetFromGemstoneApp.js
Last active February 8, 2017 22:30
tabletAppTutorialStep6
// Handle the events we're recieving from the web UI
function onWebEventReceived(event) {
print("gemstoneApp.js received a web event:" + event);
// Converts the event to a JavasScript Object
if (typeof event === "string") {
event = JSON.parse(event);
}
if (event.type === "click") {