blob: b7e9536845d9fe9c4a958b13b8b31bf1c1683d52 (
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
|
/*
*/
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)
base.sides = function(){
var sides = base.bounds.clone().div(2).div(base.zoom)
return new rect( base.center.a - sides.a, base.center.b - sides.b,
base.center.a + sides.a, base.center.b + sides.b )
}
base.zoom = 1/4
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.update = function(){
base.draw.animate()
}
}
|