-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Legokichi Duckscallion edited this page Dec 10, 2015
·
13 revisions
2015-12-10: このWikiの内容は古いのでreadme.mdを参照してください
cuttleboneは伺かのシェル描画エンジンです。 旧Named.jsと 旧Shell.jsと 旧Balloon.jsが統合されてcuttleboneになりました。
mkdir helloworld
cd helloworld
npm install -g bower
bower install cuttlebone narloader zepto
touch index.html
次の内容がindex.html
でゴーストを表示するための最小のサンプルコードです。
<script src="bower_components/bluebird/js/browser/bluebird.min.js"></script>
<script src="bower_components/encoding-japanese/encoding.min.js"></script>
<script src="bower_components/jszip/dist/jszip.min.js"></script>
<script src="bower_components/narloader/NarLoader.js"></script>
<script src="bower_components/surfaces_txt2yaml/lib/surfaces_txt2yaml.js"></script>
<script src="bower_components/zepto/zepto.min.js"></script>
<script src="bower_components/cuttlebone/lib/cuttlebone.js"></script>
<script>
$(function(){
var nmdmgr = new cuttlebone.Shell.NamedManager();
$(nmdmgr.element).appendTo("body");
Promise.all([
new Promise(function(resolve, reject){
NarLoader.loadFromURL("bower_components/cuttlebone/nar/origin.nar").then(function(nanikaDir) {
resolve(nanikaDir.asArrayBuffer());
});
}),
new Promise(function(resolve, reject){
NarLoader.loadFromURL("../bower_components/cuttlebone/nar/mobilemaster.nar").then(function(nanikaDir) {
resolve(nanikaDir.getDirectory("shell/master").asArrayBuffer());
});
})
]).then(function(tmp){
var balloonDir = tmp[0];
var shellDir = tmp[1];
var shell = new cuttlebone.Shell(shellDir);
var balloon = new cuttlebone.Balloon(balloonDir);
return Promise.all([shell.load(), balloon.load()]);
}).then(function(tmp) {
var balloon = tmp[0];
var shell = tmp[1];
var hwnd = nmdmgr.materialize(shell, balloon);
var named = nmdmgr.named(hwnd);
return named.load();
}).then(function(named){
named.scope(0).surface(0).talk("Hello,world!");
}).catch(console.error.bind(console));
});
</script>
git clone https://github.com/Ikagaka/cuttlebone.git
cd cuttlebone
npm install -g bower
npm install -g tsd
npm run init
npm run start
npm run demo