OIOIOI!
i like to share a Workaround how to Change the Video snap to normal snap.
my Problem was:
Scrolling through games causes heavy loading of Video snaps one after another, on my Retro machine Computer this was unacceptable.
So i tried to delay Video artwork. the Problem seems to be that the videoartwork property
video.video_flags = 0;
video.video_flags = Vid.ImagesOnly | Vid.NoAudio;
will only update and Show effect after transitions. i couldnt make a timer in an on_tick callback and set the new Videoflags. the effect was random.
i didnt know how to force a Transition without doing a Signal, does anybody know?.
so i made a timer in on_tick callback, waiting (800ms) to the Point the Video should load.
when the timer Ends i set a boolian and give two sgnals:
fe.signal("up"); fe.signal("down");
this fires the Transition calllback. The Transition callback then checks the boolian und sets
video.video_flags = 0;
so the Video starts loading and playing.
the up and down Thing is to stay at the current game.
the nice Thing now is: no Video will load immediatly after a new game is selected. it waits 800 MS and then loads the Video.
much better Performance when Holding a key or pushing a key fast to go through games.
this is not needed if someone can tell me how to trigger a transition without navigating signals...
local TIMEIDLE = 0;
local IDLE = 0;
local TIME = 0;
local video = gamegrid_surface.add_artwork("snap", 0, 0, 240, 220);
video.video_flags = Vid.ImagesOnly | Vid.NoAudio;
fe.add_signal_handler( "on_signal" );
function on_signal( sig )
{
if ( fe.get_input_state("down") || fe.get_input_state("up") ) //if a key is pressed (navigating to another game) reset timer
{
TIMEIDLE = TIME; IDLE = 0;
}
switch ( sig )
{
case "up":
{
.... here is the code i switch my frame to another game......
return true;
}
case "down":
{
.... here is the code i switch my frame to another game......
return true;
}
}
return false;
}
fe.add_ticks_callback( this, "on_tick" );
function on_tick( ttime )
{
TIME = ttime; //keep track of the global time since AM runs, is used in on_signal callback
if (!IDLE && (ttime - TIMEIDLE > 800)) //check if 800ms since any key was not pressed passed, then activate via fe.signal the transitioncallback, so the video will update its state after the 800ms
{
IDLE = 1;
fe.signal( "down" );fe.signal( "up" );
}
}
fe.add_transition_callback("artwork_transition");
function artwork_transition( ttype, var, ttime )
{
if (IDLE) video.video_flags = 0;
else
if (!IDLE) video.video_flags = Vid.ImagesOnly | Vid.NoAudio;
return false;
}