Hi!,
I have been searching through the forums / google and haven’t found anything about this.
Is there anyway to get the current device orientation in cocos2d-x?
Thanks in advance.
Hi!,
I have been searching through the forums / google and haven’t found anything about this.
Is there anyway to get the current device orientation in cocos2d-x?
Thanks in advance.
I can suggest an idea about how to do it.
Just get the current size of the screen by
auto size = Director::sharedDirector()->getOpenGLView()->getFrameSize();
And then see the ration of screen width and height.
if(size.width / size.height > 1)
CCLOG("Landscape orientation");
else
CCLOG("Portrait orientation");
I see, I thought there was something a bit more “standard”.
Anyway I will be using what you suggested.
Thanks for the info.