setCell method

void setCell(
  1. int x,
  2. int y,
  3. String char,
  4. int fg,
  5. int bg,
  6. int mod,
)

Sets character, colors, and modifiers at coordinates.

Implementation

void setCell(int x, int y, String char, int fg, int bg, int mod) {
  if (x >= 0 && x < width && y >= 0 && y < height) {
    final idx = (y * width + x) * 3;
    characters[y * width + x] = char;
    attributes[idx + 0] = fg;
    attributes[idx + 1] = bg;
    attributes[idx + 2] = mod;
  }
}