mickelson / attract

A graphical front-end for command line emulators that hides the underlying operating system and is intended to be controlled with a joystick or gamepad.
http://attractmode.org
GNU General Public License v3.0
393 stars 115 forks source link

preserve_aspect_ratio not working with add_image #683

Open NascentTech opened 3 years ago

NascentTech commented 3 years ago

When using add_image the preserve_aspect_ratio flag is not applying correctly unless used in a very specific manner.

When using the following the aspect is not preserved and the image is stretched to the specified dimensions.

   local test = fe.add_image( "test.png", x, y, w, h );
   test.preserve_aspect_ratio = true;

However, if the file is specified after the flag is set, then the aspect is correctly preserved.

   local test = fe.add_image( "test.png", x, y, w, h );
   test.preserve_aspect_ratio = true;
   test.file_name = "test.png";

To further complicate things, I found that using a magic token causes it to work correctly again. The following will work as expected.

   local test = fe.add_image( "[DisplayName]", x, y, w, h );
   test.preserve_aspect_ratio = true;

I have not found any such issues with add_artwork or FadeArt. This only appears to affect add_image. Tested with 2.6.1 and nightly builds