説明
簡単に三角形を描画できるクラス
公式ドキュメント
サンプル
html
<canvas id="world"></canvas>
js
var SCREEN_WIDTH = 320; // スクリーン幅
var SCREEN_HEIGHT = 320; // スクリーン高さ
var ASSETS = {
"chick": "http://jsrun.it/assets/x/X/n/k/xXnkc.png",
"frame": "http://jsrun.it/assets/5/n/Y/8/5nY87.png",
};
tm.main(function() {
var app = [[tm.display.CanvasApp]]("#world");
app.resize(SCREEN_WIDTH, SCREEN_HEIGHT);// 画面サイズに合わせる
app.fitWindow();// リサイズ対応
app.background = "rgb(0,50,0)";// 背景色をセット
// 読み込みシーンを初期セット
var loadingScene = tm.app.LoadingScene({
assets: ASSETS,
nextScene: MainScene,// 次はMainScene
width: SCREEN_WIDTH,
height: SCREEN_HEIGHT
});
app.replaceScene(loadingScene);
// tmlib実行
app.run();
});
tm.define("MainScene", {
superClass: "tm.app.Scene",
init: function() {
this.superInit();
this.player = Player();
this.addChild(this.player);
this.player.setPosition(150,300);
}
});
tm.define("Player", {
superClass: "tm.display.TriangleShape",
init: function(){
this.superInit();
},
});
最終更新:2014年07月11日 12:06