ymobe/rapanui

Transparency of objects within nested group and createRect transparency within groups are not working properly.

Sylph opened this issue · 1 comments

So, basically the following would simply make the second rectangle disappear when there's anything under it

    local group = RNGroup:new()
    local rect = RNFactory.createRect(100, 0, screenFW, screenFH, { rgb = { 255, 255, 255 }, parentGroup = group})
    local rect2 = RNFactory.createRect(0, 0, screenW, screenH, { rgb = { 0, 255, 0 }, parentGroup = group})
    rect2:setAlpha(0.5)
    group:insert(group2)

While

    local rect = RNFactory.createRect(100, 0, screenFW, screenFH, { rgb = { 255, 255, 255 }})
    local rect2 = RNFactory.createRect(0, 0, screenW, screenH, { rgb = { 0, 255, 0 }})
    rect2:setAlpha(0.5)

would set the transparency properly.

Also:

  • setAlpha on an image within group2 nested group doesn't work, with them just showing as fully opaque.
  • inserting a rectangle w/ the rgb={0,0,0} into a group makes them fully transparent. It's as if the alpha is set to 0 as well, while rgb={125,0,0 } is around half transparent, and rgb={255,0,0} is fully opaque

Any idea on how to handle these? I'm trying to add an in-game popup w/ some transparencies. Thanks. :)

Interestingly it appears that if you move the creation of rectangle after the scene onCreate function is called, you can prevent this problem.
For now I just lazy-load the popup rectangles for when the player needs it, solving the transparency issue.