How to add a splash screen in Lua.

3 replies [Last post]
rajumahato
User offline. Last seen 4 weeks 2 days ago. Offline
Joined: 4 Jun 2012

Hi All,

How can I add a fullscreen splash screen in my app. Currently I am doing this with the following code. But I am not sure about the way I do.
-------------------------------------------------------------------------------------------------
splashscreen = display.newImage( "images/default.png" );

local function removeSplash(event)
splashscreen:removeSelf()
splashscreen = nil
end
timer.performWithDelay(2000,removeSplash)
-------------------------------------------------------------------------------------------------

Using this code image is not cvering the whole screen. I appears only a portion of the screen only.

Is there any other way to display splash screen.
Please suggest...

Replies

10F_Jonathan
User offline. Last seen 19 weeks 17 hours ago. Offline
Joined: 12 Mar 2012

i would reccomend to take a look at the storyboard API and the Overlay function :)

http://developer.coronalabs.com/content/storyboard

ingemar
User offline. Last seen 2 hours 58 min ago. Offline
Joined: 20 Jun 2011

You can see this post for splash screens:
http://developer.coronalabs.com/forum/2013/01/05/splash-screen-transition

For dealing with images that fill the whole screen you can have a look at this:
http://j.mp/GIZX4p

develephant
User offline. Last seen 6 days 10 hours ago. Offline
Joined: 6 Dec 2012

You can put the following images in the root folder.

Default.png
Default-Landscape.png
Default-LandscapeLeft.png
Default-LandscapeRight.png

Or...

Set you config.lua to "zoomStretch" and try

1
2
3
4
5
6
7
8
9
10
splashscreen = display.newImage( "images/default.png", 0, 0, true );
splashscreen.x = display.contentCenterX
splashscreen.y = display.contentCenterY
 
local function removeSplash(event)
    splashscreen:removeSelf()
    splashscreen = nil
end
 
timer.performWithDelay(2000,removeSplash)

This post (content-scaling-made-easy) is really helpful, search for The “magic recipe”. If you use this, you can set your config to "letterbox"

Hope some of this can help.

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.