Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - therick3

Pages: [1]
1
Update for PopUp.net:

As you move through game list this allows a person to press a key and have a specific image (using the game name) to appear.  Great to show game instructions and control layout before selecting a game:

class UserConfig </ help="This plugin will show a popup image when the specified key is pressed." /> {
   </ label="Path to instructions, from .attract folder",
   help="Enter full path assuming you start from .attract folder.", order=1 />
   filePath="/scraper/mame/launch/";
//   </ label="Image", help="The full path to the image that will be displayed", order=1 />
//   image="";
   </ label="Select file extension of instruction file",
   help="File extension to use when opening instructions (png or jpg)", options="png,jpg",   order=2 />
   fileExtension="png";
   </ label="Key", help="The key that will display the image", is_input="yes", order=3 />
   key="";
   </ label="Hold Key", help="If enabled, you must hold the key down", options="Yes,No", order=4 />
   hold="No";
};

class PopUpImage
{
   fileExtension = null;
   filePath = null;
        _image = null;
      _key = null;
      _hold = false;
      _showing = false;
      _key_delay = 250;
      _last_check = 0;
      
        constructor()
        {
         local config = fe.get_config();
         filePath = config["filePath"];
         fileExtension = config["fileExtension"];
         print(filePath+"[Name]."+fileExtension+"\n")
         _image = fe.add_image(filePath+"[Name]."+fileExtension, 0, 0, fe.layout.width, fe.layout.height);
//         _image = fe.add_image(config["image"], 0, 0, fe.layout.width, fe.layout.height );
         _image.visible=false;
         _image.preserve_aspect_ratio = true;
         _key = config["key"];
         _hold = config["hold"];
         fe.add_ticks_callback( this, "on_tick" );
        }

      function on_tick( ttime )
      {
         local is_down = fe.get_input_state( _key );
         if ( _hold == "Yes" )
         {
            _image.visible = is_down;
            _showing = is_down;
         } else
         {
            if ( is_down )
            {
               if ( ttime - _last_check > _key_delay )
               {
                  _last_check = ttime;
                  _image.visible = !_showing;
                  _showing = !_showing;
               }
            }
         }
      }
}

fe.plugin[ "PopUpImage" ] <- PopUpImage();

2
Scripting / Re: Scrolling text?
« on: April 14, 2025, 01:20:16 PM »
I did a smooth vertical scroll on one of my layouts borrowing code from this post:

http://forum.attractmode.org/index.php?topic=300.0

My give you something to leap off from.

I grabbed something from a layout called Smooth.  here is my code:

// **Add in game description text box taken from Smooth Theme
// setup Overview text
// make the new surface

local surface = fe.add_surface(screenWidth*0.44, screenHeight*0.35  );
surface.x = screenWidth*0.52;
surface.y = screenHeight*0.58;

// put overview text on the new surface
local text = surface.add_text( "Year: [Year]\nPlayed Count: [PlayedCount]\nManufacturer: [Manufacturer]\n\n[Overview]", 0, 0, screenWidth*0.44, screenHeight );
text.word_wrap = true;
text.align = Align.TopLeft;
text.set_rgb (255, 255, 255);
text.charsize = 12;

//text.set_bg_rgb( 100, 100, 100 );
// uncoment the ubove line to visibley see the transparent text layer !
// so can u position and size in layout easier!

// calling "local text" in the animation     
local an = { when=Transition.ToNewSelection,
//local an = { when=Transition.StartLayout,
property="y",
start=text.y+200 ,
end=text.y-340,
time=20000
loop = true,
}
animation.add( PropertyAnimation( text, an ) );

3
Themes / New Attract-Man-Vertical layout
« on: November 03, 2022, 06:59:22 AM »
Tweaked the attract man theme to fit on vertical monitors.  With extra room I added a panel for game descriptions (code borrowed from the smooth layout).  Game descriptions need to be in scraper folder under the correct emulator to work.  Just extract to layouts folder.

Pages: [1]