You've already forked PixelDrawr
mirror of
https://github.com/FullScreenShenanigans/PixelDrawr.git
synced 2026-04-28 13:00:21 -07:00
Brought in updated PixelRendr with lazy loading
Renders and SpriteMultiples internally.
This commit is contained in:
+19
-34
@@ -336,9 +336,9 @@ module PixelDrawr {
|
||||
thing.sprite = this.PixelRender.decode(this.generateObjectKey(thing), thing);
|
||||
|
||||
// To do: remove dependency on .numSprites
|
||||
// For now, kit's used to know whether it's had its sprite set, but
|
||||
// For now, it's used to know whether it's had its sprite set, but
|
||||
// wouldn't physically having a .sprite do that?
|
||||
if ((<PixelRendr.ISpriteMultiple>thing.sprite).multiple) {
|
||||
if (thing.sprite.constructor === PixelRendr.SpriteMultiple) {
|
||||
thing.numSprites = 0;
|
||||
this.refillThingCanvasMultiple(thing);
|
||||
} else {
|
||||
@@ -381,7 +381,7 @@ module PixelDrawr {
|
||||
return;
|
||||
}
|
||||
|
||||
var spritesRaw: PixelRendr.ISpriteMultiple = <PixelRendr.ISpriteMultiple>thing.sprite,
|
||||
var spritesRaw: PixelRendr.SpriteMultiple = <PixelRendr.SpriteMultiple>thing.sprite,
|
||||
canvases: any = thing.canvases = {
|
||||
"direction": spritesRaw.direction,
|
||||
"multiple": true
|
||||
@@ -497,8 +497,7 @@ module PixelDrawr {
|
||||
&& quadrant[this.keyTop] < this.MapScreener[this.keyHeight]
|
||||
&& quadrant[this.keyRight] > 0
|
||||
&& quadrant[this.keyBottom] > 0
|
||||
&& quadrant[this.keyLeft] < this.MapScreener[this.keyWidth]
|
||||
) {
|
||||
&& quadrant[this.keyLeft] < this.MapScreener[this.keyWidth]) {
|
||||
this.refillQuadrant(quadrant);
|
||||
this.context.drawImage(quadrant.canvas, quadrant[this.keyLeft], quadrant[this.keyTop]);
|
||||
}
|
||||
@@ -528,8 +527,7 @@ module PixelDrawr {
|
||||
0,
|
||||
0,
|
||||
quadrant.canvas[this.keyWidth],
|
||||
quadrant.canvas[this.keyHeight]
|
||||
);
|
||||
quadrant.canvas[this.keyHeight]);
|
||||
}
|
||||
|
||||
for (i = this.groupNames.length - 1; i >= 0; i -= 1) {
|
||||
@@ -560,8 +558,7 @@ module PixelDrawr {
|
||||
|| this.getTop(thing) > this.MapScreener[this.keyHeight]
|
||||
|| this.getRight(thing) < 0
|
||||
|| this.getBottom(thing) < 0
|
||||
|| this.getLeft(thing) > this.MapScreener[this.keyWidth]
|
||||
) {
|
||||
|| this.getLeft(thing) > this.MapScreener[this.keyWidth]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -594,8 +591,7 @@ module PixelDrawr {
|
||||
|| this.getRight(thing) < quadrant[this.keyLeft]
|
||||
|| this.getBottom(thing) < quadrant[this.keyTop]
|
||||
|| this.getLeft(thing) > quadrant[this.keyRight]
|
||||
|| thing.opacity < this.epsilon
|
||||
) {
|
||||
|| thing.opacity < this.epsilon) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -606,8 +602,7 @@ module PixelDrawr {
|
||||
thing.canvas,
|
||||
thing,
|
||||
this.getLeft(thing) - quadrant[this.keyLeft],
|
||||
this.getTop(thing) - quadrant[this.keyTop]
|
||||
);
|
||||
this.getTop(thing) - quadrant[this.keyTop]);
|
||||
} else {
|
||||
// For multiple sprites, some calculations will be needed
|
||||
return this.drawThingOnContextMultiple(
|
||||
@@ -615,8 +610,7 @@ module PixelDrawr {
|
||||
thing.canvases,
|
||||
thing,
|
||||
this.getLeft(thing) - quadrant[this.keyLeft],
|
||||
this.getTop(thing) - quadrant[this.keyTop]
|
||||
);
|
||||
this.getTop(thing) - quadrant[this.keyTop]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,7 +660,7 @@ module PixelDrawr {
|
||||
thing: IThing,
|
||||
left: number,
|
||||
top: number): void {
|
||||
var sprite: PixelRendr.ISpriteMultiple = <PixelRendr.ISpriteMultiple>thing.sprite,
|
||||
var sprite: PixelRendr.SpriteMultiple = <PixelRendr.SpriteMultiple>thing.sprite,
|
||||
topreal: number = top,
|
||||
leftreal: number = left,
|
||||
rightreal: number = left + thing.unitwidth,
|
||||
@@ -744,8 +738,7 @@ module PixelDrawr {
|
||||
topreal,
|
||||
widthdrawn,
|
||||
heightdrawn,
|
||||
opacity
|
||||
);
|
||||
opacity);
|
||||
this.drawPatternOnContext(
|
||||
context,
|
||||
canvases[this.keyLeft].canvas,
|
||||
@@ -753,8 +746,7 @@ module PixelDrawr {
|
||||
topreal + diffvert,
|
||||
widthdrawn,
|
||||
heightreal - diffvert * 2,
|
||||
opacity
|
||||
);
|
||||
opacity);
|
||||
this.drawPatternOnContext(
|
||||
context,
|
||||
canvases.bottomLeft.canvas,
|
||||
@@ -762,8 +754,7 @@ module PixelDrawr {
|
||||
bottomreal - diffvert,
|
||||
widthdrawn,
|
||||
heightdrawn,
|
||||
opacity
|
||||
);
|
||||
opacity);
|
||||
leftreal += diffhoriz;
|
||||
widthreal -= diffhoriz;
|
||||
|
||||
@@ -776,8 +767,7 @@ module PixelDrawr {
|
||||
topreal,
|
||||
widthreal - diffhoriz,
|
||||
heightdrawn,
|
||||
opacity
|
||||
);
|
||||
opacity);
|
||||
this.drawPatternOnContext(
|
||||
context,
|
||||
canvases.topRight.canvas,
|
||||
@@ -785,8 +775,7 @@ module PixelDrawr {
|
||||
topreal,
|
||||
widthdrawn,
|
||||
heightdrawn,
|
||||
opacity
|
||||
);
|
||||
opacity);
|
||||
topreal += diffvert;
|
||||
heightreal -= diffvert;
|
||||
|
||||
@@ -799,8 +788,7 @@ module PixelDrawr {
|
||||
topreal,
|
||||
widthdrawn,
|
||||
heightreal - diffvert,
|
||||
opacity
|
||||
);
|
||||
opacity);
|
||||
this.drawPatternOnContext(
|
||||
context,
|
||||
canvases.bottomRight.canvas,
|
||||
@@ -808,8 +796,7 @@ module PixelDrawr {
|
||||
bottomreal - diffvert,
|
||||
widthdrawn,
|
||||
heightdrawn,
|
||||
opacity
|
||||
);
|
||||
opacity);
|
||||
this.drawPatternOnContext(
|
||||
context,
|
||||
canvases[this.keyBottom].canvas,
|
||||
@@ -817,8 +804,7 @@ module PixelDrawr {
|
||||
bottomreal - diffvert,
|
||||
widthreal - diffhoriz,
|
||||
heightdrawn,
|
||||
opacity
|
||||
);
|
||||
opacity);
|
||||
rightreal -= diffhoriz;
|
||||
widthreal -= diffhoriz;
|
||||
bottomreal -= diffvert;
|
||||
@@ -928,8 +914,7 @@ module PixelDrawr {
|
||||
0, 0,
|
||||
// Math.max(width, left - MapScreener[keyRight]),
|
||||
// Math.max(height, top - MapScreener[keyBottom])
|
||||
width, height
|
||||
);
|
||||
width, height);
|
||||
context.translate(-left, -top);
|
||||
context.globalAlpha = 1;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user