diff options
Diffstat (limited to 'ui.cpp')
-rw-r--r-- | ui.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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(); |