Using @2x bg image can resolve the composer transition problem?

@all

the easy way is to create a “timer” so I can give it time for the “background” to load. But…I can’t make the timer work.

local btnDelay local options1 = { effect = "fromBottom", time = 100 } local function esButtonTouch( event ) --the buttons are set in a scrollView if ( event.phase == "moved" ) then dy = math.abs( event.y - event.yStart ) if ( dy \> 5 ) then ScrollView:takeFocus( event ) end elseif ( event.phase == "ended" ) then audio.play( go ) composer.gotoScene( "scenes.menu-es", options1 ) end return true end btnDelay = timer.performWithDelay( 1000, esButtonTouch )

@dodi,

Can you zip up some of these images you’re having trouble with and PM me or attach them here.

Loading a single texture in the background should not be causing you any issues.  

If I can demonstrate that, then you can re-focus and look for the real cause.  I still suspect you’er doing too much work in the create() call.

You still have not provided a good description of what the problems is. So let me re-ask some of my previous questions:

  1. Are you seeing this problem on a device or are you seeing it in the simulator?

  2. Can you provide a video showing the problem? If not, can you describe the problem better. So far you just said you’re seeing a weird scene transition problem and that’s not helpful to solving the problem.

  3. Can you share your scene:create() function for scenes.menu-es?

Rob

@Rob

  1. the problem is in the device (testing device is a Nexus 6, Shamu)

  2. I am trying to record a video, but as the problem is in the device, when trying to record the screen with an app I get errors in the fps and it does not project clear what I want to show.

  3. I have been looking for a way to copy 1000+ lines in the reply editor “<code>” without having to practically fix the whole code so that it can be understood, I use a lot of spaces and it does not remain in order in the preview.

You can use ADB to screen record.

https://developer.android.com/studio/command-line/adb#screenrecord

Its real handy

Please oh please do not post 1000 lines of code. :slight_smile:

You might need a hit… just thinking out loud.

https://forums.coronalabs.com/topic/69420-hire-a-hitman-problem-solver-is-back/

I think 1000+ line of code in create gives a strong hint as to what the problem might be?  Adding to that loading much larger images and I feel we have the answer as to what is causing the slowdown.

Yea, 1000+ lines of code won’t be productive here in the forums. You could zip up the file and post a link to the .zip file on Google Drive or DropBox (a sharable URL please).

Rob

Does it work correctly with a 1x background image instead of a 2x background image? 

@sporkfin

No, it does not work well, I’m using a 768x1024 content area, zoomEven, and I thought, since the background is a blurry image, scaling up or down would not affect the App’s aesthetics at all. I only use super-light images of 768x1024px with a maximum weight of 45kb.

It feels as if when changing the scene the transition is not well appreciated because it has to load a 768x1024 image and scale it. Maybe if I have a @2x file reduce the load impact of the scene. Rather I want to understand how Corona SDK handles those loads of images.

Can you share some images or, better yet, a video of the problem?

Also please share the code you are using for the transition.

Also can you post your config.lua file?  

Rob

If a composer.* scene is delayed when you try to show it, that may mean it is too busy in the create() call to show in the frame you ask it to.  You may also be bogging down the system by destroying content at the same time.

You could pre-load the background image while your splash screen shows:

https://docs.coronalabs.com/guide/graphics/textureManagement.html

I appreciate all the help. Before uploading anything, I would like to try it once more. The problem is that I can not understand how external modules work. I read this guide: https://docs.coronalabs.com/tutorial/basics/externalModules/index.html more than 20 times and I can not see it. I even managed to pass an image to another module, but when I try to use it in another module, in addition to the one I was using before, it disappears from the initial module where it is used. It’s a problem of scope, I know, could someone help me in how the images are transmitted from one module to another, especially the background images? It is not as simple as importing a batch in Photoshop. I’m sorry, I think as a graphic artist, not as a programmer.

gotoScene code

local options1 = { effect = "fromBottom", time = 100 } local function esButtonTouch( event ) --the buttons are set in a scrollView if ( event.phase == "moved" ) then dy = math.abs( event.y - event.yStart ) if ( dy \> 5 ) then ScrollView:takeFocus( event ) end elseif ( event.phase == "ended" ) then audio.play( go ) composer.gotoScene( "scenes.menu-es", options1 ) end return true end

config.lua

-- -- For more information on config.lua see the Project Configuration Guide at: -- https://docs.coronalabs.com/guide/basics/configSettings -- application = { content = { width = 768, height = 1024, scale = "zoomEven", fps = 60, imageSuffix = { ["@2x"] = 2, --["@4x"] = 4, }, }, }

I’m thinking of load the 5 backgrounds in the main.lua and making them visible in the scene “show” and invisible in the scene “hide” of each of the scenes.   :D  :lol:  :lol:  :D 

@dodi - That approach could really bog down your frame rate and inflate your video memory usage.  i.e. It could have serious repercussions on the performance of your game, especially on low-end devices.

@roaminggamer

In this case is not a game is an utility app. This answer refers to load backgrounds in an external module or to load them in the “main.lua”?

@all

can someone tell me where can I learn how to load textures in an external module to use them as display objects on other app scene?

Thanks in advance

First, your @2x images will only load on devices that are 1536px wide. This includes most retina iPads and perhaps some Android tablets. All current phones (that I’m aware of) are 1440px or less, so they are going to use your 1x images.

These tablets should be sufficiently powerful enough to load a 1536x2048 image quickly.  

What issues are you having? I’ve read this thread several times and I’m not exactly sure what issue you’re trying to solve. Corona and almost every reasonably modern device should be powerful enough to load the right 1x or @2x image in during scene:create() for a background without causing any hiccups.

Rob