Author Topic: How to display a picture when au launch a game ?  (Read 6570 times)

ShinobiZ

  • Newbie
  • *
  • Posts: 7
    • View Profile
How to display a picture when au launch a game ?
« on: November 17, 2016, 05:17:50 AM »
Hello,

Anyone can provide me a sample code to display an image or a message like "Loading, please wait..."  on the screen when you launch a game from "Grid" layout ?

Some time when you press the launch key, the emulator takes several seconds before popup on the screen,  this is why a waiting message would be nice instead a frozen layout :)

Another question but off topic, somebody kown if there is a script for MAME to exit that emulator if no input occured after X seconds ?

Thanks in advance,

paha_13

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: How to display a picture when au launch a game ?
« Reply #1 on: November 17, 2016, 05:47:06 AM »
Anyone can provide me a sample code to display an image or a message like "Loading, please wait..."  on the screen when you launch a game from "Grid" layout ?

Some time when you press the launch key, the emulator takes several seconds before popup on the screen,  this is why a waiting message would be nice instead a frozen layout :)

Rocket Launcher?
http://forum.attractmode.org/index.php?topic=858.0

checkist

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: How to display a picture when au launch a game ?
« Reply #2 on: November 17, 2016, 11:51:41 PM »
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;
}





jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: How to display a picture when au launch a game ?
« Reply #3 on: November 18, 2016, 07:41:44 AM »
thanks this is great thank you for sharing this code.    you are very generous !

help a friend....

ShinobiZ

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: How to display a picture when au launch a game ?
« Reply #4 on: November 19, 2016, 04:20:36 AM »
thanks a lot !

Thierry

web

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: How to display a picture when au launch a game ?
« Reply #5 on: December 12, 2016, 11:00:28 AM »
thanks this is great thank you for sharing this code.    you are very generous !

Is there a way to add animed gifs ? Sequence of figures ?

bionictoothpick

  • Sr. Member
  • ****
  • Posts: 320
  • He who laughs lasts.
    • View Profile
Re: How to display a picture when au launch a game ?
« Reply #6 on: January 06, 2017, 11:55:55 AM »
I want to display an image on the desktop and have the window of the emulator positioned over top of the image, and then when the emulator is closed I want the image to close too....

This is implemented with retroarch, but I want for use with winuae loader.

Ideas?