Skip to content

Commit

Permalink
Make the frame flash a lot less
Browse files Browse the repository at this point in the history
Use std::flush instead of clearing via escape sequences
  • Loading branch information
leonmavr committed Aug 14, 2024
1 parent dc3bfad commit f27bd6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/chip8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ inline void Chip8::Cls() {

void Chip8::RenderFrame() {
TPRINT_GOTO_TOPLEFT();
TPRINT_CLEAR();
//TPRINT_CLEAR();
const std::string border_up_down = "+" + std::string(64, '-') + "+\n";
std::string pixels = border_up_down;
for (size_t row = 0; row < ROWS; ++row) {
Expand Down Expand Up @@ -408,7 +408,7 @@ void Chip8::RenderFrame() {
std::string descr = key_descr.second;
Frontend::WriteRight(pixels, line++, "[" + key + "] " + descr + "\n");
}
std::cout << pixels << std::endl;
std::cout << pixels << std::endl << std::flush;
std::this_thread::sleep_for(std::chrono::microseconds(1400));
}

Expand Down

0 comments on commit f27bd6d

Please sign in to comment.