Skip to content

Instantly share code, notes, and snippets.

@kjunichi
Last active August 29, 2015 13:58
Show Gist options
  • Save kjunichi/9966642 to your computer and use it in GitHub Desktop.
Save kjunichi/9966642 to your computer and use it in GitHub Desktop.

5月からはじめるtmlib.js

あえて、ゲーム以外

出来れば実用的なツール

候補

  • motdエディター

motdエディターに必要なこと

タッチや、クリックを検知できるオブジェクト

var app = tm.display.CanvasApp("#world");

var rec = tm.display.RectangleShape();
rec.on("click",function() {
  console.log("oops!");
});
app.currentScene.addChild(rec);
//ヒット判定フラグをON
foo.interaction.enabled=true
foo.interaction.boundingType="circle" //<-他に何が指定できんだろか?

タッチ/クリック時

現在の選択色になる

ツールパレットに必要な機能

  • アイコン
  • カラーピッカー

出力

セル群から自分の色を白状させるだけの簡単仕事

echo -e "\e[41m \e[m\e[42m \e[m\e[44m \e[m"

motdな出力をFile APIで実装すればいい。

tmlib.jsでツール系なアプリを作るのに使えそうな機能

文字を表示する

var FONT_FAMILY_FLAT= "'Helvetica-Light' 'Meiryo' sans-serif"; // フラットデザイン用フォント

var timerLabel = tm.app.Label("開けゴマ").addChildTo(parent);
timerLabel
.setPosition(650, 160) // 親に対しての相対位置か?
.setFillStyle("#444")
.setAlign("right")
.setBaseline("bottom")
.setFontFamily(FONT_FAMILY_FLAT)
.setFontSize(128);

tmlib.jsをコマンドラインで動かす

作者が苦手とする黒い画面でうごかしてみる企画

node-canvas使い、強引に出力pngを表示するとか?

Link

関連

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment