From e645b307a7a32c3c3d12989ccf6d60e324392d60 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 1 Feb 2015 14:57:56 +0100 Subject: Begin work on UI --- ui.hpp | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 ui.hpp (limited to 'ui.hpp') diff --git a/ui.hpp b/ui.hpp new file mode 100644 index 0000000..552dfa2 --- /dev/null +++ b/ui.hpp @@ -0,0 +1,64 @@ +#pragma once + +#include + +#include +#include + +#include "problem.hpp" + +enum { + M_NORMAL, + M_INS_OBSTACLE, + M_DEL_OBSTACLE, + M_SEL_BEGIN, + M_SEL_END +}; + +enum { + S_XY, + S_THETA, + S_PHI, + S_CENTER, + S_RADIUS +}; + +class UI { + private: + hilare_a_param *_param; + + problem _p; + + solution _s; + + struct { + double x0, y0, zoom; + } _view; + + sf::ContextSettings _settings; + sf::RenderWindow _win; + + // interaction mode + int _mode, _sel_step; + + public: + UI(hilare_a_param *p); + + void render_circle(const circle& c, sf::Color border, sf::Color inside, int linewidth); + void render_pos(const hilare_a &pos, sf::Color c); + void render_obstacle(const obstacle &o); + void render_mvt(const hilare_a_mvt &m); + + void render_problem(); + void render_solution(); + void render_internal(); + + sf::Vector2f to_view(const vec &p); + vec from_view(const sf::Vector2f &p); + + void run(); +}; + + +/* vim: set ts=4 sw=4 tw=0 noet :*/ + -- cgit v1.2.3