From 29158da41e7943ea8019efdbff70c994fb1c73e9 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 1 Feb 2015 18:07:20 +0100 Subject: Begin work on worker thread --- ui.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ui.cpp') diff --git a/ui.cpp b/ui.cpp index 1f61f03..a2ec620 100644 --- a/ui.cpp +++ b/ui.cpp @@ -11,6 +11,7 @@ - e : select end pos - a : add obstacle - d : delete obstacle under mouse pointer + - g : start solving Select modes : no other keys */ @@ -25,6 +26,8 @@ UI::UI(hilare_a_param *p) : _sel_obs(vec(0,0), 0) { _view.zoom = 1; _mode = M_NORMAL; + + _got_sol = true; } void UI::run() { @@ -55,6 +58,9 @@ void UI::run() { _view.zoom *= 1.1; } else if (k == 'o') { _view.zoom /= 1.1; + } else if (k == 'g') { + _solver.start(_p); + _got_sol = false; } } @@ -63,6 +69,11 @@ void UI::run() { if (_mode == M_SEL_BEGIN || _mode == M_SEL_END) handle_sel_pos(ev); } + if (!_got_sol && _solver.finished()) { + _s = _solver.get_solution(); + _got_sol = true; + } + _win.clear(sf::Color::Black); render_internal(); -- cgit v1.2.3