Screen Issues

But should the image not scale up in the ratio that is specified for the content width and content height in the config.lua?

There’s probably something else wrong somewhere in their configuration but from my experience letterbox scaling will still scale things but will maintain the aspect ratio.

@bobskeldon can you put together a simple solar2d project with just a main script, config.lua and then put your code in their for rendering these images and then drop that project here in a zip? I’d be happy to go over to see if I can find what’s going on.

Edit- I was also wondering if you’ve tried this on an actual device and not just the xCode simulator? The solar2d simulator does allow you to make a custom borderless device where you should be able to specify the resolution of an iphone 14 plus to test. If it display correctly there then in all likelihood it’d work fine on real devices. I don’t think I’ve ever tested using xcode so maybe that’s where the problem lies

Hi XeduR,

I very much appreciate your help, I will try anything you suggest as I am floundering a bit. Let me have a go along with very helpful suggestions from famousdogg. This forum is fantastic. Kind Regards Bob

Hi Famous,

I will try anything you suggest as I am floundering a bit. I will put a small project with my images and code, thank you! I will try whatever you and XeduR suggest. This forum is fantastic. Kind Regards Bob

Hi Famous,

I have stripped the game down by removing the 50 random image screens. Everything else is working but it only selects one image instead of randomly selecting from 50. The game might not make any sense to you but I am a social worker putting a game together for teenagers. Let me know if there is anything missing! Thanks again for your time and help. Bob
SIMPLE FOR FAMOUS.zip (2.6 MB)

Hi Bob,

I’ve tried running your project and while I could make some other recommendations on what you might change in terms of best practices, I do not see anything in the code that would cause the problem you’ve experienced with the iphone 14+ simulator.

As per google, the screen resolution of this device is 1284 x 2778 so I tried running your project in a custom simulator window and I did not see the same issue with rendering of the background. I’ve also attached an image showing the output of your menu screen.

In your config.lua, you have gone with a 1:2 ratio for contentWidth:contentHeight which I’m not sure is the best choice-- I personally always stick to a 9:16 ratio such as 750x1334 (which is also the screen resolution for iphone6). If you design your UI and assets for a standard aspect ratio, you’ll be able to get a more consistent output on the vast majority of devices and you can also easily accommodate more modern/taller devices by simply using larger backgrounds for your screens.

For instance, all backgrounds in my projects tend to be 750x1624 (iphone X) even though my contentWidth:contentHeight is always set to 750x1334. This allows me to design all gameplay for a standard 9:16 resolution while also ensuring that users on taller devices don’t see black bars on the top and bottom because I use taller backgrounds.

I am also unfamiliar with the Director module that you are using for moving between menus/screens. The documentation of his module advises using “zoomStretch” scaling but I don’t think that should affect how you are rendering your background because that’s just a simple image being loaded and put into a display group. Perhaps you can use Solar2D’s own scene management system which is more robust-- Solar2D Documentation — Developer Guides | UI/Scenes

Ultimately, I think the only sure shot way to find out if your code is rendering the menus correctly will be to try and get hold of an iphone14+ or another similar iphone and get a development build onto that device. Within the Solar2D environment, however, I was not able to reproduce the issue.

Hope this helps.

Hi Famous,

Thanks for your time and for providing your thoughts and suggestions, I will take on board everything you say, try a few things and I will let you know how I get on. Kind Regards Bob

It is simply impossible to get a single graphic to cover all devices without looking terrible.

What you can do is split your image into multiple images and position them according to the device dimensions.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.