mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-28 16:06:28 +01:00
merge & comment cleanup
This commit is contained in:
parent
c36346b97d
commit
2442e3ac00
13 changed files with 76 additions and 241 deletions
|
@ -16,6 +16,7 @@ indent_size = 2
|
||||||
|
|
||||||
[*.java]
|
[*.java]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
ij_continuation_indent_size = 8
|
||||||
ij_java_class_count_to_use_import_on_demand = 99
|
ij_java_class_count_to_use_import_on_demand = 99
|
||||||
ij_java_names_count_to_use_import_on_demand = 99
|
ij_java_names_count_to_use_import_on_demand = 99
|
||||||
ij_java_imports_layout = $*,|,java.**,|,javax.**,|,org.**,|,com.**,|,*
|
ij_java_imports_layout = $*,|,java.**,|,javax.**,|,org.**,|,com.**,|,*
|
||||||
|
|
|
@ -27,14 +27,14 @@ public abstract class ConfigScreen extends AbstractSimiScreen {
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* zelo's list for configUI
|
* zelo's list for configUI
|
||||||
* TODO
|
|
||||||
*
|
*
|
||||||
* replace java's awt color with something mutable
|
* reduce number of packets sent to the server when saving a bunch of values
|
||||||
|
* maybe replace java's awt color with something mutable
|
||||||
|
* find out why framebuffer blending is incorrect
|
||||||
*
|
*
|
||||||
* FIXME
|
* FIXME
|
||||||
*
|
*
|
||||||
* tooltips are hidden underneath the scrollbar, if the bar is near the middle
|
* tooltips are hidden underneath the scrollbar, if the bar is near the middle
|
||||||
* framebuffer blending is incorrect -> wait for jozu's changes to merge
|
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ public abstract class ConfigScreen extends AbstractSimiScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindowBackground(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindowBackground(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||||
//RenderSystem.disableDepthTest();
|
|
||||||
if (this.client != null && this.client.world != null) {
|
if (this.client != null && this.client.world != null) {
|
||||||
fill(ms, 0, 0, this.width, this.height, 0xb0_282c34);
|
fill(ms, 0, 0, this.width, this.height, 0xb0_282c34);
|
||||||
} else {
|
} else {
|
||||||
|
@ -84,16 +83,7 @@ public abstract class ConfigScreen extends AbstractSimiScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {}
|
||||||
int x = (int) (width * 0.5f);
|
|
||||||
int y = (int) (height * 0.5f);
|
|
||||||
//this.drawHorizontalLine(ms, x-25, x+25, y, 0xff_807060);
|
|
||||||
//this.drawVerticalLine(ms, x, y-25, y+25, 0xff_90a0b0);
|
|
||||||
|
|
||||||
//this.testStencil.render(ms);
|
|
||||||
|
|
||||||
//UIRenderHelper.streak(ms, 0, mouseX, mouseY, 16, 50, 0xaa_1e1e1e);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
|
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
|
||||||
|
@ -113,7 +103,7 @@ public abstract class ConfigScreen extends AbstractSimiScreen {
|
||||||
ms.push();
|
ms.push();
|
||||||
|
|
||||||
ms.translate(-100, 100, -100);
|
ms.translate(-100, 100, -100);
|
||||||
ms.scale(200, 200, .1f);
|
ms.scale(200, 200, 1);
|
||||||
GuiGameElement.of(cogwheelState)
|
GuiGameElement.of(cogwheelState)
|
||||||
.rotateBlock(22.5, cogSpin.getValue(partialTicks), 22.5)
|
.rotateBlock(22.5, cogSpin.getValue(partialTicks), 22.5)
|
||||||
.render(ms);
|
.render(ms);
|
||||||
|
|
|
@ -40,9 +40,6 @@ public class ConfigScreenList extends ExtendedList<ConfigScreenList.Entry> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
public void render(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||||
//render tmp background
|
|
||||||
//fill(ms, left, top, left + width, top + height, 0x10_000000);
|
|
||||||
|
|
||||||
UIRenderHelper.angledGradient(ms, 90, left + width / 2, top, width, 5, 0x60_000000, 0x0);
|
UIRenderHelper.angledGradient(ms, 90, left + width / 2, top, width, 5, 0x60_000000, 0x0);
|
||||||
UIRenderHelper.angledGradient(ms, -90, left + width / 2, bottom, width, 5, 0x60_000000, 0x0);
|
UIRenderHelper.angledGradient(ms, -90, left + width / 2, bottom, width, 5, 0x60_000000, 0x0);
|
||||||
UIRenderHelper.angledGradient(ms, 0, left, top + height / 2, height, 5, 0x60_000000, 0x0);
|
UIRenderHelper.angledGradient(ms, 0, left, top + height / 2, height, 5, 0x60_000000, 0x0);
|
||||||
|
@ -78,7 +75,6 @@ public class ConfigScreenList extends ExtendedList<ConfigScreenList.Entry> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick() {
|
public void tick() {
|
||||||
//children().forEach(Entry::tick);
|
|
||||||
for(int i = 0; i < getItemCount(); ++i) {
|
for(int i = 0; i < getItemCount(); ++i) {
|
||||||
int top = this.getRowTop(i);
|
int top = this.getRowTop(i);
|
||||||
int bot = top + itemHeight;
|
int bot = top + itemHeight;
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class SubMenuConfigScreen extends ConfigScreen {
|
||||||
|
|
||||||
new ConfirmationScreen()
|
new ConfirmationScreen()
|
||||||
.at(x, y)
|
.at(x, y)
|
||||||
.withText(ITextProperties.plain("You are about to change " + changes.size() + " values. Are you sure?"))
|
.withText(ITextProperties.plain("You are about to change " + changes.size() + " value" + (changes.size() != 1 ? "s" : "") + ". Are you sure?"))
|
||||||
.withAction(success -> {
|
.withAction(success -> {
|
||||||
if (success)
|
if (success)
|
||||||
saveChanges();
|
saveChanges();
|
||||||
|
@ -167,7 +167,7 @@ public class SubMenuConfigScreen extends ConfigScreen {
|
||||||
|
|
||||||
new ConfirmationScreen()
|
new ConfirmationScreen()
|
||||||
.at(x, y)
|
.at(x, y)
|
||||||
.withText(ITextProperties.plain("You are about to discard " + changes.size() + " unsaved changes. Are you sure?"))
|
.withText(ITextProperties.plain("You are about to discard " + changes.size() + " unsaved change" + (changes.size() != 1 ? "s" : "") + ". Are you sure?"))
|
||||||
.withAction(success -> {
|
.withAction(success -> {
|
||||||
if (success)
|
if (success)
|
||||||
clearChanges();
|
clearChanges();
|
||||||
|
@ -307,7 +307,7 @@ public class SubMenuConfigScreen extends ConfigScreen {
|
||||||
if (!changes.isEmpty() && parent instanceof BaseConfigScreen) {
|
if (!changes.isEmpty() && parent instanceof BaseConfigScreen) {
|
||||||
new ConfirmationScreen()
|
new ConfirmationScreen()
|
||||||
.centered()
|
.centered()
|
||||||
.addText(ITextProperties.plain("You still have " + changes.size() + " unsaved changes for this config."))
|
.addText(ITextProperties.plain("You still have " + changes.size() + " unsaved change" + (changes.size() != 1 ? "s" : "") + " for this config."))
|
||||||
.addText(ITextProperties.plain("Leaving this screen will discard them without saving. Are you sure?"))
|
.addText(ITextProperties.plain("Leaving this screen will discard them without saving. Are you sure?"))
|
||||||
.withAction(success -> {
|
.withAction(success -> {
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -331,7 +331,7 @@ public class SubMenuConfigScreen extends ConfigScreen {
|
||||||
|
|
||||||
new ConfirmationScreen()
|
new ConfirmationScreen()
|
||||||
.centered()
|
.centered()
|
||||||
.addText(ITextProperties.plain("You still have " + changes.size() + " unsaved changes for this config."))
|
.addText(ITextProperties.plain("You still have " + changes.size() + " unsaved change" + (changes.size() != 1 ? "s" : "") + " for this config."))
|
||||||
.addText(ITextProperties.plain("Leaving this screen will discard them without saving. Are you sure?"))
|
.addText(ITextProperties.plain("Leaving this screen will discard them without saving. Are you sure?"))
|
||||||
.withAction(success -> {
|
.withAction(success -> {
|
||||||
if (!success)
|
if (!success)
|
||||||
|
|
|
@ -18,18 +18,10 @@ public class BooleanEntry extends ValueEntry<Boolean> {
|
||||||
public BooleanEntry(String label, ForgeConfigSpec.ConfigValue<Boolean> value, ForgeConfigSpec.ValueSpec spec) {
|
public BooleanEntry(String label, ForgeConfigSpec.ConfigValue<Boolean> value, ForgeConfigSpec.ValueSpec spec) {
|
||||||
super(label, value, spec);
|
super(label, value, spec);
|
||||||
|
|
||||||
// enabled = new TextStencilElement(Minecraft.getInstance().fontRenderer, "Enabled")
|
|
||||||
// .centered(true, true)
|
|
||||||
// .withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height/2, height, width, 0xff_88f788, 0xff_20cc20));
|
|
||||||
//
|
|
||||||
// disabled = new TextStencilElement(Minecraft.getInstance().fontRenderer, "Disabled")
|
|
||||||
// .centered(true, true)
|
|
||||||
// .withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height/2, height, width, 0xff_f78888, 0xff_cc2020));
|
|
||||||
|
|
||||||
enabled = AllIcons.I_CONFIRM.asStencil()
|
enabled = AllIcons.I_CONFIRM.asStencil()
|
||||||
.withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2, height, width, Theme.p(Theme.Key.BUTTON_SUCCESS)))
|
.withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2, height, width, Theme.p(Theme.Key.BUTTON_SUCCESS)))
|
||||||
.at(10, 0);
|
.at(10, 0);
|
||||||
|
|
||||||
disabled = AllIcons.I_DISABLE.asStencil()
|
disabled = AllIcons.I_DISABLE.asStencil()
|
||||||
.withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2, height, width, Theme.p(Theme.Key.BUTTON_FAIL)))
|
.withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2, height, width, Theme.p(Theme.Key.BUTTON_FAIL)))
|
||||||
.at(10, 0);
|
.at(10, 0);
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class EnumEntry extends ValueEntry<Enum<?>> {
|
||||||
cycleLeft.y = y + 10;
|
cycleLeft.y = y + 10;
|
||||||
cycleLeft.render(ms, mouseX, mouseY, partialTicks);
|
cycleLeft.render(ms, mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
valueText.at(cycleLeft.x + cycleWidth - 8, y + 10, 200)
|
valueText.at(cycleLeft.x + cycleWidth - 8, y + 11, 200)
|
||||||
.withBounds(width - getLabelWidth(width) - 2 * cycleWidth - resetWidth - 4, 16)
|
.withBounds(width - getLabelWidth(width) - 2 * cycleWidth - resetWidth - 4, 16)
|
||||||
.render(ms);
|
.render(ms);
|
||||||
|
|
||||||
|
|
|
@ -169,25 +169,21 @@ public class ConfirmationScreen extends AbstractSimiScreen {
|
||||||
protected void renderWindowBackground(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindowBackground(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||||
|
|
||||||
UIRenderHelper.framebuffer.framebufferClear(Minecraft.IS_RUNNING_ON_MAC);
|
UIRenderHelper.framebuffer.framebufferClear(Minecraft.IS_RUNNING_ON_MAC);
|
||||||
//UIRenderHelper.prepFramebufferSize();
|
|
||||||
|
|
||||||
ms.push();
|
ms.push();
|
||||||
//ms.translate(0, 0, -50);
|
|
||||||
//ms.scale(1, 1, 0.01f);
|
|
||||||
//todo wait for jozu's framebuffer capabilities on the other branch and use them here
|
|
||||||
UIRenderHelper.framebuffer.bindFramebuffer(true);
|
UIRenderHelper.framebuffer.bindFramebuffer(true);
|
||||||
source.render(ms, mouseX, mouseY, 10);
|
source.render(ms, mouseX, mouseY, 10);
|
||||||
UIRenderHelper.framebuffer.unbindFramebuffer();
|
UIRenderHelper.framebuffer.unbindFramebuffer();
|
||||||
Framebuffer mainBuffer = Minecraft.getInstance().getFramebuffer();
|
Framebuffer mainBuffer = Minecraft.getInstance().getFramebuffer();
|
||||||
ms.pop();
|
ms.pop();
|
||||||
|
|
||||||
|
//fixme replace with glVersioned-backend calls once they are merged from jozu's branch
|
||||||
GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, UIRenderHelper.framebuffer.framebufferObject);
|
GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, UIRenderHelper.framebuffer.framebufferObject);
|
||||||
GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, mainBuffer.framebufferObject);
|
GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, mainBuffer.framebufferObject);
|
||||||
GL30.glBlitFramebuffer(0, 0, mainBuffer.framebufferWidth, mainBuffer.framebufferHeight, 0, 0, mainBuffer.framebufferWidth, mainBuffer.framebufferHeight, GL30.GL_COLOR_BUFFER_BIT, GL30.GL_LINEAR);
|
GL30.glBlitFramebuffer(0, 0, mainBuffer.framebufferWidth, mainBuffer.framebufferHeight, 0, 0, mainBuffer.framebufferWidth, mainBuffer.framebufferHeight, GL30.GL_COLOR_BUFFER_BIT, GL30.GL_LINEAR);
|
||||||
mainBuffer.bindFramebuffer(true);
|
mainBuffer.bindFramebuffer(true);
|
||||||
|
|
||||||
this.fillGradient(ms, 0, 0, this.width, this.height, 0x70101010, 0x80101010);
|
this.fillGradient(ms, 0, 0, this.width, this.height, 0x70101010, 0x80101010);
|
||||||
//RenderSystem.enableAlphaTest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -64,7 +64,6 @@ public class GuiGameElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class GuiRenderBuilder extends RenderElement {
|
public static abstract class GuiRenderBuilder extends RenderElement {
|
||||||
//double xBeforeScale, yBeforeScale, zBeforeScale = 0;
|
|
||||||
double xLocal, yLocal, zLocal;
|
double xLocal, yLocal, zLocal;
|
||||||
double xRot, yRot, zRot;
|
double xRot, yRot, zRot;
|
||||||
double scale = 1;
|
double scale = 1;
|
||||||
|
@ -78,19 +77,6 @@ public class GuiGameElement {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public GuiRenderBuilder at(double x, double y) {
|
|
||||||
this.xBeforeScale = x;
|
|
||||||
this.yBeforeScale = y;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GuiRenderBuilder at(double x, double y, double z) {
|
|
||||||
this.xBeforeScale = x;
|
|
||||||
this.yBeforeScale = y;
|
|
||||||
this.zBeforeScale = z;
|
|
||||||
return this;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public GuiRenderBuilder rotate(double xRot, double yRot, double zRot) {
|
public GuiRenderBuilder rotate(double xRot, double yRot, double zRot) {
|
||||||
this.xRot = xRot;
|
this.xRot = xRot;
|
||||||
this.yRot = yRot;
|
this.yRot = yRot;
|
||||||
|
@ -272,23 +258,10 @@ public class GuiGameElement {
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrixStack) {
|
public void render(MatrixStack matrixStack) {
|
||||||
prepareMatrix(matrixStack);
|
prepareMatrix(matrixStack);
|
||||||
// matrixStack.translate(0, 80, 0);
|
|
||||||
transformMatrix(matrixStack);
|
transformMatrix(matrixStack);
|
||||||
renderItemIntoGUI(matrixStack, stack);
|
renderItemIntoGUI(matrixStack, stack);
|
||||||
cleanUpMatrix(matrixStack);
|
cleanUpMatrix(matrixStack);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* public void render() {
|
|
||||||
* prepare();
|
|
||||||
* transform();
|
|
||||||
* RenderSystem.scaled(1, -1, 1);
|
|
||||||
* RenderSystem.translated(0, 0, -75);
|
|
||||||
* Minecraft.getInstance()
|
|
||||||
* .getItemRenderer()
|
|
||||||
* .renderItemIntoGUI(stack, 0, 0);
|
|
||||||
* cleanUp();
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static void renderItemIntoGUI(MatrixStack matrixStack, ItemStack stack) {
|
public static void renderItemIntoGUI(MatrixStack matrixStack, ItemStack stack) {
|
||||||
ItemRenderer renderer = Minecraft.getInstance()
|
ItemRenderer renderer = Minecraft.getInstance()
|
||||||
|
|
|
@ -56,7 +56,6 @@ public class TextStencilElement extends DelegatedStencilElement {
|
||||||
y = height / 2f - font.FONT_HEIGHT / 2f;
|
y = height / 2f - font.FONT_HEIGHT / 2f;
|
||||||
|
|
||||||
font.draw(ms, component, x, y, 0xff_000000);
|
font.draw(ms, component, x, y, 0xff_000000);
|
||||||
//font.draw(ms, component, 0, 0, 0xff_000000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,25 +33,17 @@ public class UIRenderHelper {
|
||||||
public static void init() {
|
public static void init() {
|
||||||
RenderSystem.recordRenderCall(() -> {
|
RenderSystem.recordRenderCall(() -> {
|
||||||
MainWindow mainWindow = Minecraft.getInstance()
|
MainWindow mainWindow = Minecraft.getInstance()
|
||||||
.getWindow();
|
.getWindow();
|
||||||
framebuffer = new Framebuffer(mainWindow.getFramebufferWidth(), mainWindow.getFramebufferHeight(), true,
|
framebuffer = new Framebuffer(mainWindow.getFramebufferWidth(), mainWindow.getFramebufferHeight(), true,
|
||||||
Minecraft.IS_RUNNING_ON_MAC);
|
Minecraft.IS_RUNNING_ON_MAC);
|
||||||
framebuffer.setFramebufferColor(0, 0, 0, 0);
|
framebuffer.setFramebufferColor(0, 0, 0, 0);
|
||||||
framebuffer.enableStencil();
|
framebuffer.enableStencil();
|
||||||
// framebuffer.deleteFramebuffer();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public static void prepFramebufferSize() {
|
|
||||||
MainWindow window = Minecraft.getInstance().getWindow();
|
|
||||||
if (framebuffer.framebufferWidth != window.getFramebufferWidth() || framebuffer.framebufferHeight != window.getFramebufferHeight()) {
|
|
||||||
framebuffer.func_216491_a(window.getFramebufferWidth(), window.getFramebufferHeight(), Minecraft.IS_RUNNING_ON_MAC);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public static void drawFramebuffer(float alpha) {
|
public static void drawFramebuffer(float alpha) {
|
||||||
MainWindow window = Minecraft.getInstance()
|
MainWindow window = Minecraft.getInstance()
|
||||||
.getWindow();
|
.getWindow();
|
||||||
|
|
||||||
float vx = (float) window.getScaledWidth();
|
float vx = (float) window.getScaledWidth();
|
||||||
float vy = (float) window.getScaledHeight();
|
float vy = (float) window.getScaledHeight();
|
||||||
|
@ -67,22 +59,10 @@ public class UIRenderHelper {
|
||||||
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||||
bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEXTURE);
|
bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEXTURE);
|
||||||
|
|
||||||
bufferbuilder.vertex(0, vy, 0)
|
bufferbuilder.vertex(0, vy, 0).color(1, 1, 1, alpha).texture(0, 0).endVertex();
|
||||||
.color(1, 1, 1, alpha)
|
bufferbuilder.vertex(vx, vy, 0).color(1, 1, 1, alpha).texture(tx, 0).endVertex();
|
||||||
.texture(0, 0)
|
bufferbuilder.vertex(vx, 0, 0).color(1, 1, 1, alpha).texture(tx, ty).endVertex();
|
||||||
.endVertex();
|
bufferbuilder.vertex(0, 0, 0).color(1, 1, 1, alpha).texture(0, ty).endVertex();
|
||||||
bufferbuilder.vertex(vx, vy, 0)
|
|
||||||
.color(1, 1, 1, alpha)
|
|
||||||
.texture(tx, 0)
|
|
||||||
.endVertex();
|
|
||||||
bufferbuilder.vertex(vx, 0, 0)
|
|
||||||
.color(1, 1, 1, alpha)
|
|
||||||
.texture(tx, ty)
|
|
||||||
.endVertex();
|
|
||||||
bufferbuilder.vertex(0, 0, 0)
|
|
||||||
.color(1, 1, 1, alpha)
|
|
||||||
.texture(0, ty)
|
|
||||||
.endVertex();
|
|
||||||
|
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
framebuffer.unbindFramebufferTexture();
|
framebuffer.unbindFramebufferTexture();
|
||||||
|
@ -118,7 +98,7 @@ public class UIRenderHelper {
|
||||||
double split1 = .5;
|
double split1 = .5;
|
||||||
double split2 = .75;
|
double split2 = .75;
|
||||||
Matrix4f model = ms.peek()
|
Matrix4f model = ms.peek()
|
||||||
.getModel();
|
.getModel();
|
||||||
GuiUtils.drawGradientRect(model, 0, -width, 0, width, (int) (split1 * height), c1, c2);
|
GuiUtils.drawGradientRect(model, 0, -width, 0, width, (int) (split1 * height), c1, c2);
|
||||||
GuiUtils.drawGradientRect(model, 0, -width, (int) (split1 * height), width, (int) (split2 * height), c2, c3);
|
GuiUtils.drawGradientRect(model, 0, -width, (int) (split1 * height), width, (int) (split2 * height), c2, c3);
|
||||||
GuiUtils.drawGradientRect(model, 0, -width, (int) (split2 * height), width, height, c3, c4);
|
GuiUtils.drawGradientRect(model, 0, -width, (int) (split2 * height), width, height, c3, c4);
|
||||||
|
@ -130,26 +110,28 @@ public class UIRenderHelper {
|
||||||
public static void angledGradient(@Nonnull MatrixStack ms, float angle, int x, int y, int breadth, int length, Couple<Color> c) {
|
public static void angledGradient(@Nonnull MatrixStack ms, float angle, int x, int y, int breadth, int length, Couple<Color> c) {
|
||||||
angledGradient(ms, angle, x, y, 0, breadth, length, c);
|
angledGradient(ms, angle, x, y, 0, breadth, length, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see #angledGradient(MatrixStack, float, int, int, int, int, int, int, int)
|
* @see #angledGradient(MatrixStack, float, int, int, int, int, int, int, int)
|
||||||
*/
|
*/
|
||||||
public static void angledGradient(@Nonnull MatrixStack ms, float angle, int x, int y, int z, int breadth, int length, Couple<Color> c) {
|
public static void angledGradient(@Nonnull MatrixStack ms, float angle, int x, int y, int z, int breadth, int length, Couple<Color> c) {
|
||||||
angledGradient(ms, angle, x, y, z, breadth, length, c.getFirst().getRGB(), c.getSecond().getRGB());
|
angledGradient(ms, angle, x, y, z, breadth, length, c.getFirst().getRGB(), c.getSecond().getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see #angledGradient(MatrixStack, float, int, int, int, int, int, int, int)
|
* @see #angledGradient(MatrixStack, float, int, int, int, int, int, int, int)
|
||||||
*/
|
*/
|
||||||
public static void angledGradient(@Nonnull MatrixStack ms, float angle, int x, int y, int breadth, int length, int color1, int color2) {
|
public static void angledGradient(@Nonnull MatrixStack ms, float angle, int x, int y, int breadth, int length, int color1, int color2) {
|
||||||
angledGradient(ms, angle, x, y, 0, breadth, length, color1, color2);
|
angledGradient(ms, angle, x, y, 0, breadth, length, color1, color2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* x and y specify the middle point of the starting edge
|
* x and y specify the middle point of the starting edge
|
||||||
*
|
*
|
||||||
* @param angle the angle of the gradient in degrees; 0° means from left to right
|
* @param angle the angle of the gradient in degrees; 0° means from left to right
|
||||||
* @param color1 the color at the starting edge
|
* @param color1 the color at the starting edge
|
||||||
* @param color2 the color at the ending edge
|
* @param color2 the color at the ending edge
|
||||||
* @param breadth the total width of the gradient
|
* @param breadth the total width of the gradient
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static void angledGradient(@Nonnull MatrixStack ms, float angle, int x, int y, int z, int breadth, int length, int color1, int color2) {
|
public static void angledGradient(@Nonnull MatrixStack ms, float angle, int x, int y, int z, int breadth, int length, int color1, int color2) {
|
||||||
ms.push();
|
ms.push();
|
||||||
|
@ -178,13 +160,13 @@ public class UIRenderHelper {
|
||||||
private static void breadcrumbArrow(MatrixStack ms, int width, int height, int indent, int c1, int c2) {
|
private static void breadcrumbArrow(MatrixStack ms, int width, int height, int indent, int c1, int c2) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 0,0 x1,y1 ********************* x4,y4 ***** x7,y7
|
* 0,0 x1,y1 ********************* x4,y4 ***** x7,y7
|
||||||
* **** ****
|
* **** ****
|
||||||
* **** ****
|
* **** ****
|
||||||
* x0,y0 x2,y2 x5,y5
|
* x0,y0 x2,y2 x5,y5
|
||||||
* **** ****
|
* **** ****
|
||||||
* **** ****
|
* **** ****
|
||||||
* x3,y3 ********************* x6,y6 ***** x8,y8
|
* x3,y3 ********************* x6,y6 ***** x8,y8
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -214,69 +196,32 @@ public class UIRenderHelper {
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||||
Matrix4f model = ms.peek()
|
Matrix4f model = ms.peek().getModel();
|
||||||
.getModel();
|
|
||||||
bufferbuilder.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR);
|
bufferbuilder.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR);
|
||||||
|
|
||||||
bufferbuilder.vertex(model, x0, y0, 0)
|
bufferbuilder.vertex(model, x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex();
|
||||||
.color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF)
|
bufferbuilder.vertex(model, x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
|
||||||
.endVertex();
|
bufferbuilder.vertex(model, x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
|
||||||
bufferbuilder.vertex(model, x1, y1, 0)
|
|
||||||
.color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
bufferbuilder.vertex(model, x2, y2, 0)
|
|
||||||
.color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
|
|
||||||
bufferbuilder.vertex(model, x0, y0, 0)
|
bufferbuilder.vertex(model, x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex();
|
||||||
.color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF)
|
bufferbuilder.vertex(model, x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
|
||||||
.endVertex();
|
bufferbuilder.vertex(model, x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
|
||||||
bufferbuilder.vertex(model, x2, y2, 0)
|
|
||||||
.color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
bufferbuilder.vertex(model, x3, y3, 0)
|
|
||||||
.color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
|
|
||||||
bufferbuilder.vertex(model, x3, y3, 0)
|
bufferbuilder.vertex(model, x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
|
||||||
.color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF)
|
bufferbuilder.vertex(model, x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
|
||||||
.endVertex();
|
bufferbuilder.vertex(model, x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
|
||||||
bufferbuilder.vertex(model, x1, y1, 0)
|
|
||||||
.color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
bufferbuilder.vertex(model, x4, y4, 0)
|
|
||||||
.color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
|
|
||||||
bufferbuilder.vertex(model, x3, y3, 0)
|
bufferbuilder.vertex(model, x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
|
||||||
.color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF)
|
bufferbuilder.vertex(model, x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
|
||||||
.endVertex();
|
bufferbuilder.vertex(model, x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
|
||||||
bufferbuilder.vertex(model, x4, y4, 0)
|
|
||||||
.color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
bufferbuilder.vertex(model, x6, y6, 0)
|
|
||||||
.color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
|
|
||||||
bufferbuilder.vertex(model, x5, y5, 0)
|
bufferbuilder.vertex(model, x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
|
||||||
.color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF)
|
bufferbuilder.vertex(model, x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
|
||||||
.endVertex();
|
bufferbuilder.vertex(model, x7, y7, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex();
|
||||||
bufferbuilder.vertex(model, x4, y4, 0)
|
|
||||||
.color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
bufferbuilder.vertex(model, x7, y7, 0)
|
|
||||||
.color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
|
|
||||||
bufferbuilder.vertex(model, x6, y6, 0)
|
bufferbuilder.vertex(model, x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
|
||||||
.color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF)
|
bufferbuilder.vertex(model, x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
|
||||||
.endVertex();
|
bufferbuilder.vertex(model, x8, y8, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex();
|
||||||
bufferbuilder.vertex(model, x5, y5, 0)
|
|
||||||
.color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
bufferbuilder.vertex(model, x8, y8, 0)
|
|
||||||
.color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF)
|
|
||||||
.endVertex();
|
|
||||||
|
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
RenderSystem.shadeModel(GL11.GL_FLAT);
|
RenderSystem.shadeModel(GL11.GL_FLAT);
|
||||||
|
@ -288,7 +233,7 @@ public class UIRenderHelper {
|
||||||
|
|
||||||
//just like AbstractGui#drawTexture, but with a color at every vertex
|
//just like AbstractGui#drawTexture, but with a color at every vertex
|
||||||
public static void drawColoredTexture(MatrixStack ms, Color c, int x, int y, int tex_left, int tex_top, int width, int height) {
|
public static void drawColoredTexture(MatrixStack ms, Color c, int x, int y, int tex_left, int tex_top, int width, int height) {
|
||||||
drawColoredTexture(ms, c, x, y, 0, (float)tex_left, (float)tex_top, width, height, 256, 256);
|
drawColoredTexture(ms, c, x, y, 0, (float) tex_left, (float) tex_top, width, height, 256, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawColoredTexture(MatrixStack ms, Color c, int x, int y, int z, float tex_left, float tex_top, int width, int height, int sheet_width, int sheet_height) {
|
public static void drawColoredTexture(MatrixStack ms, Color c, int x, int y, int z, float tex_left, float tex_top, int width, int height, int sheet_width, int sheet_height) {
|
||||||
|
@ -296,17 +241,17 @@ public class UIRenderHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawColoredTexture(MatrixStack ms, Color c, int left, int right, int top, int bot, int z, int tex_width, int tex_height, float tex_left, float tex_top, int sheet_width, int sheet_height) {
|
private static void drawColoredTexture(MatrixStack ms, Color c, int left, int right, int top, int bot, int z, int tex_width, int tex_height, float tex_left, float tex_top, int sheet_width, int sheet_height) {
|
||||||
drawTexturedQuad(ms.peek().getModel(), c, left, right, top, bot, z, (tex_left + 0.0F) / (float)sheet_width, (tex_left + (float)tex_width) / (float)sheet_width, (tex_top + 0.0F) / (float)sheet_height, (tex_top + (float)tex_height) / (float)sheet_height);
|
drawTexturedQuad(ms.peek().getModel(), c, left, right, top, bot, z, (tex_left + 0.0F) / (float) sheet_width, (tex_left + (float) tex_width) / (float) sheet_width, (tex_top + 0.0F) / (float) sheet_height, (tex_top + (float) tex_height) / (float) sheet_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawTexturedQuad(Matrix4f m, Color c, int left, int right, int top, int bot, int z, float u1, float u2, float v1, float v2) {
|
private static void drawTexturedQuad(Matrix4f m, Color c, int left, int right, int top, int bot, int z, float u1, float u2, float v1, float v2) {
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer();
|
BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer();
|
||||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR_TEXTURE);
|
bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEXTURE);
|
||||||
bufferbuilder.vertex(m, (float)left , (float)bot, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u1, v2).endVertex();
|
bufferbuilder.vertex(m, (float) left , (float) bot, (float) z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u1, v2).endVertex();
|
||||||
bufferbuilder.vertex(m, (float)right, (float)bot, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u2, v2).endVertex();
|
bufferbuilder.vertex(m, (float) right, (float) bot, (float) z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u2, v2).endVertex();
|
||||||
bufferbuilder.vertex(m, (float)right, (float)top, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u2, v1).endVertex();
|
bufferbuilder.vertex(m, (float) right, (float) top, (float) z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u2, v1).endVertex();
|
||||||
bufferbuilder.vertex(m, (float)left , (float)top, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u1, v1).endVertex();
|
bufferbuilder.vertex(m, (float) left , (float) top, (float) z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u1, v1).endVertex();
|
||||||
bufferbuilder.finishDrawing();
|
bufferbuilder.finishDrawing();
|
||||||
RenderSystem.enableAlphaTest();
|
RenderSystem.enableAlphaTest();
|
||||||
WorldVertexBufferUploader.draw(bufferbuilder);
|
WorldVertexBufferUploader.draw(bufferbuilder);
|
||||||
|
|
|
@ -134,14 +134,14 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen {
|
||||||
|
|
||||||
// draw last screen into buffer
|
// draw last screen into buffer
|
||||||
if (lastScreen != null && lastScreen != this && !transition.settled()) {
|
if (lastScreen != null && lastScreen != this && !transition.settled()) {
|
||||||
ms.push();// 1
|
ms.push();
|
||||||
UIRenderHelper.framebuffer.framebufferClear(Minecraft.IS_RUNNING_ON_MAC);
|
UIRenderHelper.framebuffer.framebufferClear(Minecraft.IS_RUNNING_ON_MAC);
|
||||||
//UIRenderHelper.prepFramebufferSize();
|
|
||||||
ms.push();// 2
|
|
||||||
ms.translate(0, 0, -1000);
|
ms.translate(0, 0, -1000);
|
||||||
UIRenderHelper.framebuffer.bindFramebuffer(true);
|
UIRenderHelper.framebuffer.bindFramebuffer(true);
|
||||||
lastScreen.render(ms, mouseX, mouseY, partialTicks);
|
lastScreen.render(ms, mouseX, mouseY, partialTicks);
|
||||||
ms.pop();// 2
|
|
||||||
|
ms.pop();
|
||||||
|
ms.push();
|
||||||
|
|
||||||
// use the buffer texture
|
// use the buffer texture
|
||||||
Minecraft.getInstance()
|
Minecraft.getInstance()
|
||||||
|
@ -157,10 +157,8 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen {
|
||||||
dpy = ((NavigatableSimiScreen) lastScreen).depthPointY;
|
dpy = ((NavigatableSimiScreen) lastScreen).depthPointY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// transitionV is 1/-1 when the older screen is hidden
|
|
||||||
// transitionV is 0 when the older screen is still fully visible
|
|
||||||
ms.translate(dpx, dpy, 0);
|
ms.translate(dpx, dpy, 0);
|
||||||
ms.scale((float) scale, (float) scale, 1);
|
ms.scale(scale, scale, 1);
|
||||||
ms.translate(-dpx, -dpy, 0);
|
ms.translate(-dpx, -dpy, 0);
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
|
@ -168,13 +166,13 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen {
|
||||||
UIRenderHelper.drawFramebuffer(1f - Math.abs(transitionValue));
|
UIRenderHelper.drawFramebuffer(1f - Math.abs(transitionValue));
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
RenderSystem.enableAlphaTest();
|
RenderSystem.enableAlphaTest();
|
||||||
ms.pop();// 1
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// modify current screen as well
|
// modify current screen as well
|
||||||
scale = transitionValue > 0 ? 1 - 0.5f * (1 - transitionValue) : 1 + .5f * (1 + transitionValue);
|
scale = transitionValue > 0 ? 1 - 0.5f * (1 - transitionValue) : 1 + .5f * (1 + transitionValue);
|
||||||
ms.translate(depthPointX, depthPointY, 0);
|
ms.translate(depthPointX, depthPointY, 0);
|
||||||
ms.scale((float) scale, (float) scale, 1);
|
ms.scale(scale, scale, 1);
|
||||||
ms.translate(-depthPointX, -depthPointY, 0);
|
ms.translate(-depthPointX, -depthPointY, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@ package com.simibubi.create.foundation.ponder;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import org.antlr.v4.runtime.misc.IntegerList;
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.foundation.gui.BoxElement;
|
import com.simibubi.create.foundation.gui.BoxElement;
|
||||||
import com.simibubi.create.foundation.gui.Theme;
|
import com.simibubi.create.foundation.gui.Theme;
|
||||||
|
@ -27,20 +25,20 @@ public class PonderProgressBar extends AbstractSimiWidget {
|
||||||
|
|
||||||
this.ponder = ponder;
|
this.ponder = ponder;
|
||||||
progress = LerpedFloat.linear()
|
progress = LerpedFloat.linear()
|
||||||
.startWithValue(0);
|
.startWithValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick() {
|
public void tick() {
|
||||||
progress.chase(ponder.getActiveScene()
|
progress.chase(ponder.getActiveScene()
|
||||||
.getSceneProgress(), .5f, LerpedFloat.Chaser.EXP);
|
.getSceneProgress(), .5f, LerpedFloat.Chaser.EXP);
|
||||||
progress.tickChaser();
|
progress.tickChaser();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean clicked(double mouseX, double mouseY) {
|
protected boolean clicked(double mouseX, double mouseY) {
|
||||||
return this.active && this.visible && !ponder.getActiveScene().keyframeTimes.isEmpty()
|
return this.active && this.visible && !ponder.getActiveScene().keyframeTimes.isEmpty()
|
||||||
&& mouseX >= (double) this.x && mouseX < (double) (this.x + this.width + 4) && mouseY >= (double) this.y - 3
|
&& mouseX >= (double) this.x && mouseX < (double) (this.x + this.width + 4) && mouseY >= (double) this.y - 3
|
||||||
&& mouseY < (double) (this.y + this.height + 20);
|
&& mouseY < (double) (this.y + this.height + 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -101,7 +99,6 @@ public class PonderProgressBar extends AbstractSimiWidget {
|
||||||
.withBounds(width, height)
|
.withBounds(width, height)
|
||||||
.render(ms);
|
.render(ms);
|
||||||
|
|
||||||
|
|
||||||
ms.push();
|
ms.push();
|
||||||
ms.translate(x - 2, y - 2, 150);
|
ms.translate(x - 2, y - 2, 150);
|
||||||
|
|
||||||
|
@ -157,7 +154,7 @@ public class PonderProgressBar extends AbstractSimiWidget {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||||
GuiUtils.drawGradientRect(ms.peek()
|
GuiUtils.drawGradientRect(ms.peek()
|
||||||
.getModel(), 100, keyframePos, 10, keyframePos + 1, 10 + height, endColor, startColor);
|
.getModel(), 100, keyframePos, 10, keyframePos + 1, 10 + height, endColor, startColor);
|
||||||
ms.push();
|
ms.push();
|
||||||
ms.translate(0, 0, 100);
|
ms.translate(0, 0, 100);
|
||||||
String text;
|
String text;
|
||||||
|
@ -174,7 +171,7 @@ public class PonderProgressBar extends AbstractSimiWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiUtils.drawGradientRect(ms.peek()
|
GuiUtils.drawGradientRect(ms.peek()
|
||||||
.getModel(), 500, keyframePos, -1, keyframePos + 1, 2 + height, startColor, endColor);
|
.getModel(), 500, keyframePos, -1, keyframePos + 1, 2 + height, startColor, endColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
.showing(AllIcons.I_MTD_SLOW_MODE)
|
.showing(AllIcons.I_MTD_SLOW_MODE)
|
||||||
.enableFade(0, 5)
|
.enableFade(0, 5)
|
||||||
.withCallback(() -> setComfyReadingEnabled(!isComfyReadingEnabled())));
|
.withCallback(() -> setComfyReadingEnabled(!isComfyReadingEnabled())));
|
||||||
|
|
||||||
if (PonderIndex.EDITOR_MODE) {
|
if (PonderIndex.EDITOR_MODE) {
|
||||||
widgets.add(userMode = new PonderButton(width - 50 - 31, bY)
|
widgets.add(userMode = new PonderButton(width - 50 - 31, bY)
|
||||||
.showing(AllIcons.I_MTD_USER_MODE)
|
.showing(AllIcons.I_MTD_USER_MODE)
|
||||||
|
@ -443,7 +443,6 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
|
|
||||||
MutableBoundingBox bounds = story.getBounds();
|
MutableBoundingBox bounds = story.getBounds();
|
||||||
ms.push();
|
ms.push();
|
||||||
// ms.peek().getModel().multiply(ms.peek().getModel());
|
|
||||||
|
|
||||||
// kool shadow fx
|
// kool shadow fx
|
||||||
{
|
{
|
||||||
|
@ -560,7 +559,6 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
int streakHeight = 35 - 9 + wordWrappedHeight;
|
int streakHeight = 35 - 9 + wordWrappedHeight;
|
||||||
UIRenderHelper.streak(ms, 0, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (150 * fade));
|
UIRenderHelper.streak(ms, 0, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (150 * fade));
|
||||||
UIRenderHelper.streak(ms, 180, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (30 * fade));
|
UIRenderHelper.streak(ms, 180, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (30 * fade));
|
||||||
//renderBox(ms, 21, 21, 30, 30, false);
|
|
||||||
new BoxElement()
|
new BoxElement()
|
||||||
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
|
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
|
||||||
.gradientBorder(Theme.p(Theme.Key.PONDER_IDLE))
|
.gradientBorder(Theme.p(Theme.Key.PONDER_IDLE))
|
||||||
|
@ -577,7 +575,6 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
textRenderer.draw(ms, Lang.translate(PONDERING), x, y - 6, tooltipColor);
|
textRenderer.draw(ms, Lang.translate(PONDERING), x, y - 6, tooltipColor);
|
||||||
y += 8;
|
y += 8;
|
||||||
x += 0;
|
x += 0;
|
||||||
// ms.translate(0, 3 * (indexDiff), 0);
|
|
||||||
ms.translate(x, y, 0);
|
ms.translate(x, y, 0);
|
||||||
ms.multiply(Vector3f.NEGATIVE_X.getDegreesQuaternion(indexDiff * -75));
|
ms.multiply(Vector3f.NEGATIVE_X.getDegreesQuaternion(indexDiff * -75));
|
||||||
ms.translate(0, 0, 5);
|
ms.translate(0, 0, 5);
|
||||||
|
@ -740,22 +737,6 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
ms.pop();
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*protected void lowerButtonGroup(MatrixStack ms, int index, int mouseX, int mouseY, float fade, AllIcons icon, KeyBinding key) {
|
|
||||||
int bWidth = 20;
|
|
||||||
int bHeight = 20;
|
|
||||||
int bX = (width - bWidth) / 2 + (index - 1) * (bWidth + 8);
|
|
||||||
int bY = height - bHeight - 31;
|
|
||||||
|
|
||||||
ms.push();
|
|
||||||
if (fade < fadeIn.getChaseTarget())
|
|
||||||
ms.translate(0, (1 - fade) * 5, 0);
|
|
||||||
boolean hovered = isMouseOver(mouseX, mouseY, bX, bY, bWidth, bHeight);
|
|
||||||
renderBox(ms, bX, bY, bWidth, bHeight, hovered);
|
|
||||||
icon.draw(ms, bX + 2, bY + 2);
|
|
||||||
drawCenteredText(ms, textRenderer, key.getBoundKeyLocalizedText(), bX + bWidth / 2 + 8, bY + bHeight - 6, 0xff606060);
|
|
||||||
ms.pop();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private void renderOverlay(MatrixStack ms, int i, float partialTicks) {
|
private void renderOverlay(MatrixStack ms, int i, float partialTicks) {
|
||||||
if (identifyMode)
|
if (identifyMode)
|
||||||
return;
|
return;
|
||||||
|
@ -767,23 +748,6 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseClicked(double x, double y, int button) {
|
public boolean mouseClicked(double x, double y, int button) {
|
||||||
/*MutableBoolean handled = new MutableBoolean(false);
|
|
||||||
widgets.forEach(w -> {
|
|
||||||
if (handled.booleanValue())
|
|
||||||
return;
|
|
||||||
if (!w.isMouseOver(x, y))
|
|
||||||
return;
|
|
||||||
if (w instanceof PonderButton) {
|
|
||||||
PonderButton mtdButton = (PonderButton) w;
|
|
||||||
mtdButton.runCallback(x, y);
|
|
||||||
handled.setTrue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (handled.booleanValue())
|
|
||||||
return true;*/
|
|
||||||
|
|
||||||
if (identifyMode && hoveredBlockPos != null && PonderIndex.EDITOR_MODE) {
|
if (identifyMode && hoveredBlockPos != null && PonderIndex.EDITOR_MODE) {
|
||||||
long handle = client.getWindow()
|
long handle = client.getWindow()
|
||||||
.getHandle();
|
.getHandle();
|
||||||
|
@ -920,7 +884,6 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//renderBox(ms, boxX, boxY, w, h, highlighted);
|
|
||||||
new BoxElement()
|
new BoxElement()
|
||||||
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
|
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
|
||||||
.gradientBorder(borderColors)
|
.gradientBorder(borderColors)
|
||||||
|
@ -945,21 +908,6 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public static void renderBox(MatrixStack ms, int x, int y, int w, int h, int backgroundColor, int borderColorStart,
|
|
||||||
int borderColorEnd) {
|
|
||||||
int z = 100;
|
|
||||||
Matrix4f model = ms.peek().getModel();
|
|
||||||
GuiUtils.drawGradientRect(model, z, x - 3, y - 4, x + w + 3, y - 3, backgroundColor, backgroundColor);
|
|
||||||
GuiUtils.drawGradientRect(model, z, x - 3, y + h + 3, x + w + 3, y + h + 4, backgroundColor, backgroundColor);
|
|
||||||
GuiUtils.drawGradientRect(model, z, x - 3, y - 3, x + w + 3, y + h + 3, backgroundColor, backgroundColor);
|
|
||||||
GuiUtils.drawGradientRect(model, z, x - 4, y - 3, x - 3, y + h + 3, backgroundColor, backgroundColor);
|
|
||||||
GuiUtils.drawGradientRect(model, z, x + w + 3, y - 3, x + w + 4, y + h + 3, backgroundColor, backgroundColor);
|
|
||||||
GuiUtils.drawGradientRect(model, z, x - 3, y - 3 + 1, x - 3 + 1, y + h + 3 - 1, borderColorStart, borderColorEnd);
|
|
||||||
GuiUtils.drawGradientRect(model, z, x + w + 2, y - 3 + 1, x + w + 3, y + h + 3 - 1, borderColorStart, borderColorEnd);
|
|
||||||
GuiUtils.drawGradientRect(model, z, x - 3, y - 3, x + w + 3, y - 3 + 1, borderColorStart, borderColorStart);
|
|
||||||
GuiUtils.drawGradientRect(model, z, x - 3, y + h + 2, x + w + 3, y + h + 3, borderColorEnd, borderColorEnd);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public ItemStack getHoveredTooltipItem() {
|
public ItemStack getHoveredTooltipItem() {
|
||||||
return hoveredTooltipItem;
|
return hoveredTooltipItem;
|
||||||
}
|
}
|
||||||
|
@ -1026,4 +974,4 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
AllConfigs.CLIENT.comfyReading.set(slowTextMode);
|
AllConfigs.CLIENT.comfyReading.set(slowTextMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue