Author Topic: Directory fallback?  (Read 2821 times)

Joelf

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
Directory fallback?
« on: May 08, 2017, 09:06:23 PM »
I have a box art call

Code: [Select]
    if ( my_config["enable_boxart"] == "yes" )
    {
    local surface_boxart = fe.add_surface( 480, 480 );
    local boxart = FadeArt("flyer", 0,0, 480, 480, surface_boxart);
    boxart.trigger = Transition.EndNavigation;
    boxart.preserve_aspect_ratio = true;
    surface_boxart.set_pos(flx*0.35, fly*0.05, flw*0.40, flh*0.40 );
    surface_boxart.rotation = 12;
    }

How do I create this so it checks /boxart first, and falls back to /flyer if it can't find anything?
« Last Edit: May 08, 2017, 09:25:04 PM by Joelf »

bjose2345

  • Sr. Member
  • ****
  • Posts: 107
    • View Profile
Re: Directory fallback?
« Reply #1 on: May 09, 2017, 01:20:28 AM »
Just put a default image in the root directory of your layout called like the folder where you get your boxart, for example if you put this piece of code>

m_wheels = fe.add_artwork( "wheels", 0, 0, width - 8*PAD, height - 24*PAD); // here you call your boxart

then put in the root of your layout a image called

wheels.png (could be .jpg or another extension really doesnt matter, the only thing that matter is that the name match the name of the directory from here you are calling your artwork)

hope that helps you.

PD. this should be in the scripting section, here is only for themes or layouts

Joelf

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
Re: Directory fallback?
« Reply #2 on: May 09, 2017, 08:11:33 PM »
That's not quite what I mean, but I maybe this will work? Brute force it to find. I was hoping there might have been a better way to check

Code: [Select]
    if ( my_config["enable_boxart"] == "yes" )
    {
    local surface_boxart = fe.add_surface( 480, 480 );
    local boxart = FadeArt("boxart", 0,0, 480, 480, surface_boxart);  // check here first
    local boxart = FadeArt("flyer", 0,0, 480, 480, surface_boxart);  // If nothing, then go here
    boxart.trigger = Transition.EndNavigation;
    boxart.preserve_aspect_ratio = true;
    surface_boxart.set_pos(flx*0.35, fly*0.05, flw*0.40, flh*0.40 );
    surface_boxart.rotation = 12;
    }