Author Topic: New layout incoming but hitting 2 issues with filters and displays.  (Read 142 times)

markc74

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Hi guys,

I did a layout a while ago called Invaders that I was using for my vertical cabinet. I uploaded it to the Themes board

I'm most of the way through a horizontal version but I'm hitting 2 bugs that I can't seem to fix and I'd be very grateful if anyone could help shed some light on what I might be missing!

I've attached a video showing what *is* happening but I'll explain first what *should* be happening!

The title on the top left bar is showing the current selected filter. I have a button on my panel which goes to the next filter when pressed.

Bug 1: When I reach the end of the filter list, I can't get the title to return to the first filter (ALL). Instead it stays on the last filter on the list (Sony Playstation). If I press the next filter button again, you can see ALL scroll off the list and it carries on as normal. I've attempted to check to see if the next filter name is null but i cant seem to get it to work... (14 seconds/27 seconds of video)

On the top right of the frontend it shows the display. As there are only 4 I can show them all with a scrolling 'tab' when you click the 'next display' button. This works great, and does go to the next display, BUT:

Bug 2: It doesn't reload the filters at the top left, meaning that they dont make sense for the display. i.e. systems should show "MAME", "Playstation" etc but if I switch to year, the filter list should show "1978", 1979" etc. (32 seconds of video)

https://youtu.be/hZihdxN8sqo

As soon as these bugs are fixed I'll upload it properly to the themes area. Any help most gratefully received!!

Many thanks,
Mark

Code: [Select]
//
// Attract-Mode Front-End - "Blip 2018 by MarkC74"
//

fe.layout.width=800;
fe.layout.height=480;

fe.load_module("animate2");
fe.layout.font = "captain";


// BACKGROUND
// ----------

local menu_bar = fe.add_image("background_menu.png",0,0,640,64);

// FILTERS MENU
// ------------

local filter_current = fe.add_text("",14,12,320,40);
filter_current.charsize = 32;
filter_current.align = Align.Left;
local filter_next = fe.add_text("",14,54,320,40);
filter_next.charsize = 32;
filter_next.align = Align.Left;


// VIDEO
// -----

local vid_area = fe.add_surface(640,368);
vid_area.y = 64
local no_vid = vid_area.add_image("black.png",0,0,640,480);
local vid = vid_area.add_artwork("video",0,0,640,480);

local shade = fe.add_image( "shade.png", 8, 64, 640, 368 );
shade.alpha = 200;

// GAMES LIST
// ----------

local lb = fe.add_listbox( 20, 80, 400, 336 );
lb.charsize = 18;
lb.set_sel_rgb( 255, 255, 255 );
lb.alpha = 50;
lb.selbg_alpha = 0;
lb.sel_alpha = 255;
lb.rows = 13;
lb.align = Align.Left;


// HISTORY TAB
// -----------

local history = fe.add_surface(640,368);
history.x = 640;
history.y = 64;
local history_background = history.add_image( "black.png", 0, 0, 640, 368 );
history_background.alpha= 150;
local history_text = history.add_text("[!get_hisinfo]", 32, 8, 600, 304);
history_text.charsize = 16;
history_text.align = Align.Left;
history_text.word_wrap = true;


// ARTWORK TAB
// -----------

local flyer_cab = fe.add_surface(640, 368);
flyer_cab.x = 640;
flyer_cab.y = 64;
local flyer_cab_background = flyer_cab.add_image( "artwork_background.png", 0, 0, 640, 368 );
local flyer_cab_flyer = flyer_cab.add_artwork ("flyer", 8, 0, 287, 368);
local flyer_cab_cab = flyer_cab.add_artwork ("cabinet", 297, 0, 333, 368);
flyer_cab_cab.preserve_aspect_ratio = true;





// FRAME
// -----

local frame = fe.add_image("frame.png",0,0,640,480);
local button_go = fe.add_image("button_go.png",552,404,68,57);
local right_side_mask = fe.add_image( "black.png", 640, 0, 880, 840 );





// TOP MENU
// --------

local top_menu_tab = fe.add_image("top_menu_tab.png",304,16,80,40);
local top_menu_system = fe.add_text("SYSTEM",304,24,80,20);
local top_menu_genre = fe.add_text("GENRE",384,24,80,20);
local top_menu_years = fe.add_text("YEAR",464,24,80,20);
local top_menu_controls = fe.add_text("CONTROLS",544,24,80,20);


// BOTTOM MENU
// -----------

local bottom_menu_text = fe.add_text("Game [ListEntry] of [ListSize]",20,440,320,20);
bottom_menu_text.charsize=16;
bottom_menu_text.align = Align.Left;

local label_game_details = fe.add_text("[Year] [Manufacturer]",304, 440, 240,20);
label_game_details.charsize=16;

