net.minecraft.client.font.TextRenderer Java Examples

The following examples show how to use net.minecraft.client.font.TextRenderer. 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: EditBlockScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void renderQuestionMark(MatrixStack matrixStack, int x, int y,
	boolean large)
{
	GL11.glPushMatrix();
	
	GL11.glTranslated(x, y, 0);
	if(large)
		GL11.glScaled(2, 2, 2);
	
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	TextRenderer tr = WurstClient.MC.textRenderer;
	tr.drawWithShadow(matrixStack, "?", 3, 2, 0xf0f0f0);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	
	GL11.glPopMatrix();
}
 
Example #2
Source File: FeatureButton.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void drawName(MatrixStack matrixStack, int x1, int x3, int y1)
{
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	
	TextRenderer tr = MC.textRenderer;
	String name = feature.getName();
	int nameWidth = tr.getWidth(name);
	int tx = x1 + (x3 - x1 - nameWidth) / 2;
	int ty = y1 + 2;
	
	tr.draw(matrixStack, name, tx, ty, 0xF0F0F0);
	
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_BLEND);
}
 
Example #3
Source File: NavigatorMainScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onResize()
{
	TextRenderer tr = WurstClient.MC.textRenderer;
	searchBar =
		new TextFieldWidget(tr, 0, 32, 200, 20, new LiteralText(""));
	searchBar.setHasBorder(false);
	searchBar.setMaxLength(128);
	
	children.add(searchBar);
	setInitialFocus(searchBar);
	searchBar.setSelected(true);
	
	searchBar.x = middleX - 100;
	setContentHeight(navigatorDisplayList.size() / 3 * 20);
}
 
Example #4
Source File: SliderComponent.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void drawNameAndValue(MatrixStack matrixStack, int x1, int x2,
	int y1, boolean renderAsDisabled)
{
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	
	TextRenderer tr = MC.textRenderer;
	String name = setting.getName();
	String value = setting.getValueString();
	int valueWidth = tr.getWidth(value);
	int color = renderAsDisabled ? 0xAAAAAA : 0xF0F0F0;
	tr.draw(matrixStack, name, x1, y1 + 2, color);
	tr.draw(matrixStack, value, x2 - valueWidth, y1 + 2, color);
	
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_BLEND);
}
 
Example #5
Source File: WTextField.java    From LibGui with MIT License 6 votes vote down vote up
/**
 * From an X offset past the left edge of a TextRenderer.draw, finds out what the closest caret
 * position (division between letters) is.
 * @param s
 * @param x
 * @return
 */
@Environment(EnvType.CLIENT)
public static int getCaretPos(String s, int x) {
	if (x<=0) return 0;
	
	TextRenderer font = MinecraftClient.getInstance().textRenderer;
	int lastAdvance = 0;
	for(int i=0; i<s.length()-1; i++) {
		int advance = font.getWidth(s.substring(0,i+1));
		int charAdvance = advance-lastAdvance;
		if (x<advance + (charAdvance/2)) return i+1;
		
		lastAdvance = advance;
	}
	
	return s.length();
}
 
Example #6
Source File: BlockComponent.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void renderQuestionMark(MatrixStack matrixStack, int x, int y,
	boolean large)
{
	GL11.glPushMatrix();
	
	GL11.glTranslated(x, y, 0);
	if(large)
		GL11.glScaled(2, 2, 2);
	
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	TextRenderer tr = WurstClient.MC.textRenderer;
	tr.drawWithShadow(matrixStack, "?", 3, 2, 0xf0f0f0);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_BLEND);
	
	GL11.glPopMatrix();
}
 
Example #7
Source File: EditSliderScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	int x1 = width / 2 - 100;
	int y1 = 60;
	int y2 = height / 3 * 2;
	
	TextRenderer tr = client.textRenderer;
	ValueDisplay vd = ValueDisplay.DECIMAL;
	String valueString = vd.getValueString(slider.getValue());
	
	valueField =
		new TextFieldWidget(tr, x1, y1, 200, 20, new LiteralText(""));
	valueField.setText(valueString);
	valueField.setSelectionStart(0);
	
	children.add(valueField);
	setInitialFocus(valueField);
	valueField.setSelected(true);
	
	doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
		b -> done());
	addButton(doneButton);
}
 
