Jvascriptでゲームエンジンを作ろうとしています。これまでのところ、私は持っています:
function gameEngine() {
this.canvas = $('canvas')[0];
this.ctx = this.canvas.getContext('2d');
this.framerate = 20;
this.resetCanvas = function() {
this.ctx.fillStyle = 'red';
this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
};
this.loop = function() {
this.resetCanvas();
};
this.run = function() {
setInterval(this.loop, this.framerate);
};
}
new gameEngine();
しかし、キャンバスは表示されません。なぜ?