Hey fellow Monkeys,
I’ve tried to make my UI resolution independent, by adding an intermediary node with scale (resolution.x, resolution.y, 1), to which I add all Lemur GUI Elements.
While this works fine for positioning, I get problems with components setPreferredSize as they seem to not take into account that huge scaling.
I wanted to add a damage indicator which is basically rotated around the screen center (hence the container) and then moved out of center for 0.25f. The Code to setup looks like this:
@Override
protected void handleAdd(EntityId playerId, IndicatorStruct struct) {
Container c = new Container(new BorderLayout(), "glass");
c.setLocalTranslation(new Vector3f(0.5f, 0.5f, 0f)); // Center of screen as rotation pivot.
Label lbl = new Label("");
QuadBackgroundComponent qbc = new QuadBackgroundComponent(Main.self.getAssetManager().loadTexture("Interface/DamageIndicator_ColorMask.png"));
lbl.setBackground(qbc);
lbl.setLocalTranslation(new Vector3f(0f, 0.25f, 0f));
lbl.setLocalScale(new Vector3f(64f / 1280f, 64f / 720f, 0f)); // My try to replace the setPreferedSize(64f, 64f, 0f), so I can at least see a part of the qbc
c.addChild(lbl, BorderLayout.Position.Center);
Main.self.guiAppState.getLemurScreen().attachChild(c); // getLemurScreen is that intermediary node
System.out.println(lbl.getWorldTransform().toString()); // Debug Info
}
The Debug Info looks like this:
Transform[ 640.0, 540.0, 0.0]
[ 0.0, 0.0, 0.0, 1.0]
[ 64.0 , 64.0, 0.0]
The problem is: This looks fine. 640, 360 is my screen center, rotation none (disabled for bug hunting) and a scale of 64x64 px. Still the Label is so huge, see the screenshot:
So I’d love suggestions how I can fix this. Is there maybe already something built in which I could use to make Lemur’s Size Calculations working again?