mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Doubled filter max string length from 12 characters to 24 characters, allows hyphens and spaces in filters, developed and integrated new fancy auto-scaling text renderer to prevent text overlap
This commit is contained in:
1 parent
7d17192173
commit
09f1a04764
10 files changed
+60
-34
No files matched your search
@@ -9,7 +9,6 @@ import mekanism.common.SideData;
|
||||
import mekanism.common.base.IInvConfiguration;
|
||||
import mekanism.common.item.ItemConfigurator;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -35,6 +34,28 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
|
||||
super(container);
|
||||
tileEntity = tile;
|
||||
}
|
||||
|
||||
public void renderScaledText(String text, int x, int y, int color, int maxX)
|
||||
{
|
||||
int length = fontRendererObj.getStringWidth(text);
|
||||
|
||||
if(length <= maxX)
|
||||
{
|
||||
fontRendererObj.drawString(text, x, y, color);
|
||||
}
|
||||
else {
|
||||
float scale = (float)maxX/length;
|
||||
float reverse = 1/scale;
|
||||
float yAdd = 4-(scale*8)/2F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
fontRendererObj.drawString(text, (int)(x*reverse), (int)((y*reverse)+yAdd), color);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
|
||||
Reference in new issue
Block a user