Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: Elaphe666 on October 27, 2024, 11:16:39 AM

Title: Keep the correct aspect ratio of vertical snapshots
Post by: Elaphe666 on October 27, 2024, 11:16:39 AM
I have a layout which shows the snapshot of the selected game. It scales the original artworks (which have different dimensions) to a fixed size of 640x480. So far so good. The problem is with vertical games, as these images get very distorted. My idea is that vertical snapshots are displayed on the same area, keeping the 480 pixels high, but at 360 pixels wide to keep the right proportions. Could you please provide an example of the code? Thank you.
Title: Re: Keep the correct aspect ratio of vertical snapshots
Post by: Elaphe666 on October 28, 2024, 10:01:44 AM
OK. I made if by copying code from other layouts:

local snap = fe.add_artwork( "snap", 1250, 26, 640, 480 );
snap.preserve_aspect_ratio = true;
local title = fe.add_artwork( "marquee", 1250, 570, 640, 480 );
title.preserve_aspect_ratio = true;