Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: 8bitsdeep on January 29, 2017, 02:16:43 AM

Title: Is there a good way to handle varying boxart dimensions?
Post by: 8bitsdeep on January 29, 2017, 02:16:43 AM
I'm making my first layout and I'm almost done, just one major hurdle remains.  I'd like the layout to display the boxart centered in the empty area on the right. (see image).  Problem is, depending on the console, the box will have wildly different dimensions.  NES vs SNES for example is tall rectangles vs wide ones.

I'd rather avoid stretching artwork into a pre-defined box, for obvious reasons. Has anyone come up with a good way to handle this sort of thing?
Title: Re: Is there a good way to handle varying boxart dimensions?
Post by: verion on January 29, 2017, 06:18:10 AM
set the artwork aspect as TRUE
and define maximum horizontal and vertical size of your artwork - it's like setting the boundaries for your artwork, it can't be higher than defined vertical size, and it can't be wider than defined horizontal size.

It will work like "scale to fit" option for printing - it will show your artwork (without stretching) in maximum size that fits within defined boundaries.
Title: Re: Is there a good way to handle varying boxart dimensions?
Post by: 8bitsdeep on January 29, 2017, 09:05:30 AM
Works great, thank you!
Title: Re: Is there a good way to handle varying boxart dimensions?
Post by: cosmo on April 06, 2017, 05:52:31 AM
Having the same problem...

Could you elaborate how to do it, please? I'm  using  this...
Code: [Select]
if ( my_config["enable_gboxart"] == "Yes" )
{
local boxart = fe.add_artwork("boxart", flx*0.0, fly*0.45 flw*0.3, flh*0.3 );
if ( my_config["ratio"] == "Yes" )
{
boxart.preserve_aspect_ratio = true;
}
}
but as you can see it streches the box...

(http://i.imgur.com/pzyCJRp.jpg)

how can i set the maximum size of the artwork?  ???
Title: Re: Is there a good way to handle varying boxart dimensions?
Post by: jedione on April 06, 2017, 07:25:07 AM
i would like to also know?
Title: Re: Is there a good way to handle varying boxart dimensions?
Post by: cosmo on April 06, 2017, 08:48:59 AM
Ok, i think i get it... You need this

local my_config = fe.get_config();
local flx = fe.layout.width;
local fly = fe.layout.height;
local flw = fe.layout.width;
local flh = fe.layout.height;

then this for the boxart

if ( my_config["enable_gboxart"] == "Yes" )
{
   local boxart = fe.add_artwork("boxart", flx*0.0, fly*0.45 flw*0.3, flh*0.3 );
        boxart.preserve_aspect_ratio = true;
}
   

I had width and height set as 640x480 and it was doing some funny effects... With some 3d artworks it's still not perfect, but it seems to work with a lot of them.
Title: Re: Is there a good way to handle varying boxart dimensions?
Post by: mahuti on April 12, 2017, 11:24:37 AM
shouldn't it be:

Code: [Select]
fe.add_artwork("boxart", flx*0.0, fly*0.45, flw*0.3, flh*0.3 );
Looks like you're missing a common between the Y and W dimensions.

fe.add_artwork( "boxart",x, y, w, h );