下コード
var hspx = 0; //x座標 var hspy = 0; //y座標 var canvas; //キャンバスのコンテキスト var fontheight; //fontの高さ onload = function(){ document.body.innerHTML = '<canvas id="hspcanvas" width="640" height="480" style="border: 1px solid #000000;"></canvas>' canvas = document.getElementById("hspcanvas").getContext("2d"); canvas.font = "16px monospace"; fontheight = 16; }; function pos(x,y){ hspx = x; hspy = y + fontheight; } function mes(mes){ canvas.fillText(mes); hspy += fontheight; } function wait(waittime){ var starttime = new Date(); while(new Date() -starttime < (waittime*10) ){}; }
pos、mes、waitのみ作っています。ミス、要望等あったら報告してください。