summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/map/_map.js
blob: 833df7a008551601f0fdcff5e0dd9228654318ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
*/

window.ctx = window.w = window.h = null;

var map = new function(){
	var base = this
	base.bounds = new vec2(500,500)
	base.center = new vec2(0,0)

	var canvas = document.createElement("canvas")
	var ctx = window.ctx = canvas.getContext("2d")
	var w = window.w = canvas.width = 500
	var h = window.h = canvas.height = 500
	document.querySelector("#map").appendChild(canvas)

	base.animate = function(){
		ctx.save()
		map.draw.clear_canvas()
		map.draw.ruler()

		ctx.translate( map.center.a + map.bounds.a/2,  map.center.b + map.bounds.b/2 )
		ctx.scale( -1, 1 )

		map.draw.regions(clipper.regions)
		map.draw.mouse(map.ui.mouse.cursor)

		ctx.restore()
	}

}