src/supertux/physic.hpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
00003 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00004 //
00005 //  This program is free software: you can redistribute it and/or modify
00006 //  it under the terms of the GNU General Public License as published by
00007 //  the Free Software Foundation, either version 3 of the License, or
00008 //  (at your option) any later version.
00009 //
00010 //  This program is distributed in the hope that it will be useful,
00011 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //  GNU General Public License for more details.
00014 //
00015 //  You should have received a copy of the GNU General Public License
00016 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 
00018 #ifndef HEADER_SUPERTUX_SUPERTUX_PHYSIC_HPP
00019 #define HEADER_SUPERTUX_SUPERTUX_PHYSIC_HPP
00020 
00021 #include "math/vector.hpp"
00022 
00024 
00027 class Physic
00028 {
00029 public:
00030   Physic();
00031   ~Physic();
00032 
00034   void reset();
00035 
00037   void set_velocity(float vx, float vy);
00038   void set_velocity(const Vector& vector);
00039 
00040   void set_velocity_x(float vx);
00041   void set_velocity_y(float vy);
00042 
00044   void inverse_velocity_x();
00045   void inverse_velocity_y();
00046 
00047   Vector get_velocity() const;
00048   float get_velocity_x() const;
00049   float get_velocity_y() const;
00050 
00052 
00055   void set_acceleration(float ax, float ay);
00056 
00057   void set_acceleration_x(float ax);
00058   void set_acceleration_y(float ay);
00059 
00060   Vector get_acceleration() const;
00061   float get_acceleration_x() const;
00062   float get_acceleration_y() const;
00063 
00065   void enable_gravity(bool gravity_enabled);
00066   bool gravity_enabled() const;
00067 
00069   void set_gravity_modifier(float gravity);
00070 
00071   Vector get_movement(float elapsed_time);
00072 
00073 private:
00075   float ax, ay;
00076 
00078   float vx, vy;
00079   
00081   bool gravity_enabled_flag;
00082 
00084   float gravity_modifier;
00085 };
00086 
00087 #endif
00088 
00089 /* EOF */

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