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 ArcadeHype

Im currently experiencing two issues with Cocoon JS and i am wondering if anyone else has encountered the same issues and can provide me with some insight.

1. Music stops playing after 5-10 seconds. I am loading all my music and sound effects in .mp3 format. My sound effects work fine but again my music stops playing.

2. Fonts are not being drawn.

I am testing my game on my Galaxy S3 and not sure if the issues i am encountering are device related or not.

Any help is appreciated.

Thanks.

1 decade ago by dominic

To fix the music issue, there's a special call you can make in CocoonJS to properly play long audio tracks. Check this blog comment for the details.

I don't know what exactly is causing the problems with the font, though. In hindsight, Impact's font system was a bad idea. It's relying on being able to read back pixels exactly as they are in an image file - which many platforms can't do :/

My suggestion is to log the font indices and the widthMap on a platform where the fonts work correctly and then always use these arrays instead of letting Impact analyse the font image.

I.e. on a platform where the fonts work correctly, do this in you Game&039;s #init:

console.log( JSON.stringify(this.font.indices) );
console.log( JSON.stringify(this.font.widthMap) );

This will log two JavaScript arrays into the console. Then simply set the properties for the font to these static arrays in CocoonJS. Again, in your Game&039;s #init:

this.font.indices = [ /* ... array data here ...  */ ];
this.font.widthMap = [ /* ... array data here ...  */ ];

1 decade ago by ArcadeHype

Dom, thanks for the help. Its all working now :]

1 decade ago by tkorkalainen

Nice, thanks for the tip :-) Setting the font properties with static arrays fixed also my font issue with CocoonJS + iOS.

1 decade ago by tkorkalainen

At some point fonts were working correctly on my Nexus 7 (CocoonJS) but at the moment I see this. Left screenshot is from Chrome and right is from Nexus 7. Fonts are working on iPad 2 (uses Ejecta) and Samsung Galaxy Tab 2 and Samsung Galaxy S2. Does anyone have any ideas how to proceed?

/>			</div>
		</div>
			<div class=

1 decade ago by ricricucit

@tkorkalainen did you find any solution for this?
Page 1 of 1
« first « previous next › last »