import 'dart:typed_data';

class FrameBuffer {
  final int width;
  final int height;

  // A 1D array representing the 2D screen.
  // Length = width * height.
  final Uint32List pixels;

  FrameBuffer(this.width, this.height) : pixels = Uint32List(width * height);

  // Helper to clear the screen (e.g., draw ceiling and floor)
  void clear(int ceilingColor32, int floorColor32) {
    int half = (width * height) ~/ 2;
    pixels.fillRange(0, half, ceilingColor32);
    pixels.fillRange(half, pixels.length, floorColor32);
  }
}
