whar
This commit is contained in:
parent
38cea35593
commit
266e877f20
File diff suppressed because it is too large
Load Diff
57151
javascript/classes.js
57151
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,9 +1,13 @@
|
||||||
/*package dev.resent.util.render;
|
package dev.resent.util.render;
|
||||||
|
|
||||||
|
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.RealOpenGLEnums;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
|
||||||
public class RoundedUtil {
|
public class RoundedUtil {
|
||||||
final static Minecraft mc = Minecraft.getMinecraft();
|
final static Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
@ -11,18 +15,21 @@ public class RoundedUtil {
|
||||||
|
|
||||||
|
|
||||||
public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
|
public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
|
||||||
glPushAttrib(0);
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||||
GlStateManager.scale(0.5D, 0.5D, 0.5D);
|
GlStateManager.scale(0.5D, 0.5D, 0.5D);
|
||||||
x *= 2.0D;
|
x *= 2.0D;
|
||||||
y *= 2.0D;
|
y *= 2.0D;
|
||||||
x1 *= 2.0D;
|
x1 *= 2.0D;
|
||||||
y1 *= 2.0D;
|
y1 *= 2.0D;
|
||||||
glEnable(RealOpenGLEnums.GL_BLEND);
|
GlStateManager.enableBlend();
|
||||||
glDisable(RealOpenGLEnums.GL_TEXTURE_2D);
|
GlStateManager.disableTexture2D();
|
||||||
glEnable(RealOpenGLEnums.GL_LINE_SMOOTH);
|
float alpha = (color >> 24 & 0xFF) / 255.0F;
|
||||||
setColor(color);
|
float red = (color >> 16 & 0xFF) / 255.0F;
|
||||||
glEnable(RealOpenGLEnums.GL_LINE_SMOOTH);
|
float green = (color >> 8 & 0xFF) / 255.0F;
|
||||||
glBegin(RealOpenGLEnums.GL_POLYGON);
|
float blue = (color & 0xFF) / 255.0F;
|
||||||
|
GlStateManager.color(red, green, blue, alpha);
|
||||||
|
worldrenderer.begin(RealOpenGLEnums.GL_POLYGON, DefaultVertexFormats.POSITION_TEX);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i <= 90; i += 3)
|
for (i = 0; i <= 90; i += 3)
|
||||||
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
|
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
|
||||||
|
@ -32,8 +39,8 @@ public class RoundedUtil {
|
||||||
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
||||||
for (i = 90; i <= 180; i += 3)
|
for (i = 90; i <= 180; i += 3)
|
||||||
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
||||||
glEnd();
|
EaglercraftGPU.glEndList();
|
||||||
glBegin(RealOpenGLEnums.GL_LINE_LOOP);
|
worldrenderer.begin(RealOpenGLEnums.GL_LINE_LOOP, DefaultVertexFormats.POSITION_TEX);
|
||||||
for (i = 0; i <= 90; i += 3)
|
for (i = 0; i <= 90; i += 3)
|
||||||
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
|
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
|
||||||
for (i = 90; i <= 180; i += 3)
|
for (i = 90; i <= 180; i += 3)
|
||||||
|
@ -42,30 +49,31 @@ public class RoundedUtil {
|
||||||
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
||||||
for (i = 90; i <= 180; i += 3)
|
for (i = 90; i <= 180; i += 3)
|
||||||
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
||||||
glEnd();
|
EaglercraftGPU.glEndList();
|
||||||
GlStateManager.enableTexture2D();
|
GlStateManager.enableTexture2D();
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
glDisable(RealOpenGLEnums.GL_LINE_SMOOTH);
|
|
||||||
glDisable(RealOpenGLEnums.GL_LINE_SMOOTH);
|
|
||||||
GlStateManager.enableTexture2D();
|
GlStateManager.enableTexture2D();
|
||||||
GlStateManager.scale(2.0D, 2.0D, 2.0D);
|
GlStateManager.scale(2.0D, 2.0D, 2.0D);
|
||||||
glPopAttrib();
|
EaglercraftGPU.glLineWidth(1);
|
||||||
glLineWidth(1);
|
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
|
public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
|
||||||
glPushAttrib(0);
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||||
GlStateManager.scale(0.5D, 0.5D, 0.5D);
|
GlStateManager.scale(0.5D, 0.5D, 0.5D);
|
||||||
x *= 2.0D;
|
x *= 2.0D;
|
||||||
y *= 2.0D;
|
y *= 2.0D;
|
||||||
x1 *= 2.0D;
|
x1 *= 2.0D;
|
||||||
y1 *= 2.0D;
|
y1 *= 2.0D;
|
||||||
glEnable(RealOpenGLEnums.GL_BLEND);
|
|
||||||
glDisable(RealOpenGLEnums.GL_TEXTURE_2D);
|
GlStateManager.enableBlend();
|
||||||
glEnable(RealOpenGLEnums.GL_LINE_SMOOTH);
|
GlStateManager.disableTexture2D();
|
||||||
setColor(color);
|
float alpha = (color >> 24 & 0xFF) / 255.0F;
|
||||||
glEnable(RealOpenGLEnums.GL_LINE_SMOOTH);
|
float red = (color >> 16 & 0xFF) / 255.0F;
|
||||||
glBegin(RealOpenGLEnums.GL_POLYGON);
|
float green = (color >> 8 & 0xFF) / 255.0F;
|
||||||
|
float blue = (color & 0xFF) / 255.0F;
|
||||||
|
GlStateManager.color(red, green, blue, alpha);
|
||||||
|
worldrenderer.begin(RealOpenGLEnums.GL_POLYGON, DefaultVertexFormats.POSITION_TEX);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i <= 90; i += 3)
|
for (i = 0; i <= 90; i += 3)
|
||||||
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
|
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
|
||||||
|
@ -75,13 +83,18 @@ GlStateManager.disableBlend();
|
||||||
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
||||||
for (i = 90; i <= 180; i += 3)
|
for (i = 90; i <= 180; i += 3)
|
||||||
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
|
||||||
glEnd();
|
EaglercraftGPU.glEndList();
|
||||||
GlStateManager.enableTexture2D();
|
GlStateManager.enableTexture2D();
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
GlStateManager.scale(2.0D, 2.0D, 2.0D);
|
GlStateManager.scale(2.0D, 2.0D, 2.0D);
|
||||||
glEnable(RealOpenGLEnums.GL_BLEND);
|
GlStateManager.enableBlend();
|
||||||
glPopAttrib();
|
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
|
public static void glVertex2d(double idk, double idk2){
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||||
|
worldrenderer.pos(idk, idk2, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
package net.minecraft.client.gui;
|
package net.minecraft.client.gui;
|
||||||
|
|
||||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
|
||||||
|
|
||||||
import dev.resent.util.render.Color;
|
import dev.resent.util.render.Color;
|
||||||
import dev.resent.util.render.RenderUtils;
|
import dev.resent.util.render.RoundedUtil;
|
||||||
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;
|
||||||
|
|
||||||
/**+
|
/**+
|
||||||
|
@ -80,8 +75,7 @@ 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(!Tessellator.getInstance().getWorldRenderer().isDrawing)
|
RoundedUtil.drawSmoothRoundedRect(this.xPosition, this.yPosition, xPosition + width, yPosition + this.height, 4, Color.BLACK.getRGB());
|
||||||
RenderUtils.drawRoundedRect(this.xPosition, this.yPosition, xPosition + width, yPosition + this.height, 4, Color.BLACK.getRGB(), true);
|
|
||||||
|
|
||||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
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());
|
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());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user