Skip to content

Commit

Permalink
Draw SmyLib screen background
Browse files Browse the repository at this point in the history
  • Loading branch information
SmylerMC committed Jun 8, 2024
1 parent 142bda9 commit 73f4379
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public VanillaScreenProxy(Screen screen) {

@Override
public void render(GuiGraphics guiGraphics, int x, int y, float partialTicks) {
super.render(guiGraphics, x, y, partialTicks);

GameClient game = getGameClient();
WrappedGuiGraphics uiDrawContext = (WrappedGuiGraphics) game.guiDrawContext();
checkState(
Expand All @@ -28,8 +28,11 @@ public void render(GuiGraphics guiGraphics, int x, int y, float partialTicks) {
);
float mouseX = game.mouse().x();
float mouseY = game.mouse().y();

this.screen.onUpdate(mouseX, mouseY, null);
this.screen.draw(uiDrawContext, 0, 0, mouseX, mouseY, true, true, null);
this.drawBackground(guiGraphics);
super.render(guiGraphics, x, y, partialTicks);
//this.screen.draw(uiDrawContext, 0, 0, mouseX, mouseY, true, true, null);
}

@Override
Expand Down Expand Up @@ -92,4 +95,20 @@ public net.smyler.smylib.gui.screen.Screen getScreen() {
return screen;
}

private void drawBackground(GuiGraphics guiGraphics) {
switch(this.screen.background) {
case NONE:
break;
case DEFAULT:
this.renderBackground(guiGraphics);
break;
case DIRT:
this.renderDirtBackground(guiGraphics);
break;
case OVERLAY:
guiGraphics.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680);
break;
}
}

}

0 comments on commit 73f4379

Please sign in to comment.