-
Notifications
You must be signed in to change notification settings - Fork 23
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
Doesn't work on Mac #30
Comments
I do not own a mac, so I can't reproduce that issue and solve it. |
This screen recording should show enough; if you want me to try anything, just let me know. |
Does this only happen on 1.18.2. Could you try running it on 1.17.1? Could you print out |
Output on 1.18.2:
Output on 1.17.1:
I didn't include a new visual for 1.17.1, because it produces the same issue. |
Does the (non-scaled) width/height approximately correspond to the actual Minecraft window size in pixels? |
The scale lines up, and I've tried all the different GUI scales, (they all render the same error). |
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 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. |
Also, thank you very much for your patience and cooperation so far! |
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? |
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. |
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.
|
Yeah, the scissor method is responsible for selecting the right rectangle for it not to do that. |
Sorry, I don't really understand what you're asking for. Could you rephrase that? |
It doesn't appear to cut any part of the category out. |
Ok, so what happens if you make the y-value positive? I presume it regresses to what you had originally. |
What I can't figure out is that the fourth argument in |
ok, assuming it's bottom left and scales with GUI scale, this will hopefully work:
|
Also, unrelated issue: How do I drag a module back onto the screen when the top of it isn't on the screen? |
Dragging it back on to screen is typically done by a "fixgui" command, implemented by the client, which resets the position of panels. |
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); |
Still nope :/ |
I can give you another image but it looks pretty much the same |
I have noticed some parts of Minecraft do it through @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());
}
} |
|
So... I found clipRect's declaration and redeclared it locally. However... |
this is what I'm trying to figure out, the part that was broken is the part that does this clipping |
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());
}
} |
That produces both issues:
|
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. |
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 |
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). |
I'll try it on Linux tomorrow and see if the issue appears there as well. |
I tested it on Linux and unfortunately it worked fine. @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);
} |
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! |
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? |
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. |
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 |
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).
The text was updated successfully, but these errors were encountered: