Posted March 18, 20178 yr Ok, so I got this method within an extender to GuiScreen. public void drawString(FontRenderer fontRendererIn, String text, int x, int y, float size, int color) { GL11.glScalef(size,size,size); float mSize = (float)Math.pow(size,-1); this.drawString(fontRendererIn,text,x,y,color); GL11.glScalef(mSize,mSize,mSize); } which draws a string with a different scale(multiplier) and then resets GL scale to normal.. The problem is, the point of which it scales from is at x,y which means the scale will move the string bottom-right a bit.. Now, since the scalef is not linked to the width of height of anything, it will leave the text in a wierd place once I resize the minecraft screen or move computers to different resolutions.. I need to find a way to translate the text back to a point based on scale, x and y. and I just dont know how... Any help is appreciated.. Doing stuff n' things
March 18, 20178 yr Author 1 hour ago, diesieben07 said: You need to scale the coordinates as well. That I know, but how.. I dont know how much I have to multiply it and to what.. Doing stuff n' things
March 18, 20178 yr Author 2 minutes ago, diesieben07 said: If you scale everything by 2 and then draw something at 10, 10 it will be drawn at 20,20. For it to actually end up at 10, 10 you need to divide by 2 (the scale). Thank you so much! I suck at math.. If anyone needs the method: public void drawString(FontRenderer fontRendererIn, String text, int x, int y, float size, int color) { GL11.glScalef(size,size,size); float mSize = (float)Math.pow(size,-1); this.drawString(fontRendererIn,text,Math.round(x / size),Math.round(y / size),color); GL11.glScalef(mSize,mSize,mSize); } Doing stuff n' things
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.