Last active
August 29, 2015 14:28
-
-
Save freekrai/60249af99f5710057d6d to your computer and use it in GitHub Desktop.
test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Welcome to Pebble.js! | |
* | |
* This is where you write your app. | |
*/ | |
var UI = require('ui'); | |
var Vector2 = require('vector2'); | |
var main = new UI.Card({ | |
title: 'Pebble.js', | |
icon: 'images/menu_icon.png', | |
subtitle: 'Hello World!', | |
body: 'Press any button.' | |
}); | |
main.show(); | |
main.on('click', 'up', function(e) { | |
var menu = new UI.Menu({ | |
sections: [{ | |
items: [{ | |
title: 'Pebble.js', | |
icon: 'images/menu_icon.png', | |
subtitle: 'Can do Menus' | |
}, { | |
title: 'Second Item', | |
subtitle: 'Subtitle Text' | |
}] | |
}] | |
}); | |
menu.on('select', function(e) { | |
console.log('Selected item #' + e.itemIndex + ' of section #' + e.sectionIndex); | |
console.log('The item is titled "' + e.item.title + '"'); | |
}); | |
menu.show(); | |
}); | |
main.on('click', 'select', function(e) { | |
var wind = new UI.Window(); | |
var textfield = new UI.Text({ | |
position: new Vector2(0, 50), | |
size: new Vector2(144, 30), | |
font: 'gothic-24-bold', | |
text: 'Text Anywhere!', | |
textAlign: 'center' | |
}); | |
wind.add(textfield); | |
wind.show(); | |
}); | |
main.on('click', 'down', function(e) { | |
var card = new UI.Card(); | |
card.title('A Card'); | |
card.subtitle('Is a Window'); | |
card.body('The simplest window type in Pebble.js.'); | |
card.show(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment