piqnt / stage.js

2D HTML5 rendering and layout engine for game development
http://piqnt.com/stage.js/
Other
2.43k stars 241 forks source link

Adding image to testbed examples #42

Closed kuyucakli closed 4 years ago

kuyucakli commented 4 years ago

Hi, I am trying to add a background image to a testbed example. I have used the below code:

...
// stage.empty();
    stage.background(testbed.background);
    stage.viewbox(testbed.width, testbed.height, 'in-pad');
    stage.pin('alignX', -0.5);
    stage.pin('alignY', -0.5);
        stage.prepend(viewer);

Stage({
    image : { src : '/media/assets/pinball.png', ratio : 1 },
  textures : {
    'board' : { x : 0, y : 0,  width : 320, height : 416 }
  }
});
...

But no image is rendered on the canvas?