Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

How to remove a black stripe on my map?
Started by suprasumomario Mar 16 2015 06:00 AM

1 reply to this topic
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Observer

  • 12 posts
  • Corona SDK

I'm getting a weird issue: My map consist to show 15x10 blocks on the screen at time (each block has 32x32 pixels, then the resolution needed is 480x320).

When I try to render the map, something happens, a black stripe is created on the bottom of the screen (some as iPad Mini the stripe is on right side), hiding the entire last row.



My config:

width = 320,
height = 480,
scale = "zoom",
fps = 30

The code:

mte.loadTileSet("Tiles", "Tiles.png")

local camera = mte.setCamera({locX = 1, locY = 1, scale = 1})

I noticed some phone viewers like iPhone 4 (640x960), Kindle Fire HD 7' (800x1280) show the map correctly. What can I do to fit the map correctly on the screen?



[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Observer

  • 12 posts
  • Corona SDK

I figured how to fix that just trying to get the aspect ratio and calculate how I need properly to scale X and Y axis regardless of mobile's display.
Like I said before, I always want to exhibit 15x10 blocks and fit all of them at same time on screen:
Considering each block has 32 x 32 pixels I can do it:

 local facScaleX = 1
 local facScaleY = 1
 local blockSizeX = display.actualContentWidth / 15
 local blockSizeY = display.actualContentHeight / 10
 if blockSizeX ~= 32 then
  facScaleX = display.actualContentWidth / 480
 if blockSizeY ~= 32 then
  facScaleY = display.actualContentHeight / 320
 local camera = mte.setCamera({locX = 1, locY = 1, scaleX = facScaleX, scaleY = facScaleY})

This code works nicely if you set your project for "zoomEven" scale factor on config.lua.

But PLEASE I feel that as workaround so I'd like to see another solution and alternatives, maybe something that Works better, I don't know.