Java Code Examples for org.lwjgl.opengl.GL11#glVertex2d()

The following examples show how to use org.lwjgl.opengl.GL11#glVertex2d() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLUtils.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
public static void drawRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, int paramColor) {

        float alpha = (paramColor >> 24 & 255) / 255.0f;
        float red = (paramColor >> 16 & 255) / 255.0f;
        float green = (paramColor >> 8 & 255) / 255.0f;
        float blue = (paramColor & 255) / 255.0f;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glPushMatrix();
        GL11.glColor4f(red, green, blue, alpha);
        GL11.glBegin(7);
        GL11.glVertex2d(paramXEnd, paramYStart);
        GL11.glVertex2d(paramXStart, paramYStart);
        GL11.glVertex2d(paramXStart, paramYEnd);
        GL11.glVertex2d(paramXEnd, paramYEnd);
        GL11.glEnd();
        GL11.glPopMatrix();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
    }
 
Example 2
Source File: CFont.java    From ForgeHax with MIT License 6 votes vote down vote up
protected void drawQuad(
    float x,
    float y,
    float width,
    float height,
    float srcX,
    float srcY,
    float srcWidth,
    float srcHeight) {
  float renderSRCX = srcX / imgSize;
  float renderSRCY = srcY / imgSize;
  float renderSRCWidth = srcWidth / imgSize;
  float renderSRCHeight = srcHeight / imgSize;
  GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY);
  GL11.glVertex2d(x + width, y);
  GL11.glTexCoord2f(renderSRCX, renderSRCY);
  GL11.glVertex2d(x, y);
  GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight);
  GL11.glVertex2d(x, y + height);
  GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight);
  GL11.glVertex2d(x, y + height);
  GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY + renderSRCHeight);
  GL11.glVertex2d(x + width, y + height);
  GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY);
  GL11.glVertex2d(x + width, y);
}
 
Example 3
Source File: RenderUtils.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void drawBorderedRect(float x, float y, float x2, float y2, float l1, Color c, Color c2) {
    drawRect(x, y, x2, y2, c2);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glPushMatrix();
    glColor(c);
    GL11.glLineWidth(l1);
    GL11.glBegin(1);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 4
Source File: ClickGui.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
private void renderMinimizeButton(int x1, int y1, int x2, int y2,
	boolean hovering, boolean minimized)
{
	renderTitleBarButton(x1, y1, x2, y2, hovering);
	
	double xa1 = x1 + 1;
	double xa2 = (x1 + x2) / 2.0;
	double xa3 = x2 - 1;
	double ya1;
	double ya2;
	
	if(minimized)
	{
		ya1 = y1 + 3;
		ya2 = y2 - 2.5;
		GL11.glColor4f(0, hovering ? 1 : 0.85F, 0, 1);
		
	}else
	{
		ya1 = y2 - 3;
		ya2 = y1 + 2.5;
		GL11.glColor4f(hovering ? 1 : 0.85F, 0, 0, 1);
	}
	
	// arrow
	GL11.glBegin(GL11.GL_TRIANGLES);
	GL11.glVertex2d(xa1, ya1);
	GL11.glVertex2d(xa3, ya1);
	GL11.glVertex2d(xa2, ya2);
	GL11.glEnd();
	
	// outline
	GL11.glColor4f(0.0625F, 0.0625F, 0.0625F, 0.5F);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	GL11.glVertex2d(xa1, ya1);
	GL11.glVertex2d(xa3, ya1);
	GL11.glVertex2d(xa2, ya2);
	GL11.glEnd();
}
 
Example 5
Source File: GLUtils.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public static void drawGradientRect(double x, double y, double x2, double y2, int col1, int col2) {

        float f = (col1 >> 24 & 255) / 255.0f;
        float f1 = (col1 >> 16 & 255) / 255.0f;
        float f2 = (col1 >> 8 & 255) / 255.0f;
        float f3 = (col1 & 255) / 255.0f;
        float f4 = (col2 >> 24 & 255) / 255.0f;
        float f5 = (col2 >> 16 & 255) / 255.0f;
        float f6 = (col2 >> 8 & 255) / 255.0f;
        float f7 = (col2 & 255) / 255.0f;
        GL11.glEnable(3042);
        GL11.glDisable(3553);
        GL11.glBlendFunc(770, 771);
        GL11.glEnable(2848);
        GL11.glShadeModel(7425);
        GL11.glPushMatrix();
        GL11.glBegin(7);
        GL11.glColor4f(f1, f2, f3, f);
        GL11.glVertex2d(x2, y);
        GL11.glVertex2d(x, y);
        GL11.glColor4f(f5, f6, f7, f4);
        GL11.glVertex2d(x, y2);
        GL11.glVertex2d(x2, y2);
        GL11.glEnd();
        GL11.glPopMatrix();
        GL11.glEnable(3553);
        GL11.glDisable(3042);
        GL11.glDisable(2848);
        GL11.glShadeModel(7424);
    }
 
Example 6
Source File: GradientPolygonBuilder.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
private static IRenderCommand createVertexCommand(final double x, final double y, final int rgb, final float opacity) {
	return new IRenderCommand() {
		@Override
		public void execute(RenderState renderState) {
			renderState.setColor(rgb, opacity);
			GL11.glVertex2d(x, y);
		}
	};
}
 
Example 7
Source File: RenderUtils.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawBorderedRect(float x, float y, float x2, float y2, float l1, int col1, int col2) {
    drawRect(x, y, x2, y2, col2);
    float f = (col1 >> 24 & 0xFF) / 255.0F;
    float f2 = (col1 >> 16 & 0xFF) / 255.0F;
    float f3 = (col1 >> 8 & 0xFF) / 255.0F;
    float f4 = (col1 & 0xFF) / 255.0F;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glPushMatrix();
    GlStateManager.color(f2, f3, f4, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(1);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 8
Source File: RenderUtils.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawFilledCircle(int x, int y, float radius, int color) {
    GlStateManager.pushAttrib();
    GlStateManager.pushMatrix();
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.disableTexture2D();

    GL11.glBegin(GL11.GL_TRIANGLE_FAN);

    for (int i = 0; i < 50; i++) {
        float px = x + radius * MathHelper.sin((float) (i * (6.28318530718 / 50)));
        float py = y + radius * MathHelper.cos((float) (i * (6.28318530718 / 50)));

        float alpha = (color >> 24 & 255) / 255.0F;
        float red = (color >> 16 & 255) / 255.0F;
        float green = (color >> 8 & 255) / 255.0F;
        float blue = (color & 255) / 255.0F;
        GL11.glColor4f(red, green, blue, alpha);

        GL11.glVertex2d(px, py);
    }

    GL11.glEnd();

    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
    GlStateManager.popAttrib();
    GlStateManager.popMatrix();
    GlStateManager.bindTexture(0);
    GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
}
 
Example 9
Source File: RenderUtil.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
public static void drawTriangle(float x, float y, float size, float theta, int color) {
    GL11.glTranslated(x, y, 0);
    GL11.glRotatef(180 + theta, 0F, 0F, 1.0F);

    float alpha = (float) (color >> 24 & 255) / 255.0F;
    float red = (float) (color >> 16 & 255) / 255.0F;
    float green = (float) (color >> 8 & 255) / 255.0F;
    float blue = (float) (color & 255) / 255.0F;

    GL11.glColor4f(red, green, blue, alpha);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glBlendFunc(770, 771);
    GL11.glLineWidth(1);
    GL11.glBegin(GL11.GL_TRIANGLE_FAN);

    GL11.glVertex2d(0, (1.0F * size));
    GL11.glVertex2d((1 * size), -(1.0F * size));
    GL11.glVertex2d(-(1 * size), -(1.0F * size));

    GL11.glEnd();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glRotatef(-180 - theta, 0F, 0F, 1.0F);
    GL11.glTranslated(-x, -y, 0);
}
 
Example 10
Source File: FeatureButton.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private void drawSettingsArrow(int x2, int x3, int y1, int y2,
	boolean hSettings)
{
	double xa1 = x3 + 1;
	double xa2 = (x3 + x2) / 2.0;
	double xa3 = x2 - 1;
	double ya1;
	double ya2;
	
	if(isSettingsWindowOpen())
	{
		ya1 = y2 - 3.5;
		ya2 = y1 + 3;
		GL11.glColor4f(hSettings ? 1 : 0.85F, 0, 0, 1);
		
	}else
	{
		ya1 = y1 + 3.5;
		ya2 = y2 - 3;
		GL11.glColor4f(0, hSettings ? 1 : 0.85F, 0, 1);
	}
	
	// arrow
	GL11.glBegin(GL11.GL_TRIANGLES);
	GL11.glVertex2d(xa1, ya1);
	GL11.glVertex2d(xa3, ya1);
	GL11.glVertex2d(xa2, ya2);
	GL11.glEnd();
	
	// outline
	GL11.glColor4f(0.0625F, 0.0625F, 0.0625F, 0.5F);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	GL11.glVertex2d(xa1, ya1);
	GL11.glVertex2d(xa3, ya1);
	GL11.glVertex2d(xa2, ya2);
	GL11.glEnd();
}
 
Example 11
Source File: CheckboxComponent.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private void drawCheck(int x1, int y1, boolean hovering)
{
	double xc1 = x1 + 2.5;
	double xc2 = x1 + 3.5;
	double xc3 = x1 + 4.5;
	double xc4 = x1 + 7.5;
	double xc5 = x1 + 8.5;
	double yc1 = y1 + 2.5;
	double yc2 = y1 + 3.5;
	double yc3 = y1 + 5.5;
	double yc4 = y1 + 6.5;
	double yc5 = y1 + 8.5;
	
	// check
	if(setting.isLocked())
		GL11.glColor4f(0.5F, 0.5F, 0.5F, 0.75F);
	else
		GL11.glColor4f(0, hovering ? 1 : 0.85F, 0, 1);
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glVertex2d(xc2, yc3);
	GL11.glVertex2d(xc3, yc4);
	GL11.glVertex2d(xc3, yc5);
	GL11.glVertex2d(xc1, yc4);
	GL11.glVertex2d(xc4, yc1);
	GL11.glVertex2d(xc5, yc2);
	GL11.glVertex2d(xc3, yc5);
	GL11.glVertex2d(xc3, yc4);
	GL11.glEnd();
	
	// outline
	GL11.glColor4f(0.0625F, 0.0625F, 0.0625F, 0.5F);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	GL11.glVertex2d(xc2, yc3);
	GL11.glVertex2d(xc3, yc4);
	GL11.glVertex2d(xc4, yc1);
	GL11.glVertex2d(xc5, yc2);
	GL11.glVertex2d(xc3, yc5);
	GL11.glVertex2d(xc1, yc4);
	GL11.glEnd();
}
 
Example 12
Source File: SliderComponent.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private void drawKnob(int x1, int x2, int y2, int y3, boolean hSlider,
	boolean renderAsDisabled)
{
	double percentage = (setting.getValue() - setting.getMinimum())
		/ (setting.getMaximum() - setting.getMinimum());
	double xk1 = x1 + (x2 - x1 - 8) * percentage;
	double xk2 = xk1 + 8;
	double yk1 = y3 + 1.5;
	double yk2 = y2 - 1.5;
	
	// knob
	if(renderAsDisabled)
		GL11.glColor4f(0.5F, 0.5F, 0.5F, 0.75F);
	else
	{
		float f = (float)(2 * percentage);
		GL11.glColor4f(f, 2 - f, 0, hSlider ? 1 : 0.75F);
	}
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glVertex2d(xk1, yk1);
	GL11.glVertex2d(xk1, yk2);
	GL11.glVertex2d(xk2, yk2);
	GL11.glVertex2d(xk2, yk1);
	GL11.glEnd();
	
	// outline
	GL11.glColor4f(0.0625F, 0.0625F, 0.0625F, 0.5F);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	GL11.glVertex2d(xk1, yk1);
	GL11.glVertex2d(xk1, yk2);
	GL11.glVertex2d(xk2, yk2);
	GL11.glVertex2d(xk2, yk1);
	GL11.glEnd();
}
 
Example 13
Source File: AltEditorScreen.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY,
	float partialTicks)
{
	renderBackground(matrixStack);
	
	// skin preview
	AltRenderer.drawAltBack(matrixStack, emailBox.getText(),
		(width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256);
	AltRenderer.drawAltBody(matrixStack, emailBox.getText(),
		width - (width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256);
	
	// text
	drawStringWithShadow(matrixStack, textRenderer, "Name or E-Mail",
		width / 2 - 100, 47, 10526880);
	drawStringWithShadow(matrixStack, textRenderer, "Password",
		width / 2 - 100, 87, 10526880);
	drawCenteredString(matrixStack, textRenderer, message, width / 2, 142,
		16777215);
	
	// text boxes
	emailBox.render(matrixStack, mouseX, mouseY, partialTicks);
	passwordBox.render(matrixStack, mouseX, mouseY, partialTicks);
	
	// red flash for errors
	if(errorTimer > 0)
	{
		GL11.glDisable(GL11.GL_TEXTURE_2D);
		GL11.glDisable(GL11.GL_CULL_FACE);
		GL11.glEnable(GL11.GL_BLEND);
		
		GL11.glColor4f(1, 0, 0, errorTimer / 16F);
		
		GL11.glBegin(GL11.GL_QUADS);
		{
			GL11.glVertex2d(0, 0);
			GL11.glVertex2d(width, 0);
			GL11.glVertex2d(width, height);
			GL11.glVertex2d(0, height);
		}
		GL11.glEnd();
		
		GL11.glEnable(GL11.GL_TEXTURE_2D);
		GL11.glEnable(GL11.GL_CULL_FACE);
		GL11.glDisable(GL11.GL_BLEND);
		errorTimer--;
	}
	
	super.render(matrixStack, mouseX, mouseY, partialTicks);
}
 
Example 14
Source File: AltManagerScreen.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY,
	float partialTicks)
{
	renderBackground(matrixStack);
	listGui.render(matrixStack, mouseX, mouseY, partialTicks);
	
	// skin preview
	if(listGui.getSelectedSlot() != -1
		&& listGui.getSelectedSlot() < altManager.getList().size())
	{
		Alt alt = listGui.getSelectedAlt();
		AltRenderer.drawAltBack(matrixStack, alt.getNameOrEmail(),
			(width / 2 - 125) / 2 - 32, height / 2 - 64 - 9, 64, 128);
		AltRenderer.drawAltBody(matrixStack, alt.getNameOrEmail(),
			width - (width / 2 - 140) / 2 - 32, height / 2 - 64 - 9, 64,
			128);
	}
	
	// title text
	drawCenteredString(matrixStack, textRenderer, "Alt Manager", width / 2,
		4, 16777215);
	drawCenteredString(matrixStack, textRenderer,
		"Alts: " + altManager.getList().size(), width / 2, 14, 10526880);
	drawCenteredString(
		matrixStack, textRenderer, "premium: " + altManager.getNumPremium()
			+ ", cracked: " + altManager.getNumCracked(),
		width / 2, 24, 10526880);
	
	// red flash for errors
	if(errorTimer > 0)
	{
		GL11.glDisable(GL11.GL_TEXTURE_2D);
		GL11.glDisable(GL11.GL_CULL_FACE);
		GL11.glEnable(GL11.GL_BLEND);
		
		GL11.glColor4f(1, 0, 0, errorTimer / 16F);
		
		GL11.glBegin(GL11.GL_QUADS);
		{
			GL11.glVertex2d(0, 0);
			GL11.glVertex2d(width, 0);
			GL11.glVertex2d(width, height);
			GL11.glVertex2d(0, height);
		}
		GL11.glEnd();
		
		GL11.glEnable(GL11.GL_TEXTURE_2D);
		GL11.glEnable(GL11.GL_CULL_FACE);
		GL11.glDisable(GL11.GL_BLEND);
		errorTimer--;
	}
	
	super.render(matrixStack, mouseX, mouseY, partialTicks);
}
 
Example 15
Source File: AltManagerScreen.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void renderItem(MatrixStack matrixStack, int id, int x, int y,
	int var4, int var5, int var6, float partialTicks)
{
	Alt alt = list.get(id);
	
	// green glow when logged in
	if(client.getSession().getUsername().equals(alt.getName()))
	{
		GL11.glDisable(GL11.GL_TEXTURE_2D);
		GL11.glDisable(GL11.GL_CULL_FACE);
		GL11.glEnable(GL11.GL_BLEND);
		
		float opacity =
			0.3F - Math.abs(MathHelper.sin(System.currentTimeMillis()
				% 10000L / 10000F * (float)Math.PI * 2.0F) * 0.15F);
		
		GL11.glColor4f(0, 1, 0, opacity);
		
		GL11.glBegin(GL11.GL_QUADS);
		{
			GL11.glVertex2d(x - 2, y - 2);
			GL11.glVertex2d(x - 2 + 220, y - 2);
			GL11.glVertex2d(x - 2 + 220, y - 2 + 30);
			GL11.glVertex2d(x - 2, y - 2 + 30);
		}
		GL11.glEnd();
		
		GL11.glEnable(GL11.GL_TEXTURE_2D);
		GL11.glEnable(GL11.GL_CULL_FACE);
		GL11.glDisable(GL11.GL_BLEND);
	}
	
	// face
	AltRenderer.drawAltFace(matrixStack, alt.getNameOrEmail(), x + 1,
		y + 1, 24, 24, isSelectedItem(id));
	
	// name / email
	client.textRenderer.draw(matrixStack,
		"Name: " + alt.getNameOrEmail(), x + 31, y + 3, 10526880);
	
	// tags
	String tags = alt.isCracked() ? "\u00a78cracked" : "\u00a72premium";
	if(alt.isStarred())
		tags += "\u00a7r, \u00a7estarred";
	if(alt.isUnchecked())
		tags += "\u00a7r, \u00a7cunchecked";
	client.textRenderer.draw(matrixStack, tags, x + 31, y + 15,
		10526880);
}
 
Example 16
Source File: SliderComponent.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
private void drawRail(int x3, int x4, int y4, int y5, boolean hSlider,
	boolean renderAsDisabled)
{
	float[] bgColor = GUI.getBgColor();
	float[] acColor = GUI.getAcColor();
	float opacity = GUI.getOpacity();
	
	double xl1 = x3;
	double xl2 = x4;
	if(!renderAsDisabled && setting.isLimited())
	{
		double ratio = (x4 - x3) / setting.getRange();
		xl1 += ratio * (setting.getUsableMin() - setting.getMinimum());
		xl2 += ratio * (setting.getUsableMax() - setting.getMaximum());
	}
	
	// limit
	GL11.glColor4f(1, 0, 0, hSlider ? opacity * 1.5F : opacity);
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glVertex2d(x3, y4);
	GL11.glVertex2d(x3, y5);
	GL11.glVertex2d(xl1, y5);
	GL11.glVertex2d(xl1, y4);
	GL11.glVertex2d(xl2, y4);
	GL11.glVertex2d(xl2, y5);
	GL11.glVertex2d(x4, y5);
	GL11.glVertex2d(x4, y4);
	GL11.glEnd();
	
	// background
	GL11.glColor4f(bgColor[0], bgColor[1], bgColor[2],
		hSlider ? opacity * 1.5F : opacity);
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glVertex2d(xl1, y4);
	GL11.glVertex2d(xl1, y5);
	GL11.glVertex2d(xl2, y5);
	GL11.glVertex2d(xl2, y4);
	GL11.glEnd();
	
	// outline
	GL11.glColor4f(acColor[0], acColor[1], acColor[2], 0.5F);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	GL11.glVertex2i(x3, y4);
	GL11.glVertex2i(x3, y5);
	GL11.glVertex2i(x4, y5);
	GL11.glVertex2i(x4, y4);
	GL11.glEnd();
}
 
Example 17
Source File: ClickGui.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
private void renderCloseButton(int x1, int y1, int x2, int y2,
	boolean hovering)
{
	renderTitleBarButton(x1, y1, x2, y2, hovering);
	
	double xc1 = x1 + 2;
	double xc2 = x1 + 3;
	double xc3 = x2 - 2;
	double xc4 = x2 - 3;
	double xc5 = x1 + 3.5;
	double xc6 = (x1 + x2) / 2.0;
	double xc7 = x2 - 3.5;
	double yc1 = y1 + 3;
	double yc2 = y1 + 2;
	double yc3 = y2 - 3;
	double yc4 = y2 - 2;
	double yc5 = y1 + 3.5;
	double yc6 = (y1 + y2) / 2.0;
	double yc7 = y2 - 3.5;
	
	// cross
	GL11.glColor4f(hovering ? 1 : 0.85F, 0, 0, 1);
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glVertex2d(xc1, yc1);
	GL11.glVertex2d(xc2, yc2);
	GL11.glVertex2d(xc3, yc3);
	GL11.glVertex2d(xc4, yc4);
	GL11.glVertex2d(xc3, yc1);
	GL11.glVertex2d(xc4, yc2);
	GL11.glVertex2d(xc6, yc5);
	GL11.glVertex2d(xc7, yc6);
	GL11.glVertex2d(xc6, yc7);
	GL11.glVertex2d(xc5, yc6);
	GL11.glVertex2d(xc1, yc3);
	GL11.glVertex2d(xc2, yc4);
	GL11.glEnd();
	
	// outline
	GL11.glColor4f(0.0625F, 0.0625F, 0.0625F, 0.5F);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	GL11.glVertex2d(xc1, yc1);
	GL11.glVertex2d(xc2, yc2);
	GL11.glVertex2d(xc6, yc5);
	GL11.glVertex2d(xc4, yc2);
	GL11.glVertex2d(xc3, yc1);
	GL11.glVertex2d(xc7, yc6);
	GL11.glVertex2d(xc3, yc3);
	GL11.glVertex2d(xc4, yc4);
	GL11.glVertex2d(xc6, yc7);
	GL11.glVertex2d(xc2, yc4);
	GL11.glVertex2d(xc1, yc3);
	GL11.glVertex2d(xc5, yc6);
	GL11.glEnd();
}
 
Example 18
Source File: TabGui.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
private void drawBox(int x1, int y1, int x2, int y2)
{
	ClickGui gui = WurstClient.INSTANCE.getGui();
	float[] bgColor = gui.getBgColor();
	float[] acColor = gui.getAcColor();
	float opacity = gui.getOpacity();
	
	// color
	GL11.glColor4f(bgColor[0], bgColor[1], bgColor[2], opacity);
	
	// box
	GL11.glBegin(GL11.GL_QUADS);
	{
		GL11.glVertex2i(x1, y1);
		GL11.glVertex2i(x2, y1);
		GL11.glVertex2i(x2, y2);
		GL11.glVertex2i(x1, y2);
	}
	GL11.glEnd();
	
	// outline positions
	double xi1 = x1 - 0.1;
	double xi2 = x2 + 0.1;
	double yi1 = y1 - 0.1;
	double yi2 = y2 + 0.1;
	
	// outline
	GL11.glLineWidth(1);
	GL11.glColor4f(acColor[0], acColor[1], acColor[2], 0.5F);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	{
		GL11.glVertex2d(xi1, yi1);
		GL11.glVertex2d(xi2, yi1);
		GL11.glVertex2d(xi2, yi2);
		GL11.glVertex2d(xi1, yi2);
	}
	GL11.glEnd();
	
	// shadow positions
	xi1 -= 0.9;
	xi2 += 0.9;
	yi1 -= 0.9;
	yi2 += 0.9;
	
	// top left
	GL11.glBegin(GL11.GL_POLYGON);
	{
		GL11.glColor4f(acColor[0], acColor[1], acColor[2], 0.75F);
		GL11.glVertex2d(x1, y1);
		GL11.glVertex2d(x2, y1);
		GL11.glColor4f(0, 0, 0, 0);
		GL11.glVertex2d(xi2, yi1);
		GL11.glVertex2d(xi1, yi1);
		GL11.glVertex2d(xi1, yi2);
		GL11.glColor4f(acColor[0], acColor[1], acColor[2], 0.75F);
		GL11.glVertex2d(x1, y2);
	}
	GL11.glEnd();
	
	// bottom right
	GL11.glBegin(GL11.GL_POLYGON);
	{
		GL11.glVertex2d(x2, y2);
		GL11.glVertex2d(x2, y1);
		GL11.glColor4f(0, 0, 0, 0);
		GL11.glVertex2d(xi2, yi1);
		GL11.glVertex2d(xi2, yi2);
		GL11.glVertex2d(xi1, yi2);
		GL11.glColor4f(acColor[0], acColor[1], acColor[2], 0.75F);
		GL11.glVertex2d(x1, y2);
	}
	GL11.glEnd();
}
 
Example 19
Source File: ClickGui.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
private void renderCloseButton(int x1, int y1, int x2, int y2,
	boolean hovering)
{
	renderTitleBarButton(x1, y1, x2, y2, hovering);
	
	double xc1 = x1 + 2;
	double xc2 = x1 + 3;
	double xc3 = x2 - 2;
	double xc4 = x2 - 3;
	double xc5 = x1 + 3.5;
	double xc6 = (x1 + x2) / 2.0;
	double xc7 = x2 - 3.5;
	double yc1 = y1 + 3;
	double yc2 = y1 + 2;
	double yc3 = y2 - 3;
	double yc4 = y2 - 2;
	double yc5 = y1 + 3.5;
	double yc6 = (y1 + y2) / 2.0;
	double yc7 = y2 - 3.5;
	
	// cross
	GL11.glColor4f(hovering ? 1 : 0.85F, 0, 0, 1);
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glVertex2d(xc1, yc1);
	GL11.glVertex2d(xc2, yc2);
	GL11.glVertex2d(xc3, yc3);
	GL11.glVertex2d(xc4, yc4);
	GL11.glVertex2d(xc3, yc1);
	GL11.glVertex2d(xc4, yc2);
	GL11.glVertex2d(xc6, yc5);
	GL11.glVertex2d(xc7, yc6);
	GL11.glVertex2d(xc6, yc7);
	GL11.glVertex2d(xc5, yc6);
	GL11.glVertex2d(xc1, yc3);
	GL11.glVertex2d(xc2, yc4);
	GL11.glEnd();
	
	// outline
	GL11.glColor4f(0.0625F, 0.0625F, 0.0625F, 0.5F);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	GL11.glVertex2d(xc1, yc1);
	GL11.glVertex2d(xc2, yc2);
	GL11.glVertex2d(xc6, yc5);
	GL11.glVertex2d(xc4, yc2);
	GL11.glVertex2d(xc3, yc1);
	GL11.glVertex2d(xc7, yc6);
	GL11.glVertex2d(xc3, yc3);
	GL11.glVertex2d(xc4, yc4);
	GL11.glVertex2d(xc6, yc7);
	GL11.glVertex2d(xc2, yc4);
	GL11.glVertex2d(xc1, yc3);
	GL11.glVertex2d(xc5, yc6);
	GL11.glEnd();
}
 
Example 20
Source File: ExcavatorHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRenderGUI(MatrixStack matrixStack, float partialTicks)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_CULL_FACE);
	
	GL11.glPushMatrix();
	
	String message;
	if(step.selectPos && step.pos != null)
		message = "Press enter to confirm, or select a different position.";
	else
		message = step.message;
	
	TextRenderer tr = MC.textRenderer;
	
	// translate to center
	Window sr = MC.getWindow();
	int msgWidth = tr.getWidth(message);
	GL11.glTranslated(sr.getScaledWidth() / 2 - msgWidth / 2,
		sr.getScaledHeight() / 2 + 1, 0);
	
	// background
	GL11.glColor4f(0, 0, 0, 0.5F);
	GL11.glBegin(GL11.GL_QUADS);
	{
		GL11.glVertex2d(0, 0);
		GL11.glVertex2d(msgWidth + 2, 0);
		GL11.glVertex2d(msgWidth + 2, 10);
		GL11.glVertex2d(0, 10);
	}
	GL11.glEnd();
	
	// text
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	tr.draw(matrixStack, message, 2, 1, 0xffffffff);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_BLEND);
}