Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.thinkingstudio.obsidianui.SprucePositioned;
import org.thinkingstudio.obsidianui.Tooltip;
import org.thinkingstudio.obsidianui.navigation.NavigationDirection;
import org.thinkingstudio.obsidianui.util.ScissorManager;
import org.thinkingstudio.obsidianui.widget.SpruceElement;
import org.thinkingstudio.obsidianui.widget.SpruceWidget;
import java.util.function.BooleanSupplier;
Expand Down Expand Up @@ -115,12 +114,10 @@ private boolean tryNavigating(Element element, NavigationDirection direction, bo

@Override
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
ScissorManager.pushScaleFactor(this.scaleFactor);
super.render(drawContext, mouseX, mouseY, delta);
this.renderWidgets(drawContext, mouseX, mouseY, delta);
this.renderTitle(drawContext, mouseX, mouseY, delta);
Tooltip.renderAll(drawContext);
ScissorManager.popScaleFactor();
}

public void renderTitle(DrawContext drawContext, int mouseX, int mouseY, float delta) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.thinkingstudio.obsidianui.SprucePositioned;
import org.thinkingstudio.obsidianui.Tooltip;
import org.thinkingstudio.obsidianui.navigation.NavigationDirection;
import org.thinkingstudio.obsidianui.util.ScissorManager;
import org.thinkingstudio.obsidianui.widget.SpruceElement;
import org.thinkingstudio.obsidianui.widget.SpruceWidget;
import java.util.function.BooleanSupplier;
Expand Down Expand Up @@ -110,12 +109,10 @@ private boolean tryNavigating(Element element, NavigationDirection direction, bo

@Override
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
ScissorManager.pushScaleFactor(this.scaleFactor);
this.renderBackground(drawContext, mouseX, mouseY, delta);
this.renderWidgets(drawContext, mouseX, mouseY, delta);
this.renderTitle(drawContext, mouseX, mouseY, delta);
Tooltip.renderAll(drawContext);
ScissorManager.popScaleFactor();
}

public void renderTitle(DrawContext drawContext, int mouseX, int mouseY, float delta) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

package org.thinkingstudio.obsidianui.widget;

