generated from rnentjes/kotlin-server-web-undertow
Refactor rewind functionality with circular buffer, update BufferedImageData handling in DisplayView, enhance ConsoleView rendering updates, and integrate SnakeCode data.
This commit is contained in:
@@ -3,7 +3,7 @@ package mtmc.emulator
|
||||
import kotlin.math.min
|
||||
|
||||
class MTMCDisplay(private val computer: MonTanaMiniComputer) {
|
||||
private val buffer: BufferedImage? = null
|
||||
val buffer: BufferedImage = createCanvasImage(COLS, ROWS)
|
||||
private var currentColor: DisplayColor? = null
|
||||
private var graphics: Array<BufferedImage> = arrayOf()
|
||||
private var byteArray: ByteArray = ByteArray(0)
|
||||
@@ -107,11 +107,11 @@ class MTMCDisplay(private val computer: MonTanaMiniComputer) {
|
||||
}
|
||||
|
||||
fun setPixel(col: Int, row: Int, color: DisplayColor) {
|
||||
buffer?.setRGB(col, row, color.intVal)
|
||||
buffer.setRGB(col, row, color.intVal)
|
||||
}
|
||||
|
||||
fun getPixel(col: Int, row: Int): Short {
|
||||
val rgb = buffer?.getRGB(col, row) ?: 0
|
||||
val rgb = buffer.getRGB(col, row)
|
||||
return DisplayColor.indexFromInt(rgb)
|
||||
}
|
||||
|
||||
@@ -123,10 +123,11 @@ class MTMCDisplay(private val computer: MonTanaMiniComputer) {
|
||||
}
|
||||
|
||||
fun drawRectangle(startCol: Short, startRow: Short, width: Short, height: Short) {
|
||||
// val graphics = buffer.getGraphics()
|
||||
// graphics.setColor(currentColor!!.javaColor)
|
||||
// graphics.fillRect(startCol.toInt(), startRow.toInt(), width.toInt(), height.toInt())
|
||||
// graphics.dispose()
|
||||
for (x in startCol..<startCol + width) {
|
||||
for (y in startRow..<startRow + height) {
|
||||
setPixel(x, y, currentColor!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun drawImage(image: Int, x: Int, y: Int) {
|
||||
|
||||
Reference in New Issue
Block a user