Example #8
Source File: EditItemListScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void renderItem(MatrixStack matrixStack, int index, int x,
	int y, int var4, int var5, int var6, float partialTicks)
{
	String name = list.get(index);
	Item item = Registry.ITEM.get(new Identifier(name));
	ItemStack stack = new ItemStack(item);
	TextRenderer fr = mc.textRenderer;
	
	String displayName =
		renderIconAndGetName(matrixStack, stack, x + 1, y + 1, true);
	fr.draw(matrixStack, displayName, x + 28, y, 0xf0f0f0);
	fr.draw(matrixStack, name, x + 28, y + 9, 0xa0a0a0);
	fr.draw(matrixStack, "ID: " + Registry.ITEM.getId(item).toString(),
		x + 28, y + 18, 0xa0a0a0);
}
 
Example #9
Source File: EditBlockScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	int x1 = width / 2 - 100;
	int y1 = 60;
	int y2 = height / 3 * 2;
	
	TextRenderer tr = client.textRenderer;
	String valueString = setting.getBlockName();
	
	blockField =
		new TextFieldWidget(tr, x1, y1, 178, 18, new LiteralText(""));
	blockField.setText(valueString);
	blockField.setSelectionStart(0);
	
	children.add(blockField);
	setInitialFocus(blockField);
	blockField.setSelected(true);
	
	doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
		b -> done());
	addButton(doneButton);
}
 
Example #10
Source File: EnterProfileNameScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	int x1 = width / 2 - 100;
	int y1 = 60;
	int y2 = height / 3 * 2;
	
	TextRenderer tr = client.textRenderer;
	
	valueField =
		new TextFieldWidget(tr, x1, y1, 200, 20, new LiteralText(""));
	valueField.setText("");
	valueField.setSelectionStart(0);
	
	children.add(valueField);
	setInitialFocus(valueField);
	valueField.setSelected(true);
	
	doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
		b -> done());
	addButton(doneButton);
}
 
Example #11
Source File: WurstOptionsScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void renderTitles(MatrixStack matrixStack)
{
	TextRenderer tr = client.textRenderer;
	int middleX = width / 2;
	int y1 = 40;
	int y2 = height / 4 + 24 - 28;
	
	drawCenteredString(matrixStack, tr, "Wurst Options", middleX, y1,
		0xffffff);
	
	drawCenteredString(matrixStack, tr, "Settings", middleX - 104, y2,
		0xcccccc);
	drawCenteredString(matrixStack, tr, "Managers", middleX, y2, 0xcccccc);
	drawCenteredString(matrixStack, tr, "Links", middleX + 104, y2,
		0xcccccc);
}
 
Example #12
Source File: WurstLogo.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
public void render(MatrixStack matrixStack)
{
	if(!WurstClient.INSTANCE.getOtfs().wurstLogoOtf.isVisible())
		return;
	
	String version = getVersionString();
	TextRenderer tr = WurstClient.MC.textRenderer;
	
	// draw version background
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	
	if(WurstClient.INSTANCE.getHax().rainbowUiHack.isEnabled())
	{
		float[] acColor = WurstClient.INSTANCE.getGui().getAcColor();
		GL11.glColor4f(acColor[0], acColor[1], acColor[2], 0.5F);
		
	}else
		GL11.glColor4f(1, 1, 1, 0.5F);
	
	drawQuads(0, 6, tr.getWidth(version) + 76, 17);
	
	// draw version string
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	tr.draw(matrixStack, version, 74, 8, 0xFF000000);
	
	// draw Wurst logo
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_BLEND);
	WurstClient.MC.getTextureManager().bindTexture(texture);
	DrawableHelper.drawTexture(matrixStack, 0, 3, 0, 0, 72, 18, 72, 18);
}
 
