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

10 years ago by Donzo

Hi.

Is anyone else having these issues other than me?
As soon as I upgraded to Xcode 6, all my projects now scale incorrectly.

For example, the following code used to work perfectly:

ig.System.scaleMode=ig.System.SCALE.CRISP;if(window.innerWidth<481){
	//iPhone 4 and 4S (480 x 320)
	ig.main('#canvas',MyGame,60,240,160,1);
}
else if(window.innerWidth<569){
	ig.main('#canvas',MyGame,60,284,160,1);
	}
else if(window.innerWidth<1025){
	ig.main('#canvas',MyGame,60,256,192,1);
	}
else{
	ig.main('#canvas',MyGame,60,240,160,1);
	}

Now huge sections of the screen don't show up and the ratios are no longer correct:

/><br />
<br />
Any ideas or suggestions would be appreciated.			</div>
		</div>
			<div class=

10 years ago by Donzo

Maybe it has something to do with my index file.

This is how it normally looks:

// Load the game
ejecta.include('lib/impact/impact.js');
ejecta.include('lib/game/main.js');

canvas.style.width = window.innerWidth;
canvas.style.height = window.innerHeight;

But if I manually set it,
I can get the game to scale correctly:

//iPhone 5S
// Load the game
ejecta.include('lib/impact/impact.js');
ejecta.include('lib/game/main.js');


canvas.style.width = 568; 
canvas.style.height = 320;


Any suggestions on a modified index file that would better detect sizes?

10 years ago by Donzo

I don't know.

Maybe it's because I've got the game in landscape or something,
but it appears to be fixed when I switch these values in the index file:


canvas.style.width = window.innerHeight; 
canvas.style.height = window.innerWidth;

Problem solved.

Now to get those iPhone 6 res sizes...

10 years ago by Donzo

I don't know.

Maybe it's because I've got the game in landscape or something,
but it appears to be fixed when I switch these values in the index file:


canvas.style.width = window.innerHeight; 
canvas.style.height = window.innerWidth;

Problem solved... I think.

10 years ago by Donzo

I continued having issues going from hardware to simulator.
I'm too stoopid to figure out the cause,

but I stuffed this in the index to solve it:


//Ipads
if (window.innerWidth == 1024 && window.innerHeight == 768){
	canvas.style.width = window.innerWidth;
	canvas.style.height = window.innerHeight;	
}
else if (window.innerWidth == 768 && window.innerHeight == 1024){
	canvas.style.width = window.innerHeight;
	canvas.style.height = window.innerWidth;
}
//Iphones
//4
else if (window.innerWidth == 480 && window.innerHeight == 320){
	canvas.style.width = window.innerWidth;
	canvas.style.height = window.innerHeight;	
}
else if (window.innerWidth == 320 && window.innerHeight == 480){
	canvas.style.width = window.innerHeight;
	canvas.style.height = window.innerWidth;
}
//5S
else if (window.innerWidth == 568 && window.innerHeight == 320){
	canvas.style.width = window.innerWidth;
	canvas.style.height = window.innerHeight;	
}
else if (window.innerWidth == 320 && window.innerHeight == 568){
	canvas.style.width = window.innerHeight;
	canvas.style.height = window.innerWidth;
}
//Fallback
else {
	canvas.style.width = window.innerHeight;
	canvas.style.height = window.innerWidth;	
}

10 years ago by RichardC

I am having the same problem and for the life of me couldn't figure it out. This is the only post i've seen on the issue. Thank you for your work around. I'm going to implement this and see if it works for us. THANK YOU!

10 years ago by NellG

The latest version of ejecta on the git repository fixes this issue.
Page 1 of 1
« first « previous next › last »