0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-26 13:49:01 -05:00

added default scale to sprites

This commit is contained in:
liabru 2014-03-27 14:38:59 +00:00
parent 203179d526
commit 473e7de6e0
4 changed files with 8 additions and 9 deletions

View file

@ -627,9 +627,7 @@
render: {
strokeStyle: '#ffffff',
sprite: {
texture: './img/box.png',
xScale: 1,
yScale: 1
texture: './img/box.png'
}
}
});
@ -641,9 +639,7 @@
friction: 0.01,
render: {
sprite: {
texture: './img/ball.png',
xScale: 1,
yScale: 1
texture: './img/ball.png'
}
}
});

View file

@ -43,7 +43,10 @@ var Body = {};
slop: 0.05,
render: {
visible: true,
sprite: null,
sprite: {
xScale: 1,
yScale: 1
},
path: 'L 0 0 L 40 0 L 40 40 L 0 40',
lineWidth: 1.5
}

View file

@ -317,7 +317,7 @@ var Render = {};
if (!body.render.visible)
continue;
if (body.render.sprite && !options.wireframes) {
if (body.render.sprite && body.render.sprite.texture && !options.wireframes) {
// body sprite
var sprite = body.render.sprite,
texture = _getTexture(render, sprite.texture);

View file

@ -239,7 +239,7 @@ var RenderPixi = {};
if (!bodyRender.visible)
return;
if (bodyRender.sprite) {
if (bodyRender.sprite && bodyRender.sprite.texture) {
var spriteId = 'b-' + body.id,
sprite = render.sprites[spriteId],
spriteBatch = render.spriteBatch;