Here's a plugin version with a few changes... copy the code into plugins/PopupImage.nut
* I changed it to use get_input_state so you can use more than just a specific signal
* Added option to Hold key (default is toggle)
* Make sure to specify the full path to the image, otherwise it will look in the plugins folder
class UserConfig </ help="This plugin will show a popup image when the specified key is pressed." /> {
</ label="Image", help="The full path to the image that will be displayed", order=1 />
image="";
</ label="Key", help="The key that will display the image", is_input="yes", order=2 />
key="";
</ label="Hold Key", help="If enabled, you must hold the key down", options="Yes,No", order=3 />
hold="No";
};
class PopUpImage
{
_image = null;
_key = null;
_hold = false;
_showing = false;
_key_delay = 250;
_last_check = 0;
constructor()
{
local config = fe.get_config();
_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();
Let me know if you find any issues, then I will add this to my github...
right now its displaying snaps. how can i get it to display the boxart. im not seeing what i would change