fixed: issue with file/console output
This commit is contained in:
@ -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,
|
void console_output::print_char(const position &pos, const char ch,
|
||||||
const int attr) {
|
const int attr) {
|
||||||
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
||||||
|
@ -12,7 +12,6 @@ public:
|
|||||||
console_output(std::ostream &cout);
|
console_output(std::ostream &cout);
|
||||||
|
|
||||||
void render() override;
|
void render() override;
|
||||||
void clear() override;
|
|
||||||
void print_char(const position &pos,
|
void print_char(const position &pos,
|
||||||
const char ch, const int attr) override;
|
const char ch, const int attr) override;
|
||||||
void print_str(const position &pos,
|
void print_str(const position &pos,
|
||||||
|
@ -1,4 +1,15 @@
|
|||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
|
||||||
display::display():
|
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);
|
||||||
|
}
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
virtual void render() = 0;
|
virtual void render() = 0;
|
||||||
|
|
||||||
// Clears the contents buffer
|
// Clears the contents buffer
|
||||||
virtual void clear() = 0;
|
virtual void clear();
|
||||||
|
|
||||||
virtual void print_char(const position &pos, const char ch,
|
virtual void print_char(const position &pos, const char ch,
|
||||||
const int attr =
|
const int attr =
|
||||||
|
@ -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,
|
void file_output::print_char(const position &pos, const char ch,
|
||||||
const int attr) {
|
const int attr) {
|
||||||
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
||||||
|
@ -11,7 +11,6 @@ public:
|
|||||||
file_output(std::ofstream &&ofs);
|
file_output(std::ofstream &&ofs);
|
||||||
|
|
||||||
void render() override;
|
void render() override;
|
||||||
void clear() override;
|
|
||||||
void print_char(const position &pos,
|
void print_char(const position &pos,
|
||||||
const char ch, const int attr) override;
|
const char ch, const int attr) override;
|
||||||
void print_str(const position &pos,
|
void print_str(const position &pos,
|
||||||
|
Reference in New Issue
Block a user