summaryrefslogtreecommitdiff
path: root/resources/js/gameArea.js
blob: a39b0e84c43d622f57638b803a063ab6321f8c3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class GameArea {

    constructor(canvas_width, canvas_height) {
        this.canvas = document.createElement("canvas");
        this.canvas_width = canvas_width;
        this.canvas_height = canvas_height;
    }

    init() {
        this.canvas.width = this.canvas_width;
        this.canvas.height = this.canvas_height;
        this.context = this.canvas.getContext("2d");
        document.getElementById('container').appendChild(this.canvas);
    }

    clear() {
        this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
    }

}