Example #13
Source File: SpaceRaceScreen.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
private void renderButton(MatrixStack stack, TextRenderer textRenderer, Text text, int x, int y, int width, int height) {
    RenderSystem.disableBlend();
    stack.push();

    fillSolid(stack.peek().getModel(), x, y, x + width, y + height, 0x0);

    drawHorizontalLineSolid(stack, x, x + width, y, 0x2d2d2d);
    drawVerticalLineSolid(stack, x + width, y, y + height, 0x2d2d2d);
    drawHorizontalLineSolid(stack, x + width, x, y + height, 0x2d2d2d);
    drawVerticalLineSolid(stack, x, y, y + height, 0x2d2d2d);

    stack.pop();
    RenderSystem.enableBlend();

    textRenderer.draw(stack, text, x + (width / 2F) - (textRenderer.getWidth(text) / 2F), y + (height / 2F) - 4F, 0xffffff);
}
 
Example #14
Source File: HackListHUD.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void drawWithOffset(MatrixStack matrixStack, HackListEntry e,
	float partialTicks)
{
	TextRenderer tr = WurstClient.MC.textRenderer;
	String s = e.hack.getRenderName();
	
	float offset =
		e.offset * partialTicks + e.prevOffset * (1 - partialTicks);
	
	float posX;
	if(otf.getPosition() == Position.LEFT)
		posX = 2 - 5 * offset;
	else
	{
		int screenWidth = WurstClient.MC.getWindow().getScaledWidth();
		int stringWidth = tr.getWidth(s);
		
		posX = screenWidth - stringWidth - 2 + 5 * offset;
	}
	
	int alpha = (int)(255 * (1 - offset / 4)) << 24;
	tr.draw(matrixStack, s, posX + 1, posY + 1, 0x04000000 | alpha);
	tr.draw(matrixStack, s, posX, posY, textColor | alpha);
	
	posY += 9;
}
 
Example #15
Source File: HackListHUD.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void drawString(MatrixStack matrixStack, String s)
{
	TextRenderer tr = WurstClient.MC.textRenderer;
	int posX;
	
	if(otf.getPosition() == Position.LEFT)
		posX = 2;
	else
	{
		int screenWidth = WurstClient.MC.getWindow().getScaledWidth();
		int stringWidth = tr.getWidth(s);
		
		posX = screenWidth - stringWidth - 2;
	}
	
	tr.draw(matrixStack, s, posX + 1, posY + 1, 0xff000000);
	tr.draw(matrixStack, s, posX, posY, textColor | 0xff000000);
	
	posY += 9;
}
 
Example #16
Source File: BleachCheckbox.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void renderButton(int int_1, int int_2, float float_1) {
	MinecraftClient minecraftClient_1 = MinecraftClient.getInstance();
	GL11.glDepthMask(true);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	TextRenderer textRenderer = minecraftClient_1.textRenderer;
	int color = int_1 > x && int_1 < x + 10 && int_2 > y && int_2 < y + 10 ? 0xffc0c0c0 : 0xffe0e0e0;
	fill(x, y, x + 11, y + 11, color);
	fill(x, y, x + 1, y + 11, 0xff303030);
	fill(x, y + 10, x + 11, y + 11, 0xffb0b0b0);
	fill(x, y, x + 10, y + 1, 0xff303030);
	fill(x + 10, y, x + 11, y + 11, 0xffb0b0b0);
	if (checked) textRenderer.draw("\u2714", x + 2, y + 2, 0x000000); //fill(x + 3, y + 5, x + 8, y + 6, 0xff000000);
	drawString(textRenderer, getMessage(), x + 15, y + 2, 0xC0C0C0);
}
 
