use of gaiasky.interafce.IGui in project gaiasky by langurmonkey.
the class EventScriptingInterface method getPositionAndSizeGui.
@Override
public float[] getPositionAndSizeGui(String name) {
IGui gui = GaiaSky.instance.mainGui;
Actor actor = gui.getGuiStage().getRoot().findActor(name);
if (actor != null) {
float x = actor.getX();
float y = actor.getY();
// x and y relative to parent, so we need to add coordinates of
// parents up to top
Group parent = actor.getParent();
while (parent != null) {
x += parent.getX();
y += parent.getY();
parent = parent.getParent();
}
return new float[] { x, y, actor.getWidth(), actor.getHeight() };
} else {
return null;
}
}