gui and text drawing, gui misc
This commit is contained in:
parent
c906760bd4
commit
4ec8affe85
37 changed files with 799 additions and 646 deletions
|
@ -222,94 +222,94 @@ public abstract class Gui {
|
|||
elem.drawHover();
|
||||
}
|
||||
|
||||
public static void drawRect(int left, int top, int right, int bottom, int color)
|
||||
{
|
||||
if (left < right)
|
||||
{
|
||||
int i = left;
|
||||
left = right;
|
||||
right = i;
|
||||
}
|
||||
|
||||
if (top < bottom)
|
||||
{
|
||||
int j = top;
|
||||
top = bottom;
|
||||
bottom = j;
|
||||
}
|
||||
|
||||
float f3 = (float)(color >> 24 & 255) / 255.0F;
|
||||
float f = (float)(color >> 16 & 255) / 255.0F;
|
||||
float f1 = (float)(color >> 8 & 255) / 255.0F;
|
||||
float f2 = (float)(color & 255) / 255.0F;
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
GlState.enableBlend();
|
||||
GlState.disableTexture2D();
|
||||
GlState.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlState.color(f, f1, f2, f3);
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION);
|
||||
worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex();
|
||||
worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex();
|
||||
worldrenderer.pos((double)right, (double)top, 0.0D).endVertex();
|
||||
worldrenderer.pos((double)left, (double)top, 0.0D).endVertex();
|
||||
Tessellator.draw();
|
||||
GlState.enableTexture2D();
|
||||
GlState.disableBlend();
|
||||
}
|
||||
// public static void drawRect(int left, int top, int right, int bottom, int color)
|
||||
// {
|
||||
// if (left < right)
|
||||
// {
|
||||
// int i = left;
|
||||
// left = right;
|
||||
// right = i;
|
||||
// }
|
||||
//
|
||||
// if (top < bottom)
|
||||
// {
|
||||
// int j = top;
|
||||
// top = bottom;
|
||||
// bottom = j;
|
||||
// }
|
||||
//
|
||||
// float f3 = (float)(color >> 24 & 255) / 255.0F;
|
||||
// float f = (float)(color >> 16 & 255) / 255.0F;
|
||||
// float f1 = (float)(color >> 8 & 255) / 255.0F;
|
||||
// float f2 = (float)(color & 255) / 255.0F;
|
||||
// RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
// GlState.enableBlend();
|
||||
// GlState.disableTexture2D();
|
||||
// GlState.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
// GlState.color(f, f1, f2, f3);
|
||||
// worldrenderer.begin(7, DefaultVertexFormats.POSITION);
|
||||
// worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex();
|
||||
// worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex();
|
||||
// worldrenderer.pos((double)right, (double)top, 0.0D).endVertex();
|
||||
// worldrenderer.pos((double)left, (double)top, 0.0D).endVertex();
|
||||
// Tessellator.draw();
|
||||
// GlState.enableTexture2D();
|
||||
// GlState.disableBlend();
|
||||
// }
|
||||
|
||||
public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
|
||||
{
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
worldrenderer.pos((double)(x + 0), (double)(y + height), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
|
||||
worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
|
||||
worldrenderer.pos((double)(x + width), (double)(y + 0), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
|
||||
worldrenderer.pos((double)(x + 0), (double)(y + 0), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
|
||||
Tessellator.draw();
|
||||
}
|
||||
|
||||
public static void drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight)
|
||||
{
|
||||
float f = 1.0F / tileWidth;
|
||||
float f1 = 1.0F / tileHeight;
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
worldrenderer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)vHeight) * f1)).endVertex();
|
||||
worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)uWidth) * f), (double)((v + (float)vHeight) * f1)).endVertex();
|
||||
worldrenderer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)uWidth) * f), (double)(v * f1)).endVertex();
|
||||
worldrenderer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex();
|
||||
Tessellator.draw();
|
||||
}
|
||||
|
||||
public static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor)
|
||||
{
|
||||
float f = (float)(startColor >> 24 & 255) / 255.0F;
|
||||
float f1 = (float)(startColor >> 16 & 255) / 255.0F;
|
||||
float f2 = (float)(startColor >> 8 & 255) / 255.0F;
|
||||
float f3 = (float)(startColor & 255) / 255.0F;
|
||||
float f4 = (float)(endColor >> 24 & 255) / 255.0F;
|
||||
float f5 = (float)(endColor >> 16 & 255) / 255.0F;
|
||||
float f6 = (float)(endColor >> 8 & 255) / 255.0F;
|
||||
float f7 = (float)(endColor & 255) / 255.0F;
|
||||
GlState.disableTexture2D();
|
||||
GlState.enableBlend();
|
||||
GlState.disableAlpha();
|
||||
GlState.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlState.shadeModel(7425);
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
worldrenderer.pos((double)right, (double)top, 0.0).color(f1, f2, f3, f).endVertex();
|
||||
worldrenderer.pos((double)left, (double)top, 0.0).color(f1, f2, f3, f).endVertex();
|
||||
worldrenderer.pos((double)left, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex();
|
||||
worldrenderer.pos((double)right, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex();
|
||||
Tessellator.draw();
|
||||
GlState.shadeModel(7424);
|
||||
GlState.disableBlend();
|
||||
GlState.enableAlpha();
|
||||
GlState.enableTexture2D();
|
||||
}
|
||||
// public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
|
||||
// {
|
||||
// float f = 0.00390625F;
|
||||
// float f1 = 0.00390625F;
|
||||
// RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
// worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
// worldrenderer.pos((double)(x + 0), (double)(y + height), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
|
||||
// worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
|
||||
// worldrenderer.pos((double)(x + width), (double)(y + 0), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
|
||||
// worldrenderer.pos((double)(x + 0), (double)(y + 0), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
|
||||
// Tessellator.draw();
|
||||
// }
|
||||
//
|
||||
// public static void drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight)
|
||||
// {
|
||||
// float f = 1.0F / tileWidth;
|
||||
// float f1 = 1.0F / tileHeight;
|
||||
// RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
// worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
// worldrenderer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)vHeight) * f1)).endVertex();
|
||||
// worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)uWidth) * f), (double)((v + (float)vHeight) * f1)).endVertex();
|
||||
// worldrenderer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)uWidth) * f), (double)(v * f1)).endVertex();
|
||||
// worldrenderer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex();
|
||||
// Tessellator.draw();
|
||||
// }
|
||||
//
|
||||
// public static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor)
|
||||
// {
|
||||
// float f = (float)(startColor >> 24 & 255) / 255.0F;
|
||||
// float f1 = (float)(startColor >> 16 & 255) / 255.0F;
|
||||
// float f2 = (float)(startColor >> 8 & 255) / 255.0F;
|
||||
// float f3 = (float)(startColor & 255) / 255.0F;
|
||||
// float f4 = (float)(endColor >> 24 & 255) / 255.0F;
|
||||
// float f5 = (float)(endColor >> 16 & 255) / 255.0F;
|
||||
// float f6 = (float)(endColor >> 8 & 255) / 255.0F;
|
||||
// float f7 = (float)(endColor & 255) / 255.0F;
|
||||
// GlState.disableTexture2D();
|
||||
// GlState.enableBlend();
|
||||
// GlState.disableAlpha();
|
||||
// GlState.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
// GlState.shadeModel(7425);
|
||||
// RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
// worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
// worldrenderer.pos((double)right, (double)top, 0.0).color(f1, f2, f3, f).endVertex();
|
||||
// worldrenderer.pos((double)left, (double)top, 0.0).color(f1, f2, f3, f).endVertex();
|
||||
// worldrenderer.pos((double)left, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex();
|
||||
// worldrenderer.pos((double)right, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex();
|
||||
// Tessellator.draw();
|
||||
// GlState.shadeModel(7424);
|
||||
// GlState.disableBlend();
|
||||
// GlState.enableAlpha();
|
||||
// GlState.enableTexture2D();
|
||||
// }
|
||||
|
||||
public void drawMainBackground() {
|
||||
if(this.gm.theWorld != null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue