Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void drawRect(double left, double top, double right, double bottom, int colorr) {
- drawRect(left, top, right, bottom, new Color(colorr));
- }
- public static void drawRect(double left, double top, double right, double bottom, Color colorr)
- {
- int color = colorr.hashCode();
- right = left + right;
- bottom = top + bottom;
- if (left < right)
- {
- double i = left;
- left = right;
- right = i;
- }
- if (top < bottom)
- {
- double 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;
- Tessellator tessellator = Tessellator.getInstance();
- WorldRenderer worldrenderer = tessellator.getWorldRenderer();
- GlStateManager.enableBlend();
- GlStateManager.disableTexture2D();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.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();
- GlStateManager.enableTexture2D();
- GlStateManager.disableBlend();
- }
- public static void drawOutline(float x, float y, float width, float height, int lineWidth, Color color) {
- glPushMatrix();
- glEnable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_LINE_SMOOTH);
- glLineWidth(lineWidth);
- glColor3f(color.getRed()/255F, color.getGreen()/255F, color.getBlue()/255F);
- // ------
- //
- // - -
- glBegin(GL_LINE_STRIP);
- glVertex2d(x, y);
- glVertex2d(width, y);
- glEnd();
- // - -
- // |
- // - -
- glBegin(GL_LINE_STRIP);
- glVertex2d(x, y);
- glVertex2d(x, height);
- glEnd();
- // - -
- // |
- // - -
- glBegin(GL_LINE_STRIP);
- glVertex2d(width, y);
- glVertex2d(width, height);
- glEnd();
- // - -
- //
- // ------
- glBegin(GL_LINE_STRIP);
- glVertex2d(x, height);
- glVertex2d(width, height);
- glEnd();
- glEnable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
- GlStateManager.resetColor();
- glPopMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment