MattRix / Futile

A super simple Unity 2D framework
http://struct.ca/futile
833 stars 130 forks source link

Consistent width / height in FScreen when resizing window in Unity Editor #205

Open jpsarda opened 11 years ago

jpsarda commented 11 years ago

When testing in free aspect window in Unity editor, if you resize the window, the width and height are no longer valid as soon as the screen orientation is not the same as the initial orientation.

You can test with the Banana demo, if you start in landscape mode and resize to portrait mode, the game is no longer adapted to the screen size as it has wrong width and height returned by Futile.screen.

I'm aware this is not a critical issue as it only happens in the Editor (unless you can resize dynamically the web player too?), but this modification is handy to check orientation change in real time in the Unity Editor (as long as you test (Futile.screen.width<Futile.screen.height) to decide is your layout is in portrait mode).

MattRix commented 10 years ago

Hmm yeah I'll have to think about this... so if I'm reading this right, if the width becomes shorter than the height, then it kinda switches them and it fires an orientation change event, as if it had changed from landscape to portrait? That does make some sense, but I wonder if it might confuse people?

jpsarda commented 10 years ago

The fix doesn't send the orientation change event as I was not sure if it's something reserved for an actual orientation change in a true device. But yes that's the idea.

jpsarda commented 10 years ago

Just to let you know that after testing it on the device, this pull request doesn't work well. So I switched back to your version. But as you might know as I already posted on reddit, FScreen needs to be improved a bit as when the device is changing its orientation there's a dirty on frame transition screen, and HandleResize being called twice.(tested on ipad mini)