Example #17
Source File: BleachCheckbox.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void renderButton(MatrixStack matrix, int mouseX, int mouseY, float delta) {
	MinecraftClient minecraftClient_1 = MinecraftClient.getInstance();
	GL11.glDepthMask(true);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	TextRenderer textRenderer = minecraftClient_1.textRenderer;
	int color = mouseX > x && mouseX < x + 10 && mouseY > y && mouseY < y + 10 ? 0xffc0c0c0 : 0xffe0e0e0;
	fill(matrix, x, y, x + 11, y + 11, color);
	fill(matrix, x, y, x + 1, y + 11, 0xff303030);
	fill(matrix, x, y + 10, x + 11, y + 11, 0xffb0b0b0);
	fill(matrix, x, y, x + 10, y + 1, 0xff303030);
	fill(matrix, x + 10, y, x + 11, y + 11, 0xffb0b0b0);
	if (checked) textRenderer.draw(matrix, "\u2714", x + 2, y + 2, 0x000000); //fill(x + 3, y + 5, x + 8, y + 6, 0xff000000);
	drawStringWithShadow(matrix, textRenderer, getMessage().getString(), x + 15, y + 2, 0xC0C0C0);
}
 
Example #18
Source File: FeatureButton.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getDefaultWidth()
{
	String name = feature.getName();
	TextRenderer tr = MC.textRenderer;
	int width = tr.getWidth(name) + 4;
	if(hasSettings)
		width += 11;
	
	return width;
}
 
Example #19
Source File: ItemListEditButton.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
public ItemListEditButton(ItemListSetting setting)
{
	this.setting = setting;
	
	TextRenderer fr = WurstClient.MC.textRenderer;
	buttonWidth = fr.getWidth("Edit...");
	
	setWidth(getDefaultWidth());
	setHeight(getDefaultHeight());
}
 
Example #20
Source File: ItemListEditButton.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getDefaultWidth()
{
	TextRenderer fr = WurstClient.MC.textRenderer;
	String text = setting.getName() + ": " + setting.getItemNames().size();
	return fr.getWidth(text) + buttonWidth + 6;
}
 
Example #21
Source File: ModuleWindow.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
protected void drawBar(int mX, int mY, TextRenderer textRend) {
	/* background and title bar */
	fillGrey(x1, y1, x2, y2);
	fillGradient(x1 + 1, y1 + 1, x2 - 2, y1 + 12, 0xff0000ff, 0xff4080ff);
	
	/* buttons */
	//fillRealGrey(x2 - 12, y1 + 3, x2 - 4, y1 + 11);
	textRend.draw(hiding ? "+" : "_", x2 - 11, y1 + (hiding ? 3 : 1), 0xffffff);
}
 
Example #22
Source File: Window.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
protected void drawBar(int mX, int mY, TextRenderer textRend) {
	/* background and title bar */
	fillGrey(x1, y1, x2, y2);
	fillGradient(x1 + 2, y1 + 2, x2 - 2, y1 + 12, (selected ? 0xff0000ff : 0xff606060), (selected ? 0xff4080ff : 0xffa0a0a0));
	
	/* buttons */
	fillGrey(x2 - 12, y1 + 3, x2 - 4, y1 + 11);
	textRend.draw("x", x2 - 11, y1 + 2, 0x000000);
	
	fillGrey(x2 - 22, y1 + 3, x2 - 14, y1 + 11);
	textRend.draw("_", x2 - 21, y1 + 1, 0x000000);
}
 
Example #23
Source File: WTextField.java    From LibGui with MIT License 5 votes vote down vote up
/**
 * From a caret position, finds out what the x-offset to draw the caret is.
 * @param s
 * @param pos
 * @return
 */
@Environment(EnvType.CLIENT)
public static int getCaretOffset(String s, int pos) {
	if (pos==0) return 0;//-1;
	
	TextRenderer font = MinecraftClient.getInstance().textRenderer;
	int ofs = font.getWidth(s.substring(0, pos))+1;
	return ofs; //(font.isRightToLeft()) ? -ofs : ofs;
}
 
Example #24
Source File: WText.java    From LibGui with MIT License 5 votes vote down vote up
/**
 * Gets the text style at the specific widget-space coordinates.
 *
 * @param x the X coordinate in widget space
 * @param y the Y coordinate in widget space
 * @return the text style at the position, or null if not found
 */
