Skip to content
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

Closed
tinytransfem opened this issue Nov 5, 2021 · 8 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tinytransfem
Copy link

tinytransfem commented Nov 5, 2021

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

  • MCreator version: 2021.3 EAP b45419
  • Generator type: forge-1.17.1
  • OS: Windows

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.

@tinytransfem tinytransfem added the bug Something isn't working label Nov 5, 2021
@KlemenDEV KlemenDEV added this to the 2021.3 milestone Nov 5, 2021
@KlemenDEV
Copy link
Contributor

@KlemenDEV KlemenDEV reopened this Nov 5, 2021
@KlemenDEV
Copy link
Contributor

Accidentally closed, oops :D

@MagicalAlexey
Copy link
Contributor

I also encountered this problem, but I bypassed it by editing the image inside the mod.

@tinytransfem
Copy link
Author

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
For now I can fix this manually in the code, but I hope it gets fixed in MCreator with the next snapshot

@KlemenDEV KlemenDEV self-assigned this Nov 7, 2021
@SiegeMaza
Copy link

I also have this problem guess I'll just have to fix it in the code :(

@KlemenDEV
Copy link
Contributor

Fixed: https://mcreator.net/changelog

@SiegeMaza
Copy link

@KlemenDEV I have the newest versions but its still not fixed, is it in an upcoming version??

@KlemenDEV
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants