kopia lustrzana https://github.com/backface/turtlestitch
oops, didn't intend to commit this :-)
rodzic
27790c7463
commit
a2237ec7a8
|
@ -91,6 +91,7 @@ WorldMap.prototype.refresh = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
WorldMap.prototype.wrapTile = function (n) {
|
WorldMap.prototype.wrapTile = function (n) {
|
||||||
|
// currently unused
|
||||||
var max = Math.pow(2, this.zoom);
|
var max = Math.pow(2, this.zoom);
|
||||||
return n < 0 ? max - n : n % max;
|
return n < 0 ? max - n : n % max;
|
||||||
};
|
};
|
||||||
|
@ -179,7 +180,7 @@ WorldMap.prototype.render = function () {
|
||||||
ctx = this.canvas.getContext('2d');
|
ctx = this.canvas.getContext('2d');
|
||||||
for (x = 0; x < tileGrid.x; x += 1) {
|
for (x = 0; x < tileGrid.x; x += 1) {
|
||||||
for (y = 0; y < tileGrid.y; y += 1) {
|
for (y = 0; y < tileGrid.y; y += 1) {
|
||||||
tileX = this.wrapTile(originTile.x + x);
|
tileX = originTile.x + x;
|
||||||
tileY = originTile.y + y;
|
tileY = originTile.y + y;
|
||||||
if ((tileX >= 0 && tileX < max) && (tileY >= 0 && tileY < max)) {
|
if ((tileX >= 0 && tileX < max) && (tileY >= 0 && tileY < max)) {
|
||||||
img = new Image();
|
img = new Image();
|
||||||
|
|
Ładowanie…
Reference in New Issue