Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by dlkulp

it seems that setting a viewport doesn't do anything? The only way I've been able to change the scale of the game is in the:
ig.main('#canvas', MyGame, 60, 1280, 704, 1);
thing. Is there another way to set the viewport to allow mobile users to have the game fit their screen or am I forced to set scale here? If changing the 1 above is the only way then why do I get this error if scale is < 1?
IndexSizeError: Index or size is negative or greater than the allowed amount maps-panel.js:76

1 decade ago by pattentrick

Hi there,

as far as I know 1 is the minimum scale. Do I understand you right, that you want some kind of resolution independence? So that the game fits the screen, no matter how big or small it is? If yes, you could use Impact++ for that. This kind of functionality is already built in.

http://collinhover.github.io/impactplusplus/

If you don't want to use another library you could still look at the code of ++ and figure out how it achieves the dynamically scale. Take a look at this part:

https://github.com/collinhover/impactplusplus/blob/master/lib/plusplus/core/game.js#L2480
Page 1 of 1
« first « previous next › last »