-
Notifications
You must be signed in to change notification settings - Fork 1
/
CRAMViewer.java
44 lines (36 loc) · 972 Bytes
/
CRAMViewer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.awt.*;
import java.awt.event.*;
public final class CRAMViewer extends Frame {
VDP vdp;
Screen screen;
Panel panel;
boolean enabled = false;
public CRAMViewer(VDP vdp) {
super("SMS CRAM Viewer - " + Remaster.APPNAME);
this.vdp = vdp;
panel = new Panel();
add(panel);
screen = new Screen(panel, 512, 40);
setResizable(false);
setLocation(0,450);
setSize(522, 69);
addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { setVisible(false); enabled = false; } } );
}
public void toggleEnabled() {
enabled = !enabled;
setVisible(enabled);
}
public void update() {
for(int i=0; i < 32; i++) {
screen.fillRect(i << 4, 0, 16, 40, vdp.palette[vdp.cram[i] & 0x3F]);
}
screen.drawScreen(0, 0);
}
public void paint(Graphics g) {
if(screen != null) screen.drawScreen(5, 23);
else {
g.setColor(Color.BLACK);
g.fillRect(0, 0, this.getWidth(), this.getHeight());
}
}
}