import com.mojang.blaze3d.opengl.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ButtonTextures;
Expand Down Expand Up @@ -164,8 +163,6 @@ protected void renderButton(DrawContext drawContext, int mouseX, int mouseY, flo
@Override
protected void renderBackground(DrawContext drawContext, int mouseX, int mouseY, float delta) {
RenderSystem.setShaderColor(1.f, 1.f, 1.f, this.getAlpha());
GlStateManager._enableBlend();
GlStateManager._enableDepthTest();
drawContext.drawGuiTexture(RenderLayer::getGuiTextured, this.getTexture(), this.getX(), this.getY(), this.getWidth(), this.getHeight());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

package org.thinkingstudio.obsidianui.widget;

import com.mojang.blaze3d.opengl.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
Expand Down Expand Up @@ -91,8 +90,6 @@ public void setColored(boolean colored) {

@Override
protected void renderButton(DrawContext drawContext, int mouseX, int mouseY, float delta) {
GlStateManager._enableDepthTest();
GlStateManager._enableBlend();
float[] oldColor = RenderSystem.getShaderColor();
float oldRed = oldColor[0], oldGreen = oldColor[1], oldBlue = oldColor[2], oldAlpha = oldColor[3];

Expand All @@ -119,9 +116,7 @@ protected void renderButton(DrawContext drawContext, int mouseX, int mouseY, flo

@Override
protected void renderBackground(DrawContext drawContext, int mouseX, int mouseY, float delta) {
GlStateManager._enableDepthTest();
int color = ColorHelper.fromFloats(this.alpha, 1.f, 1.f, 1.f);
GlStateManager._enableBlend();
drawContext.drawTexture(RenderLayer::getGuiTextured, TEXTURE, this.getX(), this.getY(), this.isFocusedOrHovered() ? 20.f : 0.f, 0.f, this.getHeight(), this.getHeight(), 64, 64, color);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

package org.thinkingstudio.obsidianui.widget;

import com.mojang.blaze3d.opengl.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
Expand Down Expand Up @@ -77,7 +76,6 @@ protected void renderBackground(DrawContext drawContext, int mouseX, int mouseY,
}

RenderSystem.setShaderColor(1.f, 1.f, 1.f, this.getAlpha());
GlStateManager._enableDepthTest();
drawContext.drawTexture(RenderLayer::getGuiTextured, this.texture,
this.getX(), this.getY(),
this.u, v,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

package org.thinkingstudio.obsidianui.widget;

import com.mojang.blaze3d.opengl.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
Expand Down Expand Up @@ -55,8 +54,6 @@ public SpruceToggleSwitch(Position position, int width, int height, Text message

@Override
protected void renderButton(DrawContext drawContext, int mouseX, int mouseY, float delta) {
GlStateManager._enableDepthTest();
GlStateManager._enableBlend();
drawContext.drawTexture(RenderLayer::getGuiTextured, TEXTURE, this.getX() + (this.getValue() ? 14 : 0), this.getY() + (this.getHeight() / 2 - 9),
this.getValue() ? 50.f : 32.f, this.isFocusedOrHovered() ? 18.f : 0.f,
18, 18, 68, 36);
Expand All @@ -72,9 +69,7 @@ protected void renderButton(DrawContext drawContext, int mouseX, int mouseY, flo

@Override
protected void renderBackground(DrawContext drawContext, int mouseX, int mouseY, float delta) {
GlStateManager._enableDepthTest();
RenderSystem.setShaderColor(1.f, 1.f, 1.f, this.alpha);
GlStateManager._enableBlend();
drawContext.drawTexture(RenderLayer::getGuiTextured, TEXTURE, this.getX(), this.getY() + (this.getHeight() / 2 - 9),
0.f, this.isFocusedOrHovered() ? 18.f : 0.f, 32, 18, 68, 36);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
package org.thinkingstudio.obsidianui.widget.container;

import com.google.common.collect.Lists;
import com.mojang.blaze3d.opengl.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.DrawContext;
Expand All @@ -31,7 +29,6 @@
import org.thinkingstudio.obsidianui.border.EmptyBorder;
import org.thinkingstudio.obsidianui.mixin.DrawContextAccessor;
import org.thinkingstudio.obsidianui.navigation.NavigationDirection;
import org.thinkingstudio.obsidianui.util.ScissorManager;
import org.thinkingstudio.obsidianui.widget.AbstractSpruceWidget;
import org.thinkingstudio.obsidianui.widget.WithBackground;
import org.thinkingstudio.obsidianui.widget.WithBorder;
Expand Down Expand Up @@ -345,12 +342,11 @@ protected void renderWidget(DrawContext drawContext, int mouseX, int mouseY, flo
int top = this.getY();
int bottom = top + this.getHeight();

ScissorManager.push(this.getX(), this.getY(), this.getWidth(), this.getHeight());
drawContext.enableScissor(left, top, right, bottom);
this.entries.forEach(e -> e.render(drawContext, mouseX, mouseY, delta));
ScissorManager.pop();
drawContext.disableScissor();


GlStateManager._enableBlend();
// Render the transition thingy.
if (this.shouldRenderTransition()) {
Identifier topTexture = getSeparatorTexture(true);
Expand Down Expand Up @@ -378,8 +374,6 @@ protected void renderWidget(DrawContext drawContext, int mouseX, int mouseY, flo
}

this.getBorder().render(drawContext, this, mouseX, mouseY, delta);

GlStateManager._disableBlend();
}

protected void renderScrollbar(DrawContext drawContext, int scrollbarX, int scrollbarEndX, int scrollbarY, int scrollbarHeight) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

package org.thinkingstudio.obsidianui.widget.text;

import com.mojang.blaze3d.opengl.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
Expand Down Expand Up @@ -511,8 +509,6 @@ protected void drawSelection(DrawContext drawContext, String line, int lineY, in
int x2 = x + this.textRenderer.getWidth(selected);
int y2 = lineY + this.textRenderer.fontHeight;

GlStateManager._enableColorLogicOp();
GlStateManager._logicOp(5387);
RenderLayer renderLayer = RenderLayer.getGui();
VertexConsumer vertexConsumer = ((DrawContextAccessor)drawContext).getVertexConsumers().getBuffer(renderLayer);
int color = ColorHelper.fromFloats(1.f, 0.f, 0.f, 1.f);
Expand All @@ -521,7 +517,6 @@ protected void drawSelection(DrawContext drawContext, String line, int lineY, in
vertexConsumer.vertex(x2, lineY, 0).color(color);
vertexConsumer.vertex(x, lineY, 0).color(color);
drawContext.draw();
GlStateManager._disableColorLogicOp();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

package org.thinkingstudio.obsidianui.widget.text;

import com.mojang.blaze3d.opengl.GlStateManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
Expand Down Expand Up @@ -467,8 +466,6 @@ protected void drawSelection(DrawContext drawContext, String line, int lineY) {
int x2 = x + this.client.textRenderer.getWidth(selected);
int y2 = lineY + this.client.textRenderer.fontHeight;

GlStateManager._enableColorLogicOp();
GlStateManager._logicOp(5387);
RenderLayer renderLayer = RenderLayer.getGui();
VertexConsumer vertexConsumer = ((DrawContextAccessor)drawContext).getVertexConsumers().getBuffer(renderLayer);
int color = ColorHelper.fromFloats(255.f, 0.f, 0.f, 255.f);
Expand All @@ -477,7 +474,6 @@ protected void drawSelection(DrawContext drawContext, String line, int lineY) {
vertexConsumer.vertex(x2, lineY, 0).color(color);
vertexConsumer.vertex(x, lineY, 0).color(color);
drawContext.draw();
GlStateManager._disableColorLogicOp();
}

/**
Expand Down