Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi, im using the drawBackground method inside GuiContainer and when i draw my texture its too small (i want it bigger than 256) when i scale the texture using GL11.glScalef(x, y, z); it makes it bigger but when i change the size of the screen it moves. So how do i get a scaled texture to stay in a ration depending on what the screen size is?

 

I currently have this:

 

public class GuiKaren extends GuiContainer {

public GuiKaren() {
	super(new ContainerEmpty());
}

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	this.mc.getTextureManager().bindTexture(new ResourceLocation(SlayerAPI.PREFIX + "textures/gui/people/karen.png"));
        int k = (this.width - this.xSize) / 2;
        int l = (this.height - this.ySize) / 2;
        GL11.glPushMatrix();
        float scale = 1.0F;
        GL11.glScalef(scale, scale, scale);
        this.drawTexturedModalRect(k - 100, l, 0, 0, 220, 220);
	int guit = ClientTickHandler.guit;
	this.mc.getTextureManager().bindTexture(new ResourceLocation(SlayerAPI.PREFIX + "textures/gui/background.png"));

	if(guit > 5) {
		this.drawTexturedModalRect(k - 130, l - 120, 0, 0, 232, 100);
	} else if(guit < 5) {
		this.drawTexturedModalRect(k - 130, l - 120, 0, 102, 232, 100);
	} else {
		this.drawTexturedModalRect(k - 130, l - 120, 0, 0, 232, 100);
	}
        GL11.glPopMatrix();
}
}

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Something like this:

GL11.glTranslatef(k - 100, l, 0);
GL11.glScalef(scale, scale, scale);
this.drawTexturedModalRect(0, 0, 0, 0, 220, 220);

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.