How to use StageSizeScaleMode with scaling on html5

45 views
Skip to first unread message

Rafael Oliveira

unread,
Mar 7, 2015, 12:17:13 PM3/7/15
to haxef...@googlegroups.com
I'm trying to use StageSizeScaleMode on html5 (html5 from OpenFL), and it work fine when there is no zoom, the game appear correctly in portrait and landscape. But if try to use zoom (with the default template, setting zoom to -1), the game appears incorrectly, with different sizes when the game starts on portrait or landscape. If the game starts in portrait, the game appears bigger than the screen, and if the game starts in landscape, the game appears smaller than the screen.

I'm using the default template with four blocks in each edge of the screen. in update I detected if the orientation changed (checking with FlxG.width < FlxG.height for portrait, and the opposite for landscape), and if the orientation is changed, I reset the blocks position to stay in the edges. As I said, if there is no zoom, the blocks stay in the right position in any orientation, but with zoom they appear with half the size out of the screen, or in a area smaller than the screen.

html5 informs different sizes of the screen when is in portrait or landscape, and this is a problem for scaling when the game starts in the wrong orientation. 

Ashiq A.

unread,
Mar 7, 2015, 12:35:14 PM3/7/15
to haxef...@googlegroups.com
Can you show us some screenshots?
> --
> HaxeFlixel Development Community
> See our github https://github.com/haxeflixel/ and our documentation
> http://haxeflixel.com/documentation/
> ---
> You received this message because you are subscribed to the Google Groups
> "HaxeFlixel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to haxeflixel+...@googlegroups.com.
> Visit this group at http://groups.google.com/group/haxeflixel.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/haxeflixel/38d0eb51-9e7e-44ec-8352-28a5cc1cbfe9%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Rafael Oliveira

unread,
Mar 7, 2015, 3:01:24 PM3/7/15
to haxef...@googlegroups.com
without zoom, starting in portrait, and starting in landscape:

with zoom, starting in portrait and starting in landscape:

Rafael Oliveira

unread,
Mar 7, 2015, 3:04:58 PM3/7/15
to haxef...@googlegroups.com


Em sábado, 7 de março de 2015 14:17:13 UTC-3, Rafael Oliveira escreveu:

Sam Bellman

unread,
Mar 9, 2015, 5:18:34 AM3/9/15
to haxef...@googlegroups.com
I had a problem with zooming and resizing in a project I'm working on, and  while your issue doesn't sound exactly the same what I found might help.
Basically when the size of the window is different to the size of your FlxGame flixel sets the camera zoom to fit the new size. In this case because your height is less than the game's height the zoom will be less than 1. Because you're setting the positions based on the actual size, but the game is being scaled they will appear in the wrong position and in the wrong sizes.
Reply all
Reply to author
Forward
0 new messages