We used this logic to add a splash screen to Android. Useful for projects that don't use Director.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | stateCounter=0 enterFrameListener=function(event) stateCounter=stateCounter+1 if(stateCounter==1) then --display our splash screen splashScreenImage=display.newImageRect("Default-Android.png",320,480) splashScreenImage.rotation=-90 splashScreenImage.x=240 splashScreenImage.y=160 elseif (stateCounter > 30) then --start our app if (splashScreenImage ~= nil) then splashScreenImage:removeSelf() splashScreenImage=nil end Runtime:removeEventListener("enterFrame", enterFrameListener) --ALL OLD MAIN.LUA CODE GOES HERE - INCLUDING “REQUIRE” INCLUDES end end Runtime:addEventListener( "enterFrame", enterFrameListener ) |