X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=manipulator.h;h=cd44a6d7ab279bfaaa3716537a114428e3be971b;hb=8697ab57c9138aa2bb1657a971e4c2cc5e4a1606;hp=f01abd729b605fc9496ee7ecd647634e5b4fb0a5;hpb=ba46b057f3e2613a86f2dea7fa8022990482c735;p=universe.git diff --git a/manipulator.h b/manipulator.h index f01abd7..cd44a6d 100644 --- a/manipulator.h +++ b/manipulator.h @@ -1,17 +1,6 @@ -//////////////////////////////////////////////////////////////////////////////// -// This program is free software; you can redistribute it and/or // -// modify it under the terms of the GNU General Public License // -// version 2 as published by the Free Software Foundation. // -// // -// This program is distributed in the hope that it will be useful, but // -// WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // -// General Public License for more details. // -// // -// Written and (C) by François Fleuret // -// Contact for comments & bug reports // -//////////////////////////////////////////////////////////////////////////////// +// Written and (C) by Francois Fleuret +// Contact for comments & bug reports #ifndef MANIPULATOR_CC #define MANIPULATOR_CC @@ -23,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; @@ -30,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; } @@ -58,7 +57,7 @@ public: int random_action(); -// void force_grab(Universe *universe, scalar_t x, scalar_t y); + // void force_grab(Universe *universe, scalar_t x, scalar_t y); void force_move(scalar_t x, scalar_t y); void force_release(); };