Updated liquid8 plugin for "two pngs"
class UserConfig </ help="This plugin will show a popup image when the specified key is pressed." /> {
</ label="Key", help="The key that will display the image", is_input="yes", order=2 />
key="";
</ label="Key2", help="The key that will display the image", is_input="yes", order=3 />
key2="";
</ label="Hold Key", help="If enabled, you must hold the key down", options="Yes,No", order=4 />
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("Arrow/left.png",50,100,200, 200);
_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();
class PopUpImage2
{
_image2 = null;
_key2 = null;
_hold = false;
_showing = false;
_key2_delay = 250;
_last_check = 0;
constructor()
{
local config = fe.get_config();
_image2 = fe.add_image("Arrow/right.png",450,100,200, 200);
_image2.visible=false;
_image2.preserve_aspect_ratio = true;
_key2 = config["key2"];
_hold = config["hold"];
fe.add_ticks_callback( this, "on_tick" );
}
function on_tick( ttime )
{
local is_down = fe.get_input_state( _key2 );
if ( _hold == "Yes" )
{
_image2.visible = is_down;
_showing = is_down;
} else
{
if ( is_down )
{
if ( ttime - _last_check > _key2_delay )
{
_last_check = ttime;
_image2.visible = !_showing;
_showing = !_showing;
}
}
}
}
}
fe.plugin[ "PopUpImage2" ] <- PopUpImage2();
Change this for what you need:
fe.add_image("Arrow/left.png",50,100,200, 200);
fe.add_image("Arrow/right.png",450,100,200, 200);