forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTexture.js
More file actions
40 lines (29 loc) · 854 Bytes
/
Copy pathTexture.js
File metadata and controls
40 lines (29 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Texture Component
// bitmask flag for GameObject.renderMask
var _FLAG = 8; // 1000
var Texture = {
texture: null,
frame: null,
setTexture: function (key, frame)
{
this.texture = this.state.sys.textures.get(key);
this.frame = this.texture.get(frame);
if (!this.frame.cutWidth || !this.frame.cutHeight)
{
this.renderFlags &= ~_FLAG;
}
else
{
this.renderFlags |= _FLAG;
// if (this.hasOwnProperty('originX'))
// {
// // Default origin to the center
// var w = Math.floor(this.frame.realWidth / 2);
// var h = Math.floor(this.frame.realHeight / 2);
// this.setOrigin(w, h);
// }
}
return this;
}
};
module.exports = Texture;