Skip to content

Commit

Permalink
Initialize and resize SmyLib screen
Browse files Browse the repository at this point in the history
  • Loading branch information
SmylerMC committed Jun 8, 2024
1 parent e5f88ad commit 5744df8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.smyler.smylib.game;

import net.minecraft.client.Minecraft;
import net.minecraft.client.MouseHandler;

public class Lwjgl3Mouse implements Mouse {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class WrappedMinecraft implements GameClient {
private final Mouse mouse;
private WrappedFont font;
private WrappedGuiGraphics uiDrawContext;
private final SpriteLibrary spriteLibrary = new SpriteLibrary();

private WrappedVanillaScreen lastAccessedVanillaScreen = null;

Expand Down Expand Up @@ -116,7 +117,7 @@ public void setUidDrawContext(WrappedGuiGraphics uiDrawContext) {

@Override
public SpriteLibrary sprites() {
return null; //TODO
return this.spriteLibrary; //TODO register sprites
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import net.minecraft.client.gui.GuiGraphics;
import net.smyler.smylib.Color;
import net.smyler.smylib.game.WrappedMinecraft;
import org.jetbrains.annotations.NotNull;

import static net.smyler.smylib.SmyLib.getGameClient;

public class WrappedFont extends BaseFont {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
package net.smyler.smylib.gui.screen;

import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.smyler.smylib.game.GameClient;
import net.smyler.smylib.gui.WrappedGuiGraphics;

import static com.google.common.base.Preconditions.checkState;
import static net.smyler.smylib.SmyLib.getGameClient;

public class VanillaScreenProxy extends Screen {
public class VanillaScreenProxy extends net.minecraft.client.gui.screens.Screen {
private final Screen screen;

private final net.smyler.smylib.gui.screen.Screen screen;

public VanillaScreenProxy(net.smyler.smylib.gui.screen.Screen screen) {
public VanillaScreenProxy(Screen screen) {
super(Component.literal("SmyLib screen"));
this.screen = screen;
}
Expand All @@ -34,6 +32,14 @@ public void render(GuiGraphics guiGraphics, int x, int y, float partialTicks) {
this.screen.draw(uiDrawContext, 0, 0, mouseX, mouseY, true, true, null);
}

@Override
protected void init() {
super.init();
this.screen.width = this.width;
this.screen.height = this.height;
this.screen.init();
}

@Override
public void onClose() {
this.screen.onClosed();
Expand Down

0 comments on commit 5744df8

Please sign in to comment.