wip
This commit is contained in:
+13
-3
@@ -3,7 +3,16 @@
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
void Window::draw_display() {
|
||||
void Window::clear_display() {
|
||||
for(int i = 0; i < ROW; i++) {
|
||||
for(int j = 0; j < COL; j++) {
|
||||
m_board[i][j] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Window::draw_display(int milliseconds) {
|
||||
std::cout << "\033[H" << std::flush; // Clear screen
|
||||
for(int i = 0; i < ROW; i++) {
|
||||
for(int j = 0; j < ROW; j++) {
|
||||
@@ -12,11 +21,12 @@ void Window::draw_display() {
|
||||
}
|
||||
std::cout << "\r\n";
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds((int) (200))); // 1000 / fps; 200ms = 5fps
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds((int) (milliseconds))); // 1000 / fps; 200ms = 5fps
|
||||
}
|
||||
|
||||
void Window::update_display(Point* segments[]) {
|
||||
for(int i = 0; i < ROW * COL; i++) {
|
||||
m_board[segments[0]->m_row][segments[0]->m_col] = segments[0];
|
||||
for(int i = 2; i < ROW * COL; i++) {
|
||||
if(segments[i] != nullptr) {
|
||||
m_board[segments[i]->m_row][segments[i]->m_col] = segments[i];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user