r/libgdx•
Nibodhika

Separate stage for UI?

I'm working in a game, and I have a stage in which the camera can be paned and zoomed, I tried to add some "HUD" but it moves together with the pan. The first thing I tried was to update the HUD elements position on when a pan/zoom happened, but I quickly realized that there should be a better way.

What I did was to create two separate stages, one for the actual game and other for the UI, when my UI needs input I should be able to use an InputMultiplexer to treat the events on the UI before the ones in the game. Is this the "correct" way? most tutorials seem to imply that the same stage should be used for both (or at least I didn't found any info on running more than one stage), is there a reason why I shouldn't use two stages at the same time? or a way do draw the UI elements ignoring the camera pan/zoom?

Posted Aug 29, 2016, 11:14 PM UTC

46
Loading comments…