From 4957968eb829c8ab22448ffd0eef2b844729ebe5 Mon Sep 17 00:00:00 2001 From: DaniTheSkunk Date: Fri, 21 Oct 2022 05:29:46 +0000 Subject: [PATCH] implemented terminal.clear function --- com/danitheskunk/skunkworks/gfx/vt/Terminal.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/com/danitheskunk/skunkworks/gfx/vt/Terminal.java b/com/danitheskunk/skunkworks/gfx/vt/Terminal.java index f130551..625b126 100644 --- a/com/danitheskunk/skunkworks/gfx/vt/Terminal.java +++ b/com/danitheskunk/skunkworks/gfx/vt/Terminal.java @@ -657,8 +657,7 @@ public class Terminal { var y = rect.getY() + 1; for(int iy = 0; iy < rect.getWidth() - 2; ++iy) { for(int ix = 0; ix < rect.getWidth() - 2; ++ix) { - setBackgroundColor( - new Vec2i(x + ix, y + iy), + setBackgroundColor(new Vec2i(x + ix, y + iy), backgroundColor ); } @@ -666,6 +665,14 @@ public class Terminal { } } + public void clear(Color bg) { + for(var cell : cells) { + cell.halfWidth = false; + cell.fullChar = 0; + cell.bgColor = bg; + } + } + private class Cell { int fullChar; int secondChar;