BlueGit

timfa frameworkv3

Files

frameworkv3 / framework / canvas.js

canvas.js

Framework 3
timfa Tim Falken · pushed by timfa · 9 years ago
4a56d325 History
canvas.js 522 B Download Raw
1// Wrapper for some canvas drawing functions
2
3var canvas =
4{
5 get canvas()
6 {
7 return GameWindow.canvas;
8 },
9
10 get context()
11 {
12 return GameWindow.canvasContext;
13 },
14
15 drawText: function(text, x, y, size, font, color)
16 {
17 this.context.font = font? size + 'px ' + font : size + 'px Arial';
18
19 this.context.fillStyle = color;
20 this.context.textAlign = "center";
21 this.context.textBaseline="middle";
22
23 this.context.fillText(text, x, y);
24 }
25}