New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Images and text added into GUIs use absolute coordinates instead of relative ones, causing scaling issues #1975
Comments
Original topic: https://mcreator.net/forum/80715/gui-scaling-center-117-snapshot |
Accidentally closed, oops :D |
I also encountered this problem, but I bypassed it by editing the image inside the mod. |
That sadly isn't an option for me, as my added image is part of an animation that shows how much fuel is left in my block, so I need images that I can show or hide however I need them |
I also have this problem guess I'll just have to fix it in the code :( |
@KlemenDEV I have the newest versions but its still not fixed, is it in an upcoming version?? |
The fix for this bug will be released with the next snapshot which is not out yet. Keep your eyes on https://mcreator.net/changelog |
Describe the bug
In the 1.17 Forge snapshot, images and text added to the GUI don't use relative coordinates like they did in 2021.2 for 1.16.5. Instead, they use absolute coordinates on the screen, meaning when the game window size or ratio changes, the images move away from their place on the GUI.
Details
Steps To Reproduce
This can be reproduced by creating any GUI and adding an image or text to it. Then, go into the game, open the GUI, and start dragging around a corner of the game window so that size and shape of the window change. You will see that whenever you let go and the window refreshes, the image or text will be in a different place compared to the GUI background.
Minimal reproducible example workspace
In this workspace I prepared two GUIs, one that uses the default code generated by MCreator, and one where I only changed the absolute coordinates to relative ones, keeping the rest of the code intact. To see the issue, you can open the workspace, run the client, and then open the first GUI by pressing B. This will open the GUI as it was created by MCreator and the image in it will move when the window changes as described in "Steps To Reproduce." The second GUI, openable with N, will show a version of how the GUI should be, using relative coordiantes.
In line 56 of the GUIScreen.java file you can see what I changed, namely
this.blit(ms, 117, 31, 0, 0, 190, 201, 190, 201);
to
this.blit(ms, k - 5, l + 3, 0, 0, 190, 201, 190, 201);
Bugreport.zip
Logs
No logs are relevant for this issue.
The text was updated successfully, but these errors were encountered: