removed the input thread and integrated it to the SnakeGame engine itself
This commit is contained in:
+1
-19
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user