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

Hey there. For my custom gui/screen, I'm wanting to print a String to the screen. I'm doing that like so:

AbstractGui.drawString(matrixStack, Minecraft.getInstance().font, "Test String", x, y, this.color);

It's working, but the text is incredibly small (this probably has to do with the game settings option for gui scale. Is there any way I can actually increase the font size or even just 'scale' the string? I've tried both the following right before making the AbstractGui#drawString call and neither worked:

matrixStack.scale(2.f, 2.f, 2.f);

GL13.glScalef(2.f, 2.f, 2.f);

Any help would be appreciated! Thanks!

  • Author

Sure thing. So in my custom screen class, here's all the logic related to printing to the screen:

//Ensure screen always takes up the same amount of 'screen space' regardless of gui scale setting
final float scale = 1.f / guiScale;
pMatrixStack.scale(scale, scale, scale);

//Create screen texture
AbstractGui.blit(pMatrixStack, pos.x(), pos.y(), 0, start.x(), start.y(), dimensions.x(), dimensions.y(), textureSize.y(), textureSize.x());

//Then call the string render
render(pMatrixStack, x, y);

Here's the string render method:

public void render(final MatrixStack matrixStack, final int x, final int y) {
        matrixStack.scale(2.f, 2.f, 2.f);
        AbstractGui.drawString(matrixStack, Minecraft.getInstance().font, "Test String", x, y, this.color);
}

All of this technically works, except for the string size being scaled at the end. My best guess is that perhaps I need to push or pop or flush or do something to the MatrixStack after the AbstractGui#blit call (of which I'll test right now --- unfortunately push and pop didn't solve the problem).

Edited by Jimmeh
Edit

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.