nicolasgramlich/AndEngine — Issue #44: Please fix the SpriteTransparency bug
Author: JFixbi
Created: 2012-02-17 17:33:14+00:00
State: open

Just insert this code into the org.andengine.util.color.Color

//;-------------------------------------------

public static final int FF_VALUE = 0XFFFFFFFF;
public static final int VALUE_255 = 255;
public static final int VALUE_24 = 24;
public static final int VALUE_16 = 16;
public static final int VALUE_8 = 8;

private void pack() {
final int packed = ((int) (VALUE_255 * this.mAlpha) << VALUE_24)
| ((int) (VALUE_255 * this.mBlue) << VALUE_16)
| ((int) (VALUE_255 * this.mGreen) << VALUE_8)
| ((int) (VALUE_255 * this.mRed));
this.mPacked = Float.intBitsToFloat(packed & FF_VALUE);
}

public static float pack(final float pRed, final float pGreen,
final float pBlue, final float pAlpha) {
final int packed = ((int) (VALUE_255 * pAlpha) << VALUE_24)
| ((int) (VALUE_255 * pBlue) << VALUE_16)
| ((int) (VALUE_255 * pGreen) << VALUE_8)
| ((int) (VALUE_255 * pRed));
return Float.intBitsToFloat(packed & FF_VALUE);