Circles have elliptical shape on device

Hello,

when I open my app in the Corona and iOS simulator circles are perfectly round. However as soon as I open the app on my iPhone 6 they are elliptical.

Here’s my config.lua:

local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 800 or math.ceil( 1200 / aspectRatio ), height = aspectRatio \< 1.5 and 1200 or math.ceil( 800 \* aspectRatio ), scale = "zoomEven", fps = 60, imageSuffix = { ["@2x"] = 1.3, }, }, }

I’m using images to create the circles:

dots[i] = display.newImageRect(nearBackground, "Dot.png", DOT\_DIAMETER, DOT\_DIAMETER )

Any idea why this is the case?

First you probably should not be using “zoomEven” with a computed width/height.  zoomEven’s job is to scale up the content area so that you don’t have letterbox bars.  The purpose of computing the width/height is to avoid having letterbox bars. You don’t need to do both.  And depending on what you’re making the calculated width/height may cause your more work than it saves.

However the likely cause is you don’t have everything setup so that the device isn’t going into iPhone 5 compatibility mode. You have to have the right combination of launch images to guarantee that Apple gives you the right actual screen size. See:

https://docs.coronalabs.com/guide/distribution/launchFile/index.html

Rob

Hello Rob, thanks for your reply. In my previous config file I tried the same with “Letterbox” but that didn’t work neither. I did configure the Launchimages files as described. Is there a newer version of the “perfect” config.lua?

First, there really isn’t such of a thing as a perfect config.lua.  The idea behind the “Ultimate config.lua” and it’s brother “Modernizing the ultimate config.lua” (which you are using) was to get the top, left to be 0, 0 and the bottom, right to be display.contentHeight, display.contentWidth.

In full disclosure, at the time, this was a cover for my dislike for adding display.screenOriginX (and/or Y) to my objects I wanted to position around the top and left edges. It protected me from having to write the extra code to write display.actualContentWidth instead of display.contentWidth. As I’ve learned since this, this type of config.lua can be really bad depending on the type of app/game you’re making.

If you’re building a card game like Solitaire, where your card stacks should move depending on the device width. In this case using the calculated width/height config.lua can help you. But if you’re building Angry Birds (or the side-scrolling space shooter I’m working on in my spare time) where the distance from the player to the enemy needs to be a fixed distance or how the game is played changes, then it’s important to **NOT** use this type of config.lua.  For business type apps it’s better to move the content area to where it’s anchored at the top, left and just let content flow down the page. 

There are more situations where the “ultimate config.lua” causes more work than it helps.  As such, we think it’s more important that you understand your config.lua, take the extra steps to add display.screenOriginX, Y to your top/left edge positioned objects than look for shortcuts.

Again, your config.lua isn’t likely the cause of your warping. I was just pointing out that zoomEven sort of does what a calculated config.lua attempts to do.

Instead, how about posting your build.settings so that we verify you’re storyboard based launch screens is correct.

Rob

Thank you again for your help Rob!

Here’s my build.settings file.

settings = {orientation = { default = "portrait", supported = { "portrait", "portraitUpsideDown"}, }, iphone = { xcassets = "Images.xcassets", plist = { UIAppFonts = { "FiraSans-Light.otf", "FiraSans-Hair.otf", "FiraSans-UltraLight.otf", }, UIApplicationExitsOnSuspend = false, UIPrerenderedIcon = true, UIStatusBarHidden = true, UILaunchStoryboardName = "LaunchScreen" } }}

Do you have a LaunchScreen.storyboardc file in your folder with your main.lua?

First you probably should not be using “zoomEven” with a computed width/height.  zoomEven’s job is to scale up the content area so that you don’t have letterbox bars.  The purpose of computing the width/height is to avoid having letterbox bars. You don’t need to do both.  And depending on what you’re making the calculated width/height may cause your more work than it saves.

However the likely cause is you don’t have everything setup so that the device isn’t going into iPhone 5 compatibility mode. You have to have the right combination of launch images to guarantee that Apple gives you the right actual screen size. See:

https://docs.coronalabs.com/guide/distribution/launchFile/index.html

Rob

Hello Rob, thanks for your reply. In my previous config file I tried the same with “Letterbox” but that didn’t work neither. I did configure the Launchimages files as described. Is there a newer version of the “perfect” config.lua?

First, there really isn’t such of a thing as a perfect config.lua.  The idea behind the “Ultimate config.lua” and it’s brother “Modernizing the ultimate config.lua” (which you are using) was to get the top, left to be 0, 0 and the bottom, right to be display.contentHeight, display.contentWidth.

In full disclosure, at the time, this was a cover for my dislike for adding display.screenOriginX (and/or Y) to my objects I wanted to position around the top and left edges. It protected me from having to write the extra code to write display.actualContentWidth instead of display.contentWidth. As I’ve learned since this, this type of config.lua can be really bad depending on the type of app/game you’re making.

If you’re building a card game like Solitaire, where your card stacks should move depending on the device width. In this case using the calculated width/height config.lua can help you. But if you’re building Angry Birds (or the side-scrolling space shooter I’m working on in my spare time) where the distance from the player to the enemy needs to be a fixed distance or how the game is played changes, then it’s important to **NOT** use this type of config.lua.  For business type apps it’s better to move the content area to where it’s anchored at the top, left and just let content flow down the page. 

There are more situations where the “ultimate config.lua” causes more work than it helps.  As such, we think it’s more important that you understand your config.lua, take the extra steps to add display.screenOriginX, Y to your top/left edge positioned objects than look for shortcuts.

Again, your config.lua isn’t likely the cause of your warping. I was just pointing out that zoomEven sort of does what a calculated config.lua attempts to do.

Instead, how about posting your build.settings so that we verify you’re storyboard based launch screens is correct.

Rob

Thank you again for your help Rob!

Here’s my build.settings file.

settings = {orientation = { default = "portrait", supported = { "portrait", "portraitUpsideDown"}, }, iphone = { xcassets = "Images.xcassets", plist = { UIAppFonts = { "FiraSans-Light.otf", "FiraSans-Hair.otf", "FiraSans-UltraLight.otf", }, UIApplicationExitsOnSuspend = false, UIPrerenderedIcon = true, UIStatusBarHidden = true, UILaunchStoryboardName = "LaunchScreen" } }}

Do you have a LaunchScreen.storyboardc file in your folder with your main.lua?