Comments (44)
There's no need to edit the library. When instantiating an instance of GuiInterface
, you can override the method. Here is the place where it is done in the example mod:
from panelstudio.
Dragging it back on to screen is typically done by a "fixgui" command, implemented by the client, which resets the position of panels.
from panelstudio.
I'll try it on Linux tomorrow and see if the issue appears there as well.
Otherwise I can't do much about it until I get hold of a Mac or something.
from panelstudio.
I do not own a mac, so I can't reproduce that issue and solve it.
Could you send a few screenshots of the issue?
from panelstudio.
This screen recording should show enough; if you want me to try anything, just let me know.
from panelstudio.
Does this only happen on 1.18.2. Could you try running it on 1.17.1?
In any case, the root cause of the problem probably lies in the class GLInterface
.
Namely the methods scissor
and guiToScreen
.
So when instantiating that class, it should work by overriding scissor
and guiToScreen
in some way.
Could you print out MinecraftClient.getInstance().getWindow().getWidth()
, MinecraftClient.getInstance().getWindow().getScaledWidth()
(and the corresponding methods for height)?
from panelstudio.
Output on 1.18.2:
Window width: 854
Window scaled width: 427
Window height: 480
Window scaled height: 240
Output on 1.17.1:
Window width: 854
Window scaled width: 427
Window height: 480
Window scaled height: 240
I didn't include a new visual for 1.17.1, because it produces the same issue.
from panelstudio.
Does the (non-scaled) width/height approximately correspond to the actual Minecraft window size in pixels?
And is your GUI size set to 2?
Could you try out other GUI sizes?
from panelstudio.
The scale lines up, and I've tried all the different GUI scales, (they all render the same error).
from panelstudio.
So when instantiating the Interface here add following method to the anonymous class:
@Override
protected void scissor (Rectangle r) {
width = MinecraftClient.getInstance().getWindow().getWidth();
height = MinecraftClient.getInstance().getWindow().getWidth();
GL11.glScissor(0,0,100,100);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
}
And then open a category and move it around until something appears (it doesn't have to necessarily be inside the category outline). Please report the location and size of the rectangle in which it appears.
Then vary the arguments of glScissor
(the first two are x and y position, the last two are width and height):
GL11.glScissor(100,100,100,100);
GL11.glScissor(0,0,width/2,height/2);
GL11.glScissor(width/2,height/2,width/2,height/2);
GL11.glScissor(0,0,width,height);
I hope this information will help me get to the bottom of this issue.
from panelstudio.
Also, thank you very much for your patience and cooperation so far!
from panelstudio.
Of course! However, I'm not quite sure how to add the method you asked, because I can't edit the library (It's included as an external library). Is there a different way I should include the code?
from panelstudio.
I found a solution that fixed the background, but on the closing of the category it crashes the game, so I'm gonna keep trying.
from panelstudio.
Update: using this method "works," but causes an issue where if a module's settings are open, they will continue to render outside of the category's frame while the module is opened.
@Override
protected void scissor (Rectangle r) {
if (r==null) {
GL11.glScissor(0,0,0,0);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
return;
}
width = MinecraftClient.getInstance().getWindow().getScaledWidth();
height = MinecraftClient.getInstance().getWindow().getScaledHeight();
double scaleFactor = MinecraftClient.getInstance().getWindow().getScaleFactor();
GL11.glScissor((int) (r.x * scaleFactor), (int) -(r.y * scaleFactor), (int) (r.width * scaleFactor), (int) (height * scaleFactor));
GL11.glEnable(GL11.GL_SCISSOR_TEST);
}
from panelstudio.
Yeah, the scissor method is responsible for selecting the right rectangle for it not to do that.
The problem is that the function transforming from GUI coordinates to screen pixels is wrong, so it either display too much or too little.
Does that cut anything or are all modules visible?
The solution to this entire issue is figuring out how the values that one plugs into glScissor
map to the screen.
from panelstudio.
Sorry, I don't really understand what you're asking for. Could you rephrase that?
from panelstudio.
The glScissor
takes x, y, width, height values in pixels. However those pixels do not correspond to the values in the rectangle r
passed as an argument for this method. The point of that method it to tell OpenGL to only draw pixels inside the category frame and ignore all pixels outside, so nothing is rendered outside the frame.
For whatever reason it seems to work differently on Macs.
What I'm trying to figure out, is how it behaves.
I was asking whether your solution cuts any part of the category out, or if it just renders all of the modules outside. I suspect it is not doing anything, because the y-value is negative.
This is why I was earlier asking for you to try out all those variants, I need to figure out what coordinates I need to pass to glScissor
to obtain each corner.
from panelstudio.
It doesn't appear to cut any part of the category out.
from panelstudio.
Ok, so what happens if you make the y-value positive? I presume it regresses to what you had originally.
So what happens if you scissor a square of 100x100 at 0,0 (i.e. GL11.glScissor(0,0,100,100))?
In what corner of the screen would the content of the category become visible and how large is that square?
from panelstudio.
- When the y-value was positive, it flipped the background such that if I placed the category at the top of the screen, the background would be at the bottom (and vice versa). I believe I know why (which you will see in my next answer).
- When I scissor a square of 100x100 at (0,0), it places the square in the bottom-left corner and the size varies depending on the gui scale, but it's small/medium sized.
What I can't figure out is that the fourth argument in GL11.glscissor()
has to be the window height
, not r.height
or else the modules' settings will not render (Doesn't make an issue bc I have a solution, but it might help in your problem solving).
from panelstudio.
ok, assuming it's bottom left and scales with GUI scale, this will hopefully work:
GL11.glScissor(r.x,MinecraftClient.getInstance().getWindow().getHeight()-r.y,r.width,r.height);
from panelstudio.
from panelstudio.
Also, unrelated issue: How do I drag a module back onto the screen when the top of it isn't on the screen?
from panelstudio.
oh, wait, I think I did a mistake, try:
GL11.glScissor(r.x,MinecraftClient.getInstance().getWindow().getHeight()-r.y-r.height,r.width,r.height);
from panelstudio.
Still nope :/
from panelstudio.
I can give you another image but it looks pretty much the same
from panelstudio.
I have noticed some parts of Minecraft do it through RenderSystem
, maybe all this was a conflict with Minecraft's own bookkeeping:
@override
protected void scissor (Rectangle r) {
if (r==null) {
RenderSystem.enableScissor(0,0,0,0);
return;
}
Point a=guiToScreen(r.getLocation()),b=guiToScreen(new Point(r.x+r.width,r.y+r.height));
if (!clipX) {
a.x=0;
b.x=MinecraftClient.getInstance().getWindow().getWidth();
}
RenderSystem.enableScissor(Math.min(a.x,b.x),Math.min(a.y,b.y),Math.abs(b.x-a.x),Math.abs(b.y-a.y));
}
@Override
public void restore() {
if (!clipRect.isEmpty()) {
clipRect.pop();
if (clipRect.isEmpty()) RenderSystem.disableScissor();
else scissor(clipRect.peek());
}
}
from panelstudio.
clipRect
is showing up as an undeclared variable in your second method, so I can't test it...
from panelstudio.
So... I found clipRect's declaration and redeclared it locally.
However...
XD I don't even know what happened, but when I opened the category it made the screen start flashing and nothing was in the right place. Tbh my earlier solution seems pretty good; all I would need to add is a way for children to clip to the frame of their parents.
from panelstudio.
all I would need to add is a way for children to clip to the frame of their parents
this is what I'm trying to figure out, the part that was broken is the part that does this clipping
your solution effectively disables it
from panelstudio.
clipRect
is showing up as an undeclared variable in your second method, so I can't test it...
Sorry, I forgot to take that into account:
private final Stack<Rectangle> clipRect=new Stack<Rectangle>();
@Override
protected void scissor (Rectangle r) {
if (r==null) {
GL11.glScissor(0,0,0,0);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
return;
}
Point a=guiToScreen(r.getLocation()),b=guiToScreen(new Point(r.x+r.width,r.y+r.height));
if (!clipX) {
a.x=0;
b.x=MinecraftClient.getInstance().getWindow().getWidth();
}
GL11.glScissor(Math.min(a.x,b.x),Math.min(a.y,b.y),Math.abs(b.x-a.x),Math.abs(b.y-a.y));
GL11.glEnable(GL11.GL_SCISSOR_TEST);
}
@Override
public void window (Rectangle r) {
if (clipRect.isEmpty()) {
scissor(r);
clipRect.push(r);
} else {
Rectangle top=clipRect.peek();
if (top==null) {
scissor(null);
clipRect.push(null);
} else {
int x1,y1,x2,y2;
x1=Math.max(r.x,top.x);
y1=Math.max(r.y,top.y);
x2=Math.min(r.x+r.width,top.x+top.width);
y2=Math.min(r.y+r.height,top.y+top.height);
if (x2>x1 && y2>y1) {
Rectangle rect=new Rectangle(x1,y1,x2-x1,y2-y1);
scissor(rect);
clipRect.push(rect);
} else {
scissor(null);
clipRect.push(null);
}
}
}
}
@Override
public void restore() {
if (!clipRect.isEmpty()) {
clipRect.pop();
if (clipRect.isEmpty()) GL11.glDisable(GL11.GL_SCISSOR_TEST);
else scissor(clipRect.peek());
}
}
from panelstudio.
That produces both issues:
- The first problem I had with rendering the background in the correct position
- The second problem of the modules spilling out too far vertically
from panelstudio.
Can you check if the modules render outside of the category's frame too far on windows? I can't get to my (windows) laptop rn bc I'm at school, but I want to see if this is an issue outside of macos.
from panelstudio.
Ok, I've tested it on Windows, and noticed I pasted the wrong code:
private final Stack<Rectangle> clipRect=new Stack<Rectangle>();
@Override
protected void scissor (Rectangle r) {
if (r==null) {
RenderSystem.enableScissor(0,0,0,0);
return;
}
Point a=guiToScreen(r.getLocation()),b=guiToScreen(new Point(r.x+r.width,r.y+r.height));
if (!clipX) {
a.x=0;
b.x=MinecraftClient.getInstance().getWindow().getWidth();
}
RenderSystem.enableScissor(Math.min(a.x,b.x),Math.min(a.y,b.y),Math.abs(b.x-a.x),Math.abs(b.y-a.y));
}
@Override
public void window (Rectangle r) {
if (clipRect.isEmpty()) {
scissor(r);
clipRect.push(r);
} else {
Rectangle top=clipRect.peek();
if (top==null) {
scissor(null);
clipRect.push(null);
} else {
int x1,y1,x2,y2;
x1=Math.max(r.x,top.x);
y1=Math.max(r.y,top.y);
x2=Math.min(r.x+r.width,top.x+top.width);
y2=Math.min(r.y+r.height,top.y+top.height);
if (x2>x1 && y2>y1) {
Rectangle rect=new Rectangle(x1,y1,x2-x1,y2-y1);
scissor(rect);
clipRect.push(rect);
} else {
scissor(null);
clipRect.push(null);
}
}
}
}
@Override
public void restore() {
if (!clipRect.isEmpty()) {
clipRect.pop();
if (clipRect.isEmpty()) RenderSystem.disableScissor();
else scissor(clipRect.peek());
}
}
The previous one didn't use RenderSystem
and was essentially the same as the original.
from panelstudio.
This screwed up the screen even more... It caused Minecraft to only render a little square on the screen and everything else was just a strobe; I managed to exit the world through guess and check of the button's locations and only that little square would show part of the menu (the rest was still the word going crazy).
from panelstudio.
I tested it on Linux and unfortunately it worked fine.
I asked a couple of fellow utility mod devs for assistance.
Unfortunately, I don't know what else to do.
Well, there's one last idea of just overriding screenToGui
and using getFramebufferWidth
and getFramebufferHeight
instead of getWidth
and getHeight
:
@Override
public Point screenToGui (Point p) {
int resX=getWindowSize().width;
int resY=getWindowSize().height;
return new Point(p.x*resX/MinecraftClient.getInstance().getWindow().getFramebufferWidth(),resY-p.y*resY/MinecraftClient.getInstance().getWindow().getFramebufferHeight()-1);
}
from panelstudio.
My gui works fine on a Windows laptop, but I tested it on my MacBook and suddenly the modules inside the categories wouldn't render (They seem to be displaced by twice the distance they should be).
heres a fix dont use macOS
from panelstudio.
My gui works fine on a Windows laptop, but I tested it on my MacBook and suddenly the modules inside the categories wouldn't render (They seem to be displaced by twice the distance they should be).
heres a fix dont use macOS
vouch, it worked
from panelstudio.
heres a fix dont use macOS
vouch, it worked
First off, I already found a solution I didn’t care to share with people like you. Second, this thread is for people who care enough to contribute helpful comments and suggestions to assist in solving an issue; if all you have to provide is a sarcastic comment that doesn’t lead to the solution, please refrain from submitting any ideas on this issue. Thanks!
from panelstudio.
Could you please share your solution, so that I might be able to push a fix to the library or assist other people who might have this issue in the future?
from panelstudio.
Sorry, I didn't see this
I'm using the solution I posted earlier, and then I have the panels pop out on the sides instead of in the main area. It works the same way on Mac and Windows, and the scissor function override I made earlier functions correctly on Mac and Windows.
from panelstudio.
heres a fix dont use macOS
vouch, it worked
First off, I already found a solution I didn’t care to share with people like you. Second, this thread is for people who care enough to contribute helpful comments and suggestions to assist in solving an issue; if all you have to provide is a sarcastic comment that doesn’t lead to the solution, please refrain from submitting any ideas on this issue. Thanks!
It is a helpful commit dont use macOS
from panelstudio.
heres a fix dont use macOS
vouch, it worked
First off, I already found a solution I didn’t care to share with people like you. Second, this thread is for people who care enough to contribute helpful comments and suggestions to assist in solving an issue; if all you have to provide is a sarcastic comment that doesn’t lead to the solution, please refrain from submitting any ideas on this issue. Thanks!
It is a helpful commit dont use macOS
about as helpful as sending supplies to the Ukraine.
from panelstudio.
heres a fix dont use macOS
vouch, it worked
First off, I already found a solution I didn’t care to share with people like you. Second, this thread is for people who care enough to contribute helpful comments and suggestions to assist in solving an issue; if all you have to provide is a sarcastic comment that doesn’t lead to the solution, please refrain from submitting any ideas on this issue. Thanks!
It is a helpful commit dont use macOS
about as helpful as sending supplies to the Ukraine.
I mean come on dude macOS is TRASH use linux or windows
from panelstudio.
Related Issues (20)
- Issue when compiling and using the library in my mod HOT 2
- "Could not find shadowJar()"? HOT 7
- Help to building HOT 1
- gui.enterGUI() gives an error. HOT 23
- gradle bad pls help (could not find method shadowJar()) HOT 2
- Hud elements only rendering while in clickgui or hudeditor HOT 10
- ClassNotFoundException when clickgui gets initialized HOT 26
- Game crashes when trying to load the mod(i added mixins so that might be the problem) HOT 12
- Update HOT 1
- I'm a panelSTUD
- crash game example code HOT 12
- Non-draggable? (Feature request) HOT 1
- Tutorial HOT 1
- The "Creating a clickGUI" section of the wiki doesnt lead anywhere HOT 1
- Keybinds run while in chat/menus HOT 1
- Panelstudio HOT 1
- how to get a module HOT 2
- Can't register speed moudle to event bus when enabled and de register when un enabled HOT 2
- lukflug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panelstudio.