NES Style JME3

Wow now I am excited I just tried out the off-screen render and saw the low res and had to try something out and it looks amazing =D.

oh and here use this for you BufferedImage if you like the look

[java]
public BufferedImage getNewNesScreen() {
int[] nesPalette = { 0x7C7C7C, 0x0000FC, 0x0000BC, 0x4428BC, 0x940084,
0xA80020, 0xA81000, 0x881400, 0x503000, 0x007800, 0x006800, 0x005800,
0x004058, 0xBCBCBC, 0x0078F8, 0x0058F8, 0x6844FC, 0xD800CC, 0xE40058,
0xF83800, 0xE45C10, 0xAC7C00, 0x00B800, 0x00A800, 0x00A844, 0x008888,
0xF8F8F8, 0x3CBCFC, 0x6888FC, 0x9878F8, 0xF878F8, 0xF85898, 0xF87858,
0xFCA044, 0xF8B800, 0xB8F818, 0x58D854, 0x58F898, 0x00E8D8, 0x787878,
0xFCFCFC, 0xA4E4FC, 0xB8B8F8, 0xD8B8F8, 0xF8B8F8, 0xF8A4C0, 0xF0D0B0,
0xFCE0A8, 0xF8D878, 0xD8F878, 0xB8F8B8, 0xB8F8D8, 0x00FCFC, 0xF8D8F8,
0x000000};

byte[] red = new byte[nesPalette.length];    
byte[] green = new byte[nesPalette.length];    
byte[] blue  = new byte[nesPalette.length];

for(int i = 0; i < nesPalette.length; i++) {
	reds[i] = (byte) ((nesPalette[i] >> 16) & 0xFF);
	greens[i] = (byte) ((nesPalette[i] >> 8) & 0xFF);
	blues[i] = (byte) (nesPalette[i] & 0xFF);
}

IndexColorModel colorModel = new IndexColorModel(
		3, nesPalette.length, red, green, blue);
return new BufferedImage(width, height,
		BufferedImage.TYPE_BYTE_INDEXED, colorModel);

}
[/java]

1 Like

I don’t know how that HTML got in my java code but this is a snip it for the green.

[java]

greens[i] = (byte) ((nesPalette[i] >> 08) & 0xFF);

[/java]

Now someone remind me is Java’s ARGB integer little endian or big?

I found a little issue with the test TestRenderToMemory class…

in the function createDisplayFrame:

[java]public void createDisplayFrame(){
SwingUtilities.invokeLater(new Runnable(){
public void run(){

frame.pack();
frame.setResizable(false);

}
});
}[/java]

should be…

[java]public void createDisplayFrame(){
SwingUtilities.invokeLater(new Runnable(){
public void run(){

frame.setResizable(false);
frame.pack();

}
});
}[/java]

the JPanel is actually 10 pixels larger than it should be if you use the first method. This messed up my CRT test :S due to stretching issues.

After creating a CRT CPU pixel filter.

1 Like