I’m currently working on learning some game development with Java. I’m working on the display and drawing pixels on the screen, I’m kind of a noob when it comes to this stuff. So I’m not quite sure what’s wrong.
So in Eclipse, I have a Display class, a Render class, and a Screen class.
I have an array called pixels. I am trying to set pixels like this:
pixels = ((DataBufferInt).img.getRaster().getDataBuffer()).getData();
However Eclipse give an error, underlining “DataBufferInt” in red. Saying that DataBufferInt cannot be resolved to a variable. I have imported the DataBufferInt class. Also img is a BufferedImage object.
There’s a dot in a wrong place:
Also make sure it’s actually
DataBufferIntthere or you’ll getClassCastException.