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

View file

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

View file

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

View file

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