Search in sources :

Example 1 with AbstractSimiScreen

use of com.simibubi.create.foundation.gui.AbstractSimiScreen in project Create by Creators-of-Create.

the class NavigatableSimiScreen method renderWindowBackground.

@Override
protected void renderWindowBackground(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
    if (backTrack != null) {
        int x = (int) Mth.lerp(arrowAnimation.getValue(partialTicks), -9, 21);
        int maxX = backTrack.x + backTrack.getWidth();
        if (x + 30 < backTrack.x)
            UIRenderHelper.breadcrumbArrow(ms, x + 30, height - 51, 0, maxX - (x + 30), 20, 5, Theme.p(Theme.Key.PONDER_BACK_ARROW));
        UIRenderHelper.breadcrumbArrow(ms, x, height - 51, 0, 30, 20, 5, Theme.p(Theme.Key.PONDER_BACK_ARROW));
        UIRenderHelper.breadcrumbArrow(ms, x - 30, height - 51, 0, 30, 20, 5, Theme.p(Theme.Key.PONDER_BACK_ARROW));
    }
    if (transition.getChaseTarget() == 0 || transition.settled()) {
        renderBackground(ms);
        return;
    }
    renderBackground(ms);
    Screen lastScreen = ScreenOpener.getPreviouslyRenderedScreen();
    float transitionValue = transition.getValue(partialTicks);
    float scale = 1 + 0.5f * transitionValue;
    // draw last screen into buffer
    if (lastScreen != null && lastScreen != this && !transition.settled()) {
        ms.pushPose();
        UIRenderHelper.framebuffer.clear(Minecraft.ON_OSX);
        ms.translate(0, 0, -1000);
        UIRenderHelper.framebuffer.bindWrite(true);
        PonderTooltipHandler.enable = false;
        lastScreen.render(ms, mouseX, mouseY, partialTicks);
        PonderTooltipHandler.enable = true;
        ms.popPose();
        ms.pushPose();
        // use the buffer texture
        minecraft.getMainRenderTarget().bindWrite(true);
        Window window = minecraft.getWindow();
        int dpx = window.getGuiScaledWidth() / 2;
        int dpy = window.getGuiScaledHeight() / 2;
        if (lastScreen instanceof AbstractSimiScreen) {
            dpx = ((NavigatableSimiScreen) lastScreen).depthPointX;
            dpy = ((NavigatableSimiScreen) lastScreen).depthPointY;
        }
        ms.translate(dpx, dpy, 0);
        ms.scale(scale, scale, 1);
        ms.translate(-dpx, -dpy, 0);
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        UIRenderHelper.drawFramebuffer(1f - Math.abs(transitionValue));
        RenderSystem.disableBlend();
        ms.popPose();
    }
    // modify current screen as well
    scale = transitionValue > 0 ? 1 - 0.5f * (1 - transitionValue) : 1 + .5f * (1 + transitionValue);
    ms.translate(depthPointX, depthPointY, 0);
    ms.scale(scale, scale, 1);
    ms.translate(-depthPointX, -depthPointY, 0);
}
Also used : Window(com.mojang.blaze3d.platform.Window) Screen(net.minecraft.client.gui.screens.Screen) AbstractSimiScreen(com.simibubi.create.foundation.gui.AbstractSimiScreen) AbstractSimiScreen(com.simibubi.create.foundation.gui.AbstractSimiScreen)

Aggregations

Window (com.mojang.blaze3d.platform.Window)1 AbstractSimiScreen (com.simibubi.create.foundation.gui.AbstractSimiScreen)1 Screen (net.minecraft.client.gui.screens.Screen)1