I (new on SO) and I'm trying to code an "emulator" for an 8-bit processor that I make with a friend.
I have only used Java to create simple graphical interfaces with Swing and, when reading similar questions, it seems to me that the use of repaint () and Graphics2D to display 60 frames per second is not the same. solution.
From my attempts to use a custom JComponent to draw, I totally agree. Despite calling screenComponent.repaint () 60 times per second, Java only updated the screen twice a second, while the array of bytes of video memory (storing the data in pixels) was also updated 60 times per second (before the repaint call). each picture.
My question is: what can I use to display my one-dimensional pixel array (using y * width + x to get pixels at a coordinate) and update it to 60fps?
What I need to be able to do:
1) draw each pixel with a defined color
– draw text with a font and a size (the computer I'm emulating has a graphic mode that can switch to text mode)
2) the efficiency is not a major concern because its main objective is to test the assembly programs that will be run later on the physical CPU, but it is necessary to update the screen to 60 Hertz and run cycles of CPU clock of at least 1 kilohertz.
3) resize the canvas because the cpu only displays 78 x 128 pixels (that's what I did with swing using g2d.fillRect to display the pixels and multiplying the arguments by an integer multiplier of the size of the screen)
4) not 3d