Posted July 15, 201510 yr Hello everyone, I really don't get it, how a GuiTextField is aligned in a GuiContainer. I have overwritten the drawGuiContainerBackgroundLayer to display my Background Image as followed: @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { mc.renderEngine.bindTexture(resourceLocation); GL11.glColor4f(1.0f,1.0f,1.0f,1.0f); int bgX = width/2-128; int bgY = height/2-28; this.drawTexturedModalRect(bgX, bgY, 0, 0, 256, 57); } Background-Image: So the Background-Image is centered in Minecraft, as I wanted. Now the problem: When I initialize my GuiTextField like so: tfFrequency = new GuiTextField(fontRendererObj, 0,0,tfWidth,tfHeight); ...the TextField is anywhere. Here is a Screenshot as it looks In-Game: So the coordinates 0/0 are up there. Why? Where do the coordinates of a GuiTextField start? Thanks for every help and sorry for my bad english, Julian
July 15, 201510 yr If you know how you centered background, you should know how to center text field. Answer is there. Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
July 15, 201510 yr Author Yeah, that's exactly what I thought, too, but if you would have read my Thread, you would know, that that's not the case. Please give a useful answer, or let it be. Why is 0/0 not in the left top of the Minecraft-Screen or in the left top of the GUI-Background? It's just anywhere?! With best regards, Julian
July 15, 201510 yr if you got a problem tell us which version u are helps a lot..... are u sure u got the arguments right? that 0,0 is the position?
July 15, 201510 yr Author Hello, thanks for your answer. I use Forge-Version 10.13.4.1448 for Minecraft 1.7.10 I just figured out, that when I overwrite the method "drawScreen()" in my GuiContainer-class and draw the GuiTextField in that method instead of drawing it in the "drawGuiContainerForegroundLayer"-method, the coordinates are right and everything is perfect. But why is 0/0 in the drawGuiContainerForegroundLayer-method on another place than 0/0 in the drawScreen-method? Thanks for your answer!
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.