Detect phone and tablets
ryast
Member Posts: 145
Hey!
Anybody have some rules to detect if the user is on a phone or tablet based on screen size X/Y or something?
I am already using some awesome UB code from BBenk which resizes the stage automatically no matter what their screen size/resolution but now I actually need to know if they are on a tablet or phone so I can throw up a custom scene...
Thanks!
Comments
@ryast For IOS devices running in Landscape mode:
Rule - when game.device.screensize.width is 1024. (run ipad scene)
Else- (run phone scene)
If your in portrait mode then just check game.device.screensize.height instead of width.
Im not familiar with Android sizes so hoping your on IOS.
Thanks!
I was away from my computer when I typed that from my phone, but location to the screen size is actually devices.screen.size.height(or width).
Thanks
@AJaymz is right. I use the same technique within my universal builds in order to adjust my actors size and or position on screen. Very easy to do.
Big Smile Games Play Happy!
Check out our other GameSalad exclusives.
Since I will be targeting Android as well as iPhone I thought I would ask the user if they are on a mobile phone or on a tablet and adjust the screen accordingly... it seems a little more fool proof...