From: Francois Fleuret Date: Sun, 28 Aug 2016 06:40:11 +0000 (+0200) Subject: Cosmetics. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=5609af651ece7980e4170c9bc0e99e35ed5c13cf;p=universe.git Cosmetics. --- diff --git a/manipulator.h b/manipulator.h index 0b8c0a1..20e8b92 100644 --- a/manipulator.h +++ b/manipulator.h @@ -12,6 +12,7 @@ class Manipulator : public Map { static const int sqsize = 16; + Polygon *_touching_polygon, *_current_polygon; scalar_t _grab_relative_x, _grab_relative_y; scalar_t _xmax, _ymax; @@ -19,15 +20,24 @@ class Manipulator : public Map { scalar_t _force_x, _force_y; bool _grab, _release; int _current_action; + enum { FEEL_TOUCHING_OBJECT, FEEL_GRABBING_OBJECT, NB_DISCRETE_PARAMETERS }; + enum { MAP_LOCATION_X, MAP_LOCATION_Y, MAP_RESISTANCE_X, MAP_RESISTANCE_Y, NB_CONTINUOUS_MAPS }; + static const int continuous_map_size = 25; + scalar_t _kernel_continuous_maps[continuous_map_size * 2 + 1]; + public: - enum { ACTION_IDLE, - ACTION_MOVE_UP, ACTION_MOVE_RIGHT, ACTION_MOVE_DOWN, ACTION_MOVE_LEFT, - ACTION_GRAB, ACTION_RELEASE, - NB_ACTIONS }; + + enum { + ACTION_IDLE, + ACTION_MOVE_UP, ACTION_MOVE_RIGHT, ACTION_MOVE_DOWN, ACTION_MOVE_LEFT, + ACTION_GRAB, ACTION_RELEASE, + NB_ACTIONS + }; + Manipulator(Task *task); inline scalar_t hand_x() { return _hand_x; } diff --git a/move_square.cc b/move_square.cc index c901422..a2bbda7 100644 --- a/move_square.cc +++ b/move_square.cc @@ -29,13 +29,24 @@ public: else if(degree == 1) _square_size = 150; else if(degree == 2) _square_size = 100; else _square_size = 50; - scalar_t x[] = { -_square_size / 2.0, _square_size / 2.0, _square_size / 2.0, -_square_size / 2.0 }; - scalar_t y[] = { -_square_size / 2.0, -_square_size / 2.0, _square_size / 2.0, _square_size / 2.0 }; + + scalar_t x[] = { + -_square_size / 2.0, _square_size / 2.0, + _square_size / 2.0, -_square_size / 2.0 + }; + + scalar_t y[] = { + -_square_size / 2.0, -_square_size / 2.0, + _square_size / 2.0, _square_size / 2.0 + }; + _target = new Polygon(0.5, 1.0, 1.0, 0.0, x, y, 4); _target->set_position(_square_size/2, _square_size/2 + (world_height - _square_size) * drand48(), 0); _target->set_speed(0, 0, 0); + universe->initialize(_target); universe->add_polygon(_target); + if(degree == 4) { Polygon *obstacle; scalar_t x[] = { ( 9 * world_width)/20, (11 * world_width)/20, @@ -59,7 +70,9 @@ public: _target->set_speed(0, 0, 0); manipulator->force_release(); return 1.0; - } else return 0.0; + } else { + return 0.0; + } } virtual void draw(SimpleWindow *window) {