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

8 years ago by tangxuanli

Dear guys:

normally we are using below mentioned logic for different device.
But if android device screen size is different,how I can adapt to it?

and also,all the game is running in canvas,if I want to add some other notifications
to the game,I have to give the absolute X .Y for the font.
then again problems accured,screen size different,notification position will be also
problems.

who can share me some solution ,if you can share me some exmaple code.
it will be very helpful for me.
thank.

if(ig.ua.iOS){
document.getElementById('buttonUp').style.display='block';
document.getElementById('buttonDown').style.display='block';
document.getElementById('buttonLeft').style.display='block';
document.getElementById('buttonRight').style.display='block';

ig.main( '#canvas', MyGame, 60, 400, 560, 1,ig.ImpactSplashLoader);

}else if(ig.ua.android){
document.getElementById('buttonUp').style.display='block';
document.getElementById('buttonDown').style.display='block';
document.getElementById('buttonLeft').style.display='block';
document.getElementById('buttonRight').style.display='block';
ig.main( '#canvas', MyGame, 60, 320, 480, 1,ig.ImpactSplashLoader);
}else{
ig.main( '#canvas', MyGame, 60, 320, 480, 2,ig.ImpactSplashLoader);
}

8 years ago by Joncom

Untested, but I wonder if you could do something like:

ig.main( '#canvas', MyGame, 60, 100%, 100%, 1);

8 years ago by schme16

@Joncom
No dice

Too bad, that would have been hand as heck; but probably not possible due to the GL bindings

8 years ago by jizaymes

Not sure if it helps but this bit did wonders for my game..

I have it right after the ig.main call

	ig.system.resize(window.innerWidth,window.innerHeight);

7 years ago by jddb

I used a slightly different method. In the index.html file I added a variable
gamesize = window.innerWidth
In main.js :
ig.main( '#canvas', MyGame, 60, gamesize, 150, 2 );

6 years ago by Jon123

Look at the JumpNRun example you get with Impactjs in your downloads. I'm adapting that for my game and it works well :)

*Just realised this was posted years ago, but someone may benefit!

6 years ago by ricricucit

@Jon123 thanks.
Page 1 of 1
« first « previous next › last »