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 Kamend

Hi,
I am new to Impact and was doing some very basic tests, from the Introduction to HTML5 book and I notices that when I run the game inside Ejecta, I get really strange black lines between my tiles, any idea what might be the reason?

At first I was getting the lines, inside the Simulator, but then I turn preRendering on and they disappeared, now they appear only when I try to run the game on my iPhone 4S.

Here is a screenshot:

/><br />
<br />
Here is how I setup my canvas size:<br />
<br />
<pre class= var height = 160; var scale = window.innerHeight / height; var width = window.innerWidth / scale; canvas.style.width = window.innerWidth; canvas.style.height = window.innerHeight; ig.main( '#canvas', MyGame, 60, width, height, 1 );
Thanks for the help

1 decade ago by dominic

This happens when the tileset texture is blurred. Pixels from neighboring tiles bleed into each other.

The easy fix - since this is a pixel art game - is to disable texture blurring. Before calling ig.main(...) do this:
ig.System.scaleMode = ig.System.SCALE.CRISP;

Or, the "manual way" for other App/Games running in Ejecta:
ctx.imageSmoothingEnabled = false;

1 decade ago by Kamend

Great, thanks Dominic!

1 decade ago by Kamend

Hmm, for some reason this does not work, I still get the lines :(

1 decade ago by Kamend

For some reason, part of Ejecta does not respect the imageSmoothingEnabled option, I figured this out by debuging the Ejecta iOS code. If I change, EJCanvas/2D/EJCanvasContext2D.m -> setTexture:, to use only GL_NEAREST, it works ok.

- (void)setTexture:(EJTexture *)newTexture {

	
	if( currentTexture == newTexture ) { return; }
	
	NSLog(@"Set Texture: %d", [self imageSmoothingEnabled]);
	
	[self flushBuffers];
	
	currentTexture = newTexture;
	[currentTexture bindWithFilter:GL_NEAREST];
}

1 decade ago by Kamend

Ok, I figured something else out, the problem is that I preRender my backgroundMaps, I guess this is where the imageSmoothingEnabled get ignored.
Page 1 of 1
« first « previous next › last »