TabGUI improvements

This commit is contained in:
ThisIsALegitUsername 2023-02-05 00:51:31 +00:00
parent 99a8de1bd0
commit e94473d402
4 changed files with 6272 additions and 6274 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -4,9 +4,8 @@ import dev.resent.Resent;
import dev.resent.annotation.RenderModule;
import dev.resent.module.base.Mod;
import dev.resent.module.base.Mod.Category;
import dev.resent.util.misc.GlUtils;
import dev.resent.util.render.RenderUtils;
import dev.resent.module.base.RenderMod;
import dev.resent.util.render.RenderUtils;
import net.lax1dude.eaglercraft.v1_8.internal.KeyboardConstants;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
@ -18,20 +17,20 @@ public class TabGui extends RenderMod{
public boolean expanded;
public int getWidth(){
return expanded ? 90 : 70;
return expanded ? 100 : 75;
}
public int getHeight(){
return Category.values().length*16;
return Category.values().length*16+4;
}
public void draw() {
Gui.drawRect(x+5, y+30.5, x+70, y+31.5+Category.values().length*16, 0x90000000);
RenderUtils.drawChromaRectangle(x+7, y+33+current*16, x+68, y+45+current*16, 0xff900000);
Gui.drawRect(x+5, y+2, x+70, y+3+Category.values().length*16, 0x90000000);
RenderUtils.drawChromaRectangle(x+7, y+4.5f+current*16, x+68, y+16.5f+current*16, 0xff900000);
int offset = 0;
for(Category c : Category.values()){
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(c.name, x+10, y+35+offset, -1);
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(c.name, x+10, y+6.5f+offset, -1);
offset += 16;
}
@ -41,12 +40,12 @@ public class TabGui extends RenderMod{
if(Resent.INSTANCE.modManager.modsInCategory(category).size() == 0)
return;
Gui.drawRect(x+70, y+30.5, x+138, y+31.5+Resent.INSTANCE.modManager.modsInCategory(category).size()*16, 0x90000000);
RenderUtils.drawChromaRectangle(x+70, y+33+category.i*16, x+136, y+45+category.i*16, 0xff900000);
Gui.drawRect(x+70, y+2, x+138, y+3+Resent.INSTANCE.modManager.modsInCategory(category).size()*16, 0x90000000);
RenderUtils.drawChromaRectangle(x+70, y+4.5f+category.i*16, x+136, y+16.5f+category.i*16, 0xff900000);
offset = 0;
for(Mod m : Resent.INSTANCE.modManager.modsInCategory(category)){
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(m.name, x+73, y+35+offset, -1);
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(m.name, x+73, y+6.5f+offset, -1);
offset += 16;
}
}

View File

@ -25,8 +25,8 @@ public class RenderUtils {
}
}
public static void drawChromaRectangle(int x, int y, int width, int height, int colorbecauseidontwanttoremovecolor) {
int i = x;
public static void drawChromaRectangle(float x, float y, float width, float height, int colorbecauseidontwanttoremovecolor) {
float i = x;
while(true) {
if(i+10 <= width) {
Gui.drawRect(i, y, i+10, height,RenderUtils.astolfoColorsDraw(i, GuiScreen.width,10000f));
@ -36,13 +36,13 @@ public class RenderUtils {
i+=10;
}
if(width-i != 0) {
for(int h = i; h < width; h++) {
for(float h = i; h < width; h++) {
Gui.drawRect(h, y, h+1, height,RenderUtils.astolfoColorsDraw(h, GuiScreen.width,10000f));
}
}
}
public static int astolfoColorsDraw(int yOffset, int yTotal, float speed) {
public static int astolfoColorsDraw(float yOffset, int yTotal, float speed) {
float hue = (float) (System.currentTimeMillis() % (int)speed) + ((yTotal - yOffset) * 9);
while (hue > speed) {
hue -= speed;
@ -52,10 +52,10 @@ public class RenderUtils {
hue = 0.5F - (hue - 0.5f);
}
hue += 0.5F;
return Color.HSBtoRGB(hue, 0.5f, 1F);
return Color.HSBtoRGB(hue, 0.5f, 1f);
}
public static int astolfoColorsDraw(int yOffset, int yTotal) {
public static int astolfoColorsDraw(float yOffset, int yTotal) {
return astolfoColorsDraw(yOffset, yTotal, 50000f);
}