Hey all, i need a help how to compare orientation, if is portrait mode, it should pause the game, otherwise if is landscape mode, it can continue the game.
Is for browser, not native mobile apps.
Thanks!.
ummm. well. A thought would be to do a "check on every X seconds" say 1. If your fortunate the window Width will change. Check all the Width of course just to make sure. If it changes then you have your check. I used this model in straight js, but i'm guessing here in C2.
oh oh. You should be able to check the acceleramotr instead of width. I'm not sure which vector your checking for or the degree's before the tablet instelf changes. but I think this will work out.
Use compare values, if windowwidth>windowheight it's landscape, else it's portrait.
I added an event: windowwidth>windowheight well it didn't work, in that case is using letterbox scale
Hmm. Maybe it doesn't work on all devices. Maybe every tick try setting a text object to windowwidth and windowheight to see what the problem is?
http://dl.dropbox.com/u/76227787/orientationWindow.capx
No big difference.
Oh, the reason it's not working is you're using letterbox scale. If you switch it to scale it works. That will require you to make your own black borders, though.
Develop games in your browser. Powerful, performant & highly capable.
Yes, it worked if is scale.
However, is there a workaround for no fullscreen and letter box versions?
Aside from checking the accelerometer, not that I know of.
Edit: I suppose you could do something like check if the windowwidth changes, if the new windowwidth is lower than the previous windowwidth, it's probably in portrait. Tough that wouldn't help for determining if it's in portrait or landscape at start, though.