use of org.bleachhack.gui.clickgui.window.ClickGuiWindow.Tooltip in project BleachHack by BleachDrinker420.
the class ClickGuiScreen method render.
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
for (Window w : getWindows()) {
if (w instanceof ClickGuiWindow) {
((ClickGuiWindow) w).updateKeys(mouseX, mouseY, keyDown, lmDown, rmDown, lmHeld, mwScroll);
}
}
super.render(matrices, mouseX, mouseY, delta);
matrices.push();
matrices.translate(0, 0, 250);
for (Window w : getWindows()) {
if (w instanceof ClickGuiWindow) {
Tooltip tooltip = ((ClickGuiWindow) w).getTooltip();
if (tooltip != null) {
int tooltipY = tooltip.y;
String[] split = tooltip.text.split("\n", -1);
ArrayUtils.reverse(split);
for (String s : split) {
/* Match lines to end of words after it reaches 22 characters long */
Matcher mat = Pattern.compile(".{1,22}\\b\\W*").matcher(s);
List<String> lines = new ArrayList<>();
while (mat.find()) lines.add(mat.group().trim());
if (lines.isEmpty())
lines.add(s);
int start = tooltipY - lines.size() * 10;
for (int l = 0; l < lines.size(); l++) {
fill(matrices, tooltip.x, start + (l * 10) - 1, tooltip.x + textRenderer.getWidth(lines.get(l)) + 3, start + (l * 10) + 9, 0xff000000);
textRenderer.drawWithShadow(matrices, lines.get(l), tooltip.x + 2, start + (l * 10), -1);
}
tooltipY -= lines.size() * 10;
}
}
}
}
Window.fill(matrices, width / 2 - 50, -1, width / 2 - 2, 12, mouseX >= width / 2 - 50 && mouseX <= width / 2 - 2 && mouseY >= 0 && mouseY <= 12 ? 0x60b070f0 : 0x60606090);
Window.fill(matrices, width / 2 + 2, -1, width / 2 + 50, 12, mouseX >= width / 2 + 2 && mouseX <= width / 2 + 50 && mouseY >= 0 && mouseY <= 12 ? 0x60b070f0 : 0x60606090);
drawCenteredText(matrices, textRenderer, "Modules", width / 2 - 26, 2, 0xf0f0f0);
drawCenteredText(matrices, textRenderer, "UI", width / 2 + 26, 2, 0xf0f0f0);
if (warningOpacity > 3) {
drawCenteredText(matrices, textRenderer, "UI not available on the main menu!", width / 2, 17, warningOpacity > 255 ? 0xd14a3b : (warningOpacity << 24) | 0xd14a3b);
warningOpacity -= 3;
}
matrices.pop();
lmDown = false;
rmDown = false;
keyDown = -1;
mwScroll = 0;
}
use of org.bleachhack.gui.clickgui.window.ClickGuiWindow.Tooltip in project BleachHack by BleachDrinker420.
the class SettingToggle method getTooltip.
public Tooltip getTooltip(ModuleWindow window, int x, int y, int len) {
if (!expanded || window.mouseY - y <= 12)
return super.getTooltip(window, x, y, len);
Tooltip tooltip = null;
int h = y + 12;
for (ModuleSetting<?> s : children) {
if (window.mouseOver(x + 2, h, x + len, h + s.getHeight(len))) {
tooltip = s.getTooltip(window, x + 2, h, len - 2);
}
h += s.getHeight(len - 2);
}
return tooltip;
}
Aggregations