Jump to content

Recommended Posts

Posted (edited)

I want my gui to maintain position and size proportional to the screen resolution and not be affected by the gui scale factor.

To keep the size I've tried many different ways like getting the gui scale factor from the settings, dividing the resolution by the texture dimensions and so on, but I haven't been successful so far.

I also don't understand how the position affects drawing a texture. I thought that positions would be relative to resolution, but I've found that setting anything more than around ~400 will cause the texture to disappear completely (considering I have a 1080p screen).

Edited by Melonslise
Posted (edited)

How would be harmful to accessibility and usability of the mod? The gui can't be interacted with anyway so I doubt it would be much of a problem.

 

How do I invert the glScale using the gui scaling factor? From what I've tested the factor returns strange values like 0 for auto, 1 for small, 2 for normal, etc. This isn't particularly helpful.

Edited by Melonslise
Posted

Well in my case I'm actually improving the readability. I need the gui stretched across almost the whole screen.

 

I've gathered as much by now. As I said, the problem lies in the values of the scale factor (at least the one I'm getting from the game settings). I wouldn't be able to to divide by 0 for instance.

Posted
1 hour ago, Melonslise said:

Well in my case I'm actually improving the readability. I need the gui stretched across almost the whole screen.

 

I've gathered as much by now. As I said, the problem lies in the values of the scale factor (at least the one I'm getting from the game settings). I wouldn't be able to to divide by 0 for instance.

I did a tutorial on this some time ago and although its a bad one, you may find some ideas there on how you will do it. Mine was pretty much hard coded though

Posted

Have you tried setting xSize, ySize, guiLeft and guiTop? For example:

 

@Override
	public void initGui() {
		super.initGui();
		
		xSize=width-10;
		ySize=height-10;
		guiLeft=(width-xSize)/2;
		guiTop=(height-ySize)/2;
	}

"width" and "height" fields are the ones that scale when screen size changes.

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.

Announcements



×
×
  • Create New...

Important Information

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