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

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

  • 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

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

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.