fastiles icon indicating copy to clipboard operation
fastiles copied to clipboard

[Suggestion] Add a clear() function

Open hidde-vb opened this issue 4 months ago • 2 comments

Currently the scene works great as a replacement for the display from rot.js. However, there is no clear analogue to clear the screen. Here's my basic current implementation in a Display class

clear() {
  for (let y = 0; y < tileCountHeight; y++) {
    for (let x = 0; x < tileCountWidth; x++) {
      this.scene.draw([x, y], 0, 1, 0);
    }
  }
}

This works, but can't we improve on this by drawing a single quad for the whole scene?

Thanks!

hidde-vb avatar Aug 04 '25 20:08 hidde-vb

I am currently on a vacation until the end of August. Acknowledging the issue, will look into it when I come back.

ondras avatar Aug 07 '25 15:08 ondras

I just pushed a new Scene#clear method that clears the whole scene (using a specified color from the currently active palette). Would this API work for you?

ondras avatar Oct 14 '25 19:10 ondras