use of mathax.client.systems.modules.Module in project Client by MatHax.
the class ActiveModulesHud method update.
@Override
public void update(HudRenderer renderer) {
if (Modules.get() == null) {
box.setSize(renderer.textWidth("Active Modules"), renderer.textHeight());
return;
}
modules.clear();
for (Module module : Modules.get().getActive()) {
if (module.isVisible())
modules.add(module);
}
modules.sort((o1, o2) -> {
double _1 = getModuleWidth(renderer, o1);
double _2 = getModuleWidth(renderer, o2);
if (sort.get() == Sort.Smallest) {
double temp = _1;
_1 = _2;
_2 = temp;
}
int a = Double.compare(_1, _2);
if (a == 0)
return 0;
return a < 0 ? 1 : -1;
});
double width = 0;
double height = 0;
for (int i = 0; i < modules.size(); i++) {
Module module = modules.get(i);
width = Math.max(width, getModuleWidth(renderer, module));
height += renderer.textHeight();
if (i > 0)
height += 2;
}
box.setSize(width, height);
}
use of mathax.client.systems.modules.Module in project Client by MatHax.
the class ActiveModulesHud method renderModule.
private void renderModule(HudRenderer renderer, List<Module> modules, int index, double x, double y) {
Module module = modules.get(index);
Color color = flatColor.get();
ModuleColorMode colorMode = this.colorMode.get();
if (colorMode == ModuleColorMode.Random)
color = module.color;
else if (colorMode == ModuleColorMode.Rainbow) {
rainbowHue2 += rainbowSpread.get();
int c = java.awt.Color.HSBtoRGB((float) rainbowHue2, rainbowSaturation.get().floatValue(), 1);
rainbow.r = Color.toRGBAR(c);
rainbow.g = Color.toRGBAG(c);
rainbow.b = Color.toRGBAB(c);
color = rainbow;
} else if (colorMode == ModuleColorMode.Category)
color = new Color(module.category.color);
renderer.text(module.title, x, y, color);
double textLength = renderer.textWidth(module.title);
if (activeInfo.get()) {
String info = module.getInfoString();
if (info != null) {
renderer.text(info, x + renderer.textWidth(module.title) + renderer.textWidth(" "), y, hud.secondaryColor.get());
textLength += renderer.textWidth(" ") + renderer.textWidth(info);
}
}
if (outlines.get()) {
if (index == 0) {
// Left quad
Renderer2D.COLOR.quad(x - 2 - outlineWidth.get(), y - 2, outlineWidth.get(), renderer.textHeight() + 4, prevColor, prevColor, color, color);
// Right quad
Renderer2D.COLOR.quad(x + textLength + 2, y - 2, outlineWidth.get(), renderer.textHeight() + 4, prevColor, prevColor, color, color);
// Top quad
Renderer2D.COLOR.quad(x - 2 - outlineWidth.get(), y - 2 - outlineWidth.get(), textLength + 4 + (outlineWidth.get() * 2), outlineWidth.get(), prevColor, prevColor, color, color);
} else if (index == modules.size() - 1) {
// Left quad
Renderer2D.COLOR.quad(x - 2 - outlineWidth.get(), y, outlineWidth.get(), renderer.textHeight() + 2 + outlineWidth.get(), prevColor, prevColor, color, color);
// Right quad
Renderer2D.COLOR.quad(x + textLength + 2, y, outlineWidth.get(), renderer.textHeight() + 2 + outlineWidth.get(), prevColor, prevColor, color, color);
// Bottom quad
Renderer2D.COLOR.quad(x - 2 - outlineWidth.get(), y + renderer.textHeight() + 2, textLength + 4 + (outlineWidth.get() * 2), outlineWidth.get(), prevColor, prevColor, color, color);
}
if (index > 0) {
if (index < modules.size() - 1) {
// Left quad
Renderer2D.COLOR.quad(x - 2 - outlineWidth.get(), y, outlineWidth.get(), renderer.textHeight() + 2, prevColor, prevColor, color, color);
// Right quad
Renderer2D.COLOR.quad(x + textLength + 2, y, outlineWidth.get(), renderer.textHeight() + 2, prevColor, prevColor, color, color);
}
// Left inbetween quad
Renderer2D.COLOR.quad(Math.min(prevX, x) - 2 - outlineWidth.get(), Math.max(prevX, x) == x ? y : y - outlineWidth.get(), (Math.max(prevX, x) - 2) - (Math.min(prevX, x) - 2 - outlineWidth.get()), outlineWidth.get(), prevColor, prevColor, color, color);
// Right inbetween quad
Renderer2D.COLOR.quad(Math.min(prevX + prevTextLength, x + textLength) + 2, Math.min(prevX + prevTextLength, x + textLength) == x + textLength ? y : y - outlineWidth.get(), (Math.max(prevX + prevTextLength, x + textLength) + 2 + outlineWidth.get()) - (Math.min(prevX + prevTextLength, x + textLength) + 2), outlineWidth.get(), prevColor, prevColor, color, color);
}
}
prevTextLength = textLength;
prevColor = color;
}
use of mathax.client.systems.modules.Module in project Client by MatHax.
the class ModuleInfoHud method render.
@Override
public void render(HudRenderer renderer) {
double x = box.getX();
double y = box.getY();
if (Modules.get() == null || modules.get().isEmpty()) {
renderer.text("Module Info", x, y, hud.primaryColor.get());
return;
}
for (Module module : modules.get()) {
renderModule(renderer, module, x + box.alignX(getModuleWidth(renderer, module)), y);
y += 2 + renderer.textHeight();
}
}
use of mathax.client.systems.modules.Module in project Client by MatHax.
the class ModuleInfoHud method update.
@Override
public void update(HudRenderer renderer) {
if (Modules.get() == null || modules.get().isEmpty()) {
box.setSize(renderer.textWidth("Module Info"), renderer.textHeight());
return;
}
double width = 0;
double height = 0;
int i = 0;
for (Module module : modules.get()) {
width = Math.max(width, getModuleWidth(renderer, module));
height += renderer.textHeight();
if (i > 0)
height += 2;
i++;
}
box.setSize(width, height);
}
Aggregations