local bottom_menu_tab = fe.add_image("bottom_menu_tab.png",276,371,128,64);
local bottom_menu_video = fe.add_text("GAMEPLAY",304,408,80,20);
local bottom_menu_info = fe.add_text("HISTORY",384,408,80,20);
local bottom_menu_cabinet = fe.add_text("ARTWORK",464,408,80,20);


// SCRIPTS
// -------

// VARIABLES
// ---------

local info_view = 0;
local slide_time = "500ms";
local animation_style = "ease-in-out-circle";


// ONLOAD
// ------

function start_up( ttype, var, transition_time )
{
if (ttype==Transition.StartLayout) {
if (var==FromTo.Frontend)
{
PropertyAnimation(button_go).key("alpha").from(0).to(220).duration("1s").yoyo(1).loops(-1).play();
filter_current.msg = fe.filters[fe.list.filter_index].name;
if (fe.list.name=="System") {top_menu_tab.x=304;}
if (fe.list.name=="Genre") {top_menu_tab.x=384;}
if (fe.list.name=="Year") {top_menu_tab.x=464;}
if (fe.list.name=="Controls") {top_menu_tab.x=544;}
}
}
if (ttype==Transition.ToNewList) {
//fe.set_display(fe.list.display_index);
};
   return false;
};
fe.add_transition_callback( "start_up" );


// ON TRANSITIONS
// --------------

function on_transition( signal_str )
{
if (signal_str=="next_filter")
{
filter_current.msg = fe.filters[fe.list.filter_index].name;
filter_next.msg = fe.filters[fe.list.filter_index+1].name;
//if (fe.filters[fe.list.filter_index+1].name.isnull()) {
// filter_next.msg = "xxxx"
//};
PropertyAnimation(filter_current).key("y").from(12).to(-28).duration(slide_time).easing(animation_style).play();
PropertyAnimation(filter_next).key("y").from(52).to(12).duration(slide_time).easing(animation_style).play();




};
if (signal_str=="next_display")
{
if (fe.list.name=="System") {
PropertyAnimation(top_menu_tab).key("x").to(384).duration(slide_time).easing(animation_style).play();
} else if (fe.list.name=="Genre") {
PropertyAnimation(top_menu_tab).key("x").to(464).duration(slide_time).easing(animation_style).play();
} else if (fe.list.name=="Year") {
PropertyAnimation(top_menu_tab).key("x").to(544).duration(slide_time).easing(animation_style).play();
} else {
PropertyAnimation(top_menu_tab).key("x").to(304).duration(slide_time).easing(animation_style).play();
};
};
if ((signal_str=="up"||signal_str=="down"||signal_str=="next_display")&&(info_view!=0))
{
info_view = 2;
fe.signal( "custom1" );
}
if ((signal_str=="custom1"))
{
if (info_view==0) {

PropertyAnimation(lb).key("x").from(20).to(-250).duration(slide_time).easing(animation_style).play();
PropertyAnimation(history).key("x").from(640).to(0).duration(slide_time).easing(animation_style).play();
PropertyAnimation(bottom_menu_tab).key("x").to(356).duration(slide_time).easing(animation_style).play();
info_view = 1;
};
else if (info_view==1) {
PropertyAnimation(flyer_cab).key("x").from(640).to(0).duration(slide_time).easing(animation_style).play();
PropertyAnimation(bottom_menu_tab).key("x").to(436).duration(slide_time).easing(animation_style).play();
info_view = 2;
};
else {
PropertyAnimation(lb).key("x").from(-250).to(20).duration(slide_time).easing(animation_style).play();
PropertyAnimation(history).key("x").from(0).to(640).duration(slide_time).easing(animation_style).play();
PropertyAnimation(flyer_cab).key("x").from(0).to(640).duration(slide_time).easing(animation_style).play();
PropertyAnimation(bottom_menu_tab).key("x").to(276).duration(slide_time).easing(animation_style).play();
info_view = 0;
};
};
return false;
};
fe.add_signal_handler( "on_transition" );





// SHOW HISTORY TEXT

class UserConfig {
</ label="History.dat", help="History.dat location. Be sure to enable and config History.dat from the plugins menu.", order=1 />
dat_path="C:\\games\\mame\\history.dat";
};

local my_config = fe.get_config();

function get_hisinfo()
{
local sys = split( fe.game_info( Info.System ), ";" );
local rom = fe.game_info( Info.Name );
local text = "";
local currom = "";

local alt = fe.game_info( Info.AltRomname );
local cloneof = fe.game_info( Info.CloneOf );
local lookup = get_history_offset( sys, rom, alt, cloneof );

if ( lookup >= 0 )
{
text = get_history_entry( lookup, my_config );
local index = text.find("- TECHNICAL -");
if (index >= 0)
{
local tempa = text.slice(0, index);
text = strip(tempa);
}
} else {
if ( lookup == -2 )
text = "Index file not found.  Try generating an index from the history.dat plug-in configuration menu.";
else
text = "No Information available for:  " + rom;

return text;
};



// DEBUG
// -----