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 appMobiTony

I noticed that there is a problem with drawing pre-rendered repeating backgrounds when the size of the layer is different from the chunkSize. For the specific example I was looking at, the layer is 320x320 (10x10 with a tileSize of 32), the chunkSize is 512 repeat=true.

Here is a screenshot of the issue:
/><br />
As you can see, there is a gap after the second copy of the layer in both directions.  This gap repeats after every even copy.  We think there is an issue in BackgroundMap.drawPreRendered: nudgeX and nudgeY get re-assigned inside the draw loop every time, but they should get accumulated instead.  This also leads to some issues where the background appears to jump around - this is due to the "gap" being shifted as the layer is scrolled.<br />
<br />
Here is a screenshot after changing = to += for nudgeX and nudgeY:<br />
<img src=

1 decade ago by dominic

You're right! Good catch.

Concerning small preRendered BackgroundMaps, I also added a check that will decrease the chunkSize to the size of the BackgroundMap if it's smaller. This way, there wont be as much overdraw. I.e. it makes no sense to render a 100x100 px map into 512px chunks if they end up mostly empty anyway.

The updated version is in the git repo. Thanks!

1 decade ago by appMobiTony

Shrinking the chunkSize makes sense, thanks for the update!
Page 1 of 1
« first « previous next › last »