fix: (tail) fixed where tail index 0 is on top of the head

This commit is contained in:
DarthMooMancer
2025-08-28 20:14:35 -04:00
parent ac23c873c3
commit 157933c122
9 changed files with 86 additions and 84 deletions
+18 -23
View File
@@ -8,30 +8,25 @@ void Input::get_input(int &d, bool &r) {
cbreak();
noecho();
m_current_key = getch();
m_getch = getch();
endwin();
switch (m_current_key) {
case 'D':
case 'a':
d = -1;
break;
case 'C':
case 'd':
d = 1;
break;
case 'B':
case 's':
d = 2;
break;
case 'A':
case 'w':
d = -2;
break;
case 'q':
r = false;
running = false;
break;
// TODO
// m_current_key should be the m_getch and then as long as the opposite doesnt equal m_current_key
if(m_getch == 'a' || m_getch == 'D') {
d = -1;
m_current_key = -1;
} else if(m_getch == 'd' || m_getch == 'C') {
d = 1;
m_current_key = 1;
} else if(m_getch == 's' || m_getch == 'B') {
d = 2;
m_current_key = m_getch;
} else if(m_getch == 'w' || m_getch == 'A') {
d = -2;
m_current_key = m_getch;
} else if(m_getch == 'q') {
r = false;
running = false;
}
}
}