Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Where is the proper point to get the safe area of the device? — Gideros Forum

Where is the proper point to get the safe area of the device?

It won't get the real value if the getDeviceSafeArea method is called in the main.lua.
Of course, it can be get by calling Timer.delayedCall for several milliseconds.
Where is the correct point to get these values?

Comments

  • Hmm, how about that?

    In main.lua:
    local function LoadApp()
    	-- setup variables, create scenes, load resources, etc.
    	-- use getDeviceSafeArea 
    end
     
    Core.asyncCall(LoadApp)
  • There is also this tutorial by hgy29: https://wiki.giderosmobile.com/index.php/2D_Space_Shooter_Part_2:_Background
    He uses
    -- Compute screen bounds
    SCR_LEFT,SCR_TOP,SCR_RIGHT,SCR_BOTTOM=application:getLogicalBounds()
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • antixantix Member
    edited March 2020
    I am using something similar to @hgy29 where I make some global variables... and I do it in init.lua as I feel that is the best place for that kind of thing to live.
  • XmanXman Member
    Thanks for all of the reply.
    but not the getLogicalBounds.
  • hgy29hgy29 Maintainer
    Accepted Answer
    Yes, I think I had similar issues due to orientation changes when app is launched. I think calling it from APPLICATION_RESIZE event was the workaround.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.