idk
This commit is contained in:
parent
38e2fd5651
commit
38cea35593
File diff suppressed because it is too large
Load Diff
56305
javascript/classes.js
56305
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,9 @@ package dev.resent.util.render;
|
||||||
|
|
||||||
import dev.resent.module.base.setting.ModeSetting;
|
import dev.resent.module.base.setting.ModeSetting;
|
||||||
import dev.resent.visual.ui.Theme;
|
import dev.resent.visual.ui.Theme;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums;
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Gui;
|
import net.minecraft.client.gui.Gui;
|
||||||
|
@ -56,6 +58,70 @@ public class RenderUtils {
|
||||||
return Color.HSBtoRGB(hue, 0.5f, 1f);
|
return Color.HSBtoRGB(hue, 0.5f, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void drawOtherRoundedRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, float radius, int color, boolean popPush) {
|
||||||
|
float alpha = (color >> 24 & 0xFF) / 255.0F;
|
||||||
|
float red = (color >> 16 & 0xFF) / 255.0F;
|
||||||
|
float green = (color >> 8 & 0xFF) / 255.0F;
|
||||||
|
float blue = (color & 0xFF) / 255.0F;
|
||||||
|
|
||||||
|
float z = 0;
|
||||||
|
if (paramXStart > paramXEnd) {
|
||||||
|
z = paramXStart;
|
||||||
|
paramXStart = paramXEnd;
|
||||||
|
paramXEnd = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (paramYStart > paramYEnd) {
|
||||||
|
z = paramYStart;
|
||||||
|
paramYStart = paramYEnd;
|
||||||
|
paramYEnd = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
double x1 = (double)(paramXStart + radius);
|
||||||
|
double y1 = (double)(paramYStart + radius);
|
||||||
|
double x2 = (double)(paramXEnd - radius);
|
||||||
|
double y2 = (double)(paramYEnd - radius);
|
||||||
|
|
||||||
|
if (popPush)
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.enableTexture2D();
|
||||||
|
GlStateManager.blendFunc(RealOpenGLEnums.GL_SRC_ALPHA, RealOpenGLEnums.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
EaglercraftGPU.glLineWidth(1);
|
||||||
|
//glEnable(GL_LINE_SMOOTH);
|
||||||
|
|
||||||
|
GlStateManager.color(red, green, blue, alpha);
|
||||||
|
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||||
|
|
||||||
|
worldrenderer.begin(RealOpenGLEnums.GL_POLYGON, DefaultVertexFormats.POSITION_TEX);
|
||||||
|
worldrenderer.begin(RealOpenGLEnums.GL_LINE_SMOOTH, DefaultVertexFormats.POSITION_TEX);
|
||||||
|
|
||||||
|
double degree = Math.PI / 180;
|
||||||
|
for (double i = 0; i <= 90; i += 1)
|
||||||
|
glVertex2d(x2 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius);
|
||||||
|
for (double i = 90; i <= 180; i += 1)
|
||||||
|
glVertex2d(x2 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius);
|
||||||
|
for (double i = 180; i <= 270; i += 1)
|
||||||
|
glVertex2d(x1 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius);
|
||||||
|
for (double i = 270; i <= 360; i += 1)
|
||||||
|
glVertex2d(x1 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius);
|
||||||
|
EaglercraftGPU.glEndList();
|
||||||
|
|
||||||
|
GlStateManager.enableTexture2D();
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
//glDisable(GL_LINE_SMOOTH);
|
||||||
|
if (popPush)
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void glVertex2d(double idk, double idk2){
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||||
|
worldrenderer.pos(idk, idk2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public static void drawRoundedRect(final float paramInt1, final float paramInt2, final float paramInt3, final float paramInt4, final float radius, final int color, boolean... forceOverride) {
|
public static void drawRoundedRect(final float paramInt1, final float paramInt2, final float paramInt3, final float paramInt4, final float radius, final int color, boolean... forceOverride) {
|
||||||
final float f1 = (color >> 24 & 0xFF) / 255.0f;
|
final float f1 = (color >> 24 & 0xFF) / 255.0f;
|
||||||
final float f2 = (color >> 16 & 0xFF) / 255.0f;
|
final float f2 = (color >> 16 & 0xFF) / 255.0f;
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class Gui {
|
||||||
* Renders the specified text to the screen, center-aligned.
|
* Renders the specified text to the screen, center-aligned.
|
||||||
* Args : renderer, string, x, y, color
|
* Args : renderer, string, x, y, color
|
||||||
*/
|
*/
|
||||||
public static void drawCenteredString(FontRenderer fontRendererIn, String text, int x, int y, int color) {
|
public static void drawCenteredString(FontRenderer fontRendererIn, String text, float x, float y, int color) {
|
||||||
fontRendererIn.drawString(text, (float) (x - fontRendererIn.getStringWidth(text) / 2), (float) y, color, true);
|
fontRendererIn.drawString(text, (float) (x - fontRendererIn.getStringWidth(text) / 2), (float) y, color, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,14 @@ package net.minecraft.client.gui;
|
||||||
|
|
||||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||||
|
|
||||||
|
import dev.resent.util.render.Color;
|
||||||
|
import dev.resent.util.render.RenderUtils;
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
import net.minecraft.client.audio.SoundHandler;
|
import net.minecraft.client.audio.SoundHandler;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
/**+
|
/**+
|
||||||
|
@ -76,29 +80,14 @@ public class GuiButton extends Gui {
|
||||||
* Draws this button to the screen.
|
* Draws this button to the screen.
|
||||||
*/
|
*/
|
||||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||||
if (this.visible) {
|
if(!Tessellator.getInstance().getWorldRenderer().isDrawing)
|
||||||
FontRenderer fontrenderer = mc.fontRendererObj;
|
RenderUtils.drawRoundedRect(this.xPosition, this.yPosition, xPosition + width, yPosition + this.height, 4, Color.BLACK.getRGB(), true);
|
||||||
mc.getTextureManager().bindTexture(buttonTextures);
|
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
|
||||||
int i = this.getHoverState(this.hovered);
|
|
||||||
GlStateManager.enableBlend();
|
|
||||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
|
||||||
GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + i * 20, this.width / 2, this.height);
|
|
||||||
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
|
||||||
this.mouseDragged(mc, mouseX, mouseY);
|
|
||||||
int j = 14737632;
|
|
||||||
if (!this.enabled) {
|
|
||||||
j = 10526880;
|
|
||||||
} else if (this.hovered) {
|
|
||||||
j = 16777120;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j);
|
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||||
}
|
drawCenteredString(mc.fontRendererObj, this.displayString, this.xPosition + this.width / 2f, this.yPosition + (this.height - 8) / 2f, this.hovered ? new Color(47, 116, 253, 255).getRGB() : new Color(200, 200, 200).getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**+
|
/**+
|
||||||
* Fired when the mouse button is dragged. Equivalent of
|
* Fired when the mouse button is dragged. Equivalent of
|
||||||
* MouseListener.mouseDragged(MouseEvent e).
|
* MouseListener.mouseDragged(MouseEvent e).
|
||||||
|
|
Loading…
Reference in New Issue
Block a user