black screen on Composer transition

-- hide device status bar display.setStatusBar( display.HiddenStatusBar ) -- require controller module local composer = require( "composer" ) -- load first scene local scrOptions = { effect = "fromRight", time = 2000 } composer.gotoScene( "game", scrOptions ) -- -- Display objects added below will not respond to storyboard transitions local MemUsageDisplay = display.newText( "0", 400, 25, native.systemFont, 20 ) MemUsageDisplay:setFillColor( gray ) local monitorMem = function() local textMem = system.getInfo( "textureMemoryUsed" ) / 1000000 collectgarbage() local date = os.date( "\*t" ) MemUsageDisplay.text = date.hour .. ":" .. date.min .. ":" .. date.sec .. " / Lua: " .. math.round(collectgarbage("count")) .. "K " .. "Tex: " .. math.round(textMem\*10) \* 0.1 .. "MB" end timer.performWithDelay( 500, monitorMem, 0 )

In the simulator everything is fine.

On the device however the splashscreen flashes for less than a second, then the screen goes black for about 5 seconds, and then the game starts.

There is no transition.

I have to add that my game.lua contains a lot of code, but if I understand the docs correctly, all of that should be processed while the splashscreen is visible? I also ran the app while watching it in debugging mode (catlog…) and put some markers in it to see how fast the code executes. The whole game.lua is processed in less than a second.

Is this normal behavior?

In the mean time I’ve added dynamic scaling to my images, reducing texture memory dramatically on low resolution devices. The black screen (in between the default splash screen and the game view) is reduced to like half a second, but the splash screen still fades before that. This should not happen.

Decided to add the basic layout of my game.lua code, maybe, hopefully that will stir up a response.

Also I forgot to mention that this is for Android only, I have tested on multiple devices and the result is the same on all of them.

local physics = require( "physics" ) local composer = require( "composer" ) local scene = composer.newScene() composer.removeHidden() --- lots of forward declarations here local function GoToMenu(event) print( "calling GoToMenu" ) audio.stop ( 3 ) composer.gotoScene( "results", "fromRight", "500" ) end -- "scene:create()" function scene:create( event ) local sceneGroup = self.view -- virtually all display objects are created here and inserted into sceneGroup, all locals were declared before print( "screens loaded" ) end -- "scene:show()" function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is still off screen (but is about to come on screen). elseif ( phase == "did" ) then print( "done." ) -- Called when the scene is now on screen. -- Insert code here to make the scene come alive. -- Example: start timers, begin animation, play audio, etc. ---- the biggest part of the code is here, including a lot of runtime enterFrame listeners end -- "scene:hide()" function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then print( "game.lua about to hide" ) -- Called when the scene is on screen (but is about to go off screen). -- Insert code here to "pause" the scene. -- Example: stop timers, stop animation, stop audio, etc. ----- in here I put composer.setVariables, some removeEventlisteners and timer.cancels elseif ( phase == "did" ) then end end -- "scene:destroy()" function scene:destroy( event ) local sceneGroup = self.view end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene

Nevermind, in the mean time I’ve found the problem.

Hi;

I’m also having this problem.

Just decided to use composer instead of storyboard because of the new GUI today.

What was the problem? Could you let me know so I can try and fix it on mine please.

Cheers!

Hi Appsessed,

my problem was the location of composer.removeHidden(). Once I had moved it to the “will” phase of scene:show it worked fine.

Hi eriklen;

Thank you for the reply. I appreciate it.

However, I’m still having the problem even if I remove the composer.removeHidden().

I will look into it some more.

Cheers.

In the mean time I’ve added dynamic scaling to my images, reducing texture memory dramatically on low resolution devices. The black screen (in between the default splash screen and the game view) is reduced to like half a second, but the splash screen still fades before that. This should not happen.

Decided to add the basic layout of my game.lua code, maybe, hopefully that will stir up a response.

Also I forgot to mention that this is for Android only, I have tested on multiple devices and the result is the same on all of them.

local physics = require( "physics" ) local composer = require( "composer" ) local scene = composer.newScene() composer.removeHidden() --- lots of forward declarations here local function GoToMenu(event) print( "calling GoToMenu" ) audio.stop ( 3 ) composer.gotoScene( "results", "fromRight", "500" ) end -- "scene:create()" function scene:create( event ) local sceneGroup = self.view -- virtually all display objects are created here and inserted into sceneGroup, all locals were declared before print( "screens loaded" ) end -- "scene:show()" function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is still off screen (but is about to come on screen). elseif ( phase == "did" ) then print( "done." ) -- Called when the scene is now on screen. -- Insert code here to make the scene come alive. -- Example: start timers, begin animation, play audio, etc. ---- the biggest part of the code is here, including a lot of runtime enterFrame listeners end -- "scene:hide()" function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then print( "game.lua about to hide" ) -- Called when the scene is on screen (but is about to go off screen). -- Insert code here to "pause" the scene. -- Example: stop timers, stop animation, stop audio, etc. ----- in here I put composer.setVariables, some removeEventlisteners and timer.cancels elseif ( phase == "did" ) then end end -- "scene:destroy()" function scene:destroy( event ) local sceneGroup = self.view end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene

Nevermind, in the mean time I’ve found the problem.

Hi;

I’m also having this problem.

Just decided to use composer instead of storyboard because of the new GUI today.

What was the problem? Could you let me know so I can try and fix it on mine please.

Cheers!

Hi Appsessed,

my problem was the location of composer.removeHidden(). Once I had moved it to the “will” phase of scene:show it worked fine.

Hi eriklen;

Thank you for the reply. I appreciate it.

However, I’m still having the problem even if I remove the composer.removeHidden().

I will look into it some more.

Cheers.