Jump to content

[1.7.10] Need Help With Drawing An Overlay OnScreen [SOLVED]


Recommended Posts

Posted

Hello everyone i have an overlay i am trying to put onscreen and i have got it to display but it displays multiple of the image on screen and i just want it to display one image.Any ideas?

p.s my image is 256x256 if that helps.

 

Heres the code

 

 

import org.lwjgl.opengl.GL11;

 

import com.Looke81.BioWarfare.BioWarfare;

import com.Looke81.BioWarfare.DrawB;

import com.Looke81.BioWarfare.DrawM;

import com.Looke81.BioWarfare.blocks.BacteriaTest;

import com.Looke81.BioWarfare.items.Microscope;

 

import cpw.mods.fml.common.eventhandler.EventPriority;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

import net.minecraft.client.Minecraft;

import net.minecraft.client.gui.Gui;

import net.minecraft.client.gui.GuiChat;

import net.minecraft.client.gui.ScaledResolution;

import net.minecraft.client.renderer.Tessellator;

import net.minecraft.util.ResourceLocation;

 

public class OverlayGui extends Gui{

public static OverlayGui instance = new OverlayGui();

private static Minecraft mc = Minecraft.getMinecraft();

private ResourceLocation MOverlay = new ResourceLocation(BioWarfare.modid + ":textures/gui/MOverlay.png");

@SubscribeEvent (priority = EventPriority.LOWEST)

public void RenderGameOverlayEvent(net.minecraftforge.client.event.RenderGameOverlayEvent event) {

 

ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);

      int Width = sr.getScaledWidth();

      int Height = sr.getScaledHeight();

   

 

      GL11.glPushMatrix();

 

this.mc.renderEngine.bindTexture(MOverlay);

 

// texture

this.drawTexturedModalRect(0, 0, 0, 0, Width, Height);

 

    GL11.glPopMatrix();

   

}

}

 

BioWarfare Mod: http://goo.gl/BYWQty

Posted

Did you register the class that contains the @SubscribeEvent? If so, show where you registered it.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

I pretty sure the resource location is working as i can see the texture. I've removed the push and pop Im not sure why I did that but i saw it in other peoples code so i did it to be safe.My texture is 256x256. Also I've kept the event the same because I'm not sure what event i should use if i just want it to display all the time when in game. I think the problem is with scaled resolution because when i use scaled resolution it fills the screen repeating the image from left to right but if i don't use scaled resolution and instead tell it its 256x256 then it displays one image in the top left that is 256x256. I have tried changing this so that the one image will fill the whole screen but it doesn't seem to work the only time i can fill the screen is when i use scaled resolution but it just repeats the image. 

 

So what im asking is how do i fill the screen with one image and what even should i use to display all the time?

BioWarfare Mod: http://goo.gl/BYWQty

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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