Improved RenderScope #59

This commit is contained in:
2026-03-25 18:23:14 +01:00
parent 3d315fa2cc
commit c72af1300a
3 changed files with 52 additions and 30 deletions
@@ -153,7 +153,7 @@ public class KeystrokesMod extends Mod implements HudMod {
int fg = pressed ? clickFg.value : layout.fgColor.value;
scope.drawRoundedRectangle(x, y, layout.width, SPACE_H, layout.radius.value, bg);
int lineY = y + SPACE_H / 2;
scope.drawRect(x + (layout.width - 30) / 2, lineY, 30, 1, fg);
scope.drawRectangle(x + (layout.width - 30) / 2, lineY, 30, 1, fg);
}
private void refreshHeight() {
@@ -6,52 +6,74 @@ import org.saturnclient.common.ref.game.ItemStackRef;
import org.saturnclient.common.ref.render.MatrixStackRef;
public interface RenderScope {
public MatrixStackRef getMatrixStack();
public void setOpacity(float alpha);
// ----------------------------
// Matrix & Transform
// ----------------------------
MatrixStackRef getMatrixStack();
public int getColor(int color);
// ----------------------------
// Color & Opacity
// ----------------------------
void setOpacity(float alpha);
public void drawRect(int x, int y, int width, int height, int color);
int getColor(int color);
public void drawText(String text, int x, int y, int font, int color);
// ----------------------------
// Shapes
// ----------------------------
void drawRectangle(int x, int y, int width, int height, int color);
public void drawText(float scale, String text, int x, int y, int font, int color);
void drawRoundedRectangle(int x, int y, int width, int height, int radius, int color);
public void drawRoundedRectangle(int x, int y, int width, int height, int radius, int color);
void drawBorder(int x, int y, int width, int height, int color);
public int getScaledWindowWidth();
void fill(int x1, int y1, int x2, int y2, int color);
public int getScaledWindowHeight();
// ----------------------------
// Text
// ----------------------------
void drawText(String text, int x, int y, int font, int color);
public void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height,
int color);
void drawText(float scale, String text, int x, int y, int font, int color);
public void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height);
// ----------------------------
// Textures & Sprites
// ----------------------------
void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height);
public void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height,
int regionWith,
int regionHeight, int textureWidth, int textureHeight);
void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height, int color);
public void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height,
int regionWidth,
int regionHeight, int textureWidth, int textureHeight, int color);
void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height,
int regionWidth, int regionHeight, int textureWidth, int textureHeight);
public void enableScissor(int x1, int y1, int x2, int y2);
void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height,
int regionWidth, int regionHeight, int textureWidth, int textureHeight, int color);
public void disableScissor();
void drawSpriteStretched(SpriteRef sprite, int x, int y, int width, int height);
public boolean scissorContains(int x, int y);
void drawSpriteStretched(SpriteRef sprite, int x, int y, int width, int height, int color);
public void drawItem(ItemStackRef item, int x, int y);
// ----------------------------
// Items
// ----------------------------
void drawItem(ItemStackRef item, int x, int y);
public void drawItemWithoutEntity(ItemStackRef stack, int x, int y);
// ----------------------------
// Scissor / Clipping
// ----------------------------
void enableScissor(int x1, int y1, int x2, int y2);
public void drawSpriteStretched(SpriteRef sprite, int x, int y, int width, int height);
void disableScissor();
public void drawSpriteStretched(SpriteRef sprite, int x, int y, int width, int height, int color);
boolean scissorContains(int x, int y);
public void fill(int x1, int y1, int x2, int y2, int color);
// ----------------------------
// Window Info / Draw
// ----------------------------
int getScaledWindowWidth();
public void drawBorder(int x, int y, int width, int height, int color);
int getScaledWindowHeight();
void draw();
}
@@ -76,7 +76,7 @@ public abstract class Input extends Element {
(int) (Fonts.getWidth(visibleText.substring(0, cursorPosition - scrollOffset), Theme.FONT.value)
* 0.6f);
renderScope.drawRect(cursorX, 2, 1, height - 4, 0xFFFFFFFF);
renderScope.drawRectangle(cursorX, 2, 1, height - 4, 0xFFFFFFFF);
}
}