Author Topic: Is there a good way to handle varying boxart dimensions?  (Read 4559 times)

8bitsdeep

  • Full Member
  • ***
  • Posts: 49
    • View Profile
Is there a good way to handle varying boxart dimensions?
« 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?

verion

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 861
    • View Profile
    • new projects
Re: Is there a good way to handle varying boxart dimensions?
« Reply #1 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.

8bitsdeep

  • Full Member
  • ***
  • Posts: 49
    • View Profile
Re: Is there a good way to handle varying boxart dimensions?
« Reply #2 on: January 29, 2017, 09:05:30 AM »
Works great, thank you!

cosmo

  • Full Member
  • ***
  • Posts: 54
    • View Profile
Re: Is there a good way to handle varying boxart dimensions?
« Reply #3 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...



how can i set the maximum size of the artwork?  ???

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Is there a good way to handle varying boxart dimensions?
« Reply #4 on: April 06, 2017, 07:25:07 AM »
i would like to also know?
« Last Edit: April 06, 2017, 07:28:57 AM by jedione »
help a friend....

cosmo

  • Full Member
  • ***
  • Posts: 54
    • View Profile
Re: Is there a good way to handle varying boxart dimensions?
« Reply #5 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.
« Last Edit: April 06, 2017, 08:51:06 AM by cosmo »

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
    • View Profile
    • Github Repositories
Re: Is there a good way to handle varying boxart dimensions?
« Reply #6 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 );