2 // C++ Interface: physic
7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2004
9 // Copyright: See COPYING file that comes with this distribution
13 #ifndef SUPERTUX_PHYSIC_H
14 #define SUPERTUX_PHYSIC_H
16 /** This is a very simplistic physics engine handling accelerated and constant
17 * movement along with gravity.
25 /** resets all velocities and accelerations to 0 */
28 /** sets velocity to a fixed value */
29 void set_velocity(float vx, float vy);
31 /** velocities invertion */
32 void inverse_velocity_x();
33 void inverse_velocity_y();
35 float get_velocity_x();
36 float get_velocity_y();
38 /** sets acceleration applied to the object. (Note that gravity is
39 * eventually added to the vertical acceleration)
41 void set_acceleration(float ax, float ay);
43 float get_acceleration_x();
44 float get_acceleration_y();
46 /** enables or disables handling of gravity */
47 void enable_gravity(bool gravity_enabled);
49 /** applies the physical simulation to given x and y coordinates */
50 void apply(float frame_ratio, float &x, float &y);
53 /// horizontal and vertical acceleration
55 /// horizontal and vertical velocity
57 /// should we respect gravity in out calculations?
61 #endif /*SUPERTUX_PHYSIC_H*/