2017-02-21 01:04:11 +00:00
|
|
|
// Texture Component
|
|
|
|
|
2017-02-23 03:10:48 +00:00
|
|
|
// bitmask flag for GameObject.renderMask
|
|
|
|
var _FLAG = 8; // 1000
|
2017-02-21 01:04:11 +00:00
|
|
|
|
2017-02-23 03:10:48 +00:00
|
|
|
var Texture = {
|
2017-02-21 01:04:11 +00:00
|
|
|
|
2017-02-23 03:10:48 +00:00
|
|
|
texture: null,
|
|
|
|
frame: null,
|
|
|
|
|
|
|
|
setTexture: function (key, frame)
|
|
|
|
{
|
|
|
|
this.texture = this.state.sys.textures.get(key);
|
|
|
|
|
|
|
|
this.frame = this.texture.get(frame);
|
2017-02-21 01:04:11 +00:00
|
|
|
|
2017-02-23 03:10:48 +00:00
|
|
|
if (!this.frame.cutWidth || !this.frame.cutHeight)
|
|
|
|
{
|
|
|
|
this.renderFlags &= ~_FLAG;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.renderFlags |= _FLAG;
|
|
|
|
}
|
|
|
|
}
|
2017-02-21 01:04:11 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Texture;
|