android - Drawing one group over the other in libgdx (same stage) -
i have menu screen on game 2 groups using same stage: maingroup , popupgroup(hidden -> isvisible(false)). when button on maingroup clicked, popupgroup(isvisible(true)) added stage , comes imagebutton.
i darken entire screen extent except imagebutton on display. how can have such click anywhere else on screen except imagebutton remove() popupgroup , bring maingroup forefront?
code..
...addlistener(new inputlistener() { public boolean touchdown(inputevent event, float x, float y, int pointer, int button) { maingroup.settouchable(touchable.disabled); popupgroup.setvisible(true); popupgroup.setcolor(1f, 1f, 1f, 0f); popupgroup.addaction(actions.fadein(1f)); return true; }
is there clicklistener detect when you've pressed out of bounds of group or item?
thanks
first of - why not create 1 more stage? easier have 2 stages - 1 common sprites , second pop-ups.
anyway need set z-index of groups , should use tofront()
, toback()
methods
//when need show popup darkengroup.setvisible(true); popupgroup.setvisible(true); darkengroup.tofront(); popupgroup.tofront(); //hide them using setvisible(false) darkengroup.setvisible(false); popupgroup.setvisible(false);
about creating darken semi-transparent group consider using @munyul's comment idea - keep 1x1px texture , stretch - should more optimized
Comments
Post a Comment