mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 09:48:18 +00:00
* Camera.preRender
will now apply Math.floor
instead of Math.round
to the values, keeping it consistent with the Renderer when following a sprite.
This commit is contained in:
parent
e2c9838896
commit
f136a796fa
1 changed files with 20 additions and 10 deletions
|
@ -517,12 +517,25 @@ var Camera = new Class({
|
|||
|
||||
var emitFollowEvent = false;
|
||||
|
||||
if (this.roundPixels)
|
||||
{
|
||||
originX = Math.floor(originX);
|
||||
originY = Math.floor(originY);
|
||||
}
|
||||
|
||||
if (follow && !this.panEffect.isRunning)
|
||||
{
|
||||
var fx = (follow.x - this.followOffset.x);
|
||||
var fy = (follow.y - this.followOffset.y);
|
||||
var lerp = this.lerp;
|
||||
|
||||
var fx = follow.x - this.followOffset.x;
|
||||
var fy = follow.y - this.followOffset.y;
|
||||
|
||||
if (this.roundPixels)
|
||||
{
|
||||
fx = Math.floor(fx);
|
||||
fy = Math.floor(fy);
|
||||
}
|
||||
|
||||
if (deadzone)
|
||||
{
|
||||
if (fx < deadzone.x)
|
||||
|
@ -560,11 +573,8 @@ var Camera = new Class({
|
|||
|
||||
if (this.roundPixels)
|
||||
{
|
||||
originX = Math.round(originX);
|
||||
originY = Math.round(originY);
|
||||
|
||||
sx = Math.round(sx);
|
||||
sy = Math.round(sy);
|
||||
sx = Math.floor(sx);
|
||||
sy = Math.floor(sy);
|
||||
}
|
||||
|
||||
// Values are in pixels and not impacted by zooming the Camera
|
||||
|
@ -586,13 +596,13 @@ var Camera = new Class({
|
|||
|
||||
if (this.roundPixels)
|
||||
{
|
||||
vwx = Math.round(vwx);
|
||||
vwy = Math.round(vwy);
|
||||
vwx = Math.floor(vwx);
|
||||
vwy = Math.floor(vwy);
|
||||
}
|
||||
|
||||
this.worldView.setTo(vwx, vwy, displayWidth, displayHeight);
|
||||
|
||||
matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom);
|
||||
matrix.applyITRS(Math.floor(this.x + originX), Math.floor(this.y + originY), this.rotation, zoom, zoom);
|
||||
matrix.translate(-originX, -originY);
|
||||
|
||||
this.shakeEffect.preRender();
|
||||
|
|
Loading…
Reference in a new issue