I currently have a fairly decent framework for a side-view strategy-ish game built around libgdx. While I may have reinvented the wheel a couple of times, I believe I've done the vast majority with tools already existing in libgdx parts properly: camera, viewport, sprites, etc.
One thing I've not used at all is Scene2D, as I've simply not had a need for it (yet). Drawing the sprites at their positions is more than enough. The terrain is procedurally generated pixel art that is drawn beforehand.
Now I've come to the point where I need to implement some fairly basic UI-systems. Nothing out of the ordinary: A few buttons to click, and an area with additional info.
I haven't decided entirely on which approach to use when implementing the UI, but in the meantime I'm going with a fairly simple approach: When everything else is drawn, I reset the projectionmatrix so that everything drawn after that never moves with the world:
Matrix4 uiMatrix = camera.combined.cpy(); uiMatrix.setToOrtho2D(0,0,viewport.getWorldWidth(), viewport.getWorldHeight()); batch.setProjectionMatrix(uiMatrix); // Then draw the UI
This works fine, except when the aspect ratio changes and/or when the window resizes. Therefore I would like to find a more scalable way.
Is Scene2D the way to go? It currently looks like the only reasonable way of getting an UI that works well with resizing the screen and panning around.
The info I find on how to implement it either assumes a complete rewrite to use actors instead of sprites, or doesn't scale well at all.