Auto-rotation question

Looks like I haven’t gotten that far yet, you are running it on your phone? I’m just using the sim and can’t see an option to do face up/down.

Correct, you only realise some things in real situations- Some apps are available to help test with the simulator to test such things as GPS, and I think the accelerometer, so if you search you may find something useful

Alec

I’m late replying to this one, but I must add, this is a very useful snippet of code.  Thank you Alec.

I finally figured out how to run the app on my device.  My app was having a lot of flickering whenever I tilted the phone away and towards me.   The code above to check for faceUp/faceDown events prevented it from happening.

My next problem to tackle is to check for memory leaks, so I’ll be sure to try your suggestions earlier (I found a couple of tutorials on the Corona site as well that are helpful for memory leaks).   I’m coming across a lot of cases where I have variables accidentally not declared as ‘local’, so I’m hoping those are the parts (along with the divisions instead of multiplications) that are contributing to the lag.  I have a lot of newRect()s as well.    The orientation routine causes the app to refresh, and hence triggers the cleanup and re-setup of memory-hungry graphics, so it’s crucial I get those lags resolved.  

I also find that changing the fps in the config.lua from 30 to 60 helps with the lag on an iPhone 5s, but not on devices like an iPad 3.

I am pleased we are gradually illuminating some of the ‘issues’

I originally was refreshing the complete scene. But over time, looking at my code and having structured it for orientation with routines to ‘unformat’ i.e remove unwanted objects from display and removing tables entries (deleteall)  and making the rest of the ‘refresh’ variable nil help cut down on memory requirements/leaks.

Another tip is to ourge on exiting scenes

–============================

local scene = storyboard.newScene()

storyboard.purgeOnSceneChange = true

–============================

I have not had to change fps yet.

I have an app that is a spreadsheet style app and that used numerous newRec as cells and graphs.

I place these in a newTableview and no performance issues.

Alec

I haven’t given the purge command much thought.  Normally when I do an orientation change, I delete all the existing objects with ‘display.remove(obj_name)’ and set it to nil, and then re-create them.

Regarding TableView, how smooth is it… have you compared to ScrollView?   I have scrollview with many newRects per row, and it lags a bit, but I read that TableView is worse performance-wise.

Hi guys - do you have any feedback/advice on any gottchas associated with re-laying out UI components in general with Graphics 2.0 and use of groups and containers, and storyboard.  I did not want to delete/create the UI components, but just relay them out.  Is this feasible or is it difficult/frustrating?  :)    

In fact I got stuck early on with something basic and posted here http://forums.coronalabs.com/topic/43058-whats-wrong-with-this-basic-orientation-change-handling-code-to-change-object-widthsposition/

Hi

I am not using Graphics 2.0 yet but I ran your code on my system and after setting up config files and build files it work as I would have expected.

Here are the build and config files I used with your code.

–=====Config file

local aspectRatio =display.pixelHeight/display.pixelWidth

application =

{

    content =

    {

        width = aspectRatio > 1.5 and 320 or math.ceil(480 /aspectRatio),

        height = aspectRatio<1.5 and 480 or math.ceil (320*aspectRatio),

        scale = “letterbox”,

        fps = 30,

        antialias = false

    –    xAlign = “center”,

        --yAlign = “center”

    }

}

–=======

–======build=======================

settings =

{

    orientation =

    {

         default = “portrait”,

       supported = { “portrait”,“landscapeLeft”, “landscapeRight”,“portraitUpsideDown”

         },

    },

    

    iphone =

    {

        plist =

        {

            UIAppFonts = {“Helvetica Neue Condensed Bold”}

        },

    },

}

–========

I also changed the your code to highlight the objects more because I could not see them on the default black background on the Graphics system I am using Corona Version 2013.1202 (2013.8.28)

–=======code change

myRoundedRect2:setFillColor(0,0,255)

myRoundedRect2:setStrokeColor(255,255,0)

–=====

Regards

Alec

Ok Alec. I don’t have access to my Mac at the moment but I’ll check the build file. When I was running I got:

  • startup: all good. In portrait
  • 1st orientation change: ok. Ie to landscape
  • subsequent changes (landscape <=> portrait): width of rectangles increased it appeared such you do not see rounded edges at either ends of the rectangles.

Hi Greg,

My test show everything as I would expect. Just tried again…

Just keeping rotating in either direction as many times as you wish and all aspects of object (both) are show ok. No cutoffs or increase in size.

Alec

oops - updated in wrong post - moved my update to here:

http://forums.coronalabs.com/topic/43058-whats-wrong-with-this-basic-orientation-change-handling-code-to-change-object-widthsposition/?p=224325

Sorry I have given false hopes…

I have not moved to Graphics 2 because of the dropping of reference points. Looks like I will leave it for a while longer now.

