Slight optimizations, more centered center

main
Astoria 7 months ago
parent 4435e0a790
commit c981206adf

@ -13,6 +13,7 @@ import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.Objects;
import static com.simon816.j65el02.device.RPMonitor.HEIGHT;
@ -21,15 +22,12 @@ import static com.simon816.j65el02.device.RPMonitor.WIDTH;
public class BasicMonitorDriver implements MonitorDriver, KeyListener {
BufferedImage display;
final int width = 8;
final int height = 8;
int rows = 16;
int cols = 16;
JLabel[] lines = new JLabel[HEIGHT];
Machine emu;
byte[][] windowDataOld = new byte[HEIGHT][WIDTH];
int xoffset = 32;
int yoffset = 27;
int xoffset = 30;
int yoffset = 26;
public BasicMonitorDriver(Machine emu) {
this.emu = emu;
try{
@ -102,11 +100,14 @@ public class BasicMonitorDriver implements MonitorDriver, KeyListener {
public void update(byte[][] windowData) {
for(int y = windowData.length - 1; y >= 0; y--){
String text = "";
for(int x = 0; x<windowData[y].length; x++){
int temp = Math.floorMod(windowData[y][x] , 256);
text += (char)((temp + 0xDED0));
if(!Arrays.equals(windowData[y], windowDataOld[y])) {
for (int x = 0; x < windowData[y].length; x++) {
int temp = Math.floorMod(windowData[y][x], 256);
text += (char) ((temp + 0xDED0));
}
lines[y].setText(text);
System.arraycopy(windowData[y], 0, windowDataOld[y], 0, windowData[y].length);
}
lines[y].setText(text);
}
}

Loading…
Cancel
Save