Below is code fragment of my layout that does the 'displaying a picture when lanching game'
It may need some modifying though..
The key is displaying such image at 'case Transition.ToGame' and hide at other cases.
I used alpha properties for fade in/out effects. It might be easier to use 'IsVisible'.
Anyway, the code fragment is as follows:
local screen_now_loading = fe.add_image("Loading.png", (fe.layout.width - 600)/2, (fe.layout.height - 300)/2, 0, 0);
fe.add_transition_callback( "launch_transition" );
function launch_transition( ttype, var, ttime ) {
switch ( ttype )
{
case Transition.StartLayout:
screen_now_loading.alpha = 0;
break;
case Transition.FromGame:
if ( ttime < 255 )
{
foreach (o in fe.obj)
o.alpha = ttime;
screen_now_loading.alpha = 0;
return true;
}
else
{
foreach (o in fe.obj)
o.alpha = 255;
screen_now_loading.alpha = 0;
}
break;
case Transition.EndLayout:
if ( ttime < 255 )
{
foreach (o in fe.obj)
o.alpha = 255 - ttime;
screen_now_loading.alpha = 0;
return true;
}
break;
case Transition.ToGame:
if ( ttime < 255 )
{
foreach (o in fe.obj)
o.alpha = 255 - ttime;
screen_now_loading.alpha = ttime;
return true;
}
screen_now_loading.alpha = 255;
break;
}
return false;
}