I'm trying to change alpha value of a HUD, but it is not changing. I've tried with AlphaModifier and changing with method .setAlpha(), but with no result. As i can see, a HUD entity does not have setBlendingFunction() method.
This is what i am now trying to do:
this.mHud = new HUD() {
@Override
protected void onManagedUpdate(float pSecondsElapsed) {
super.onManagedUpdate(pSecondsElapsed);
if(flag) {
while (this.getAlpha() > 0) {
this.set(this.getAlpha() - (pSecondsElapsed / 1.5f));
}
} else {
while (this.getAlpha() < 1) {
this.setAlpha(this.getAlpha() + (pSecondsElapsed / 1.5f));
}
}
}
};
The "flag" variable is initialized to false, and it is changed when a button is pressed.
I have tried this too:
private static final IEntitiyModifier mToTransparentModifier = new AlphaModifier(1, 1, 0);
private static final IEntitiyModifier mToOpaqueModifier = new AlphaModifier(1, 0, 1);
this.mToTransparentModifier.setAutoUnregisterWhenFinished(true);
this.mToOpaqueModifier.setAutoUnregisterWhenFinished(true);
if(flag) {
this.mHud.registerEntityModifier(this.mToTransparentModifier);
}else {
this.mHud.registerEntityModifier(this.mToOpaqueModifier);
}
Any help would be appreciated. Thanks