@dodi - Load or display?
I think you mean display. Based on that I have made a small example with four composer scenes 1…4. Each scene is almost exactly the same, but calls a function in the module mod.lua to create the content in that scene.
This shows how to set up a nice composer scene file AND how to use a module to create content (including backgrounds) in scenes.
https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/05/dodi.zip
Suggestion: Edit mod.lua and change this line to have the scene to scene transition parameters you want to explore.
Line 53: easyButton.easyPush( button, function() composer.gotoScene( “scene” … i, { time = 500, effect = “crossFade” } ) end )
See if the lag/problem occurs with my code.
-Ed
Also your transition time of 100ms is a mere 1/10th of a second which isn’t a long transition, but that transition shouldn’t start until after the scene is created. So if you’re loading your backgrounds in scene:create() it might delay the transition from starting, but once it starts, it should be smooth.
Rob
Rob and I agree here. If your create() call is doing too much work it will delay the ‘transition’
As soon as I arrive at the studio I will follow @roaminggamer instructions and keep them up to date on how the transitions behave, actually thank you very much for all your time and comments.
@dodi to test if your images are the issue try a simple black or white png a simple 1x1 png loaded and stretched to fill the screen will be fine.
If your scene transition is smooth then the (physical) size of your image is the problem. If not the problem will be in your scene creation code.
I make the test using a solid color image “100x100 png”, transition time 600, no delay occur, so the problem here is the 768 x 1024 bg images load.
I want to tell you that you are a very professional programmer, wao, thanks for the example, I will keep it and study it thoroughly. I still have a lot to learn. I would practically start a new app if I try to adapt my app to your code. Thank you very much, I’m going to immerse myself in it and see how I can understand it.
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:
-
Are you seeing this problem on a device or are you seeing it in the simulator?
-
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.
-
Can you share your scene:create() function for scenes.menu-es?
Rob
-
the problem is in the device (testing device is a Nexus 6, Shamu)
-
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.
-
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.
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