Jump to content

CocoonJS, Images and screen resolution


jamessimo
 Share

Recommended Posts

Hey guys! I just want to find out if anyone knows why this is happening to my CocoonJS game. 

 

I had my physics game running at 60+ FPS no problems on my samsung S3 (720x1280). However once I added a single image (58x62) it dropped the FPS to 42~43. The image is attached to a static box2D obj. 

 

Could the screen resolution be too big? I ask because I have made and iPad game with loads of images and no problems on cocoonJS. 

 

For now I have made the resolution smaller and planning to scale up however I wanted to see if I could a better reason to why this happens with a single image. 

 

Thanks all! 

Link to comment
Share on other sites

I am using the iio engine. 

I think its just my initial huge screen resolution. HTML5 Canvas blits textures and images every draw which is intensive if your resolution is huge.

 

I have shrunk the res down to 360X480 and I scale up using CSS now and my issues are fixed. 

Link to comment
Share on other sites

  • 3 weeks later...

Awesome! Going to try!  Did you had to change your input touch events to calculate the zoomed thing? (in case you use input touch)

 

Yes, cocoonJS calls the resize event on load so inside it I do this to make the screen the correct size. (this streches to fill the screen) 

this.onResize = function(event){		io.canvas.width = 320;		io.canvas.height = 480;		scaleX = io.canvas.width / window.innerWidth;		scaleY = io.canvas.height / window.innerHeight;		io.canvas.style.width = window.innerWidth + 'px';		io.canvas.style.height = window.innerHeight + 'px';	};

And inside the touches I simply 

  function touchMove(event){    	mouseX = event.touches[0].pageX*scaleX;    	mouseY = event.touches[0].pageY*scaleY;    }
Link to comment
Share on other sites

  • 3 weeks later...

For what it's worth, I've understood that graphics hardware typically works better when textures are sized in powers of 2. so 8, 16, 64, 128, 256 etc. (see here)

 

Have you tried resizing the image to 64x64 pixels instead of 58x62? (just leaving the non-used parts of the image blank)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...