支持电晕的背景和精灵需要多少尺寸的图像才能支持android / iphone [英] What sizes of images do I need for background and sprites in corona to support android/iphone

查看:86
本文介绍了支持电晕的背景和精灵需要多少尺寸的图像才能支持android / iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢电晕可以在多种环境下编译,但是我想知道什么大小的精灵,以及我需要的图像。我的意思是我没有时间为每种可能的设备尺寸创建单独的图像。我知道电晕会支持图像的某些自动缩放。因此,举例来说,如果我有一个64x64的精灵,这就是我所需要的吗?还是每种情况都需要新的图像尺寸?我正在寻找80%的覆盖率,而不是每种设备都完美。

I like that corona compiles to multiple environments, but I want to know what size sprites, and images do I need. I mean I don't have time to create separate images for every conceivable device size. I know corona supports some auto scaling of images. So for example if I have a 64x64 sprite is that all I need? or do I need new image sizes for every scenario? I am looking for 80% coverage not perfect for every device.

推荐答案

我用不同的方式来做。我认为这可能对您有帮助。我认为,只需为宽度和高度创建乘数(根据您在其中编码的模拟器),然后将每个宽度或高度参数乘以此值(如下所示)即可:

I'm doing it in a different way. I think this may help you. As my opinion, just create multiplier values for width and height(according to which simulator you are coding in), and multiply your each width or height parameter with this(as below):

--------------------------------------------------------------------------
   -- choosing xMultiplier and yMultiplier values --
--------------------------------------------------------------------------
   local xMultiplier = display.contentWidth/320  
   local yMultiplier = display.contentHeight/480
   --[[ I used 320 here because i'm using iPhone Simulator 
        (320 is the width of the simulator you are coding in)
        I used 480 here because i'm using iPhone Simulator 
        (480 is the height of the simulator you are coding in)--]]

--------------------------------------------------------------------------
   -- creating background and positioning it --
--------------------------------------------------------------------------
   local bg = display.newImageRect("bg.png",320*xMultiplier,480*yMultiplier)
   bg.x = 160*xMultiplier ; bg.y = 240*yMultiplier

--------------------------------------------------------------------------
   -- creating object and positioning it --
--------------------------------------------------------------------------
   local rect = display.newImageRect(0,0,50*xMultiplier,50*yMultiplier)
   rect.x = 160*xMultiplier ; rect.y = 100*yMultiplier

--------------------------------------------------------------------------

注意:如果您使用的是 config.lua 文件项目,这可能行不通。

Note: If you are using config.lua file in your project, this may not work.

优点:这仅需要一张图像。

缺点: 可能会影响高分辨率设备中图像的清晰度。因此,请选择具有适当分辨率的图像。

Cons: It may affect the clarity of images in devices with high resolution. So choose an image with suitable resolution.

继续编码...:)

这篇关于支持电晕的背景和精灵需要多少尺寸的图像才能支持android / iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