batiste / sprite.js

An efficient javascript sprite animation framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resize the Scene

JumpLink opened this issue · comments

I want to use the full size of my browser window.

Is it possible to have a scene with a size of 100%?
Or is it possible to resize the scene to the window size on each window resize event?

To illustrate what I mean, I've wrote a bit pseudo code:

var scene = sjs.Scene({w:'100%', h:'100%'});

or

var scene = sjs.Scene({w:640, h:480});
$(window).resize(function() {
  scene.w = $(window).width();
   scene.h = $(window).height();
   scene.update();
});

thanks!

As for now you can do it this way

scene.dom.style.width = $(window).width() + 'px';
scene.dom.style.height = $(window).height() + 'px';

Or a creation time with

var scene = sjs.Scene({w:$(window).width(), h:$(window).height()});