using memmove to update snake

This commit is contained in:
DarthMooMancer
2025-10-09 11:51:21 -04:00
parent baf2e21358
commit 6c6605fcb5
4 changed files with 41 additions and 52 deletions
+3 -6
View File
@@ -24,11 +24,8 @@ void Window::draw_display(int milliseconds) {
}
void Window::update_display(Point** buffer) {
m_board[buffer[0]->m_row][buffer[0]->m_col] = buffer[0];
m_board[buffer[2]->m_row][buffer[2]->m_col] = buffer[2];
for(int i = 3; i < ROW * COL; i++) {
if(buffer[i] != nullptr) {
m_board[buffer[i]->m_row][buffer[i]->m_col] = buffer[i];
}
for(int i = 0; i < ROW * COL; i++) {
if(buffer[i] == nullptr || i == 1 || buffer[i]->m_row > ROW - 1 || buffer[i]->m_col > COL - 1) continue;
m_board[buffer[i]->m_row][buffer[i]->m_col] = buffer[i];
}
}