Suggestion: New Scale Mode = Scale to Fit (Un-Letterboxed)

id8games

  • Posts: 205
Could you create a new Scale Mode called "Scale to Fit (Un-Letterboxed)", which behaves exactly as the existing "Scale to Fit (Letterbox) just without the letter boxing.

This will allow us to use filler material to fill the area which used to be letter boxed.

This mode will be perfect for non-scrolling games, and will not violate Apples guidelines.
It is also perfect for maximising screen space on a mobile device, without losing any part of the game (as what happens with Scale to Fit (Fill).
It is also perfect for Android devices such as the Samsung Galaxy S4, with a large screen. On these devices, when using Full Screen mode, the app is not scaled to 4x, but remains at 2x, thus resulting in a poorly aligned and tiny app.

If it is not possible to create this new Scale Mode, could you at least provide me with the code that will allow me to remove the letter boxing effect from the Scale to Fit (Letterbox) mode.
Many thanks.


id8games

  • Posts: 205
It shouldn't be too hard to implement. All that is needed is to duplicate the functionality of the Scale Mode - Scale to Fit -  and just remove the Letterbox effect...

id8games

  • Posts: 205
Gintonic, you are a champion! I had a look at your code and added it to Universal.hx and is exactly what I needed, my game looks perfect...

So now on iOS I set the Game Mode to Full Screen, and for Android, I set it to Stretch to Fit (your version).

MANY THANKS.

Gintonic

  • Posts: 69
Don't forget to backup your Universal.hx. You have to compare it with the new version after every Stencyl update.  It would be great to have it as a separate scale mode in Stencyl.

id8games

  • Posts: 205
Gintonic,

Your modifications to the Universal.hx file worked really well, however when I tested on a Samsung galaxy S4, it didn't scale right.
So I did some digging around inside Universal.hx and found the code that forces the "LetterBox" effect. All I did was comment this code out.
Now when I select "Scale to Fit (Letterbox), I get the desired result without the Letterbox effect, which means I can control the look of my game completely.

It would be good if Jon and the crew had an option to tick or un-tick the letterbox effect. But for now this is working fine.

Here are the lines of code inside Universal.hx (almost at the end of the file) which I commented out for your reference:

      //Clip the view
            
      //#if(mobile)
      //if(!usingFullScreen && !stretchToFit)
      //{
      //   scrollRect = new nme.geom.Rectangle(0, 0, scripts.MyAssets.stageWidth, scripts.MyAssets.stageHeight);
      //}
      //#end
      
      //#if(flash || js || (cpp && !mobile))
      //scrollRect = new nme.geom.Rectangle(0, 0, scripts.MyAssets.stageWidth, scripts.MyAssets.stageHeight);
      //#end

captaincomic

  • *
  • Posts: 6109
This has been added now.