diff --git a/src/console_output.cc b/src/console_output.cc index 20cbc41..4d467bf 100644 --- a/src/console_output.cc +++ b/src/console_output.cc @@ -81,11 +81,6 @@ void console_output::render() { } } -void console_output::clear() { - contents.clear(); - contents.reserve(DISPLAY_BUFFER_SIZE); -} - void console_output::print_char(const position &pos, const char ch, const int attr) { if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT) diff --git a/src/console_output.h b/src/console_output.h index a6b5d44..4315e46 100644 --- a/src/console_output.h +++ b/src/console_output.h @@ -12,7 +12,6 @@ public: console_output(std::ostream &cout); void render() override; - void clear() override; void print_char(const position &pos, const char ch, const int attr) override; void print_str(const position &pos, diff --git a/src/display.cc b/src/display.cc index c868fd4..4b9d63d 100644 --- a/src/display.cc +++ b/src/display.cc @@ -1,4 +1,15 @@ #include "display.h" display::display(): - contents{DISPLAY_BUFFER_SIZE, 0} {} + contents{DISPLAY_BUFFER_SIZE, 0} { + for (int i = 0; i < DISPLAY_BUFFER_SIZE; ++i) + contents.push_back(0); +} + +void display::clear() { + contents.clear(); + contents.reserve(DISPLAY_BUFFER_SIZE); + + for (int i = 0; i < DISPLAY_BUFFER_SIZE; ++i) + contents.push_back(0); +} diff --git a/src/display.h b/src/display.h index 06bd63a..b7f57b6 100644 --- a/src/display.h +++ b/src/display.h @@ -21,7 +21,7 @@ public: virtual void render() = 0; // Clears the contents buffer - virtual void clear() = 0; + virtual void clear(); virtual void print_char(const position &pos, const char ch, const int attr = diff --git a/src/file_output.cc b/src/file_output.cc index 1ed9fa2..f1bc686 100644 --- a/src/file_output.cc +++ b/src/file_output.cc @@ -14,11 +14,6 @@ void file_output::render() { } } -void file_output::clear() { - contents.clear(); - contents.reserve(DISPLAY_BUFFER_SIZE); -} - void file_output::print_char(const position &pos, const char ch, const int attr) { if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT) diff --git a/src/file_output.h b/src/file_output.h index ff96ce5..c0754b3 100644 --- a/src/file_output.h +++ b/src/file_output.h @@ -11,7 +11,6 @@ public: file_output(std::ofstream &&ofs); void render() override; - void clear() override; void print_char(const position &pos, const char ch, const int attr) override; void print_str(const position &pos,