removed the input thread and integrated it to the SnakeGame engine itself

This commit is contained in:
DarthMooMancer
2025-11-04 23:31:23 -05:00
parent 183be3c24a
commit e87094ce13
8 changed files with 59 additions and 67 deletions
+1 -19
View File
@@ -1,25 +1,7 @@
#include <thread>
#include "element.hpp"
#include "window.hpp"
#include "input.hpp"
int main () {
std::srand(std::time(0));
SnakeGame engine;
Window win;
std::thread input_thread([&] { get_input(engine.m_dir, engine.running ); } );
while (engine.exit_summary()) {
engine.on_fruit_eaten(win.board);
engine.determine_index_zero_pos();
engine.move_tail_indicies();
win.clear_display();
win.update_display(engine.buf);
win.draw_display(200);
}
input_thread.join();
engine.run();
return 0;
}