Improved structure

This commit is contained in:
2026-03-06 12:17:31 +01:00
parent 58a38ad809
commit 12bb846e50
13 changed files with 79 additions and 18 deletions
@@ -4,9 +4,13 @@ import java.io.File;
import java.io.InputStream;
import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
import org.saturnclient.common.minecraft.render.IWindow;
public interface IMinecraftClient {
public File getRunDirectory();
public InputStream getResource(SaturnIdentifier identifier);
public IWindow getWindow();
}
@@ -0,0 +1,11 @@
package org.saturnclient.common.minecraft.render;
public interface IWindow {
public int getWidth();
public int getHeight();
public int getFramebufferWidth();
public int getFramebufferHeight();
}
@@ -6,6 +6,7 @@ import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
import org.saturnclient.ui.Element;
import org.saturnclient.ui.ElementContext;
import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.resources.SvgTexture;
public class ImageTexture extends Element {
SaturnIdentifier sprite;
@@ -16,16 +17,16 @@ public class ImageTexture extends Element {
@Override
public void render(RenderScope renderScope, ElementContext ctx) {
// if (sprite.toString().endsWith(".svg")) {
// IMinecraftClient client = MinecraftProvider.PROVIDER.getClient();
if (sprite.toString().endsWith(".svg")) {
IMinecraftClient client = MinecraftProvider.PROVIDER.getClient();
// // Get the actual window pixel dimensions for the image
// int renderWidth = (int) (width * client.getWindow().getFramebufferWidth() / client.getWindow().getWidth());
// int renderHeight = (int) (height * client.getWindow().getFramebufferHeight()
// / client.getWindow().getHeight());
// Get the actual window pixel dimensions for the image
int renderWidth = (int) (width * client.getWindow().getFramebufferWidth() / client.getWindow().getWidth());
int renderHeight = (int) (height * client.getWindow().getFramebufferHeight()
/ client.getWindow().getHeight());
// sprite = SvgTexture.getSvg(client, sprite, renderWidth * 2, renderHeight * 2);
// }
sprite = SvgTexture.getSvg(client, sprite, renderWidth * 2, renderHeight * 2);
}
renderScope.drawTexture(sprite, 0, 0, 0, 0, width, height);
}