src/object/path.hpp

Go to the documentation of this file.
00001 //  SuperTux Path
00002 //  Copyright (C) 2005 Philipp <balinor@pnxs.de>
00003 //  Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
00004 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00005 //
00006 //  This program is free software: you can redistribute it and/or modify
00007 //  it under the terms of the GNU General Public License as published by
00008 //  the Free Software Foundation, either version 3 of the License, or
00009 //  (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 #ifndef HEADER_SUPERTUX_OBJECT_PATH_HPP
00020 #define HEADER_SUPERTUX_OBJECT_PATH_HPP
00021 
00022 #include <vector>
00023 
00024 #include "math/vector.hpp"
00025 #include "util/reader_fwd.hpp"
00026 #include "util/writer_fwd.hpp"
00027 
00028 class Path
00029 {
00030 public:
00031   Path();
00032   ~Path();
00033 
00034   void read(const Reader& reader);
00035 
00036   Vector get_base() const;
00037 
00041   class Node
00042   {
00043   public:
00044     Vector position; 
00045     float time; 
00047     Node() :
00048       position(),
00049       time()
00050     {}
00051   };
00052 
00053   std::vector<Node> nodes;
00054 
00058   int get_nearest_node_no(Vector reference_point) const;
00059 
00063   int get_farthest_node_no(Vector reference_point) const;
00064 
00065 private:
00066   friend class PathWalker;
00067 
00068   enum WalkMode {
00069     // moves from first to last path node and stops
00070     ONE_SHOT,
00071     // moves from first to last node then in reverse order back to first
00072     PING_PONG,
00073     // moves from last node back to the first node
00074     CIRCULAR
00075   };
00076 
00077   WalkMode mode;
00078 };
00079 
00080 #endif
00081 
00082 /* EOF */

Generated on Mon Jun 9 03:38:19 2014 for SuperTux by  doxygen 1.5.1