Refactor MatrixStack and RenderScope #59
This commit is contained in:
@@ -20,8 +20,8 @@ public class ElementRenderer {
|
||||
|
||||
renderScope.getMatrixStack().push();
|
||||
renderScope.setOpacity(element.opacity);
|
||||
renderScope.getMatrixStack().translate(element.x, element.y, 0);
|
||||
renderScope.getMatrixStack().scale(element.scale, element.scale, 1.0f);
|
||||
renderScope.getMatrixStack().translate(element.x, element.y);
|
||||
renderScope.getMatrixStack().scale(element.scale, element.scale);
|
||||
element.render(renderScope, new ElementContext(elapsed, mouseX, mouseY, element));
|
||||
renderScope.getMatrixStack().pop();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ public interface RenderScope {
|
||||
|
||||
public int getScaledWindowHeight();
|
||||
|
||||
/* Saturn common sprites */
|
||||
public void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height,
|
||||
int color);
|
||||
|
||||
@@ -44,25 +43,15 @@ public interface RenderScope {
|
||||
|
||||
public boolean scissorContains(int x, int y);
|
||||
|
||||
public void draw();
|
||||
|
||||
public void drawItem(ItemStackRef item, int x, int y);
|
||||
|
||||
public void drawItem(ItemStackRef stack, int x, int y, int seed);
|
||||
|
||||
public void drawItem(ItemStackRef stack, int x, int y, int seed, int z);
|
||||
|
||||
public void drawItemWithoutEntity(ItemStackRef stack, int x, int y);
|
||||
|
||||
public void drawItemWithoutEntity(ItemStackRef stack, int x, int y, int seed);
|
||||
|
||||
public void drawSpriteStretched(SpriteRef sprite, int x, int y, int width, int height);
|
||||
|
||||
public void drawSpriteStretched(SpriteRef sprite, int x, int y, int width, int height, int color);
|
||||
|
||||
public void fill(int x1, int y1, int x2, int y2, int color);
|
||||
|
||||
public void fill(int x1, int y1, int x2, int y2, int z, int color);
|
||||
|
||||
public void drawBorder(int x, int y, int width, int height, int color);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class SaturnScreen {
|
||||
public void render(RenderScope renderScope, int mouseX, int mouseY, float delta, long elapsed) {
|
||||
renderScope.getMatrixStack().push();
|
||||
|
||||
renderScope.getMatrixStack().scale(0.5f, 0.5f, 0.5f);
|
||||
renderScope.getMatrixStack().scale(0.5f, 0.5f);
|
||||
|
||||
ElementRenderer.render(new ArrayList<>(elements), elapsed, renderScope, mouseX, mouseY);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Scroll extends Element {
|
||||
|
||||
renderScope.enableScissor(padding, padding, width - padding, height - padding);
|
||||
renderScope.getMatrixStack().push();
|
||||
renderScope.getMatrixStack().translate(padding, -scroll + padding, 0);
|
||||
renderScope.getMatrixStack().translate(padding, -scroll + padding);
|
||||
|
||||
ElementRenderer.render(children, ctx.elapsed, renderScope,
|
||||
ctx.mouseX - padding,
|
||||
|
||||
@@ -95,8 +95,8 @@ public class HudEditor extends SaturnScreen {
|
||||
MatrixStackRef matrices = renderScope.getMatrixStack();
|
||||
matrices.push();
|
||||
|
||||
matrices.translate(dim.x.value, dim.y.value, 0);
|
||||
matrices.scale(dim.scale.value, dim.scale.value, 1.0f);
|
||||
matrices.translate(dim.x.value, dim.y.value);
|
||||
matrices.scale(dim.scale.value, dim.scale.value);
|
||||
|
||||
// Render the mod
|
||||
mod.renderDummy(renderScope);
|
||||
|
||||
Reference in New Issue
Block a user