src/object/path_walker.hpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 #ifndef HEADER_SUPERTUX_OBJECT_PATH_WALKER_HPP
00018 #define HEADER_SUPERTUX_OBJECT_PATH_WALKER_HPP
00019 
00020 #include <string.h>
00021 
00022 #include "object/path.hpp"
00023 
00027 class PathWalker
00028 {
00029 public:
00030   PathWalker(const Path* path, bool running = true);
00031   virtual ~PathWalker();
00032 
00036   virtual Vector advance(float elapsed_time);
00037 
00039   Vector get_pos();
00040 
00042   void goto_node(int node_no);
00043 
00045   void start_moving();
00046 
00048   void stop_moving();
00049 
00051   bool is_moving() {
00052     return running;
00053   }
00054   
00055   const Path* path;
00056 
00057 private:
00058   void advance_node();
00059   void goback_node();
00060 
00064   bool running;
00065 
00066   size_t current_node_nr;
00067   size_t next_node_nr;
00068 
00072   int stop_at_node_nr;
00073 
00078   float node_time;
00079   float node_mult;
00080 
00081   float walking_speed;
00082 
00083 private:
00084   PathWalker(const PathWalker&);
00085   PathWalker& operator=(const PathWalker&);
00086 };
00087 
00088 #endif
00089 
00090 /* EOF */

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