@Environment(EnvType.CLIENT)
@Nullable
public Style getTextStyleAt(int x, int y) {
	TextRenderer font = MinecraftClient.getInstance().textRenderer;
	int lineIndex = y / font.fontHeight;

	if (lineIndex >= 0 && lineIndex < wrappedLines.size()) {
		StringRenderable line = wrappedLines.get(lineIndex);
		return font.getTextHandler().trimToWidth(line, x);
	}

	return null;
}
 
Example #25
Source File: Window.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void render(int mX, int mY) {
	TextRenderer textRend = MinecraftClient.getInstance().textRenderer;
	
	if (dragging) {
		x2 = (x2 - x1) + mX - dragOffX;
		y2 = (y2 - y1) + mY - dragOffY;
		x1 = mX - dragOffX;
		y1 = mY - dragOffY;
	}
	
	drawBar(mX, mY, textRend);
	
	for (WindowButton w: buttons) {
		int bx1 = x1 + w.x1;
		int by1 = y1 + w.y1;
		int bx2 = x1 + w.x2;
		int by2 = y1 + w.y2;
		
		Screen.fill(bx1, by1, bx2 - 1, by2 - 1, 0xffb0b0b0);
		Screen.fill(bx1 + 1, by1 + 1, bx2, by2, 0xff000000);
		Screen.fill(bx1 + 1, by1 + 1, bx2 - 1, by2 - 1,
				selected && mX >= bx1 && mX <= bx2 && mY >= by1 && mY <= by2 ? 0xff959595 : 0xff858585);
		textRend.drawWithShadow(w.text, bx1 + (bx2 - bx1) / 2 - textRend.getStringWidth(w.text) / 2, by1 + (by2 - by1) / 2 - 4, -1);
	}
	
	/* window icon */
	if (icon != null && selected) {
		GL11.glPushMatrix();
		GL11.glScaled(0.55, 0.55, 1);
		DiffuseLighting.enableGuiDepthLighting();
		MinecraftClient.getInstance().getItemRenderer().renderGuiItem(icon, (int)((x1 + 3) * 1/0.55), (int)((y1 + 3) * 1/0.55));
		GL11.glPopMatrix();
	}
	
	/* window title */
	textRend.drawWithShadow(title, x1 + (icon == null || !selected || icon.getItem() == Items.AIR ? 4 : 15), y1 + 3, -1);
}
 
Example #26
Source File: WText.java    From LibGui with MIT License 5 votes vote down vote up
@Environment(EnvType.CLIENT)
@Override
public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) {
	if (wrappedLines == null || wrappingScheduled) {
		wrapLines();
		wrappingScheduled = false;
	}

	TextRenderer font = MinecraftClient.getInstance().textRenderer;

	int yOffset;
	switch (verticalAlignment) {
		case CENTER:
			yOffset = height / 2 - font.fontHeight * wrappedLines.size() / 2;
			break;
		case BOTTOM:
			yOffset = height - font.fontHeight * wrappedLines.size();
			break;
		case TOP:
		default:
			yOffset = 0;
			break;
	}

	for (int i = 0; i < wrappedLines.size(); i++) {
		StringRenderable line = wrappedLines.get(i);
		int c = LibGuiClient.config.darkMode ? darkmodeColor : color;

		ScreenDrawing.drawString(matrices, line, horizontalAlignment, x, y + yOffset + i * font.fontHeight, width, c);
	}

	Style hoveredTextStyle = getTextStyleAt(mouseX, mouseY);
	if (hoveredTextStyle != null) {
		Screen screen = MinecraftClient.getInstance().currentScreen;
		if (screen instanceof TextHoverRendererScreen) {
			((TextHoverRendererScreen) screen).renderTextHover(matrices, hoveredTextStyle, x + mouseX, y + mouseY);
		}
	}
}
 
