mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-14 23:56:07 +09:00
fixed wrong scroll up behaviour
Former-commit-id: 07837a20ae008e1072497e25b25709a6cbe97df1 Former-commit-id: 93db3957e5e9d745c78a864eb2cddd5a80a94320
This commit is contained in:
@@ -12,8 +12,10 @@ constructor(var width: Int, var height: Int) {
|
||||
/**
|
||||
* 0000_0000_00000000
|
||||
|
||||
* Upper bits: Background colour 0 black 1 dark grey 2 grey 3 white
|
||||
* Middle bits: Foreground colour ditto.
|
||||
* Upper bits: Background colour
|
||||
*
|
||||
* Middle bits: Foreground colour
|
||||
*
|
||||
* Lower 8 bits: CP437
|
||||
*/
|
||||
internal val frameBuffer: CharArray
|
||||
@@ -25,7 +27,7 @@ constructor(var width: Int, var height: Int) {
|
||||
}
|
||||
|
||||
fun drawBuffer(x: Int, y: Int, c: Char, colourKey: Int) {
|
||||
if (y * width + x >= frameBuffer.size)
|
||||
if (y * width + x >= frameBuffer.size || y * width + x < 0)
|
||||
throw ArrayIndexOutOfBoundsException("x: $x, y; $y")
|
||||
frameBuffer[y * width + x] = ((c.toInt().and(0xFF)) + colourKey.shl(8)).toChar()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user