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

I've been scratching my head over this one for awhile now. I'm trying to render font in the bottom left corner of the screen, but I can't figure out why y position to use. It changes based on the resolution and I can't seem to find any clear pattern (I've taken several screenshots and compared the height of the text to the resolution in Photoshop). I know I need to use 0 for the x position, but I'm stuck on y. Is there any way to find what height a string will be? I know there is a method for width.

 

Thanks for any help you can provide.

ScaledResolution has your answer:

 

Minecraft minecraft = Minecraft.getMinecraft();
ScaledResolution sr = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
int y = sr.getScaledHeight(); //gives the screen height.

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

  • Author

I already know how to get the scaled height of the screen. The problem is that if I render the text at (0, scaledHeight), it will render off the screen and not show. I need to move the text up by how tall the text is, which is what I don't know how to find.

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.