Can you post your “build.settings” content here?
settings = { orientation = { default = "portrait", supported = {"portrait"}, fps = 30, } }
OK… “fps” doesn’t belong there. That goes in “config.lua”. You should also probably be supporting both “portrait” and “portraitUpsideDown” so people can turn the phone either way.
Fixed, error has disappeared. Still can’t figure out why some objects have their alignment offset on the macOS, I tested every other component and the game is fully functional, and if I change the code to fix the objects on mac, it then offsets it on PC. Tried switching to and from the different config formats to no avail.
Can you show me a bit of code from objects which aren’t aligning how you expect them to?
centerX = display.contentCenterX centerY = display.contentCenterY screenLeft = display.screenOriginX screenWidth = display.contentWidth - screenLeft \* 2 screenRight = screenLeft + screenWidth screenTop = display.screenOriginY screenHeight = display.contentHeight - screenTop \* 2 screenBottom = screenTop + screenHeight display.contentWidth = screenWidth display.contentHeight = screenHeight local RegFont = native.newFont("/fonts/RINGM\_\_\_.ttf",100) -- var.playerClass is whatever class the player has selected, pulled from the var.lua file -- This is aligning perfectly. local playerClass = display.newText(var.playerClass, screenRight-10, screenTop+75, RegFont) playerClass.anchorX = 1 playerClass.anchorY = 0 playerClass.fill = {0} -- After a few seconds, game replaces the class name with its icon -- This isn't aligning perfectly. (Showed in the pics earlier) classIcon = display.newImage("images/"..var.playerClass.."Icon.png", screenRight-10, screenTop+100) classIcon.anchorX = 1 classIcon.anchorY = 0
Why do this:
screenWidth = display.contentWidth - screenLeft \* 2
instead of this:
screenWidth = display.actualContentWidth
Rob
Didn’t even know display.actualContentWidth existed, just accustomed to using those (copy paste when I make a new project). Does it make a difference though?
Should produce the same number… there are various ways to use the display.*-based measurement APIs and, using some calculations, come up with the exact same value.
In your original screenshots, what object is “classIcon” on the screen?
Brent
classIcon is the swirl under “Lvl. 0”.
There is minimal differences in that it takes CPU cycles for you to calculate the values that’s not needed because we already have gotten the values for you. It’s a trivial amount of savings. Also your calculations work assuming the content area is center aligned, but since you’re likely using center aligning for your app, your calculations are safe.
Rob
Hi @sachinseem,
The “offsets” I talk about above are generally meant to be added or subtracted from a set position on the screen, not just used by themselves as positions. So instead of going like “screenTop+100” for the Y position of “classIcon”, do something more like “180-screenTop” (obviously you’ll need to adjust the numbers to suit your design, this is just an example).
Brent
After trying to remove/alter every possible aspect of my program, I’ve found the issue, but I’m unsure of why it’s happening.
Corona on macOS or just mac itself is aligning the font awkwardly. If I change the variable RegFont (in the code above) to any other font installed on the Mac, the aligning issue I’m experiencing magically disappears.
Can anyone else confirm that this font doesn’t work well on mac? http://www.dafont.com/ringbearer.font
I can’t find a reason why this specific font is causing an issue.