This commit is contained in:
DarthMooMancer
2025-10-02 17:53:17 -04:00
parent 21e72d523e
commit 29cf913478
7 changed files with 62 additions and 90 deletions
-23
View File
@@ -3,29 +3,6 @@
#include <chrono>
#include <thread>
Window::Window() {
m_lives = 3;
}
void Window::tick(int fps) {
std::this_thread::sleep_for(std::chrono::milliseconds(fps)); // 1000 / fps; 200ms = 5fps
}
void Window::clear() {
std::cout << "\033[H" << std::flush;
}
void Window::terminate(Ball &ball, bool &running) {
if(m_lives <= 0) {
clear();
std::cout << "You lose!" << std::endl;
running = false;
} if(ball.m_blocks_left <= 0) {
clear();
std::cout << "You win!" << std::endl;
running = false;
}
}
void Window::clear_display() {
for(int i = 0; i < ROW; i++) {
for(int j = 0; j < COL; j++) {