Example #27
Source File: WLabel.java    From LibGui with MIT License 5 votes vote down vote up
@Override
public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) {
	MinecraftClient mc = MinecraftClient.getInstance();
	TextRenderer renderer = mc.textRenderer;
	int yOffset;

	switch (verticalAlignment) {
		case CENTER:
			yOffset = height / 2 - renderer.fontHeight / 2;
			break;
		case BOTTOM:
			yOffset = height - renderer.fontHeight;
			break;
		case TOP:
		default:
			yOffset = 0;
			break;
	}

	ScreenDrawing.drawString(matrices, text, horizontalAlignment, x, y + yOffset, this.getWidth(), LibGuiClient.config.darkMode ? darkmodeColor : color);

	Style hoveredTextStyle = getTextStyleAt(mouseX, mouseY);
	if (hoveredTextStyle != null) {
		Screen screen = MinecraftClient.getInstance().currentScreen;
		if (screen instanceof TextHoverRendererScreen) {
			((TextHoverRendererScreen) screen).renderTextHover(matrices, hoveredTextStyle, x + mouseX, y + mouseY);
		}
	}
}
 
Example #28
Source File: Window.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void render(int mX, int mY) {
	TextRenderer textRend = MinecraftClient.getInstance().textRenderer;
	
	if (dragging) {
		x2 = (x2 - x1) + mX - dragOffX;
		y2 = (y2 - y1) + mY - dragOffY;
		x1 = mX - dragOffX;
		y1 = mY - dragOffY;
	}
	
	drawBar(mX, mY, textRend);
	
	for (WindowButton w: buttons) {
		int bx1 = x1 + w.x1;
		int by1 = y1 + w.y1;
		int bx2 = x1 + w.x2;
		int by2 = y1 + w.y2;
		
		Screen.fill(bx1, by1, bx2 - 1, by2 - 1, 0xffb0b0b0);
		Screen.fill(bx1 + 1, by1 + 1, bx2, by2, 0xff000000);
		Screen.fill(bx1 + 1, by1 + 1, bx2 - 1, by2 - 1,
				selected && mX >= bx1 && mX <= bx2 && mY >= by1 && mY <= by2 ? 0xff959595 : 0xff858585);
		textRend.drawWithShadow(w.text, bx1 + (bx2 - bx1) / 2 - textRend.getStringWidth(w.text) / 2, by1 + (by2 - by1) / 2 - 4, -1);
	}
	
	/* window icon */
	if (icon != null && selected) {
		GL11.glPushMatrix();
		GL11.glScaled(0.55, 0.55, 1);
		GuiLighting.enable();
		MinecraftClient.getInstance().getItemRenderer().renderGuiItem(icon, (int)((x1 + 3) * 1/0.55), (int)((y1 + 3) * 1/0.55));
		GL11.glPopMatrix();
	}
	
	/* window title */
	textRend.drawWithShadow(title, x1 + (icon == null  || !selected ? 4 : 15), y1 + 3, -1);
}
 
Example #29
Source File: Window.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
protected void drawBar(int mX, int mY, TextRenderer textRend) {
	/* background and title bar */
	fillGrey(x1, y1, x2, y2);
	fillGradient(x1 + 2, y1 + 2, x2 - 2, y1 + 12, (selected ? 0xff0000ff : 0xff606060), (selected ? 0xff4080ff : 0xffa0a0a0));
	
	/* buttons */
	fillGrey(x2 - 12, y1 + 3, x2 - 4, y1 + 11);
	textRend.draw("x", x2 - 11, y1 + 2, 0x000000);
	
	fillGrey(x2 - 22, y1 + 3, x2 - 14, y1 + 11);
	textRend.draw("_", x2 - 21, y1 + 1, 0x000000);
}
 
Example #30
Source File: FileComponent.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handleMouseClick(double mouseX, double mouseY, int mouseButton)
{
	if(mouseButton != 0)
		return;
	
	TextRenderer fr = WurstClient.MC.textRenderer;
	int buttonWidth = fr.getWidth(setting.getSelectedFileName());
	
	if(mouseX < getX() + getWidth() - buttonWidth - 4)
		return;
	
	WurstClient.MC.openScreen(
		new SelectFileScreen(WurstClient.MC.currentScreen, setting));
}