PGD Home

P0-A7: Part 757: Debugging, Dynamic Pictures, etc.

by on Jun.21, 2020, under Astral Realms, P-0, P0_A7, Software and Games, Spiritus Astrum

I have created a dynamic picture system to the project. This allows me to choose a specific image, or a random image, from the hard disk, and display it within a picture frame.

The system works with any size picture frame, portrait or landscape, and can be used to display any image (as long as it is approximately square or rectangular) in .png or .jpg format.

This makes it very easy to rapidly decorate walls, etc, with art, since a small number of frames can be used to display a large number of pictures. I can also change the pictures at runtime, providing the basis for a customisable building or decoration system.

I had some issues with loading the images from the disk in the build though. It seems that I can’t use directory names (DirectoryInfo dir = new DirectoryInfo(path);) with resources.load, so I had to move the images to the streaming assets directory, however to get them to load properly from there, I had to duplicate the data, so I now have two copies of that data, one in resources, and one in streaming assets.

This is obviously not ideal, especially since I am using directory names in a few places in my project, meaning that a lot of assets are duplicated, but it seems to solve the problem for now.


Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!