use of org.terasology.engine.rendering.nui.UIScreenLayer in project Terasology by MovingBlocks.
the class NUIManagerInternal method update.
@Override
public void update(float delta) {
canvas.processMousePosition(mouse.getPosition());
// modifying a collection while iterating of it is typically not supported
for (UIScreenLayer screen : new ArrayList<>(screens)) {
screen.update(delta);
}
for (ControlWidget widget : overlays.values()) {
widget.update(delta);
}
InputSystem inputSystem = context.get(InputSystem.class);
inputSystem.getMouseDevice().setGrabbed(inputSystem.isCapturingMouse() && !(this.isReleasingMouse()));
}
use of org.terasology.engine.rendering.nui.UIScreenLayer in project Terasology by MovingBlocks.
the class NUIManagerInternal method pushScreen.
@Override
public void pushScreen(UIScreenLayer screen) {
TabbingManager.setInitialized(false);
if (!screen.isLowerLayerVisible()) {
UIScreenLayer current = screens.peek();
if (current != null) {
current.onHide();
}
}
screens.push(screen);
screen.onOpened();
String id = screen.getId();
if (ResourceUrn.isValid(id)) {
ResourceUrn uri = new ResourceUrn(id);
screenLookup.put(uri, screen);
}
}
use of org.terasology.engine.rendering.nui.UIScreenLayer in project Terasology by MovingBlocks.
the class NUIManagerInternal method closeScreen.
private void closeScreen(ResourceUrn screenUri, boolean sendEvents) {
UIScreenLayer screen = screenLookup.remove(screenUri);
if (screen != null) {
screens.remove(screen);
onCloseScreen(screen, screenUri, sendEvents);
}
}
use of org.terasology.engine.rendering.nui.UIScreenLayer in project Terasology by MovingBlocks.
the class NUIManagerInternal method render.
@Override
public void render() {
canvas.preRender();
Deque<UIScreenLayer> screensToRender = Queues.newArrayDeque();
for (UIScreenLayer layer : screens) {
screensToRender.push(layer);
if (!layer.isLowerLayerVisible()) {
break;
}
}
for (UIScreenLayer screen : screensToRender) {
canvas.drawWidget(screen, canvas.getRegion());
}
for (ControlWidget overlay : overlays.values()) {
canvas.drawWidget(overlay);
}
canvas.postRender();
}
use of org.terasology.engine.rendering.nui.UIScreenLayer in project Terasology by MovingBlocks.
the class NUIManagerInternal method popScreen.
@Override
public void popScreen() {
if (!screens.isEmpty()) {
UIScreenLayer top = screens.peek();
closeScreen(top);
if (!top.isLowerLayerVisible()) {
UIScreenLayer current = screens.peek();
if (current != null) {
current.onShow();
}
}
}
}
Aggregations