remove: tick in window
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
struct Window {
|
||||
std::array<std::array<char, COL>, ROW> m_board = {};
|
||||
void update_display(Bird &bird, std::vector<Pipe> pipes);
|
||||
void tick(int fps);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+3
-8
@@ -3,19 +3,14 @@
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
void Window::tick(int fps) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(fps)); // 1000 / fps; 200ms = 5fps
|
||||
}
|
||||
|
||||
void Window::update_display(Bird &bird, std::vector<Pipe> pipes) {
|
||||
for(std::array<char, COL> &row : m_board) { row.fill('.'); }
|
||||
|
||||
m_board[bird.m_body.m_row][bird.m_body.m_col] = bird.m_body.m_symbol;
|
||||
for(int i = 0; i < pipes.size(); i++) {
|
||||
for(int j = 0; j < pipes.front().m_size; j++) {
|
||||
if(pipes.at(i).m_nodes[j].m_symbol == '|') {
|
||||
m_board[pipes.at(i).m_nodes[j].m_row][pipes.at(i).m_nodes[j].m_col] = pipes.at(i).m_nodes[j].m_symbol;
|
||||
}
|
||||
if(pipes.at(i).m_nodes[j].m_symbol != '|') continue;
|
||||
m_board[pipes.at(i).m_nodes[j].m_row][pipes.at(i).m_nodes[j].m_col] = pipes.at(i).m_nodes[j].m_symbol;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,5 +21,5 @@ void Window::update_display(Bird &bird, std::vector<Pipe> pipes) {
|
||||
}
|
||||
std::cout << "\r\n";
|
||||
}
|
||||
tick(200);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200)); // 1000 / fps; 200ms = 5fps
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user