feat: input and window
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#include "input.hpp"
|
||||
#include <ncurses.h>
|
||||
|
||||
void Input::get_input(bool &running) {
|
||||
while(running) {
|
||||
initscr();
|
||||
cbreak();
|
||||
noecho();
|
||||
|
||||
|
||||
_getch = getch();
|
||||
endwin();
|
||||
if(_getch == 113) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-1
@@ -1,6 +1,16 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include "input.hpp"
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello World" << std::endl;
|
||||
Input input;
|
||||
|
||||
bool running = true;
|
||||
std::thread input_thread(&Input::get_input, &input, std::ref(running));
|
||||
while(running) {
|
||||
std::cout << "Hello World" << std::endl;
|
||||
}
|
||||
|
||||
input_thread.join();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user