1 /// <reference path="jquery-1.4.1-vsdoc.js" />
2 /// <reference path="canvas-vsdoc.js" />
3 var ctx_main = Canvas.vsGet($("#disp01")[0].getContext("2d"));
4 var backBuffer = Canvas.vsGet($("<canvas>")[0]);
5 backBuffer.width = 320;
6 backBuffer.height = 240;
7 var ctx = backBuffer.getContext("2d");
9 var renderTimerId = undefined;
11 $(window).ready(function () {
12 ctx.fillStyle = "blue";
13 ctx.fillRect(0, 0, 320, 240);
14 ctx.fillStyle = "white";
15 ctx.font = "12pt 'MS ゴシック'"; ;
16 ctx.fillText("ボールを表示します。", 0, 20, 240);
17 ctx_main.drawImage(backBuffer, 0, 0, 640, 480);
20 $("#start").click(function () {
21 renderTimerId = setInterval(function () {
22 ctx.fillStyle = "black";
23 ctx.fillRect(0, 0, 320, 240);
24 ctx.fillStyle = "white";
25 ctx.fillText("frame:" + (t++), 0, 20, 240);
26 ctx_main.drawImage(backBuffer, 0, 0, 640, 480);
28 $("#stop")[0].disabled = false;
29 $("#start")[0].disabled = true;
33 $("#stop").click(function () {
34 if (renderTimerId != undefined) {
35 clearInterval(renderTimerId);
36 renderTimerId = undefined;
38 $("#stop")[0].disabled = true;
39 $("#start")[0].disabled = false;
42 // 準備ができたので開始ボタンを押せるようにする
43 $("#start")[0].disabled = false;