Search in sources :

Example 1 with ControlWidget

use of org.terasology.rendering.nui.ControlWidget 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()));
}
Also used : ControlWidget(org.terasology.rendering.nui.ControlWidget) ArrayList(java.util.ArrayList) InputSystem(org.terasology.input.InputSystem) UIScreenLayer(org.terasology.rendering.nui.UIScreenLayer)

Example 2 with ControlWidget

use of org.terasology.rendering.nui.ControlWidget 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();
}
Also used : ControlWidget(org.terasology.rendering.nui.ControlWidget) UIScreenLayer(org.terasology.rendering.nui.UIScreenLayer)

Aggregations

ControlWidget (org.terasology.rendering.nui.ControlWidget)2 UIScreenLayer (org.terasology.rendering.nui.UIScreenLayer)2 ArrayList (java.util.ArrayList)1 InputSystem (org.terasology.input.InputSystem)1