PS I have asked this way back several months ago…

 Is there a team at Corona doing regression testing?

It would seem not. Lots of simple test have failed in prior sample programs on prior releases.

Having worked in product testing for years it is point of concern to me that these things get through. I realise the product is vast and many exciting  things being supported and very exciting to work on new and top interest items but there should be a team verifying these very basic things or a set of test cases that are run and verified each build before it is released…

or have I the wrong impression?

It would be nice to have a layout manager in Corona wouldn’t it?   Well an easier way to support different orientation changes I guess.   I understand the anchor point concept but keep having to go back to re-read the bit on Groups & “anchorChildren” (vs containers & other objects)   :slight_smile:    

I have just looked at the documentation out of interest to ‘see what I need to change’ in my app.

Well my first comment is ‘wow’ heeavvy… plus there is an obvious lack of diagrams of these new concepts and how they fit with the older hierarchy of ‘objects’. 

[Greg have you tried graphicsCompatibility = 1]

It would help to start at the Stage level and provide step by step  diagrams (plus code) of the hiearchy of all these concepts so that frames, levels, Anchor points, groups and children and so on can be visualised more easily by the Corona user/app developer. 

There is far too much reading and re-reading required to understand if there is a bug or a miss-understanding. Further when simple tests fail it does not give users confidence that they understand anything…

But I am pleased to see, at last, that there is some ‘backward compatibility’ at last being considered instead of pure deprecation.

[in Graphics 2.0, reference points have been deprecated. Anchor points must be used in their place unless you decide to use V1 Compatibility Mode]

_ . _

Back when ‘I was a lad’ deprecation was never spoken of [in fact it was a swear word] and everything had backward compatibility because of maintaining customer confidence and reducing  the amount of re-work costs for the users. Nothing was shipped without backward compatibility testing and simple test cases validation ‘sign off’ before a build was released. 

I will try my apps with the {graphicsCompatibility = 1} this week as there are so many critical placements that took me weeks to get right and I dont look forward re-working all that code and thought processes…

I’m trying to exist in the new world for what I’m starting with this app, so I’m resisting the temptation to switch on compatibility mode  :)   

Fine for new apps and the new world… Scouts take all the risks. B)

For readers of the forum I post another compatibly support link for interest…

http://developer.coronalabs.com/code/continue-using-setreferencepoint-set-new-anchor-points-graphics20

Now this is what I call backword compatibility…

Hi guys - do you have any feedback/advice on any gottchas associated with re-laying out UI components in general with Graphics 2.0 and use of groups and containers, and storyboard.  I did not want to delete/create the UI components, but just relay them out.  Is this feasible or is it difficult/frustrating?  :)    

In fact I got stuck early on with something basic and posted here http://forums.coronalabs.com/topic/43058-whats-wrong-with-this-basic-orientation-change-handling-code-to-change-object-widthsposition/

Hi

I am not using Graphics 2.0 yet but I ran your code on my system and after setting up config files and build files it work as I would have expected.

Here are the build and config files I used with your code.

–=====Config file

local aspectRatio =display.pixelHeight/display.pixelWidth

application =

{

    content =

    {

        width = aspectRatio > 1.5 and 320 or math.ceil(480 /aspectRatio),

        height = aspectRatio<1.5 and 480 or math.ceil (320*aspectRatio),

        scale = “letterbox”,

        fps = 30,

        antialias = false

    –    xAlign = “center”,

        --yAlign = “center”

    }

}

–=======

–======build=======================

settings =

{

    orientation =

    {

         default = “portrait”,

       supported = { “portrait”,“landscapeLeft”, “landscapeRight”,“portraitUpsideDown”

         },

    },

    

    iphone =

    {

        plist =

        {

            UIAppFonts = {“Helvetica Neue Condensed Bold”}

        },

    },

}

–========

I also changed the your code to highlight the objects more because I could not see them on the default black background on the Graphics system I am using Corona Version 2013.1202 (2013.8.28)

–=======code change

myRoundedRect2:setFillColor(0,0,255)

myRoundedRect2:setStrokeColor(255,255,0)

–=====

Regards

Alec

Ok Alec. I don’t have access to my Mac at the moment but I’ll check the build file. When I was running I got:

  • startup: all good. In portrait
  • 1st orientation change: ok. Ie to landscape
  • subsequent changes (landscape <=> portrait): width of rectangles increased it appeared such you do not see rounded edges at either ends of the rectangles.

Hi Greg,

My test show everything as I would expect. Just tried again…

Just keeping rotating in either direction as many times as you wish and all aspects of object (both) are show ok. No cutoffs or increase in size.

Alec

oops - updated in wrong post - moved my update to here:

http://forums.coronalabs.com/topic/43058-whats-wrong-with-this-basic-orientation-change-handling-code-to-change-object-widthsposition/?p=224325