mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
camera scrolling
This commit is contained in:
parent
2c37dc3fda
commit
6f19416129
3 changed files with 7 additions and 6 deletions
|
@ -9,6 +9,8 @@ var Camera = function (x, y, width, height)
|
|||
this.state = null;
|
||||
this.statePositionX = 0.0;
|
||||
this.statePositionY = 0.0;
|
||||
this.scrollX = 0.0;
|
||||
this.scrollY = 0.0;
|
||||
};
|
||||
|
||||
Camera.prototype.setState = function (state)
|
||||
|
@ -28,7 +30,7 @@ Camera.prototype.preRender = function (interpolation, renderer)
|
|||
stateTransform.positionX = this.x;
|
||||
stateTransform.positionY = this.y;
|
||||
|
||||
Transform.updateRoot(stateTransform);
|
||||
Transform.updateRoot(stateTransform, -this.scrollX, -this.scrollY);
|
||||
};
|
||||
|
||||
Camera.prototype.postRender = function ()
|
||||
|
|
|
@ -72,7 +72,7 @@ Transform.prototype.remove = function (transform)
|
|||
}
|
||||
};
|
||||
|
||||
Transform.updateRoot = function (root)
|
||||
Transform.updateRoot = function (root, globalOffsetX, globalOffsetY)
|
||||
{
|
||||
var currentChild = null;
|
||||
var stackLength = 0;
|
||||
|
@ -117,8 +117,8 @@ Transform.updateRoot = function (root)
|
|||
var p4 = tempLocal[4];
|
||||
var p5 = tempLocal[5];
|
||||
|
||||
transX = child.positionX;
|
||||
transY = child.positionY;
|
||||
transX = child.positionX + globalOffsetX;
|
||||
transY = child.positionY + globalOffsetY;
|
||||
scaleX = child.scaleX;
|
||||
scaleY = child.scaleY;
|
||||
rotation = child.rotation;
|
||||
|
|
|
@ -273,7 +273,6 @@ WebGLRenderer.prototype = {
|
|||
|
||||
var list = state.sys.children.list;
|
||||
var length = list.length;
|
||||
var matrixBuffer = Transform.float32Buffer;
|
||||
for (var index = 0; index < length; ++index)
|
||||
{
|
||||
var child = list[index];
|
||||
|
@ -299,7 +298,7 @@ WebGLRenderer.prototype = {
|
|||
this.blendMode = newBlendMode;
|
||||
}
|
||||
// drawing child
|
||||
child.renderWebGL(this, child, interpolationPercentage, matrixBuffer);
|
||||
child.renderWebGL(this, child, interpolationPercentage);
|
||||
batch = this.batch;
|
||||
if (batch && batch.isFull())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue