Jump to content

Scaling for CocoonJS


SignalSin
 Share

Recommended Posts

I'm having trouble scaling my game for CocoonJS. I've done a lot of reading and messing around, but haven't been able to come up with an adequate solution yet. I've used the full-screen mobile template to handle scaling for mobile when run in web, but this doesn't produce the desired results on Android when compiled in CocoonJS. Instead, my game doesn't seem to scale at all, instead appearing like this:

post-9095-0-19207000-1409112194.jpg

 

The solutions in this thread don't seem to work for CocoonJS.

An alternative that I've found is described in this thread. It does work to a certain extent. It scales the entire game up for CocoonJS, but physics.arcade.moveToPointer doesn't work - it seems the pointer uses co-ordinates after scaling, but the sprites position co-ordinates are set to what they would be before scaling, if that makes sense. This means the player movement doesn't work correctly.

 

I guess what I want to know is what are the solutions to this? Is there any sort of standard/best practice when it comes to scaling for CocoonJS? Or am I missing something obvious?

Link to comment
Share on other sites

Have you looked under "Scaling" on the issues thread? I've been trying to collect and post solutions others come up with for dealing with scaling in CocoonJS there.

 

From that, my first suggestion would be to use window.innerWidth and window.innerHeight to make sure you are scaling up or within the full CocoonJS reported space.

 

Many people have also reported that Phaser's scaling manager using EXACT_FIT works well for them too.

Link to comment
Share on other sites

Yeah, I've seen the thread. Using window.innerWidth and window.innerHeight does make the game world fit the screen, but the game assets aren't scaled along with it. It works as intended on desktop and mobile browsers, just not CocoonJS.

 

I am having this issue as well. Move to pointer goes off of the real screen size and not the game width and height. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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