mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 06:28:30 +00:00
Added setPointer
This commit is contained in:
parent
55410038eb
commit
8620e2303d
1 changed files with 18 additions and 0 deletions
|
@ -244,6 +244,8 @@ var Shader = new Class({
|
|||
}
|
||||
}
|
||||
|
||||
this.pointer = null;
|
||||
|
||||
this._rendererWidth = renderer.width;
|
||||
this._rendererHeight = renderer.height;
|
||||
|
||||
|
@ -314,6 +316,13 @@ var Shader = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
setPointer: function (pointer)
|
||||
{
|
||||
this.pointer = pointer;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets up an orthographics projection matrix
|
||||
*
|
||||
|
@ -493,6 +502,15 @@ var Shader = new Class({
|
|||
|
||||
this.uniforms.time.value = this.renderer.game.loop.time / 1000;
|
||||
|
||||
if (this.pointer)
|
||||
{
|
||||
var px = this.pointer.x / this.width;
|
||||
var py = 1 - this.pointer.y / this.height;
|
||||
|
||||
this.uniforms.mouse.value.x = px.toFixed(2);
|
||||
this.uniforms.mouse.value.y = py.toFixed(2);
|
||||
}
|
||||
|
||||
this.syncUniforms();
|
||||
|
||||
// Draw
|
||||
|
|
Loading…
Add table
Reference in a new issue