Jump to content

Rendering Font in Bottom Left Corner


superckl

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.