掩模在模拟器上工作但在设备上没有

时间:2015-02-18 05:11:42

标签: lua corona

问题的标题将其删除。我有一堆附着在一些图像上的面具。这些面具按照它们在模拟器上的应用方式工作,但当我部署到我的平板电脑时,我的图像已经消失,因为它们被面具覆盖。我的面具缩放必须关闭或者其他东西,但是我不能缝合以解决它的问题。

local maskFileArray = {}
maskFileArray[0] = "Images/hydro_screen/hy_screen_river1_mask.png"
maskFileArray[1] = "Images/hydro_screen/hy_screen_river2_mask.png"
maskFileArray[2] = "Images/hydro_screen/hy_screen_river3_mask.png"
maskFileArray[3] = "Images/hydro_screen/hy_screen_river4_mask.png"
maskFileArray[4] = "Images/hydro_screen/hy_screen_river5_mask.png"
maskFileArray[5] = "Images/hydro_screen/hy_screen_river6_mask.png"


local defaultFileArray = {}
  defaultFileArray[0] = "Images/hydro_screen/hy_screen_river1.png"
  defaultFileArray[1] = "Images/hydro_screen/hy_screen_river2.png"  
  defaultFileArray[2] = "Images/hydro_screen/hy_screen_river3.png"
  defaultFileArray[3] = "Images/hydro_screen/hy_screen_river4.png"
  defaultFileArray[4] = "Images/hydro_screen/hy_screen_river5.png"
  defaultFileArray[5] = "Images/hydro_screen/hy_screen_river6.png"



for x = 0, 5, 1 do 

      streams[x] = widget.newButton
      {
          width = display.contentWidth,
          height = display.contentHeight,
          left = 0,
          top = 0,
          defaultFile = defaultFileArray[x],
          onEvent   = function(event) return dam(x + 0,event) end,

      }
      streams[x].anchorY, streams[x].anchorX = 0,0
      streams[x].x = 0
      streams[x].y = 0

      local mask = graphics.newMask( maskFileArray[x] )
      local xScale = streams[x].width/2400
      local yScale = streams[x].height/1600

      streams[x]:setMask( mask )
      streams[x].maskScaleX = xScale
      streams[x].maskScaleY = yScale
      streams[x].maskX = streams[x].width/2
      streams[x].maskY = streams[x].height/2

      sceneGroup:insert(streams[x])
end

我在程序的其他部分使用相同的算法和掩码,它们在设计中显示得很好。当我说算法时,我的意思是将宽度和高度除以2和缩放策略。我不知道这部分有什么问题。

本节中不同的是我的文件比其他文件大得多。我已经附上第一条河和面具供你观看。将它们放大使我可以将图片的尺寸设置为屏幕尺寸,从而消除定位问题。

任何人都可以帮助我吗?River that should be clickable

Mask to only make the blue part of the river clickable

1 个答案:

答案 0 :(得分:0)

如果它在模拟器中工作但在设备上没有工作,一般原因可能是,

  1. 首先检查文件和文件夹名称,无论是CAPS还是小写字母。一般模拟器不会担心它的小或CAPS。
  2. 这可能是可能的问题。

    谢谢,KumarKS

相关问题