From 099a19c461338df5b074e6e02cae36665388e794 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Fri, 24 Jun 2022 14:51:48 +0000 Subject: [PATCH] Editor background drawing should be based on the center of the view area instead of the upper-left corner Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 --- src/sig/RabiClone.java | 3 --- src/sig/objects/EditorRenderer.java | 17 +++++++++++++++-- src/sig/objects/weapons/KnifeSwing.java | 1 - src/sig/objects/weapons/KnifeSwing2.java | 1 - 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/sig/RabiClone.java b/src/sig/RabiClone.java index 394eca8..49242c4 100644 --- a/src/sig/RabiClone.java +++ b/src/sig/RabiClone.java @@ -2,11 +2,8 @@ package sig; import javax.swing.JFrame; -import net.java.games.input.AbstractController; import net.java.games.input.Controller; import net.java.games.input.ControllerEnvironment; -import net.java.games.input.ControllerEvent; -import net.java.games.input.ControllerListener; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/sig/objects/EditorRenderer.java b/src/sig/objects/EditorRenderer.java index fc432cf..42584ed 100644 --- a/src/sig/objects/EditorRenderer.java +++ b/src/sig/objects/EditorRenderer.java @@ -301,7 +301,20 @@ public class EditorRenderer extends LevelRenderer{ dataTileValue.clear(); }break; } - } + } - + @Override + public void drawBackground(byte[] p) { + int screenX = (int)(getX()+RabiClone.BASE_WIDTH/2)/Tile.TILE_WIDTH; + int screenY = (int)(getY()+RabiClone.BASE_HEIGHT/2)/Tile.TILE_HEIGHT; + Background targetBackground = RabiClone.CURRENT_MAP.getBackground(screenX, screenY); + for (int y=0;y