Question

I want to put 2 analog OnScreenControl on the screen to control two different things.

When I put just 1, this works perfectly. But when I put an other one, the first just collasped, disappeared.

I tried using HUD but I think I do something wrong

this is my code :

    // 2  
    analogOnScreenControl.getControlBase().setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);    
    analogOnScreenControl.getControlBase().setAlpha(0.5f); 
    analogOnScreenControl.getControlBase().setScaleCenter(-16, 128+16); 
    analogOnScreenControl.getControlBase().setScale(2f);
    analogOnScreenControl.getControlKnob().setScale(2f); 
    analogOnScreenControl.refreshControlKnobPosition();

    // 2 
    analogOnShotControl.getControlBase().setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); 
    analogOnShotControl.getControlBase().setAlpha(0.5f); 
    analogOnShotControl.getControlBase().setScaleCenter(-16, 128+16);  
    analogOnShotControl.getControlBase().setScale(2f); 
    analogOnShotControl.getControlKnob().setScale(2f); 
    analogOnShotControl.refreshControlKnobPosition(); 

    HUD hud1 = new HUD();
    HUD hud2 = new HUD();
    hud1.setChildScene(analogOnScreenControl); // 1
    hud2.setChildScene(analogOnShotControl); // 2

    this.mCamera.setHUD(hud1);
    this.mCamera.setHUD(hud2);

But only the second is on the screen.

how can I put the 2 on the screen ?
Thanks !

Was it helpful?

Solution

I succeded with this :

    HUD hud = new HUD();
    hud.setChildScene(analogOnScreenControl); // 1
    analogOnScreenControl.setChildScene(analogOnShotControl);

    this.mCamera.setHUD(hud);

added the second to the child scene of the first.

Bey !

OTHER TIPS

You do not need 2 huds:

HUD hud = new HUD();

hud.setChildScene(analogOnScreenControl); // 1
hud.setChildScene(analogOnShotControl); // 2

this.mCamera.setHUD(hud);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top