I am trying to make an Scaling UI Hud Element, I want it so scale with the screen size but i haven't gotten an clue how to, ive looked online but all i found was code that would change the size of the picture but it would be black and would tile, this is the code i have
package com.callumcarmicheal.galacticfrontier.gui;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import com.callumcarmicheal.galacticfrontier.init.ModInfo;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
public class Logo extends GuiScreen {
public ResourceLocation TEXTURE = new ResourceLocation(ModInfo.Mod_ID, "textures/gui/base.png");
TextureManager renderEngine = Minecraft.getMinecraft().renderEngine;
private static GuiIngame gig = new GuiIngame(Minecraft.getMinecraft());
FontRenderer fontRender;
ScaledResolution scale;
public void renderLogoText(RenderGameOverlayEvent event) {
GL11.glDisable(GL11.GL_LIGHTING);
fontRender = Minecraft.getMinecraft().fontRenderer;
scale = new ScaledResolution(
Minecraft.getMinecraft().getMinecraft(),
Minecraft.getMinecraft().displayWidth,
Minecraft.getMinecraft().displayHeight
);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
int width = scale.getScaledWidth();
int height = scale.getScaledHeight();
int posX = 1;
int posY = 1;
int sizeX = 176;
int sizeY = 88;
this.drawTexturedModalRect(posX, posY, 0,0, sizeX, sizeY);
String Version = "Developer Edition";
drawText("§fGlactical Frontier", 1, true);
drawText("§b(§2" + Version + "§b)", 2, true);
drawText("§fPress §4Enter §fto §aContinue", 2, 7, true);
//GL11.glEnable(GL11.GL_LIGHTING);
}
public void drawText(String text, int WidthOffset, int Line, boolean Shaddow) {
fontRender.drawString(
text,
10 * WidthOffset,
10 * Line,
Color.white.getRGB(),
true);
}
public void drawText(String text, int Line, boolean Shaddow) {
fontRender.drawString(
text,
10,
10 * Line,
Color.white.getRGB(),
true);
}
}
This is the image i have for the base.png: http://i.imgur.com/LxK33.png