mindsnacks/moai-dev — pull request #19 by aab29 (2013-05-29 00:14:19+00:00)
Title: [Final] MOAIColor - Replacing alpha with opacity

Moai handles transparency much differently than Cocos did. It lets you modify a prop's alpha channel directly. It turns out that alpha is not the same as opacity. When you set an object's opacity, it should set the object's alpha channel to the opacity value, and it should also multiply the other three channels by the opacity value. This is really hard to keep track of in game code, so I changed Moai to expose opacity to lua instead of alpha. Alpha multiplication is handled in C, so we don't have to worry about it anymore. Just like in Cocos. :confetti_ball:

Of course, while working on this, @jeiting and I discovered that ```MOAITextBox``` doesn't do transparency the same way that other props do. :frowning: It looks like it's using separate OpenGL blend functions for the glyph textures and for the text box itself. The result is that semi-opaque text ends up looking darker than it should be. Ew. :eggplant:

We could try to work around that by tearing up ```MOATextBox``` and using some more fancy OpenGL stuff, but at this point I'm so fed up with ```MOAITextBox``` problems that I think a better solution is just to create our own text class that renders text to a texture so we can display it in a regular sprite... like we used to do with ```CCLabelTTF```. :name_badge:

Note that ```MOAIColor.ATTR_A_COL``` no longer exists. It has been replaced by ```MOAIColor.ATTR_OPACITY```. Double-check to make sure this doesn't break your games. :bread:

TL; DR: Transparency works like it did in Cocos2D. Don't use it on ```MOAITextBox``` for now.