Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Positioning at absolute bottom
Started by nickolascarlos Nov 08 2019 06:05 AM

3 replies to this topic

Best Answer nickolascarlos , 11 November 2019 - 07:04 PM

Thank you guys for your responses.

 

I fixed this problem in config.lua by calculating the device screen aspect ratio and then setting the content dimensions accordingly.

That's what I have in config.lua:

local aspectRatio = display.pixelHeight / display.pixelWidth

application =
{
	content =
	{
		width = 320,
		height = 320*aspectRatio, 
		scale = "letterbox",
		fps = 60,
	},
}

This way the content dimensions properties I mentioned before are working as I expected them to.

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

nickolascarlos

[GLOBAL: userInfoPane.html]
nickolascarlos
  • Observer

  • 7 posts
  • Corona SDK

I'm trying to position a ground (platform) exactly at the bottom of the device screen, but its position changes when I change the screen aspect ratio, as you can see in these images below:

 

https://prnt.sc/pu8wc0

https://prnt.sc/pu8wc0

 

I've already tried changing .contentHeight to .actualContentHeight, but it didn't go as expected. I've also changed the content scale in config.lua file, but the game got completely deformed. How can I fix it?

 


  • nickolascarlos likes this

[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,542 posts
  • Enterprise

This blog post should help you...  https://coronalabs.com/blog/2018/08/08/understanding-content-scaling-in-corona/

 

Rob


  • nickolascarlos likes this

[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,617 posts
  • Corona SDK

Here too is and example that may help you understand how to figure things out:

 

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/10/lgg4.zip

 

lgg4.png

 

 

 

From my AskEd repository (400+ code answers to posts).  Get whole set and more by downloading RG FreeStuff:

https://github.com/roaminggamer/RG_FreeStuff/archive/master.zip


  • nickolascarlos and pixec like this

[TOPIC: post.html]
#4

nickolascarlos

[GLOBAL: userInfoPane.html]
nickolascarlos
  • Observer

  • 7 posts
  • Corona SDK

  Best Answer

Thank you guys for your responses.

 

I fixed this problem in config.lua by calculating the device screen aspect ratio and then setting the content dimensions accordingly.

That's what I have in config.lua:

local aspectRatio = display.pixelHeight / display.pixelWidth

application =
{
	content =
	{
		width = 320,
		height = 320*aspectRatio, 
		scale = "letterbox",
		fps = 60,
	},
}

This way the content dimensions properties I mentioned before are working as I expected them to.




[topic_controls]
[/topic_controls]