Is there some way to manually make rotation occur? for instance I did my apps originally in portrait mode and defined my canvas with coordinates 0,0 in bottom left corner and images rotated 90 degrees to make them work in the portrait mode. (this was from early version of corona). Is there some way to detect the current orientation, and manually set the orientation of the device based on that? that way I could rotate the coordinate system? (dont want to just rotate graphics). Thanks! [import]uid: 6317 topic_id: 1223 reply_id: 301223[/import]
function onOrientationChange(event)
backing.parent:setReferencePoint(display.CenterReferencePoint);
if event.type=="landscapeLeft" then
transition.to(backing.parent, {time=300, rotation=-180});
elseif event.type=="landscapeRight" then
transition.to(backing.parent, {time=300, rotation=0});
end
end
Runtime:addEventListener( "orientation", onOrientationChange )
I put this code in my app, and it works and rotates everything. HOWEVER when it’s in rotated mode (180 rotation in landscapeleft) the redraw is sluggish and has a lag. isn’t smooth like when it rotates back into 0 rotation landscapeRight mode. [import]uid: 6317 topic_id: 1223 reply_id: 3225[/import]
COOL! Thank you!!!
I am using this simplified / modified like this for my portrait mode application now:
function Foo:orientation(event)
local s=display.getCurrentStage()
s:setReferencePoint(display.CenterReferencePoint);
if event.type=="portraitUpsideDown" then
transition.to(s, {time=300, rotation=180});
elseif event.type=="portrait" then
transition.to(s, {time=300, rotation=0});
end
end
function Foo:init()
Runtime:addEventListener("orientation", self)
end
Your “backing.parent” … can be simply the display.getCurrentState() call! [import]uid: 6928 topic_id: 1223 reply_id: 3254[/import]