33 lines
708 B
C++
33 lines
708 B
C++
#include "input.hpp"
|
|
#include <ncurses.h>
|
|
|
|
void Input::get_input(int &d, bool &r) {
|
|
bool running = true;
|
|
while(running) {
|
|
initscr();
|
|
cbreak();
|
|
noecho();
|
|
|
|
m_getch = getch();
|
|
endwin();
|
|
// 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;
|
|
}
|
|
}
|
|
}
|