canvas.putTextRotate( 文字列, CX, CY, 角度, 文字サイズ, 文字色[,背景色] )
メイン画面に文字を回転させて書きます。表示座標は文字の中心座標となります。
引数
- 表示文字: 表示する文字です。
- CX: 表示回転中心X座標
- CY: 表示回転中心Y座標
- 角度: 回転角(deg)
- 文字サイズ: 文字フォントサイズ
- 文字色: 文字の色コード
- 背景色: 文字背景の色コード
背景色を省略したときは背景無しとなります。角度を 0 にすると、センタリング表示と同様になります。描画結果はcanvas.putflush()か、canvas.draw〜命令が実行されるまで、実画面に表示されません。
使用例
while(true)do --加速度を取得 ax, ay, az = sensor.getAccel() kaku = math.atan2( -ay, ax ) angle = math.floor(kaku/pi*180) x = math.sin(kaku) y = math.cos(kaku) canvas.putg( 0, 0, w, h, 80, 0, wb, hb ) canvas.putrotg( cx, cy, angle, 0, 0, 79, 93 ) canvas.putTextRotate("θ="..angle, cx-70*x, cy+70*y, angle, 24, color(255,0,0)) canvas.putflush() --画面タッチで終了 x,y,s = touch() if( s~=1 )then if( x>=cx-79/2 and x<=cx+79/2 and y>=cy-93/2 and y<=cy+93/2 )then break end end end