Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Device rotation — Gideros Forum

Device rotation

VenorcisVenorcis Member
edited February 2014 in General questions
I'm a bit stuck with trying to support landscape mode in our app. I've tried adding the following code:
local orientation = application:getOrientation()
stage:addEventListener(Event.ENTER_FRAME,function()
local neworientation = application:getDeviceOrientation()
if neworientation ~= orientation then
print(neworientation)
orientation = neworientation
end
end)
However, on my iOS Gideros Player, this only ever prints 'portrait' or 'portraitUpsideDown', even though all rotations modes are enabled through the XCode project. On android, the value does not ever seem to change at all.
What am I doing wrong?

Comments

  • Unfortunately not possible by default, because in gideros you can only set one single mode (+ autorotation you get only two modes)

    But what you can try to do is to go to the
    ViewController.mm and change - (NSUInteger)supportedInterfaceOrientations method to provide all orientation modes:
    - (NSUInteger)supportedInterfaceOrientations
    {
     //return gdr_supportedInterfaceOrientations();
     return UIInterfaceOrientationMaskAll; 
    }
    Don't know if that will work correctly, because currently not sure how Gideros OpenGL will handle it, but it is worth to try :)
  • @ar2rsawseen Ok that works; the animation is a bit freaky by default but the events now work. How about Android then? ;)
Sign In or Register to comment.